AnsweredAssumed Answered

create and query document in custom model error

Question asked by phong_van on Jun 9, 2017
Latest reply on Jun 12, 2017 by mrks.js1

Dear everyone,

Now I miss error as below, 

- the first step I create new data model with name  "Document"

- in "Document" I create custom type: with name "mc:whilePaper" and aspect

-in the first time I query document, the result  return error

- I try query document again the result is ok 

- When I try to create new document as below

 

Session cmisSession = getCmisSession();

String fileName = file.getName();

// create a map of properties if one wasn't passed in
if (props == null) {
props = new HashMap<String, Object>();
}
if (props.get("cmis:baseTypeId") == null) {
props.put("cmis:baseTypeId", "cmis:document");
}

// Add the object type ID if it wasn't already
if (props.get("cmis:objectTypeId") == null) {
props.put("cmis:objectTypeId", "D:mc:whilePaper");
}


ContentStream contentStream = cmisSession.getObjectFactory().
createContentStream(
fileName,
file.length(),
fileType,
new FileInputStream(file)
);

Document document = null;
try {
document = parentFolder.createDocument(props, contentStream, null);
System.out.println("Created new document: " + document.getId());
} catch (CmisContentAlreadyExistsException ccaee) {
document = (Document) cmisSession.getObjectByPath(parentFolder.getPath() + "/" + fileName);
System.out.println("Document already exists: " + fileName);
}

 

- In run code above, the result return: un know type D:mc:whilePaper

 

So I don't know what wrong? Anyone can help me?

Outcomes