add Aspect on custom type by cmis error

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

add Aspect on custom type by cmis error

Jump to solution

Dear everyone,

I'm using alfresco 5 and cmis 1.1. I have model with 2 aspect scSmiley TongueroductRelated 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("cmisSmiley SurprisedbjectTypeId") == null) {
props.put("cmisSmiley SurprisedbjectTypeId", "D:sc:doc,P:scSmiley TongueroductRelated");
}

// 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("scSmiley Tongueroduct", "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 scSmiley TongueroductRelated 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>
<cmisSmiley TonguearentId>cmis:document</cmisSmiley TonguearentId>
<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>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyIdDefinition>
<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>
<cmisSmiley TongueropertyType>id</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyIdDefinition>
<cmisSmiley TongueropertyBooleanDefinition>
<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>
<cmisSmiley TongueropertyType>boolean</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyBooleanDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyIdDefinition>
<cmis:id>cmisSmiley SurprisedbjectTypeId</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>cmisSmiley SurprisedbjectTypeId</cmis:queryName>
<cmis:description>Id of the object’s type</cmis:description>
<cmisSmiley TongueropertyType>id</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyIdDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyDateTimeDefinition>
<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>
<cmisSmiley TongueropertyType>datetime</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyDateTimeDefinition>
<cmisSmiley TongueropertyBooleanDefinition>
<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>
<cmisSmiley TongueropertyType>boolean</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyBooleanDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyBooleanDefinition>
<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>
<cmisSmiley TongueropertyType>boolean</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyBooleanDefinition>
<cmisSmiley TongueropertyDateTimeDefinition>
<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>
<cmisSmiley TongueropertyType>datetime</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyDateTimeDefinition>
<cmisSmiley TongueropertyIntegerDefinition>
<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>
<cmisSmiley TongueropertyType>integer</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
<cmis:maxValue>9223372036854775807</cmis:maxValue>
<cmis:minValue>-9223372036854775808</cmis:minValue>
</cmisSmiley TongueropertyIntegerDefinition>
<cmisSmiley TongueropertyIdDefinition>
<cmis:id>cmisSmiley SurprisedbjectId</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>cmisSmiley SurprisedbjectId</cmis:queryName>
<cmis:description>The unique object id (a node ref)</cmis:description>
<cmisSmiley TongueropertyType>id</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyIdDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyIdDefinition>
<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>
<cmisSmiley TongueropertyType>id</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyIdDefinition>
<cmisSmiley TongueropertyIdDefinition>
<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>
<cmisSmiley TongueropertyType>id</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyIdDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>true</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyIdDefinition>
<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>
<cmisSmiley TongueropertyType>id</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyIdDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyBooleanDefinition>
<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>
<cmisSmiley TongueropertyType>boolean</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyBooleanDefinition>
<cmisSmiley TongueropertyStringDefinition>
<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>
<cmisSmiley TongueropertyType>string</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyStringDefinition>
<cmisSmiley TongueropertyBooleanDefinition>
<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>
<cmisSmiley TongueropertyType>boolean</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyBooleanDefinition>
<cmisSmiley TongueropertyIdDefinition>
<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>
<cmisSmiley TongueropertyType>id</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyIdDefinition>
<cmisSmiley TongueropertyBooleanDefinition>
<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>
<cmisSmiley TongueropertyType>boolean</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyBooleanDefinition>
<cmisSmiley TongueropertyIdDefinition>
<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>
<cmisSmiley TongueropertyType>id</cmisSmiley TongueropertyType>
<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>
<cmisSmiley Surprisedrderable>false</cmisSmiley Surprisedrderable>
<cmis:defaultValue />
</cmisSmiley TongueropertyIdDefinition>
<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> 

1 Solution

Accepted Solutions
Highlighted
Active Member II

Re: add Aspect on custom type by cmis error

Jump 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! 

View solution in original post

8 Replies
Highlighted
Alfresco Employee

Re: add Aspect on custom type by cmis error

Jump to solution
Highlighted
Active Member II

Re: add Aspect on custom type by cmis error

Jump to solution

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:scSmiley TongueroductRelated. Please give me some advise?

Many thanks Smiley Happy

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("cmisSmiley SurprisedbjectTypeId") == null) {
props.put("cmisSmiley SurprisedbjectTypeId", "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:scSmiley TongueroductRelated";
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("scSmiley Tongueroduct", "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!");
}
}

Highlighted
Alfresco Employee

Re: add Aspect on custom type by cmis error

Jump to solution

Making all content versionable | Alfresco Documentation 

Software Engineer in Alfresco Search Team.
Highlighted
Active Member II

Re: add Aspect on custom type by cmis error

Jump to solution

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!

Highlighted
Alfresco Employee

Re: add Aspect on custom type by cmis error

Jump to solution

Just linked to make you note that versionable aspect is required to set. You can add it to your aspect lists.

Software Engineer in Alfresco Search Team.
Highlighted
Active Member II

Re: add Aspect on custom type by cmis error

Jump to solution

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

Highlighted
Active Member II

Re: add Aspect on custom type by cmis error

Jump to solution

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("cmisSmiley SurprisedbjectTypeId") == null) {
props.put("cmisSmiley SurprisedbjectTypeId", "D:sc:doc,P:cm:titled");
// ,P:scSmiley TongueroductRelated
}
// 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.

Highlighted
Active Member II

Re: add Aspect on custom type by cmis error

Jump 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! 

View solution in original post