Merged CMIS063 to HEAD

15185: 0.62c upgrade: service document
  15198: 0.62c upgrade: allowable actions
  15228: 0.62c upgrade: types and properties

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17227 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-10-29 16:07:47 +00:00
parent 76b68cb8cd
commit f2e3183a5c
23 changed files with 553 additions and 453 deletions

View File

@@ -1,7 +1,7 @@
<model name="cmis:cmismodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>CMIS Model Definitions</description>
<version>0.5</version>
<version>0.62c</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
@@ -9,7 +9,7 @@
</imports>
<namespaces>
<namespace uri="http://www.alfresco.org/model/cmis/0.6" prefix="cmis" />
<namespace uri="http://www.alfresco.org/model/cmis/0.62c" prefix="cmis" />
</namespaces>
<data-types>
@@ -69,18 +69,20 @@
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:Uri">
<title>URI</title>
<description>URI</description>
<type>cmis:uri</type>
<protected>true</protected>
<mandatory enforced="false">false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:ObjectTypeId">
<title>Object Type Id</title>
<description>The object type id</description>
<description>Id of the objects type</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:BaseTypeId">
<title>Base Type Id</title>
<description>Id of the base object type for the object</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
@@ -163,7 +165,7 @@
</properties>
</type>
<type name="cmis:document">
<type name="cmis:Document">
<title>Document</title>
<description>Document Type</description>
<parent>cmis:filesystemobject</parent>
@@ -262,18 +264,6 @@
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:ContentStreamAllowed">
<title>Content Stream Allowed</title>
<description>Is a content stream allowed?</description>
<type>d:text</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
<multiple>false</multiple>
<index enabled="false" />
<constraints>
<constraint ref="cmis:allowedValuesForContentStreamAllowed" />
</constraints>
</property>
<property name="cmis:ContentStreamLength">
<title>Content Stream Length</title>
<description>The length of the content stream</description>
@@ -296,7 +286,7 @@
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:ContentStreamFilename">
<property name="cmis:ContentStreamFileName">
<title>Content Stream Filename</title>
<description>The content stream filename</description>
<type>d:text</type>
@@ -307,19 +297,21 @@
<tokenised>true</tokenised>
</index>
</property>
<property name="cmis:ContentStreamUri">
<title>Content Stream URI</title>
<description>The content stream URI</description>
<type>cmis:uri</type>
<property name="cmis:ContentStreamId">
<title>Content Stream Id</title>
<description>Id of the stream</description>
<type>cmis:id</type>
<protected>true</protected>
<mandatory enforced="false">false</mandatory>
<multiple>false</multiple>
<index enabled="false" />
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
</properties>
</type>
<type name="cmis:folder">
<type name="cmis:Folder">
<title>Folder</title>
<description>Folder Type</description>
<parent>cmis:filesystemobject</parent>
@@ -335,6 +327,17 @@
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:PathName">
<title>Path Name</title>
<description>Name of the path element for this folder</description>
<type>d:text</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
<property name="cmis:AllowedChildObjectTypeIds">
<title>Allowed Child Object Types Ids</title>
<description>The allowed child object type ids</description>
@@ -347,7 +350,7 @@
</properties>
</type>
<type name="cmis:relationship">
<type name="cmis:Relationship">
<title>Relationship</title>
<description>Relationship Type</description>
<parent>cmis:object</parent>
@@ -373,20 +376,11 @@
</properties>
</type>
<type name="cmis:policy">
<type name="cmis:Policy">
<title>Policy</title>
<description>Policy Type</description>
<parent>cmis:object</parent>
<properties>
<property name="cmis:PolicyName">
<title>Policy Name</title>
<description>The name of the policy</description>
<type>d:text</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
<multiple>false</multiple>
<index enabled="false" />
</property>
<property name="cmis:PolicyText">
<title>Policy Text</title>
<description>The policy text</description>

View File

@@ -31,33 +31,47 @@ package org.alfresco.cmis;
*/
public enum CMISAllowedActionEnum implements EnumLabel
{
CAN_DELETE("canDelete"),
CAN_UPDATE_PROPERTIES("canUpdateProperties"),
CAN_GET_PROPERTIES("canGetProperties"),
CAN_GET_RELATIONSHIPS("canGetRelationships"),
CAN_GET_PARENTS("canGetParents"),
CAN_GET_FOLDER_PARENT("canGetFolderParent"),
// navigation services
CAN_GET_DESCENDANTS("canGetDescendants"),
CAN_MOVE("canMove"),
CAN_DELETE_VERSION("canDeleteVersion"),
CAN_DELETE_CONTENT("canDeleteContent"),
CAN_CHECKOUT("canCheckout"),
CAN_CANCEL_CHECKOUT("canCancelCheckout"),
CAN_CHECKIN("canCheckin"),
CAN_SET_CONTENT("canSetContent"),
CAN_GET_ALL_VERSIONS("canGetAllVersions"),
CAN_ADD_TO_FOLDER("canAddToFolder"),
CAN_REMOVE_FROM_FOLDER("canRemoveFromFolder"),
CAN_VIEW_CONTENT("canViewContent"),
CAN_ADD_POLICY("canAddPolicy"),
CAN_GET_APPLIED_POLICIES("canGetAppliedPolicies"),
CAN_REMOVE_POLICY("canRemovePolicy"),
CAN_GET_CHILDREN("canGetChildren"),
CAN_GET_FOLDER_PARENT("canGetFolderParent"),
CAN_GET_OBJECT_PARENTS("canGetObjectParents"),
// object services
CAN_CREATE_DOCUMENT("canCreateDocument"),
CAN_CREATE_FOLDER("canCreateFolder"),
CAN_CREATE_RELATIONSHIP("canCreateRelationship"),
CAN_CREATE_POLICY("canCreatePolicy"),
CAN_DELETE_TREE("canDeleteTree");
CAN_GET_PROPERTIES("canGetProperties"),
CAN_GET_RENDITIONS("canGetRenditions"),
CAN_GET_CONTENT_STREAM("canGetContentStream"),
CAN_UPDATE_PROPERTIES("canUpdateProperties"),
CAN_MOVE_OBJECT("canMoveObject"),
CAN_DELETE_OBJECT("canDelete"), // TODO: ISSUE - should be canDeleteObject
CAN_SET_CONTENT_STREAM("canSetContentStream"),
CAN_DELETE_CONTENT_STREAM("canDeleteContentStream"),
// multi-filing services
CAN_ADD_OBJECT_TO_FOLDER("canAddObjectToFolder"),
CAN_REMOVE_OBJECT_FROM_FOLDER("canRemoveObjectFromFolder"),
// versioning services
CAN_CHECKOUT("canCheckOut"),
CAN_CANCEL_CHECKOUT("canCancelCheckOut"),
CAN_CHECKIN("canCheckIn"),
CAN_GET_ALL_VERSIONS("canGetAllVersions"),
// relationship services
CAN_GET_RELATIONSHIPS("canGetRelationships"),
// policy services
CAN_APPLY_POLICY("canApplyPolicy"),
CAN_REMOVE_POLICY("canRemovePolicy"),
CAN_GET_APPLIED_POLICIES("canGetAppliedPolicies"),
// acl services
CAN_GET_ACL("canGetACL"),
CAN_APPLY_ACL("canApplyACL");
private String label;

View File

@@ -34,60 +34,41 @@ import org.alfresco.model.ContentModel;
*/
public interface CMISDictionaryModel
{
/**
* Type id for CMIS documents, from the spec.
*/
public static String DOCUMENT_OBJECT_TYPE = "document";
/**
* Type is for CMIS folders, from the spec.
*/
public static String FOLDER_OBJECT_TYPE = "folder";
/**
* Type Id for CMIS Relationships, from the spec.
*/
public static String RELATIONSHIP_OBJECT_TYPE = "relationship";
/**
* Type Id for CMIS Policies, from the spec.
*/
public static String POLICY_OBJECT_TYPE = "policy";
// TODO: spec issue - objectTypeEnum is lower cased - object type ids are repository specific in spec
public static CMISTypeId DOCUMENT_TYPE_ID = new CMISTypeId(CMISScope.DOCUMENT, DOCUMENT_OBJECT_TYPE.toLowerCase(), ContentModel.TYPE_CONTENT);
public static CMISTypeId FOLDER_TYPE_ID = new CMISTypeId(CMISScope.FOLDER, FOLDER_OBJECT_TYPE.toLowerCase(), ContentModel.TYPE_FOLDER);
public static CMISTypeId RELATIONSHIP_TYPE_ID = new CMISTypeId(CMISScope.RELATIONSHIP, RELATIONSHIP_OBJECT_TYPE.toLowerCase(), CMISMapping.RELATIONSHIP_QNAME);
public static CMISTypeId POLICY_TYPE_ID = new CMISTypeId(CMISScope.POLICY, POLICY_OBJECT_TYPE.toLowerCase(), CMISMapping.POLICY_QNAME);
// CMIS Type Ids
public static CMISTypeId DOCUMENT_TYPE_ID = new CMISTypeId(CMISScope.DOCUMENT, CMISMapping.DOCUMENT_QNAME, CMISMapping.CMIS_MODEL_NS + ":" + CMISMapping.DOCUMENT_QNAME.getLocalName(), ContentModel.TYPE_CONTENT);
public static CMISTypeId FOLDER_TYPE_ID = new CMISTypeId(CMISScope.FOLDER, CMISMapping.FOLDER_QNAME, CMISMapping.CMIS_MODEL_NS + ":" + CMISMapping.FOLDER_QNAME.getLocalName(), ContentModel.TYPE_FOLDER);
public static CMISTypeId RELATIONSHIP_TYPE_ID = new CMISTypeId(CMISScope.RELATIONSHIP, CMISMapping.RELATIONSHIP_QNAME, CMISMapping.CMIS_MODEL_NS + ":" + CMISMapping.RELATIONSHIP_QNAME.getLocalName(), CMISMapping.RELATIONSHIP_QNAME);
public static CMISTypeId POLICY_TYPE_ID = new CMISTypeId(CMISScope.POLICY, CMISMapping.POLICY_QNAME, CMISMapping.CMIS_MODEL_NS + ":" + CMISMapping.POLICY_QNAME.getLocalName(), CMISMapping.POLICY_QNAME);
// CMIS properties
public static String PROP_OBJECT_ID = "ObjectId";
public static String PROP_URI = "Uri";
public static String PROP_OBJECT_TYPE_ID = "ObjectTypeId";
public static String PROP_CREATED_BY = "CreatedBy";
public static String PROP_CREATION_DATE = "CreationDate";
public static String PROP_LAST_MODIFIED_BY = "LastModifiedBy";
public static String PROP_LAST_MODIFICATION_DATE = "LastModificationDate";
public static String PROP_CHANGE_TOKEN = "ChangeToken";
public static String PROP_NAME = "Name";
public static String PROP_IS_IMMUTABLE = "IsImmutable";
public static String PROP_IS_LATEST_VERSION = "IsLatestVersion";
public static String PROP_IS_MAJOR_VERSION = "IsMajorVersion";
public static String PROP_IS_LATEST_MAJOR_VERSION = "IsLatestMajorVersion";
public static String PROP_VERSION_LABEL = "VersionLabel";
public static String PROP_VERSION_SERIES_ID = "VersionSeriesId";
public static String PROP_IS_VERSION_SERIES_CHECKED_OUT = "IsVersionSeriesCheckedOut";
public static String PROP_VERSION_SERIES_CHECKED_OUT_BY = "VersionSeriesCheckedOutBy";
public static String PROP_VERSION_SERIES_CHECKED_OUT_ID = "VersionSeriesCheckedOutId";
public static String PROP_CHECKIN_COMMENT = "CheckinComment";
public static String PROP_CONTENT_STREAM_ALLOWED = "ContentStreamAllowed";
public static String PROP_CONTENT_STREAM_LENGTH = "ContentStreamLength";
public static String PROP_CONTENT_STREAM_MIME_TYPE = "ContentStreamMimeType";
public static String PROP_CONTENT_STREAM_FILENAME = "ContentStreamFilename";
public static String PROP_CONTENT_STREAM_URI = "ContentStreamUri";
public static String PROP_PARENT_ID = "ParentId";
public static String PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS = "AllowedChildObjectTypeIds";
public static String PROP_SOURCE_ID = "SourceId";
public static String PROP_TARGET_ID = "TargetId";
public static String PROP_OBJECT_ID = "cmis:ObjectId";
public static String PROP_BASE_TYPE_ID = "cmis:BaseTypeId";
public static String PROP_OBJECT_TYPE_ID = "cmis:ObjectTypeId";
public static String PROP_CREATED_BY = "cmis:CreatedBy";
public static String PROP_CREATION_DATE = "cmis:CreationDate";
public static String PROP_LAST_MODIFIED_BY = "cmis:LastModifiedBy";
public static String PROP_LAST_MODIFICATION_DATE = "cmis:LastModificationDate";
public static String PROP_CHANGE_TOKEN = "cmis:ChangeToken";
public static String PROP_NAME = "cmis:Name";
public static String PROP_IS_IMMUTABLE = "cmis:IsImmutable";
public static String PROP_IS_LATEST_VERSION = "cmis:IsLatestVersion";
public static String PROP_IS_MAJOR_VERSION = "cmis:IsMajorVersion";
public static String PROP_IS_LATEST_MAJOR_VERSION = "cmis:IsLatestMajorVersion";
public static String PROP_VERSION_LABEL = "cmis:VersionLabel";
public static String PROP_VERSION_SERIES_ID = "cmis:VersionSeriesId";
public static String PROP_IS_VERSION_SERIES_CHECKED_OUT = "cmis:IsVersionSeriesCheckedOut";
public static String PROP_VERSION_SERIES_CHECKED_OUT_BY = "cmis:VersionSeriesCheckedOutBy";
public static String PROP_VERSION_SERIES_CHECKED_OUT_ID = "cmis:VersionSeriesCheckedOutId";
public static String PROP_CHECKIN_COMMENT = "cmis:CheckinComment";
public static String PROP_CONTENT_STREAM_LENGTH = "cmis:ContentStreamLength";
public static String PROP_CONTENT_STREAM_MIME_TYPE = "cmis:ContentStreamMimeType";
public static String PROP_CONTENT_STREAM_FILENAME = "cmis:ContentStreamFileName";
public static String PROP_CONTENT_STREAM_ID = "cmis:ContentStreamId";
public static String PROP_PARENT_ID = "cmis:ParentId";
public static String PROP_PATH_NAME = "cmis:PathName";
public static String PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS = "cmis:AllowedChildObjectTypeIds";
public static String PROP_SOURCE_ID = "cmis:SourceId";
public static String PROP_TARGET_ID = "cmis:TargetId";
public static String PROP_POLICY_TEXT = "cmis:PolicyText";
}

View File

@@ -48,6 +48,12 @@ public interface CMISPropertyDefinition
*/
public CMISTypeDefinition getOwningType();
/**
* Get the query name
* @return
*/
public String getQueryName();
/**
* Get the display name
*

View File

@@ -39,9 +39,8 @@ public class CMISPropertyId implements Serializable
private static final long serialVersionUID = 4094778633095367606L;
// Id properties
private String propertyName;
private QName propertyQName;
private String propertyId;
private QName qName;
/**
@@ -49,23 +48,12 @@ public class CMISPropertyId implements Serializable
*
* @param propertyName
* @param propertyId
* @param qName
* @param internalQName
*/
public CMISPropertyId(String propertyName, String propertyId, QName qName)
public CMISPropertyId(QName propertyQName, String propertyId)
{
this.propertyName = propertyName;
this.propertyQName = propertyQName;
this.propertyId = propertyId;
this.qName = qName;
}
/**
* Get property name
*
* @return
*/
public String getName()
{
return propertyName;
}
/**
@@ -78,6 +66,24 @@ public class CMISPropertyId implements Serializable
return propertyId;
}
/**
* Get property local name
* @return
*/
public String getLocalName()
{
return propertyQName.getLocalName();
}
/**
* Get property local namespace
* @return
*/
public String getLocalNamespace()
{
return propertyQName.getNamespaceURI();
}
/**
* Get the Alfresco model QName associated with the property
*
@@ -85,7 +91,7 @@ public class CMISPropertyId implements Serializable
*/
public QName getQName()
{
return qName;
return propertyQName;
}
/*
@@ -95,7 +101,7 @@ public class CMISPropertyId implements Serializable
@Override
public String toString()
{
return getName();
return getId();
}
/*
@@ -107,7 +113,7 @@ public class CMISPropertyId implements Serializable
{
final int prime = 31;
int result = 1;
result = prime * result + ((propertyName == null) ? 0 : propertyName.hashCode());
result = prime * result + ((propertyQName == null) ? 0 : propertyQName.hashCode());
return result;
}
@@ -125,12 +131,12 @@ public class CMISPropertyId implements Serializable
if (getClass() != obj.getClass())
return false;
final CMISPropertyId other = (CMISPropertyId) obj;
if (propertyName == null)
if (propertyQName == null)
{
if (other.propertyName != null)
if (other.propertyQName != null)
return false;
}
else if (!propertyName.equals(other.propertyName))
else if (!propertyQName.equals(other.propertyQName))
return false;
return true;
}

View File

@@ -34,7 +34,7 @@ public enum CMISQueryEnum implements EnumLabel
NONE("none"),
METADATA_ONLY("metadataonly"),
FULLTEXT_ONLY("fulltextonly"),
BOTH_SEPERATE("bothseperate"),
BOTH_SEPERATE("bothseparate"),
BOTH_COMBINED("bothcombined");
private String label;

View File

@@ -115,11 +115,24 @@ public interface CMISTypeDefinition
public boolean isQueryable();
/**
* Are objects of this type controllable.
* Is the type full text indexed for querying via CONTAINS()
* @return
*/
public boolean isFullTextIndexed();
/**
* Are objects of this type controllable via Policies.
*
* @return
*/
public boolean isControllable();
public boolean isControllablePolicy();
/**
* Are objects of this type controllable via ACLs.
*
* @return
*/
public boolean isControllableACL();
/**
* Are objects of this type included in super type queries

View File

@@ -39,22 +39,25 @@ public class CMISTypeId implements Serializable
{
private static final long serialVersionUID = -4709046883083948302L;
private String typeId;
private CMISScope scope;
private QName qName;
private QName typeQName;
private String typeId;
private QName internalQName;
/**
* Construct
*
* @param scope
* @param typeId
* @param qName
* @param scope type scope
* @param typeQName name of the CMIS type
* @param typeId id of the CMIS type
* @param internalQName alfresco class definition representing the type
*/
public CMISTypeId(CMISScope scope, String typeId, QName qName)
public CMISTypeId(CMISScope scope, QName typeQName, String typeId, QName internalQName)
{
this.scope = scope;
this.typeQName = typeQName;
this.typeId = typeId;
this.qName = qName;
this.internalQName = internalQName;
}
/**
@@ -66,6 +69,24 @@ public class CMISTypeId implements Serializable
return typeId;
}
/**
* Get the CMIS local name
* @return
*/
public String getLocalName()
{
return typeQName.getLocalName();
}
/**
* Get the CMIS local namespace
* @return
*/
public String getLocalNamespace()
{
return typeQName.getNamespaceURI();
}
/**
* Get the scope for the type (Doc, Folder, Relationship or unknown)
* @return
@@ -82,7 +103,7 @@ public class CMISTypeId implements Serializable
*/
public QName getQName()
{
return qName;
return internalQName;
}
/**
@@ -109,6 +130,7 @@ public class CMISTypeId implements Serializable
}
}
@Override
public String toString()
{
return getId();
@@ -133,12 +155,12 @@ public class CMISTypeId implements Serializable
if (getClass() != obj.getClass())
return false;
final CMISTypeId other = (CMISTypeId) obj;
if (typeId == null)
if (typeQName == null)
{
if (other.typeId != null)
if (other.typeQName != null)
return false;
}
else if (!typeId.equals(other.typeId))
else if (!typeQName.equals(other.typeQName))
return false;
return true;
}

View File

@@ -110,7 +110,6 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
}
// TODO: read / write locks
/** CMIS Dictionary Registry (tenant-aware) */
private Map<String, DictionaryRegistry> registryMap = new ConcurrentHashMap<String, DictionaryRegistry>(4);
@@ -130,7 +129,7 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
Map<String, CMISTypeDefinition> typeDefsByTable = new HashMap<String, CMISTypeDefinition>();
// Property Definitions Index
Map<String, CMISPropertyDefinition> propDefsByName = new HashMap<String, CMISPropertyDefinition>();
Map<String, CMISPropertyDefinition> propDefsById = new HashMap<String, CMISPropertyDefinition>();
Map<QName, CMISPropertyDefinition> propDefsByQName = new HashMap<QName, CMISPropertyDefinition>();
Map<CMISPropertyId, CMISPropertyDefinition> propDefsByPropId = new HashMap<CMISPropertyId, CMISPropertyDefinition>();
@@ -190,13 +189,13 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
propDefsByPropId.put(propDef.getPropertyId(), propDef);
propDefsByQName.put(propDef.getPropertyId().getQName(), propDef);
propDefsByName.put(propDef.getPropertyId().getName().toLowerCase(), propDef);
propDefsById.put(propDef.getPropertyId().getId().toLowerCase(), propDef);
if (logger.isDebugEnabled())
{
logger.debug("Registered property " + propDef.getPropertyId().getId());
logger.debug(" QName: " + propDef.getPropertyId().getQName());
logger.debug(" Name: " + propDef.getPropertyId().getName());
logger.debug(" Id: " + propDef.getPropertyId().getId());
logger.debug(" Owning Type: " + propDef.getOwningType().getTypeId());
logger.debug(" Property Accessor: " + propDef.getPropertyAccessor() + " , mappedProperty=" + propDef.getPropertyAccessor().getMappedProperty());
logger.debug(" Property Lucene Builder: " + propDef.getPropertyLuceneBuilder());
@@ -334,7 +333,7 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
*/
public CMISPropertyDefinition findProperty(String property, CMISTypeDefinition matchingType)
{
CMISPropertyDefinition propDef = getRegistry().propDefsByName.get(property.toLowerCase());
CMISPropertyDefinition propDef = getRegistry().propDefsById.get(property.toLowerCase());
return getProperty(propDef, matchingType);
}
@@ -351,7 +350,7 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
if (property != null && matchingType != null)
{
Map<String, CMISPropertyDefinition> props = matchingType.getPropertyDefinitions();
if (props.containsKey(property.getPropertyId().getName()))
if (props.containsKey(property.getPropertyId().getId()))
{
isMatchingType = true;
}
@@ -441,6 +440,12 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
}
}
// phase 4: assert valid
for (CMISAbstractTypeDefinition typeDef : registry.objectDefsByTypeId.values())
{
typeDef.assertComplete();
}
// publish new registry
registryMap.put(tenantService.getCurrentUserDomain(), registry);

View File

@@ -55,7 +55,7 @@ import org.apache.commons.logging.LogFactory;
*
* @author davidc
*/
public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializable
public abstract class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializable
{
// Logger
protected static final Log logger = LogFactory.getLog(CMISAbstractTypeDefinition.class);
@@ -63,26 +63,54 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
private static final long serialVersionUID = -3131505923356013430L;
// Object type properties
protected boolean isPublic;
protected ClassDefinition cmisClassDef;
protected CMISTypeId objectTypeId;
protected String objectTypeQueryName;
protected String displayName;
protected CMISTypeId parentTypeId;
protected CMISTypeDefinition parentType;
protected CMISAbstractTypeDefinition internalParentType;
protected CMISTypeDefinition rootType;
protected String description;
protected boolean creatable;
protected boolean queryable;
protected boolean controllable;
protected boolean includeInSuperTypeQuery;
protected Collection<CMISTypeId> subTypeIds = new ArrayList<CMISTypeId>();
protected Collection<CMISTypeDefinition> subTypes = new ArrayList<CMISTypeDefinition>();
protected Map<String, CMISPropertyDefinition> properties = new HashMap<String, CMISPropertyDefinition>();
protected Map<String, CMISPropertyDefinition> inheritedProperties = new HashMap<String, CMISPropertyDefinition>();
protected Map<String, CMISPropertyDefinition> ownedProperties = new HashMap<String, CMISPropertyDefinition>();
protected Map<CMISAllowedActionEnum, CMISActionEvaluator> actionEvaluators;
protected Boolean isPublic = null;
protected ClassDefinition cmisClassDef = null;
protected CMISTypeId objectTypeId = null;
protected String objectTypeQueryName = null;
protected String displayName = null;
protected CMISTypeId parentTypeId = null;
protected CMISTypeDefinition parentType = null;
protected CMISAbstractTypeDefinition internalParentType = null;
protected CMISTypeDefinition rootType = null;
protected String description = null;
protected Boolean creatable = null;
protected Boolean queryable = null;
protected Boolean fullTextIndexed = null;
protected Boolean controllablePolicy = null;
protected Boolean controllableACL = null;
protected Boolean includeInSuperTypeQuery = null;
protected Collection<CMISTypeId> subTypeIds = null;
protected Collection<CMISTypeDefinition> subTypes = null;
protected Map<String, CMISPropertyDefinition> properties = null;
protected Map<String, CMISPropertyDefinition> inheritedProperties = null;
protected Map<String, CMISPropertyDefinition> ownedProperties = null;
protected Map<CMISAllowedActionEnum, CMISActionEvaluator> actionEvaluators = null;
/*package*/ void assertComplete()
{
if (objectTypeId == null) throw new IllegalStateException("objectTypeId not specified");
if (isPublic == null) throw new IllegalStateException("isPublic not specified; objectTypeId=" + objectTypeId);
//if (cmisClassDef == null) throw new IllegalStateException("cmisClassDef not specified; objectTypeId=" + objectTypeId);
if (objectTypeQueryName == null) throw new IllegalStateException("objectTypeQueryName not specified; objectTypeId=" + objectTypeId);
if (displayName == null) throw new IllegalStateException("displayName not specified; objectTypeId=" + objectTypeId);
//if (parentTypeId == null) throw new IllegalStateException("parentTypeId not specified; objectTypeId=" + objectTypeId);
if (parentTypeId != null && internalParentType == null) throw new IllegalStateException("parentType not specified; objectTypeId=" + objectTypeId + ",parentTypeId=" + parentTypeId);
if (rootType == null) throw new IllegalStateException("rootType not specified; objectTypeId=" + objectTypeId);
//if (description == null) throw new IllegalStateException("description not specified; objectTypeId=" + objectTypeId);
if (creatable == null) throw new IllegalStateException("creatable not specified; objectTypeId=" + objectTypeId);
if (queryable == null) throw new IllegalStateException("queryable not specified; objectTypeId=" + objectTypeId);
if (fullTextIndexed == null) throw new IllegalStateException("fullTextIndexed not specified; objectTypeId=" + objectTypeId);
if (controllablePolicy == null) throw new IllegalStateException("controllablePolicy not specified; objectTypeId=" + objectTypeId);
if (controllableACL == null) throw new IllegalStateException("controllablePolicy not specified; objectTypeId=" + objectTypeId);
if (includeInSuperTypeQuery == null) throw new IllegalStateException("includeInSuperTypeQuery not specified; objectTypeId=" + objectTypeId);
if (subTypeIds == null) throw new IllegalStateException("subTypeIds not specified; objectTypeId=" + objectTypeId);
if (subTypes == null) throw new IllegalStateException("subTypes not specified; objectTypeId=" + objectTypeId);
if (properties == null) throw new IllegalStateException("properties not specified; objectTypeId=" + objectTypeId);
if (inheritedProperties == null) throw new IllegalStateException("inheritedProperties not specified; objectTypeId=" + objectTypeId);
if (ownedProperties == null) throw new IllegalStateException("inheritedProperties not specified; objectTypeId=" + objectTypeId);
if (actionEvaluators == null) throw new IllegalStateException("actionEvaluators not specified; objectTypeId=" + objectTypeId);
}
/**
@@ -95,6 +123,7 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
/*package*/ Map<String, CMISPropertyDefinition> createProperties(CMISMapping cmisMapping, DictionaryService dictionaryService)
{
// map properties directly defined on this type
properties = new HashMap<String, CMISPropertyDefinition>();
for (PropertyDefinition propDef : cmisClassDef.getProperties().values())
{
if (propDef.getContainerClass().equals(cmisClassDef) && !propDef.isOverride())
@@ -102,7 +131,7 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
if (cmisMapping.getDataType(propDef.getDataType()) != null)
{
CMISPropertyDefinition cmisPropDef = createProperty(cmisMapping, propDef);
properties.put(cmisPropDef.getPropertyId().getName(), cmisPropDef);
properties.put(cmisPropDef.getPropertyId().getId(), cmisPropDef);
}
}
}
@@ -120,9 +149,8 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
private CMISPropertyDefinition createProperty(CMISMapping cmisMapping, PropertyDefinition propDef)
{
QName propertyQName = propDef.getName();
String propertyName = cmisMapping.getCmisPropertyName(propertyQName);
String propertyId = cmisMapping.getCmisPropertyId(propertyQName);
CMISPropertyId cmisPropertyId = new CMISPropertyId(propertyName, propertyId, propertyQName);
CMISPropertyId cmisPropertyId = new CMISPropertyId(propertyQName, propertyId);
return new CMISBasePropertyDefinition(cmisMapping, cmisPropertyId, propDef, this);
}
@@ -134,6 +162,7 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
*/
/*package*/ void createSubTypes(CMISMapping cmisMapping, DictionaryService dictionaryService)
{
subTypeIds = new ArrayList<CMISTypeId>();
Collection<QName> subTypes = dictionaryService.getSubTypes(objectTypeId.getQName(), false);
for (QName subType : subTypes)
{
@@ -185,6 +214,7 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
if (logger.isDebugEnabled())
logger.debug("Type " + objectTypeId + ": root=" + rootType.getTypeId());
subTypes = new ArrayList<CMISTypeDefinition>();
for (CMISTypeId subTypeId : subTypeIds)
{
CMISTypeDefinition subType = registry.objectDefsByTypeId.get(subTypeId);
@@ -209,6 +239,8 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
*/
/*package*/ void resolveInheritance(DictionaryRegistry registry)
{
inheritedProperties = new HashMap<String, CMISPropertyDefinition>();
ownedProperties = new HashMap<String, CMISPropertyDefinition>();
inheritedProperties.putAll(properties);
ownedProperties.putAll(properties);
if (internalParentType != null)
@@ -352,13 +384,31 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
return queryable;
}
/*
* (non-Javadoc)
* @see org.alfresco.cmis.CMISTypeDefinition#isFullTextIndexed()
*/
public boolean isFullTextIndexed()
{
return fullTextIndexed;
}
/*
* (non-Javadoc)
* @see org.alfresco.cmis.dictionary.CMISTypeDefinition#isControllable()
*/
public boolean isControllable()
public boolean isControllablePolicy()
{
return controllable;
return controllablePolicy;
}
/*
* (non-Javadoc)
* @see org.alfresco.cmis.CMISTypeDefinition#isControllableACL()
*/
public boolean isControllableACL()
{
return controllableACL;
}
/*

View File

@@ -65,6 +65,7 @@ public class CMISBasePropertyDefinition implements CMISPropertyDefinition, Seria
// Properties of Property
private CMISTypeDefinition typeDef;
private CMISPropertyId propertyId;
private String queryName;
private String displayName;
private String description;
private CMISDataTypeEnum propertyType;
@@ -94,7 +95,8 @@ public class CMISBasePropertyDefinition implements CMISPropertyDefinition, Seria
{
this.propertyId = propertyId;
this.typeDef = typeDef;
displayName = (propDef.getTitle() != null) ? propDef.getTitle() : propertyId.getName();
queryName = cmisMapping.buildPrefixEncodedString(propertyId.getQName());
displayName = (propDef.getTitle() != null) ? propDef.getTitle() : propertyId.getId();
description = propDef.getDescription();
propertyType = cmisMapping.getDataType(propDef.getDataType());
cardinality = propDef.isMultiValued() ? CMISCardinalityEnum.MULTI_VALUED : CMISCardinalityEnum.SINGLE_VALUED;
@@ -177,6 +179,16 @@ public class CMISBasePropertyDefinition implements CMISPropertyDefinition, Seria
return typeDef;
}
/**
* Get the query name
*
* @return
*/
public String getQueryName()
{
return queryName;
}
/**
* Get the display name
*
@@ -348,9 +360,11 @@ public class CMISBasePropertyDefinition implements CMISPropertyDefinition, Seria
StringBuilder builder = new StringBuilder();
builder.append("CMISPropertyDefinition[");
builder.append("OwningTypeId=").append(getOwningType().getTypeId()).append(", ");
builder.append("PropertyName=").append(getPropertyId().getName()).append(", ");
builder.append("PropertyId=").append(getPropertyId().getId()).append(", ");
builder.append("PropertyQName=").append(getPropertyId().getQName()).append(", ");
builder.append("Id=").append(getPropertyId().getId()).append(", ");
builder.append("LocalName=").append(getPropertyId().getLocalName()).append(", ");
builder.append("Namespace=").append(getPropertyId().getLocalNamespace()).append(", ");
builder.append("InternalQName=").append(getPropertyId().getQName()).append(", ");
builder.append("QueryName=").append(getQueryName()).append(", ");
builder.append("DisplayName=").append(getDisplayName()).append(", ");
builder.append("Description=").append(getDescription()).append(", ");
builder.append("PropertyType=").append(getDataType()).append(", ");

View File

@@ -80,7 +80,7 @@ public class CMISDocumentTypeDefinition extends CMISAbstractTypeDefinition
}
else
{
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName());
if (cmisMapping.isValidCmisDocument(parentQName))
{
parentTypeId = cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, parentQName);
@@ -89,7 +89,9 @@ public class CMISDocumentTypeDefinition extends CMISAbstractTypeDefinition
creatable = true;
queryable = true;
controllable = false;
fullTextIndexed = true;
controllablePolicy = false;
controllableACL = false;
includeInSuperTypeQuery = true;
actionEvaluators = cmisMapping.getActionEvaluators(objectTypeId.getScope());
@@ -148,15 +150,19 @@ public class CMISDocumentTypeDefinition extends CMISAbstractTypeDefinition
{
StringBuilder builder = new StringBuilder();
builder.append("CMISDocumentTypeDefinition[");
builder.append("ObjectTypeId=").append(getTypeId()).append(", ");
builder.append("ObjectTypeQueryName=").append(getQueryName()).append(", ");
builder.append("ObjectTypeDisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentTypeId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Id=").append(getTypeId().getId()).append(", ");
builder.append("Namespace=").append(getTypeId().getLocalNamespace()).append(", ");
builder.append("LocalName=").append(getTypeId().getLocalName()).append(", ");
builder.append("QueryName=").append(getQueryName()).append(", ");
builder.append("DisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Description=").append(getDescription()).append(", ");
builder.append("Creatable=").append(isCreatable()).append(", ");
builder.append("Queryable=").append(isQueryable()).append(", ");
builder.append("Controllable=").append(isControllable()).append(", ");
builder.append("FullTextIndexed=").append(isFullTextIndexed()).append(", ");
builder.append("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
builder.append("ControllablePolicy=").append(isControllablePolicy()).append(", ");
builder.append("ControllableACL=").append(isControllableACL()).append(", ");
builder.append("Fileable=").append(isFileable()).append(", ");
builder.append("Versionable=").append(isVersionable()).append(", ");
builder.append("ContentStreamAllowed=").append(getContentStreamAllowed()).append(", ");

View File

@@ -68,7 +68,7 @@ public class CMISFolderTypeDefinition extends CMISAbstractTypeDefinition
}
else
{
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName());
if (cmisMapping.isValidCmisFolder(parentQName))
{
parentTypeId = cmisMapping.getCmisTypeId(CMISScope.FOLDER, parentQName);
@@ -79,7 +79,9 @@ public class CMISFolderTypeDefinition extends CMISAbstractTypeDefinition
creatable = true;
queryable = true;
controllable = false;
fullTextIndexed = true;
controllablePolicy = false;
controllableACL = false;
includeInSuperTypeQuery = true;
}
@@ -92,15 +94,19 @@ public class CMISFolderTypeDefinition extends CMISAbstractTypeDefinition
{
StringBuilder builder = new StringBuilder();
builder.append("CMISFolderTypeDefinition[");
builder.append("ObjectTypeId=").append(getTypeId()).append(", ");
builder.append("ObjectTypeQueryName=").append(getQueryName()).append(", ");
builder.append("ObjectTypeDisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentTypeId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Id=").append(getTypeId().getId()).append(", ");
builder.append("Namespace=").append(getTypeId().getLocalNamespace()).append(", ");
builder.append("LocalName=").append(getTypeId().getLocalName()).append(", ");
builder.append("QueryName=").append(getQueryName()).append(", ");
builder.append("DisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Description=").append(getDescription()).append(", ");
builder.append("Creatable=").append(isCreatable()).append(", ");
builder.append("Queryable=").append(isQueryable()).append(", ");
builder.append("Controllable=").append(isControllable()).append(", ");
builder.append("FullTextIndexed=").append(isFullTextIndexed()).append(", ");
builder.append("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
builder.append("ControllablePolicy=").append(isControllablePolicy()).append(", ");
builder.append("ControllableACL=").append(isControllableACL()).append(", ");
builder.append("SubTypes=").append(getSubTypes(false).size()).append(", ");
builder.append("Properties=").append(getPropertyDefinitions().size());
builder.append("]");

View File

@@ -24,6 +24,7 @@
*/
package org.alfresco.cmis.dictionary;
import java.util.ArrayList;
import java.util.Collection;
import org.alfresco.cmis.CMISScope;
@@ -57,7 +58,7 @@ public class CMISObjectTypeDefinition extends CMISAbstractTypeDefinition
// Object type properties
objectTypeId = typeId;
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName());
if (cmisClassDef != null)
{
@@ -75,8 +76,10 @@ public class CMISObjectTypeDefinition extends CMISAbstractTypeDefinition
creatable = false;
queryable = false;
controllable = false;
fullTextIndexed = false;
includeInSuperTypeQuery = false;
controllablePolicy = false;
controllableACL = false;
}
/**
@@ -87,6 +90,7 @@ public class CMISObjectTypeDefinition extends CMISAbstractTypeDefinition
*/
/*package*/ void createSubTypes(CMISMapping cmisMapping, DictionaryService dictionaryService)
{
subTypeIds = new ArrayList<CMISTypeId>();
Collection<QName> subTypes = dictionaryService.getSubTypes(objectTypeId.getQName(), false);
for (QName subType : subTypes)
{
@@ -115,7 +119,7 @@ public class CMISObjectTypeDefinition extends CMISAbstractTypeDefinition
builder.append("Description=").append(getDescription()).append(", ");
builder.append("Creatable=").append(isCreatable()).append(", ");
builder.append("Queryable=").append(isQueryable()).append(", ");
builder.append("Controllable=").append(isControllable()).append(", ");
builder.append("Controllable=").append(isControllablePolicy()).append(", ");
builder.append("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
builder.append("SubTypes=").append(getSubTypes(false).size()).append(", ");
builder.append("Properties=").append(getPropertyDefinitions().size());

View File

@@ -24,9 +24,12 @@
*/
package org.alfresco.cmis.dictionary;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import org.alfresco.cmis.CMISDictionaryModel;
import org.alfresco.cmis.CMISPropertyDefinition;
import org.alfresco.cmis.CMISScope;
import org.alfresco.cmis.CMISTypeId;
import org.alfresco.cmis.dictionary.CMISAbstractDictionaryService.DictionaryRegistry;
@@ -71,7 +74,7 @@ public class CMISPolicyTypeDefinition extends CMISAbstractTypeDefinition
}
else
{
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName());
parentTypeId = CMISDictionaryModel.POLICY_TYPE_ID;
}
description = cmisClassDef.getDescription();
@@ -79,8 +82,11 @@ public class CMISPolicyTypeDefinition extends CMISAbstractTypeDefinition
actionEvaluators = cmisMapping.getActionEvaluators(objectTypeId.getScope());
creatable = false;
queryable = false;
controllable = false;
queryable = true;
includeInSuperTypeQuery = true;
fullTextIndexed = true;
controllablePolicy = false;
controllableACL = false;
}
/*
@@ -90,6 +96,7 @@ public class CMISPolicyTypeDefinition extends CMISAbstractTypeDefinition
@Override
/*package*/ void createSubTypes(CMISMapping cmisMapping, DictionaryService dictionaryService)
{
subTypeIds = new ArrayList<CMISTypeId>();
if (objectTypeId.equals(CMISDictionaryModel.POLICY_TYPE_ID))
{
// all aspects are sub-type of POLICY_OBJECT_TYPE
@@ -111,6 +118,8 @@ public class CMISPolicyTypeDefinition extends CMISAbstractTypeDefinition
@Override
/*package*/ void resolveInheritance(DictionaryRegistry registry)
{
inheritedProperties = new HashMap<String, CMISPropertyDefinition>();
ownedProperties = new HashMap<String, CMISPropertyDefinition>();
// NOTE: Force no inheritance of base Policy type
inheritedProperties.putAll(properties);
ownedProperties.putAll(properties);
@@ -128,14 +137,16 @@ public class CMISPolicyTypeDefinition extends CMISAbstractTypeDefinition
{
StringBuilder builder = new StringBuilder();
builder.append("CMISPolicyTypeDefinition[");
builder.append("ObjectTypeId=").append(getTypeId()).append(", ");
builder.append("ObjectTypeQueryName=").append(getQueryName()).append(", ");
builder.append("ObjectTypeDisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentTypeId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Id=").append(getTypeId().getId()).append(", ");
builder.append("Namespace=").append(getTypeId().getLocalNamespace()).append(", ");
builder.append("LocalName=").append(getTypeId().getLocalName()).append(", ");
builder.append("QueryName=").append(getQueryName()).append(", ");
builder.append("DisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Description=").append(getDescription()).append(", ");
builder.append("Creatable=").append(isCreatable()).append(", ");
builder.append("Queryable=").append(isQueryable()).append(", ");
builder.append("Controllable=").append(isControllable()).append(", ");
builder.append("Controllable=").append(isControllablePolicy()).append(", ");
builder.append("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
builder.append("SubTypes=").append(getSubTypes(false).size()).append(", ");
builder.append("Properties=").append(getPropertyDefinitions().size());

View File

@@ -26,6 +26,7 @@ package org.alfresco.cmis.dictionary;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -78,7 +79,10 @@ public class CMISRelationshipTypeDefinition extends CMISAbstractTypeDefinition
actionEvaluators = cmisMapping.getActionEvaluators(objectTypeId.getScope());
queryable = false;
controllable = false;
fullTextIndexed = false;
includeInSuperTypeQuery = false;
controllablePolicy = false;
controllableACL = false;
if (assocDef == null)
{
@@ -97,7 +101,7 @@ public class CMISRelationshipTypeDefinition extends CMISAbstractTypeDefinition
{
creatable = true;
displayName = (assocDef.getTitle() != null) ? assocDef.getTitle() : typeId.getId();
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName());
parentTypeId = CMISDictionaryModel.RELATIONSHIP_TYPE_ID;
description = assocDef.getDescription();
@@ -126,6 +130,7 @@ public class CMISRelationshipTypeDefinition extends CMISAbstractTypeDefinition
{
return super.createProperties(cmisMapping, dictionaryService);
}
properties = new HashMap<String, CMISPropertyDefinition>();
return properties;
}
@@ -136,6 +141,7 @@ public class CMISRelationshipTypeDefinition extends CMISAbstractTypeDefinition
@Override
/*package*/ void createSubTypes(CMISMapping cmisMapping, DictionaryService dictionaryService)
{
subTypeIds = new ArrayList<CMISTypeId>();
if (objectTypeId.equals(CMISDictionaryModel.RELATIONSHIP_TYPE_ID))
{
// all associations are sub-type of RELATIONSHIP_OBJECT_TYPE
@@ -231,14 +237,16 @@ public class CMISRelationshipTypeDefinition extends CMISAbstractTypeDefinition
{
StringBuilder builder = new StringBuilder();
builder.append("CMISRelationshipTypeDefinition[");
builder.append("ObjectTypeId=").append(getTypeId()).append(", ");
builder.append("ObjectTypeQueryName=").append(getQueryName()).append(", ");
builder.append("ObjectTypeDisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentTypeId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Id=").append(getTypeId().getId()).append(", ");
builder.append("Namespace=").append(getTypeId().getLocalNamespace()).append(", ");
builder.append("LocalName=").append(getTypeId().getLocalName()).append(", ");
builder.append("QueryName=").append(getQueryName()).append(", ");
builder.append("DisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Description=").append(getDescription()).append(", ");
builder.append("Creatable=").append(isCreatable()).append(", ");
builder.append("Queryable=").append(isQueryable()).append(", ");
builder.append("Controllable=").append(isControllable()).append(", ");
builder.append("Controllable=").append(isControllablePolicy()).append(", ");
builder.append("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
builder.append("AllowedSourceTypes=[");
for (CMISTypeDefinition type : getAllowedSourceTypes())

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.cmis.mapping;
import java.io.Serializable;
import org.alfresco.cmis.CMISDictionaryModel;
import org.alfresco.cmis.CMISScope;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
/**
* Get the CMIS object type id property
*
* @author andyh
*/
public class BaseTypeIdProperty extends AbstractProperty
{
/**
* Construct
*
* @param serviceRegistry
*/
public BaseTypeIdProperty(ServiceRegistry serviceRegistry)
{
super(serviceRegistry, CMISDictionaryModel.PROP_BASE_TYPE_ID);
}
/*
* (non-Javadoc)
* @see org.alfresco.cmis.mapping.AbstractProperty#getValue(org.alfresco.service.cmr.repository.NodeRef)
*/
public Serializable getValue(NodeRef nodeRef)
{
QName type = getServiceRegistry().getNodeService().getType(nodeRef);
return getServiceRegistry().getCMISDictionaryService().findTypeForClass(type).getBaseType().getTypeId().getId();
}
/*
* (non-Javadoc)
* @see org.alfresco.cmis.mapping.AbstractProperty#getValue(org.alfresco.service.cmr.repository.AssociationRef)
*/
public Serializable getValue(AssociationRef assocRef)
{
QName type = assocRef.getTypeQName();
return getServiceRegistry().getCMISDictionaryService().findTypeForClass(type, CMISScope.RELATIONSHIP).getBaseType().getTypeId().getId();
}
}

View File

@@ -24,7 +24,6 @@
*/
package org.alfresco.cmis.mapping;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -45,7 +44,6 @@ import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceException;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.apache.commons.logging.Log;
@@ -64,9 +62,10 @@ public class CMISMapping implements InitializingBean
protected static final Log logger = LogFactory.getLog(CMISMapping.class);
/**
* The Alfresco CMIS model URI.
* The Alfresco CMIS Namespace
*/
public static String CMIS_MODEL_URI = "http://www.alfresco.org/model/cmis/0.6";
public static String CMIS_MODEL_NS = "cmis";
public static String CMIS_MODEL_URI = "http://www.alfresco.org/model/cmis/0.62c";
/**
* The Alfresco CMIS Model name.
@@ -78,10 +77,6 @@ public class CMISMapping implements InitializingBean
*/
public static QName CMIS_MODEL_QNAME = QName.createQName(CMIS_MODEL_URI, CMIS_MODEL_NAME);
// CMIS Internal Types
public static String OBJECT_OBJECT_TYPE = "object";
public static String FILESYSTEM_OBJECT_TYPE ="filesystemobject";
// CMIS Data Types
public static QName CMIS_DATATYPE_ID = QName.createQName(CMIS_MODEL_URI, "id");
public static QName CMIS_DATATYPE_URI = QName.createQName(CMIS_MODEL_URI, "uri");
@@ -89,16 +84,16 @@ public class CMISMapping implements InitializingBean
public static QName CMIS_DATATYPE_HTML = QName.createQName(CMIS_MODEL_URI, "html");
// CMIS Types
public static QName OBJECT_QNAME = QName.createQName(CMIS_MODEL_URI, OBJECT_OBJECT_TYPE);
public static QName FILESYSTEM_OBJECT_QNAME = QName.createQName(CMIS_MODEL_URI, FILESYSTEM_OBJECT_TYPE);
public static QName DOCUMENT_QNAME = QName.createQName(CMIS_MODEL_URI, CMISDictionaryModel.DOCUMENT_OBJECT_TYPE);
public static QName FOLDER_QNAME = QName.createQName(CMIS_MODEL_URI, CMISDictionaryModel.FOLDER_OBJECT_TYPE);
public static QName RELATIONSHIP_QNAME = QName.createQName(CMIS_MODEL_URI, CMISDictionaryModel.RELATIONSHIP_OBJECT_TYPE);
public static QName POLICY_QNAME = QName.createQName(CMIS_MODEL_URI, CMISDictionaryModel.POLICY_OBJECT_TYPE);
public static QName OBJECT_QNAME = QName.createQName(CMIS_MODEL_URI, "object");
public static QName FILESYSTEM_OBJECT_QNAME = QName.createQName(CMIS_MODEL_URI, "filesystemobject");
public static QName DOCUMENT_QNAME = QName.createQName(CMIS_MODEL_URI, "Document");
public static QName FOLDER_QNAME = QName.createQName(CMIS_MODEL_URI, "Folder");
public static QName RELATIONSHIP_QNAME = QName.createQName(CMIS_MODEL_URI, "Relationship");
public static QName POLICY_QNAME = QName.createQName(CMIS_MODEL_URI, "Policy");
// CMIS Internal Type Ids
public static CMISTypeId OBJECT_TYPE_ID = new CMISTypeId(CMISScope.OBJECT, OBJECT_OBJECT_TYPE.toLowerCase(), OBJECT_QNAME);
public static CMISTypeId FILESYSTEM_OBJECT_TYPE_ID = new CMISTypeId(CMISScope.OBJECT, FILESYSTEM_OBJECT_TYPE.toLowerCase(), FILESYSTEM_OBJECT_QNAME);
public static CMISTypeId OBJECT_TYPE_ID = new CMISTypeId(CMISScope.OBJECT, OBJECT_QNAME, CMIS_MODEL_NS + ":" + OBJECT_QNAME.getLocalName(), OBJECT_QNAME);
public static CMISTypeId FILESYSTEM_OBJECT_TYPE_ID = new CMISTypeId(CMISScope.OBJECT, FILESYSTEM_OBJECT_QNAME, CMIS_MODEL_NS + ":" + FILESYSTEM_OBJECT_QNAME.getLocalName(), FILESYSTEM_OBJECT_QNAME);
// Properties
public static QName PROP_OBJECT_ID_QNAME = QName.createQName(CMIS_MODEL_URI, CMISDictionaryModel.PROP_OBJECT_ID);
@@ -173,8 +168,8 @@ public class CMISMapping implements InitializingBean
//
registerPropertyAccessor(new ObjectIdProperty(serviceRegistry));
registerPropertyAccessor(new FixedValueProperty(serviceRegistry, CMISDictionaryModel.PROP_URI, null));
registerPropertyAccessor(new ObjectTypeIdProperty(serviceRegistry));
registerPropertyAccessor(new BaseTypeIdProperty(serviceRegistry));
registerPropertyAccessor(new DirectProperty(serviceRegistry, CMISDictionaryModel.PROP_CREATED_BY, ContentModel.PROP_CREATOR));
registerPropertyAccessor(new DirectProperty(serviceRegistry, CMISDictionaryModel.PROP_CREATION_DATE, ContentModel.PROP_CREATED));
registerPropertyAccessor(new DirectProperty(serviceRegistry, CMISDictionaryModel.PROP_LAST_MODIFIED_BY, ContentModel.PROP_MODIFIER));
@@ -191,12 +186,12 @@ public class CMISMapping implements InitializingBean
registerPropertyAccessor(new VersionSeriesCheckedOutByProperty(serviceRegistry));
registerPropertyAccessor(new VersionSeriesCheckedOutIdProperty(serviceRegistry));
registerPropertyAccessor(new CheckinCommentProperty(serviceRegistry));
registerPropertyAccessor(new FixedValueProperty(serviceRegistry, CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED, CMISContentStreamAllowedEnum.ALLOWED.toString()));
registerPropertyAccessor(new ContentStreamLengthProperty(serviceRegistry));
registerPropertyAccessor(new ContentStreamMimetypeProperty(serviceRegistry));
registerPropertyAccessor(new ContentStreamIdProperty(serviceRegistry));
registerPropertyAccessor(new DirectProperty(serviceRegistry, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME, ContentModel.PROP_NAME));
registerPropertyAccessor(new ContentStreamUriProperty(serviceRegistry));
registerPropertyAccessor(new ParentProperty(serviceRegistry));
registerPropertyAccessor(new FixedValueProperty(serviceRegistry, CMISDictionaryModel.PROP_PATH_NAME, null));
registerPropertyAccessor(new FixedValueProperty(serviceRegistry, CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS, null));
registerPropertyAccessor(new SourceIdProperty(serviceRegistry));
registerPropertyAccessor(new TargetIdProperty(serviceRegistry));
@@ -205,39 +200,41 @@ public class CMISMapping implements InitializingBean
// Action Evaluator Mappings
//
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE_OBJECT, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_UPDATE_PROPERTIES, PermissionService.WRITE_PROPERTIES));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_PROPERTIES, PermissionService.READ_PROPERTIES));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_RELATIONSHIPS, true));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_PARENTS, true));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_OBJECT_PARENTS, true));
// Is CAN_MOVE correct mapping?
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_MOVE, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE_VERSION, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE_CONTENT, PermissionService.WRITE_PROPERTIES, PermissionService.WRITE_CONTENT));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_MOVE_OBJECT, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE_CONTENT_STREAM, PermissionService.WRITE_PROPERTIES, PermissionService.WRITE_CONTENT));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_CHECKOUT, PermissionService.CHECK_OUT));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_CANCEL_CHECKOUT, PermissionService.CANCEL_CHECK_OUT));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_CHECKIN, PermissionService.CHECK_IN));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_SET_CONTENT, PermissionService.WRITE_CONTENT));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_SET_CONTENT_STREAM, PermissionService.WRITE_CONTENT));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_ALL_VERSIONS, true));
registerEvaluator(CMISScope.DOCUMENT, new ParentActionEvaluator(new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_ADD_TO_FOLDER, PermissionService.LINK_CHILDREN)));
registerEvaluator(CMISScope.DOCUMENT, new ParentActionEvaluator(new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_ADD_OBJECT_TO_FOLDER, PermissionService.LINK_CHILDREN)));
// Is CAN_REMOVE_FROM_FOLDER correct mapping?
registerEvaluator(CMISScope.DOCUMENT, new ParentActionEvaluator(new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_REMOVE_FROM_FOLDER, true)));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_VIEW_CONTENT, PermissionService.READ_CONTENT));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_ADD_POLICY, false));
registerEvaluator(CMISScope.DOCUMENT, new ParentActionEvaluator(new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_REMOVE_OBJECT_FROM_FOLDER, true)));
registerEvaluator(CMISScope.DOCUMENT, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_CONTENT_STREAM, PermissionService.READ_CONTENT));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_APPLY_POLICY, false));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_APPLIED_POLICIES, false));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_REMOVE_POLICY, false));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_CREATE_RELATIONSHIP, true));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_RENDITIONS, true));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_ACL, false));
registerEvaluator(CMISScope.DOCUMENT, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_APPLY_ACL, false));
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE_OBJECT, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_UPDATE_PROPERTIES, PermissionService.WRITE_PROPERTIES));
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_PROPERTIES, PermissionService.READ_PROPERTIES));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_RELATIONSHIPS, true));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_PARENTS, true));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_OBJECT_PARENTS, true));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_FOLDER_PARENT, true));
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_DESCENDANTS, PermissionService.READ_CHILDREN));
// Is CAN_MOVE correct mapping?
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_MOVE, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_ADD_POLICY, false));
// Is CAN_MOVE_OBJECT correct mapping?
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_MOVE_OBJECT, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_APPLY_POLICY, false));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_APPLIED_POLICIES, false));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_REMOVE_POLICY, false));
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_CHILDREN, PermissionService.READ_CHILDREN));
@@ -245,20 +242,25 @@ public class CMISMapping implements InitializingBean
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_CREATE_FOLDER, PermissionService.CREATE_CHILDREN));
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_CREATE_RELATIONSHIP, PermissionService.CREATE_ASSOCIATIONS));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_CREATE_POLICY, false));
registerEvaluator(CMISScope.FOLDER, new PermissionActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE_TREE, PermissionService.DELETE_NODE));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_ACL, false));
registerEvaluator(CMISScope.FOLDER, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_APPLY_ACL, false));
registerEvaluator(CMISScope.RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE, true));
registerEvaluator(CMISScope.RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE_OBJECT, true));
registerEvaluator(CMISScope.RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_UPDATE_PROPERTIES, false));
registerEvaluator(CMISScope.RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_PROPERTIES, true));
registerEvaluator(CMISScope.RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_ACL, false));
registerEvaluator(CMISScope.RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_APPLY_ACL, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_DELETE_OBJECT, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_UPDATE_PROPERTIES, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_PROPERTIES, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_OBJECT_PARENTS, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_MOVE_OBJECT, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_ADD_OBJECT_TO_FOLDER, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_REMOVE_OBJECT_FROM_FOLDER, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_RELATIONSHIPS, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_PARENTS, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_MOVE, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_ADD_TO_FOLDER, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_REMOVE_FROM_FOLDER, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_GET_ACL, false));
registerEvaluator(CMISScope.POLICY, new FixedValueActionEvaluator(serviceRegistry, CMISAllowedActionEnum.CAN_APPLY_ACL, false));
}
@@ -324,10 +326,10 @@ public class CMISMapping implements InitializingBean
{
throw new AlfrescoRuntimeException("Malformed type id '" + typeId + "'; discriminator " + typeId.charAt(0) + " unknown");
}
QName typeQName = QName.resolveToQName(serviceRegistry.getNamespaceService(), typeId.substring(2).replace('_', ':'));
QName typeQName = QName.resolveToQName(serviceRegistry.getNamespaceService(), typeId.substring(2));
// Construct CMIS Type Id
return new CMISTypeId(scope, typeId, typeQName);
return new CMISTypeId(scope, typeQName, typeId, typeQName);
}
/**
@@ -341,11 +343,8 @@ public class CMISMapping implements InitializingBean
CMISTypeId typeId = mapAlfrescoQNameToTypeId.get(typeQName);
if (typeId == null)
{
StringBuilder builder = new StringBuilder(128);
builder.append(scope.getLabel());
builder.append("/");
builder.append(buildPrefixEncodedString(typeQName, false));
return new CMISTypeId(scope, builder.toString(), typeQName);
String typeIdStr = scope.getLabel() + "/" + typeQName.toPrefixString(serviceRegistry.getNamespaceService());
return new CMISTypeId(scope, typeQName, typeIdStr, typeQName);
}
else
{
@@ -399,25 +398,9 @@ public class CMISMapping implements InitializingBean
return null;
}
public String buildPrefixEncodedString(QName qname, boolean upperCase)
public String buildPrefixEncodedString(QName qname)
{
StringBuilder builder = new StringBuilder(128);
if (!qname.getNamespaceURI().equals(CMIS_MODEL_URI))
{
Collection<String> prefixes = serviceRegistry.getNamespaceService().getPrefixes(qname.getNamespaceURI());
if (prefixes.size() == 0)
{
throw new NamespaceException("A namespace prefix is not registered for uri " + qname.getNamespaceURI());
}
String resolvedPrefix = prefixes.iterator().next();
builder.append(upperCase ? resolvedPrefix.toUpperCase() : resolvedPrefix);
builder.append("_");
}
builder.append(upperCase ? qname.getLocalName().toUpperCase() : qname.getLocalName());
return builder.toString();
return qname.toPrefixString(serviceRegistry.getNamespaceService());
}
/**
@@ -612,18 +595,6 @@ public class CMISMapping implements InitializingBean
return cmisTypeQName;
}
/**
* Get the CMIS property name from the property QName.
*
* @param namespaceService
* @param propertyQName
* @return
*/
public String getCmisPropertyName(QName propertyQName)
{
return buildPrefixEncodedString(propertyQName, false);
}
/**
* Get the CMIS property type for a property
*
@@ -722,14 +693,7 @@ public class CMISMapping implements InitializingBean
*/
public String getCmisPropertyId(QName propertyQName)
{
if (propertyQName.getNamespaceURI().equals(CMIS_MODEL_URI))
{
return propertyQName.getLocalName();
}
else
{
return propertyQName.toString();
}
return propertyQName.toPrefixString(serviceRegistry.getNamespaceService());
}
/**
@@ -740,15 +704,15 @@ public class CMISMapping implements InitializingBean
*/
public AbstractProperty getPropertyAccessor(CMISPropertyId propertyId)
{
AbstractProperty propertyAccessor = propertyAccessors.get(propertyId.getName());
AbstractProperty propertyAccessor = propertyAccessors.get(propertyId.getId());
if (propertyAccessor == null)
{
QName propertyQName = propertyId.getQName();
if (propertyQName == null)
{
throw new AlfrescoRuntimeException("Can't get property accessor for property id " + propertyId.getName() + " due to unknown property QName");
throw new AlfrescoRuntimeException("Can't get property accessor for property id " + propertyId.getId() + " due to unknown property QName");
}
propertyAccessor = new DirectProperty(serviceRegistry, propertyId.getName(), propertyQName);
propertyAccessor = new DirectProperty(serviceRegistry, propertyId.getId(), propertyQName);
}
return propertyAccessor;
}

View File

@@ -29,7 +29,6 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.alfresco.cmis.CMISContentStreamAllowedEnum;
import org.alfresco.cmis.CMISDictionaryModel;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
@@ -48,8 +47,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
NodeRef folder = fileFolderService.create(rootNodeRef, "BaseFolder", ContentModel.TYPE_FOLDER).getNodeRef();
Map<String, Serializable> properties = cmisService.getProperties(folder);
assertEquals(folder.toString(), properties.get(CMISDictionaryModel.PROP_OBJECT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(CMISDictionaryModel.FOLDER_TYPE_ID.getId(), properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID));
assertEquals(CMISDictionaryModel.FOLDER_TYPE_ID.getId(), properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID));
assertEquals(authenticationComponent.getCurrentUserName(), properties.get(CMISDictionaryModel.PROP_CREATED_BY));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(authenticationComponent.getCurrentUserName(), properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY));
@@ -68,36 +67,23 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY));
assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT));
assertNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED));
assertNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH));
assertNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE));
assertNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME));
assertNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI));
assertNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertEquals(rootNodeRef.toString(), properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
}
private String createContentUri(NodeRef nodeRef)
{
String uri = "/api/node/" + nodeRef.getStoreRef().getProtocol() + "/" + nodeRef.getStoreRef().getIdentifier() + "/" + nodeRef.getId() + "/content";
String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
int dotIndex = name.indexOf('.');
if (dotIndex != -1)
{
uri += "." + name.substring(dotIndex);
}
return uri;
}
public void testBasicDocument()
{
NodeRef content = fileFolderService.create(rootNodeRef, "BaseContent", ContentModel.TYPE_CONTENT).getNodeRef();
Map<String, Serializable> properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -116,11 +102,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
}
@@ -131,8 +116,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
Map<String, Serializable> properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -151,11 +136,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -172,11 +156,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
long size = writer.getSize();
properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), size);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "text/plain");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
}
public void testLock()
@@ -185,8 +168,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
Map<String, Serializable> properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -205,11 +188,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -232,8 +214,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -252,11 +234,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -268,8 +249,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
Map<String, Serializable> properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -288,11 +269,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -314,8 +294,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(pwc);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), pwc.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -334,11 +314,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -347,8 +326,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -367,11 +346,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -393,8 +371,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(pwc);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), pwc.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -413,11 +391,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -426,8 +403,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -446,11 +423,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -462,8 +438,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
Map<String, Serializable> properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -482,11 +458,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -495,8 +470,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -515,11 +490,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -541,8 +515,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(pwc);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), pwc.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -561,11 +535,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -574,8 +547,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -594,11 +567,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -620,8 +592,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(pwc);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), pwc.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -640,11 +612,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -656,8 +627,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString()+"/1.0");
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -676,11 +647,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), "Meep");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -702,8 +672,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(pwc);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), pwc.toString());
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -722,11 +692,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -738,8 +707,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
properties = cmisService.getProperties(content);
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_ID), content.toString()+"/1.1");
assertNull(properties.get(CMISDictionaryModel.PROP_URI));
assertEquals(properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.DOCUMENT_TYPE_ID.getId());
assertEquals(properties.get(CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -758,11 +727,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
assertEquals(properties.get(CMISDictionaryModel.PROP_CHECKIN_COMMENT), "Woof");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH), 0L);
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
assertEquals(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_URI), createContentUri(content));
assertNotNull(properties.get(CMISDictionaryModel.PROP_CONTENT_STREAM_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
@@ -772,8 +740,8 @@ public class CMISPropertyServiceTest extends BaseCMISTest
{
NodeRef folder = fileFolderService.create(rootNodeRef, "BaseFolder", ContentModel.TYPE_FOLDER).getNodeRef();
assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_OBJECT_ID), folder.toString());
assertNull(cmisService.getProperty(folder, CMISDictionaryModel.PROP_URI));
assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.FOLDER_TYPE_ID.getId());
assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_BASE_TYPE_ID), CMISDictionaryModel.FOLDER_TYPE_ID.getId());
assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
assertNotNull(cmisService.getProperty(folder, CMISDictionaryModel.PROP_CREATION_DATE));
assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
@@ -794,11 +762,10 @@ public class CMISPropertyServiceTest extends BaseCMISTest
cmisService.getProperty(folder, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY);
cmisService.getProperty(folder, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID);
cmisService.getProperty(folder, CMISDictionaryModel.PROP_CHECKIN_COMMENT);
cmisService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED);
cmisService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH);
cmisService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE);
cmisService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME);
cmisService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_URI);
cmisService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_ID);
fail("Failed to catch invalid property on type folder");
}
catch(AlfrescoRuntimeException e)
@@ -809,7 +776,7 @@ public class CMISPropertyServiceTest extends BaseCMISTest
assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_PARENT_ID), rootNodeRef.toString());
assertNull(cmisService.getProperty(folder, CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
assertEquals(cmisService.getProperty(folder, "NAME"), "BaseFolder");
assertEquals(cmisService.getProperty(folder, "name"), "BaseFolder");
assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_NAME.toUpperCase()), "BaseFolder");
assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_NAME.toLowerCase()), "BaseFolder");
}
}

View File

@@ -38,7 +38,6 @@ import org.alfresco.cmis.CMISRelationshipDirectionEnum;
import org.alfresco.cmis.CMISScope;
import org.alfresco.cmis.CMISServices;
import org.alfresco.cmis.CMISTypeDefinition;
import org.alfresco.cmis.CMISTypeId;
import org.alfresco.cmis.CMISTypesFilterEnum;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
@@ -62,7 +61,6 @@ import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.QNamePattern;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.AbstractLifecycleBean;
import org.springframework.beans.BeansException;
@@ -591,7 +589,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
Map<String, Serializable> values = new HashMap<String, Serializable>(propDefs.size());
for (CMISPropertyDefinition propDef : propDefs.values())
{
values.put(propDef.getPropertyId().getName(), propDef.getPropertyAccessor().getValue(nodeRef));
values.put(propDef.getPropertyId().getId(), propDef.getPropertyAccessor().getValue(nodeRef));
}
return values;
}

View File

@@ -27,7 +27,6 @@ package org.alfresco.cmis.mapping;
import java.io.Serializable;
import org.alfresco.cmis.CMISDictionaryModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -36,16 +35,16 @@ import org.alfresco.service.cmr.repository.NodeRef;
*
* @author andyh
*/
public class ContentStreamUriProperty extends AbstractProperty
public class ContentStreamIdProperty extends AbstractProperty
{
/**
* Construct
*
* @param serviceRegistry
*/
public ContentStreamUriProperty(ServiceRegistry serviceRegistry)
public ContentStreamIdProperty(ServiceRegistry serviceRegistry)
{
super(serviceRegistry, CMISDictionaryModel.PROP_CONTENT_STREAM_URI);
super(serviceRegistry, CMISDictionaryModel.PROP_CONTENT_STREAM_ID);
}
/*
@@ -54,19 +53,7 @@ public class ContentStreamUriProperty extends AbstractProperty
*/
public Serializable getValue(NodeRef nodeRef)
{
StringBuilder sb = new StringBuilder();
sb.append("/api/node/");
sb.append(nodeRef.getStoreRef().getProtocol());
sb.append("/");
sb.append(nodeRef.getStoreRef().getIdentifier());
sb.append("/");
sb.append(nodeRef.getId());
sb.append("/content");
String name = (String)getServiceRegistry().getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME);
if (name.lastIndexOf('.') != -1)
{
sb.append(name.substring(name.lastIndexOf('.')));
}
return sb.toString();
return "cm:content";
}
}

View File

@@ -492,11 +492,11 @@ public class CMISQueryParser
Function function = factory.getFunction(PropertyAccessor.NAME);
Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, propDef.isQueryable(), propDef.isOrderable(), selector.getAlias(), propDef
.getPropertyId().getName());
.getPropertyId().getId());
Map<String, Argument> functionArguments = new LinkedHashMap<String, Argument>();
functionArguments.put(arg.getName(), arg);
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getName() : propDef.getPropertyId().getName();
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getId() : propDef.getPropertyId().getId();
match = factory.createColumn(function, functionArguments, alias);
}
@@ -531,11 +531,11 @@ public class CMISQueryParser
Function function = factory.getFunction(PropertyAccessor.NAME);
Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, propDef.isQueryable(), propDef.isOrderable(), selector.getAlias(), propDef
.getPropertyId().getName());
.getPropertyId().getId());
Map<String, Argument> functionArguments = new LinkedHashMap<String, Argument>();
functionArguments.put(arg.getName(), arg);
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getName() : propDef.getPropertyId().getName();
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getId() : propDef.getPropertyId().getId();
orderColumn = factory.createColumn(function, functionArguments, alias);
}
@@ -575,10 +575,10 @@ public class CMISQueryParser
{
Function function = factory.getFunction(PropertyAccessor.NAME);
Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(),
definition.getPropertyId().getName());
definition.getPropertyId().getId());
Map<String, Argument> functionArguments = new LinkedHashMap<String, Argument>();
functionArguments.put(arg.getName(), arg);
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyId().getName() : definition.getPropertyId().getName();
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyId().getId() : definition.getPropertyId().getId();
Column column = factory.createColumn(function, functionArguments, alias);
columns.add(column);
}
@@ -619,11 +619,11 @@ public class CMISQueryParser
{
Function function = factory.getFunction(PropertyAccessor.NAME);
Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(),
definition.getPropertyId().getName());
definition.getPropertyId().getId());
Map<String, Argument> functionArguments = new LinkedHashMap<String, Argument>();
functionArguments.put(arg.getName(), arg);
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyId().getName() : definition.getPropertyId()
.getName();
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyId().getId() : definition.getPropertyId()
.getId();
Column column = factory.createColumn(function, functionArguments, alias);
columns.add(column);
}
@@ -667,11 +667,11 @@ public class CMISQueryParser
Function function = factory.getFunction(PropertyAccessor.NAME);
Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, propDef.isQueryable(), propDef.isOrderable(), selector.getAlias(), propDef
.getPropertyId().getName());
.getPropertyId().getId());
Map<String, Argument> functionArguments = new LinkedHashMap<String, Argument>();
functionArguments.put(arg.getName(), arg);
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getName() : propDef.getPropertyId().getName();
String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getId() : propDef.getPropertyId().getId();
if (columnNode.getChildCount() > 1)
{
alias = columnNode.getChild(1).getText();
@@ -795,7 +795,7 @@ public class CMISQueryParser
{
throw new CMISQueryException("Column refers to unqueryable property " + definition.getName());
}
PropertyArgument arg = factory.createPropertyArgument(definition.getName(), propDef.isQueryable(), propDef.isOrderable(), "", propDef.getPropertyId().getName());
PropertyArgument arg = factory.createPropertyArgument(definition.getName(), propDef.isQueryable(), propDef.isOrderable(), "", propDef.getPropertyId().getId());
return arg;
}
}
@@ -946,7 +946,7 @@ public class CMISQueryParser
CMISTypeDefinition typeDef = cmisDictionaryService.findTypeForTable(tableName);
if (typeDef == null)
{
throw new CMISQueryException("Type is unsupported in query " + tableName);
throw new CMISQueryException("Type is unsupported in query: " + tableName);
}
if (typeDef.getTypeId().getScope() != CMISScope.POLICY)
{
@@ -1053,7 +1053,7 @@ public class CMISQueryParser
{
throw new CMISQueryException("Unknown column/property " + cmisPropertyName);
}
return factory.createPropertyArgument(argumentName, propDef.isQueryable(), propDef.isOrderable(), qualifer, propDef.getPropertyId().getName());
return factory.createPropertyArgument(argumentName, propDef.isQueryable(), propDef.isOrderable(), qualifer, propDef.getPropertyId().getId());
}
public String getFunctionName(CommonTree functionNameNode)

View File

@@ -426,7 +426,7 @@ public class QueryTest extends BaseCMISTest
public void test_PARENT()
{
testQuery("SELECT ParentId FROM Folder WHERE ParentId = '" + rootNodeRef.toString() + "'", 4, false, "ParentId", new String(), false);
testQuery("SELECT cmis:ParentId FROM cmis:Folder WHERE cmis:ParentId = '" + rootNodeRef.toString() + "'", 4, false, "cmis:ParentId", new String(), false);
testQuery("SELECT ParentId FROM Folder WHERE ParentId <> '" + rootNodeRef.toString() + "'", 6, false, "ParentId", new String(), false);
testQuery("SELECT ParentId FROM Folder WHERE ParentId < '" + rootNodeRef.toString() + "'", 0, false, "ParentId", new String(), true);
testQuery("SELECT ParentId FROM Folder WHERE ParentId <= '" + rootNodeRef.toString() + "'", 0, false, "ParentId", new String(), true);
@@ -453,35 +453,6 @@ public class QueryTest extends BaseCMISTest
testQuery("SELECT ParentId FROM Folder WHERE ANY ParentId NOT IN ('" + rootNodeRef.toString() + "')", 6, false, "ParentId", new String(), false);
}
public void test_CONTENT_STREAM_URI()
{
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri = 'test'", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri <> 'test'", 10, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri < 'test'", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri <= 'test'", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri > 'test'", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri >= 'test'", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IN ('test')", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri NOT IN ('test')", 10, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri LIKE 'test'", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri NOT LIKE 'test'", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IS NOT NULL", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IS NULL", 10, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' = ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' <> ANY ContentStreamUri", 10, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' < ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' <= ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' > ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' >= ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ANY ContentStreamUri IN ('test')", 0, false, "ContentStreamUri", new String(), true);
testQuery("SELECT ContentStreamUri FROM Document WHERE ANY ContentStreamUri NOT IN ('test')", 10, false, "ContentStreamUri", new String(), true);
}
public void test_CONTENT_STREAM_FILENAME()
{
testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename = 'Alfresco Tutorial'", 1, false, "ContentStreamFilename", new String(), false);