属性 'pos:empCode' 对该类型或其中一种辅助类型无效!在 cmis 中设置自定义对象时出错

Property 'pos:empCode' is not valid for this type or one of the secondary types! error setting custom object in cmis

当我在地图中添加自定义对象时,出现错误。

java.lang.IllegalArgumentException: Property 'pos:empCode' is not valid for this type or one of the secondary types! at org.apache.chemistry.opencmis.client.runtime.repository.ObjectFactoryImpl.conver tProperties(ObjectFactoryImpl.java:426) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(Session Impl.java:1091) at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImp l.java:77)

我的代码是:

    Map<String, Object> metaData = new HashMap<String, Object>(0);
    metaData.put(DocumentConstants.EMPCODE, empCode);
//  metaData.put(DocumentConstants.TYPE, Constants.EMP_FILE_UPLOAD);
//  metaData.put(DocumentConstants.SUBTYPE, Constants.ADD);
    docService.uploadDocumentsForAlfresco(metaData, byteArray, fileName);

文档服务:

    public Boolean uploadDocumentsForAlfresco(Map<String, Object> metaData, 
    byte[] data, String name) {
        Session session = connect();
        String folderPath = null;
        folderPath = cmisSite.concat(cmisPath).concat("documentlibrary/");
       //       String path = 
    "DATAFILES/".concat(metaData.get(DocumentConstants.EMPCODE).toString());
    String path = "DATAFILES/".concat("6");
    folderPath = folderPath.concat(path);
    Folder folder = createFolder(session, folderPath); 
// metaData.put(PropertyIds.OBJECT_TYPE_ID, "D:ebs:bulkUploadDoc");
    metaData.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
    // set the alfresco object factory

    metaData.put(PropertyIds.NAME, name);
    ByteArrayInputStream input = new ByteArrayInputStream(data);
    ContentStream contentStream = 
   session.getObjectFactory().createContentStream(name, data.length, 
   "application/octet-stream", input);
    try {
            folder.createDocument(metaData, contentStream, 
    VersioningState.MAJOR);
            return true;
    } catch (Exception ex) {
   //log.error("exception while uploading document",ex);
        ex.printStackTrace();
        return false;
    }
  }

在 pom.xml

中添加了依赖项
   <dependency>
        <groupId>org.alfresco.cmis.client</groupId>
        <artifactId>alfresco-opencmis-extension</artifactId>
        <version>0.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.chemistry.opencmis</groupId>
        <artifactId>chemistry-opencmis-client-impl</artifactId>
        <version>0.13.0</version>
    </dependency>

pos:empCode 是在您的自定义类型或方面之一上定义的 属性。您试图在对象上设置 属性 的值,但您已经告诉 CMIS 对象类型是 cmis:document。 cmis:document 类型映射到 cm:content,out-of-the-box 类型没有您自定义的 属性。

不要使用 cmis:document 作为对象类型 ID,而是使用自定义模型中定义 pos:empCode 属性.

的类型的对象类型 ID