Dear everyone,
I'm using alfresco 5 and cmis 1.1. I have model with 2 aspect scroductRelated and sc:webable .I've writen cmis code to create new document with aspect as:
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("cmisbjectTypeId") == null) {
props.put("cmisbjectTypeId", "D:sc:doc,P:scroductRelated");
}
// Add the name if it wasn't already
if (props.get("cmis:name") == null) {
props.put("cmis:name", fileName);
}
props.put("sc:campaign", "this is my campaign");
props.put("scroduct", "MC High class");
props.put("sc:version", "2.1");
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);
}
when I run that code, document is created on Alfresco but I check scroductRelated i found that it empty.
Anyone can help?
This is my model.
<?xml version='1.0' encoding='UTF-8'?>
<cmis:type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xsi:type="cmis:cmisTypeDocumentDefinitionType">
<cmis:id>D:sc:doc</cmis:id>
<cmis:localName>doc</cmis:localName>
<cmis:localNamespace>http://www.mcredit.com.vn/model/dictionary/1.0</cmis:localNamespace>
<cmis:displayName>Someco Document</cmis:displayName>
<cmis:queryName>sc:doc</cmis:queryName>
<cmis:description>D:sc:doc</cmis:description>
<cmis:baseId>cmis:document</cmis:baseId>
<cmisarentId>cmis:document</cmisarentId>
<cmis:creatable>true</cmis:creatable>
<cmis:fileable>true</cmis:fileable>
<cmis:queryable>true</cmis:queryable>
<cmis:fulltextIndexed>true</cmis:fulltextIndexed>
<cmis:includedInSupertypeQuery>true</cmis:includedInSupertypeQuery>
<cmis:controllablePolicy>false</cmis:controllablePolicy>
<cmis:controllableACL>true</cmis:controllableACL>
<cmisropertyStringDefinition>
<cmis:id>sc:campaign</cmis:id>
<cmis:localName>campaign</cmis:localName>
<cmis:localNamespace>http://www.mcredit.com.vn/model/dictionary/1.0</cmis:localNamespace>
<cmis:displayName>campaign</cmis:displayName>
<cmis:queryName>sc:campaign</cmis:queryName>
<cmis:description>campaign</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readwrite</cmis:updatability>
<cmis:inherited>false</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyIdDefinition>
<cmis:id>alfcmis:nodeRef</cmis:id>
<cmis:localName>nodeRef</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/alfcmis</cmis:localNamespace>
<cmis:displayName>Alfresco Node Ref</cmis:displayName>
<cmis:queryName>alfcmis:nodeRef</cmis:queryName>
<cmis:description>Alfresco Node Ref</cmis:description>
<cmisropertyType>id</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyIdDefinition>
<cmisropertyBooleanDefinition>
<cmis:id>cmis:isImmutable</cmis:id>
<cmis:localName>isImmutable</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Is Immutable</cmis:displayName>
<cmis:queryName>cmis:isImmutable</cmis:queryName>
<cmis:description>Is the document immutable?</cmis:description>
<cmisropertyType>boolean</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyBooleanDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:versionLabel</cmis:id>
<cmis:localName>versionLabel</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Version Label</cmis:displayName>
<cmis:queryName>cmis:versionLabel</cmis:queryName>
<cmis:description>The version label</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyIdDefinition>
<cmis:id>cmisbjectTypeId</cmis:id>
<cmis:localName>objectTypeId</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Object Type Id</cmis:displayName>
<cmis:queryName>cmisbjectTypeId</cmis:queryName>
<cmis:description>Id of the object’s type</cmis:description>
<cmisropertyType>id</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>oncreate</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>true</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
</cmisropertyIdDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:description</cmis:id>
<cmis:localName>description</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Description</cmis:displayName>
<cmis:queryName>cmis:description</cmis:queryName>
<cmis:description>Description</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readwrite</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:createdBy</cmis:id>
<cmis:localName>createdBy</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Created by</cmis:displayName>
<cmis:queryName>cmis:createdBy</cmis:queryName>
<cmis:description>The authority who created this object</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:checkinComment</cmis:id>
<cmis:localName>checkinComment</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Checkin Comment</cmis:displayName>
<cmis:queryName>cmis:checkinComment</cmis:queryName>
<cmis:description>The checkin comment</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyDateTimeDefinition>
<cmis:id>cmis:creationDate</cmis:id>
<cmis:localName>creationDate</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Creation Date</cmis:displayName>
<cmis:queryName>cmis:creationDate</cmis:queryName>
<cmis:description>The object creation date</cmis:description>
<cmisropertyType>datetime</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
</cmisropertyDateTimeDefinition>
<cmisropertyBooleanDefinition>
<cmis:id>cmis:isMajorVersion</cmis:id>
<cmis:localName>isMajorVersion</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Is Major Version</cmis:displayName>
<cmis:queryName>cmis:isMajorVersion</cmis:queryName>
<cmis:description>Is this a major version of the document?</cmis:description>
<cmisropertyType>boolean</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyBooleanDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:contentStreamFileName</cmis:id>
<cmis:localName>contentStreamFileName</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Content Stream Filename</cmis:displayName>
<cmis:queryName>cmis:contentStreamFileName</cmis:queryName>
<cmis:description>The content stream filename</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:name</cmis:id>
<cmis:localName>name</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Name</cmis:displayName>
<cmis:queryName>cmis:name</cmis:queryName>
<cmis:description>Name</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readwrite</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>true</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyBooleanDefinition>
<cmis:id>cmis:isLatestVersion</cmis:id>
<cmis:localName>isLatestVersion</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Is Latest Version</cmis:displayName>
<cmis:queryName>cmis:isLatestVersion</cmis:queryName>
<cmis:description>Is this the latest version of the document?</cmis:description>
<cmisropertyType>boolean</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyBooleanDefinition>
<cmisropertyDateTimeDefinition>
<cmis:id>cmis:lastModificationDate</cmis:id>
<cmis:localName>lastModificationDate</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Last Modified Date</cmis:displayName>
<cmis:queryName>cmis:lastModificationDate</cmis:queryName>
<cmis:description>The date this object was last modified</cmis:description>
<cmisropertyType>datetime</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
</cmisropertyDateTimeDefinition>
<cmisropertyIntegerDefinition>
<cmis:id>cmis:contentStreamLength</cmis:id>
<cmis:localName>contentStreamLength</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Content Stream Length</cmis:displayName>
<cmis:queryName>cmis:contentStreamLength</cmis:queryName>
<cmis:description>The length of the content stream</cmis:description>
<cmisropertyType>integer</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
<cmis:maxValue>9223372036854775807</cmis:maxValue>
<cmis:minValue>-9223372036854775808</cmis:minValue>
</cmisropertyIntegerDefinition>
<cmisropertyIdDefinition>
<cmis:id>cmisbjectId</cmis:id>
<cmis:localName>objectId</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Object Id</cmis:displayName>
<cmis:queryName>cmisbjectId</cmis:queryName>
<cmis:description>The unique object id (a node ref)</cmis:description>
<cmisropertyType>id</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
</cmisropertyIdDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:lastModifiedBy</cmis:id>
<cmis:localName>lastModifiedBy</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Last Modified By</cmis:displayName>
<cmis:queryName>cmis:lastModifiedBy</cmis:queryName>
<cmis:description>The authority who last modified this object</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyIdDefinition>
<cmis:id>cmis:secondaryObjectTypeIds</cmis:id>
<cmis:localName>secondaryObjectTypeIds</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Secondary Object Type Ids</cmis:displayName>
<cmis:queryName>cmis:secondaryObjectTypeIds</cmis:queryName>
<cmis:description>Ids of the secondary object types for the object</cmis:description>
<cmisropertyType>id</cmisropertyType>
<cmis:cardinality>multi</cmis:cardinality>
<cmis:updatability>readwrite</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyIdDefinition>
<cmisropertyIdDefinition>
<cmis:id>cmis:contentStreamId</cmis:id>
<cmis:localName>contentStreamId</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Content Stream Id</cmis:displayName>
<cmis:queryName>cmis:contentStreamId</cmis:queryName>
<cmis:description>Id of the stream</cmis:description>
<cmisropertyType>id</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyIdDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:contentStreamMimeType</cmis:id>
<cmis:localName>contentStreamMimeType</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Content Stream MIME Type</cmis:displayName>
<cmis:queryName>cmis:contentStreamMimeType</cmis:queryName>
<cmis:description>The content stream MIME type</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>true</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyIdDefinition>
<cmis:id>cmis:baseTypeId</cmis:id>
<cmis:localName>baseTypeId</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Base Type Id</cmis:displayName>
<cmis:queryName>cmis:baseTypeId</cmis:queryName>
<cmis:description>Id of the base object type for the object</cmis:description>
<cmisropertyType>id</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>true</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyIdDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:changeToken</cmis:id>
<cmis:localName>changeToken</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Change token</cmis:displayName>
<cmis:queryName>cmis:changeToken</cmis:queryName>
<cmis:description>Change Token</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyBooleanDefinition>
<cmis:id>cmis:isPrivateWorkingCopy</cmis:id>
<cmis:localName>isPrivateWorkingCopy</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Is private working copy</cmis:displayName>
<cmis:queryName>cmis:isPrivateWorkingCopy</cmis:queryName>
<cmis:description>Indicates if this instance is a private working copy</cmis:description>
<cmisropertyType>boolean</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyBooleanDefinition>
<cmisropertyStringDefinition>
<cmis:id>cmis:versionSeriesCheckedOutBy</cmis:id>
<cmis:localName>versionSeriesCheckedOutBy</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Version Series Checked Out By</cmis:displayName>
<cmis:queryName>cmis:versionSeriesCheckedOutBy</cmis:queryName>
<cmis:description>The authority who checked out this document version
series</cmis:description>
<cmisropertyType>string</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyStringDefinition>
<cmisropertyBooleanDefinition>
<cmis:id>cmis:isVersionSeriesCheckedOut</cmis:id>
<cmis:localName>isVersionSeriesCheckedOut</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Is Version Series Checked Out</cmis:displayName>
<cmis:queryName>cmis:isVersionSeriesCheckedOut</cmis:queryName>
<cmis:description>Is the version series checked out?</cmis:description>
<cmisropertyType>boolean</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyBooleanDefinition>
<cmisropertyIdDefinition>
<cmis:id>cmis:versionSeriesId</cmis:id>
<cmis:localName>versionSeriesId</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Version series id</cmis:displayName>
<cmis:queryName>cmis:versionSeriesId</cmis:queryName>
<cmis:description>The version series id</cmis:description>
<cmisropertyType>id</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyIdDefinition>
<cmisropertyBooleanDefinition>
<cmis:id>cmis:isLatestMajorVersion</cmis:id>
<cmis:localName>isLatestMajorVersion</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Is Latest Major Version</cmis:displayName>
<cmis:queryName>cmis:isLatestMajorVersion</cmis:queryName>
<cmis:description>Is this the latest major version of the document?</cmis:description>
<cmisropertyType>boolean</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyBooleanDefinition>
<cmisropertyIdDefinition>
<cmis:id>cmis:versionSeriesCheckedOutId</cmis:id>
<cmis:localName>versionSeriesCheckedOutId</cmis:localName>
<cmis:localNamespace>http://www.alfresco.org/model/cmis/1.0/cs01</cmis:localNamespace>
<cmis:displayName>Version Series Checked Out Id</cmis:displayName>
<cmis:queryName>cmis:versionSeriesCheckedOutId</cmis:queryName>
<cmis:description>The checked out version series id</cmis:description>
<cmisropertyType>id</cmisropertyType>
<cmis:cardinality>single</cmis:cardinality>
<cmis:updatability>readonly</cmis:updatability>
<cmis:inherited>true</cmis:inherited>
<cmis:required>false</cmis:required>
<cmis:queryable>false</cmis:queryable>
<cmisrderable>false</cmisrderable>
<cmis:defaultValue />
</cmisropertyIdDefinition>
<cmis:versionable>true</cmis:versionable>
<cmis:contentStreamAllowed>allowed</cmis:contentStreamAllowed>
<e1:mandatoryAspects xmlns:e1="http://www.alfresco.org">
<e1:mandatoryAspect>P:sys:localized</e1:mandatoryAspect>
</e1:mandatoryAspects>
</cmis:type>
Solved! Go to Solution.
Dear everyone,
I've just resloved my problem. The problem I'm using code alfresco extention => So I try to remove this line
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
in method create session the problem is resloved.
Once againt, I'm very thanks for Angel Borroy!
Dear Angel Borroy,
Thanks for reply,
I've already try as your help. But when I run application, system return Property 'sc:version' is neither an object type property nor an aspect property!
It's seem the system do not realize property sc:version of aspect P:scroductRelated. Please give me some advise?
Many thanks
This is my code
Session cmisSession = getCmisSession();
String fileName = file.getName();
if (props == null) {
props = new HashMap<String, Object>();
}
if (props.get("cmis:baseTypeId") == null) {
props.put("cmis:baseTypeId", "cmis:document");
}
if (props.get("cmisbjectTypeId") == null) {
props.put("cmisbjectTypeId", "D:sc:doc");
}
if (props.get("cmis:name") == null) {
props.put("cmis:name", fileName);
}
props.put("sc:campaign", "Learning CMIS");
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);
addAspectToExistingDocument(document);
}
private static final String SECONDARY_OBJECT_TYPE_IDS_PROP_NAME = "cmis:secondaryObjectTypeIds";
public void addAspectToExistingDocument(Document document) {
String aspectName = "P:scroductRelated";
if (document != null) {
List<Object> aspects = document.getProperty(SECONDARY_OBJECT_TYPE_IDS_PROP_NAME).getValues();
if (!aspects.contains(aspectName)) {
aspects.add(aspectName);
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(SECONDARY_OBJECT_TYPE_IDS_PROP_NAME, aspects);
properties.put("scroduct", "MC High class");
properties.put("sc:version", "2.1");
Document updatedDocument = (Document) document.updateProperties(properties);
System.out.println("Added aspect " + aspectName + " to ");
} else {
System.out.println("Aspect " + aspectName + " is already applied to ");
}
} else {
System.out.println("Document is null, cannot add aspect to it!");
}
}
Making all content versionable | Alfresco Documentation
Dear Angel Borrory,
Thanks your help,
But I created model by admin tool on link http://MyIP/share/page/console/admin-console/custom-model-manager
I check in folder $TOMCAT_HOME/shared/classes/alfresco/extension there are no models directory.
So please give some instruction, Thanks!
Just linked to make you note that versionable aspect is required to set. You can add it to your aspect lists.
Very thanks for your help,
but when a read your link i'm try to add versionable aspect to aspect list, but I can't. It seem I only create new aspect to custom model
When I try aspect P:cm:titled,
this is my code
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("cmisbjectTypeId") == null) {
props.put("cmisbjectTypeId", "D:sc:doc,P:cm:titled");
// ,P:scroductRelated
}
// Add the name if it wasn't already
if (props.get("cmis:name") == null) {
props.put("cmis:name", fileName);
}
props.put("sc:campaign", "OanhLT.HO");
props.put("cm:title", "MC High class");
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);
}
The document upload is OK, but when I check document in repository the property "Title" is empty. When I check mangage aspect the system show that versionable aspect already applied.
Dear everyone,
I've just resloved my problem. The problem I'm using code alfresco extention => So I try to remove this line
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
in method create session the problem is resloved.
Once againt, I'm very thanks for Angel Borroy!
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.