diff --git a/config/alfresco/cmis-api-context.xml b/config/alfresco/cmis-api-context.xml
index 9343db2a6f..0c98ddb3b6 100644
--- a/config/alfresco/cmis-api-context.xml
+++ b/config/alfresco/cmis-api-context.xml
@@ -12,15 +12,15 @@
-
+
-
-
-
-
- false
+
+
+
+
+
@@ -56,9 +56,6 @@
-
-
-
diff --git a/source/java/org/alfresco/cmis/CMISPropertyTypeEnum.java b/source/java/org/alfresco/cmis/CMISDataTypeEnum.java
similarity index 85%
rename from source/java/org/alfresco/cmis/CMISPropertyTypeEnum.java
rename to source/java/org/alfresco/cmis/CMISDataTypeEnum.java
index 3d12d0483d..5ac924c2d5 100644
--- a/source/java/org/alfresco/cmis/CMISPropertyTypeEnum.java
+++ b/source/java/org/alfresco/cmis/CMISDataTypeEnum.java
@@ -29,7 +29,7 @@ package org.alfresco.cmis;
*
* @author andyh
*/
-public enum CMISPropertyTypeEnum implements EnumLabel
+public enum CMISDataTypeEnum implements EnumLabel
{
STRING("string"),
DECIMAL("decimal"),
@@ -49,7 +49,7 @@ public enum CMISPropertyTypeEnum implements EnumLabel
*
* @param label
*/
- CMISPropertyTypeEnum(String label)
+ CMISDataTypeEnum(String label)
{
this.label = label;
}
@@ -62,5 +62,5 @@ public enum CMISPropertyTypeEnum implements EnumLabel
return label;
}
- public static EnumFactory FACTORY = new EnumFactory(CMISPropertyTypeEnum.class, null, true);
+ public static EnumFactory FACTORY = new EnumFactory(CMISDataTypeEnum.class, null, true);
}
diff --git a/source/java/org/alfresco/cmis/dictionary/AbstractCMISDictionaryService.java b/source/java/org/alfresco/cmis/dictionary/AbstractCMISDictionaryService.java
new file mode 100644
index 0000000000..ac1f05eca4
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/AbstractCMISDictionaryService.java
@@ -0,0 +1,381 @@
+/*
+ * Copyright (C) 2005-2009 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.dictionary;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.alfresco.cmis.CMISDataTypeEnum;
+import org.alfresco.repo.dictionary.DictionaryDAO;
+import org.alfresco.repo.dictionary.DictionaryListener;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.util.AbstractLifecycleBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.ApplicationEvent;
+
+
+/**
+ * Common CMIS Dictionary Support including registry of Types.
+ *
+ * @author davidc
+ */
+public abstract class AbstractCMISDictionaryService extends AbstractLifecycleBean implements CMISDictionaryService, DictionaryListener
+{
+ // Logger
+ protected static final Log logger = LogFactory.getLog(AbstractCMISDictionaryService.class);
+
+ // service dependencies
+ private DictionaryDAO dictionaryDAO;
+ protected CMISMapping cmisMapping;
+ protected DictionaryService dictionaryService;
+
+ /**
+ * Set the mapping service
+ *
+ * @param cmisMapping
+ */
+ public void setCMISMapping(CMISMapping cmisMapping)
+ {
+ this.cmisMapping = cmisMapping;
+ }
+
+ /**
+ * Set the dictionary Service
+ *
+ * @param dictionaryService
+ */
+ public void setDictionaryService(DictionaryService dictionaryService)
+ {
+ this.dictionaryService = dictionaryService;
+ }
+
+ /**
+ * Set the dictionary DAO
+ *
+ * @param dictionaryDAO
+ */
+ public void setDictionaryDAO(DictionaryDAO dictionaryDAO)
+ {
+ this.dictionaryDAO = dictionaryDAO;
+ }
+
+
+ // TODO: Handle tenants
+ // TODO: read / write locks
+ private DictionaryRegistry registry;
+
+
+ /**
+ * CMIS Dictionary registry
+ *
+ * Index of CMIS Type Definitions
+ */
+ /*package*/ class DictionaryRegistry
+ {
+ // Type Definitions Index
+ Map typeDefsByQName = new HashMap();
+ Map assocDefsByQName = new HashMap();
+ Map objectDefsByTypeId = new HashMap();
+ Map typeDefsByTypeId = new HashMap();
+ Map typeDefsByTable = new HashMap();
+
+ // Property Definitions Index
+ Map propDefsByName = new HashMap();
+ Map propDefsByQName = new HashMap();
+ Map propDefsByPropId = new HashMap();
+
+ /**
+ * Register Type Definition
+ *
+ * @param typeDefinition
+ */
+ public void registerTypeDefinition(CMISObjectTypeDefinition typeDefinition)
+ {
+ QName typeQName = typeDefinition.getTypeId().getQName();
+ if (typeQName != null)
+ {
+ if (typeDefinition instanceof CMISRelationshipTypeDefinition)
+ {
+ assocDefsByQName.put(typeQName, typeDefinition);
+ }
+ else
+ {
+ typeDefsByQName.put(typeQName, typeDefinition);
+ }
+ }
+ objectDefsByTypeId.put(typeDefinition.getTypeId(), typeDefinition);
+ typeDefsByTypeId.put(typeDefinition.getTypeId(), typeDefinition);
+ typeDefsByTable.put(typeDefinition.getQueryName().toLowerCase(), typeDefinition);
+ }
+
+ /**
+ * Registry Property Definition
+ *
+ * @param propDef
+ */
+ public void registerPropertyDefinition(CMISPropertyDefinition propDef)
+ {
+ propDefsByPropId.put(propDef.getPropertyId(), propDef);
+ propDefsByQName.put(propDef.getPropertyId().getQName(), propDef);
+ propDefsByName.put(propDef.getPropertyId().getName().toLowerCase(), propDef);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("DictionaryRegistry[");
+ builder.append("Types=").append(typeDefsByTypeId.size()).append(", ");
+ builder.append("Properties=").append(propDefsByPropId.size());
+ builder.append("]");
+ return builder.toString();
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getTypeId(java.lang.String)
+ */
+ public CMISTypeId getTypeId(String typeId)
+ {
+ return cmisMapping.getCmisTypeId(typeId);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getTypeId(org.alfresco.service.namespace.QName, org.alfresco.cmis.dictionary.CMISScope)
+ */
+ public CMISTypeId getTypeId(QName clazz, CMISScope matchingScope)
+ {
+ CMISTypeDefinition typeDef = null;
+ if (matchingScope != null && matchingScope == CMISScope.RELATIONSHIP)
+ {
+ typeDef = registry.assocDefsByQName.get(clazz);
+ }
+ else
+ {
+ typeDef = registry.typeDefsByQName.get(clazz);
+ }
+
+ CMISTypeDefinition matchingTypeDef = null;
+ if (matchingScope == null)
+ {
+ matchingTypeDef = typeDef;
+ }
+ else
+ {
+ if (typeDef != null && typeDef.getTypeId().getScope() == matchingScope)
+ {
+ matchingTypeDef = typeDef;
+ }
+ }
+ return matchingTypeDef == null ? null : matchingTypeDef.getTypeId();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getTypeIdFromTable(java.lang.String)
+ */
+ public CMISTypeId getTypeIdFromTable(String table)
+ {
+ CMISTypeDefinition typeDef = registry.typeDefsByTable.get(table.toLowerCase());
+ return (typeDef == null) ? null : typeDef.getTypeId();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getType(org.alfresco.cmis.dictionary.CMISTypeId)
+ */
+ public CMISTypeDefinition getType(CMISTypeId typeId)
+ {
+ return registry.objectDefsByTypeId.get(typeId);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getAllTypes()
+ */
+ public Collection getAllTypes()
+ {
+ return Collections.unmodifiableCollection(registry.typeDefsByTypeId.values());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getProperty(org.alfresco.cmis.dictionary.CMISPropertyId)
+ */
+ public CMISPropertyDefinition getProperty(CMISPropertyId propertyId)
+ {
+ return registry.propDefsByPropId.get(propertyId);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getPropertyId(java.lang.String)
+ */
+ public CMISPropertyId getPropertyId(String property)
+ {
+ CMISPropertyDefinition propDef = registry.propDefsByName.get(property.toLowerCase());
+ return (propDef == null) ? null : propDef.getPropertyId();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getPropertyId(org.alfresco.service.namespace.QName)
+ */
+ public CMISPropertyId getPropertyId(QName property)
+ {
+ CMISPropertyDefinition propDef = registry.propDefsByQName.get(property);
+ return (propDef == null) ? null : propDef.getPropertyId();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISDictionaryService#getDataType(org.alfresco.service.namespace.QName)
+ */
+ public CMISDataTypeEnum getDataType(QName dataType)
+ {
+ return cmisMapping.getDataType(dataType);
+ }
+
+
+ /**
+ * Factory for creating CMIS Definitions
+ *
+ * @param registry
+ */
+ abstract protected void createDefinitions(DictionaryRegistry registry);
+
+
+ /**
+ * Dictionary Initialisation - creates a new registry
+ */
+ private void init()
+ {
+ DictionaryRegistry registry = new DictionaryRegistry();
+
+ // phase 1: construct type definitions
+ createDefinitions(registry);
+ for (CMISObjectTypeDefinition objectTypeDef : registry.objectDefsByTypeId.values())
+ {
+ Map propDefs = objectTypeDef.createProperties(cmisMapping, dictionaryService);
+ for (CMISPropertyDefinition propDef : propDefs.values())
+ {
+ registry.registerPropertyDefinition(propDef);
+ }
+ objectTypeDef.createSubTypes(cmisMapping, dictionaryService);
+ }
+
+ // phase 2: link together
+ for (CMISObjectTypeDefinition objectTypeDef : registry.objectDefsByTypeId.values())
+ {
+ objectTypeDef.resolveDependencies(registry);
+ }
+
+ // phase 3: resolve inheritance
+ Map> order = new TreeMap>();
+ for (CMISObjectTypeDefinition typeDef : registry.objectDefsByTypeId.values())
+ {
+ // calculate class depth in hierarchy
+ int depth = 0;
+ CMISTypeDefinition parent = typeDef.getParentType();
+ while (parent != null)
+ {
+ depth = depth +1;
+ parent = parent.getParentType();
+ }
+
+ // map class to depth
+ List classes = order.get(depth);
+ if (classes == null)
+ {
+ classes = new ArrayList();
+ order.put(depth, classes);
+ }
+ classes.add(typeDef);
+ }
+ for (int depth = 0; depth < order.size(); depth++)
+ {
+ for (CMISObjectTypeDefinition typeDef : order.get(depth))
+ {
+ typeDef.resolveInheritance(registry);
+ }
+ }
+
+ // publish new registry
+ this.registry = registry;
+
+ if (logger.isDebugEnabled())
+ logger.debug("Initialized CMIS Dictionary. Types:" + registry.typeDefsByTypeId.size() + ", Properties:" + registry.propDefsByPropId.size());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.repo.dictionary.DictionaryListener#onInit()
+ */
+ public void onDictionaryInit()
+ {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.repo.dictionary.DictionaryListener#afterInit()
+ */
+ public void afterDictionaryInit()
+ {
+ init();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent)
+ */
+ protected void onBootstrap(ApplicationEvent event)
+ {
+ afterDictionaryInit();
+ dictionaryDAO.register(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent)
+ */
+ protected void onShutdown(ApplicationEvent event)
+ {
+ }
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/BaseCMISTest.java b/source/java/org/alfresco/cmis/dictionary/BaseCMISTest.java
index 174b1d0faf..70e016705c 100644
--- a/source/java/org/alfresco/cmis/dictionary/BaseCMISTest.java
+++ b/source/java/org/alfresco/cmis/dictionary/BaseCMISTest.java
@@ -65,7 +65,7 @@ public abstract class BaseCMISTest extends TestCase
protected CMISMapping cmisMapping;
protected CMISDictionaryService cmisDictionaryService;
-
+
protected DictionaryService dictionaryService;
protected TransactionService transactionService;
@@ -103,7 +103,7 @@ public abstract class BaseCMISTest extends TestCase
serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
cmisDictionaryService = (CMISDictionaryService) ctx.getBean("CMISDictionaryService");
- cmisMapping = cmisDictionaryService.getCMISMapping();
+ cmisMapping = (CMISMapping) ctx.getBean("CMISMapping");
cmisPropertyService = (CMISPropertyService) ctx.getBean("CMISPropertyService");
cmisQueryService = (CMISQueryService) ctx.getBean("CMISQueryService");
cmisService = (CMISService) ctx.getBean("CMISService");
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISDictionaryModel.java b/source/java/org/alfresco/cmis/dictionary/CMISDictionaryModel.java
new file mode 100644
index 0000000000..8d539de0b0
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/CMISDictionaryModel.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2005-2009 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.dictionary;
+
+import org.alfresco.model.ContentModel;
+
+/**
+ * CMIS <-> Alfresco mappings
+ *
+ * @author andyh
+ */
+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 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";
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISDictionaryService.java b/source/java/org/alfresco/cmis/dictionary/CMISDictionaryService.java
index d513623e11..498cf90500 100644
--- a/source/java/org/alfresco/cmis/dictionary/CMISDictionaryService.java
+++ b/source/java/org/alfresco/cmis/dictionary/CMISDictionaryService.java
@@ -25,371 +25,97 @@
package org.alfresco.cmis.dictionary;
import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import org.alfresco.service.cmr.dictionary.AspectDefinition;
-import org.alfresco.service.cmr.dictionary.AssociationDefinition;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.cmr.dictionary.TypeDefinition;
+import org.alfresco.cmis.CMISDataTypeEnum;
import org.alfresco.service.namespace.QName;
/**
* Service to query the CMIS meta model
*
- * @author andyh
+ * @author davidc
*/
-public class CMISDictionaryService
+public interface CMISDictionaryService
{
- private CMISMapping cmisMapping;
-
- private DictionaryService dictionaryService;
-
- private boolean strict = true;
-
/**
- * Set the mapping service
- *
- * @param cmisMapping
- */
- public void setCMISMapping(CMISMapping cmisMapping)
- {
- this.cmisMapping = cmisMapping;
- }
-
- /**
- * @return cmis mapping service
- */
- public CMISMapping getCMISMapping()
- {
- return cmisMapping;
- }
-
- /**
- * Set the dictionary Service
- *
- * @param dictionaryService
- */
- public void setDictionaryService(DictionaryService dictionaryService)
- {
- this.dictionaryService = dictionaryService;
- }
-
- /**
- * Gets the dictionary service
- *
- * @return dictionaryService
- */
- /* package */DictionaryService getDictionaryService()
- {
- return this.dictionaryService;
- }
-
- /**
- * Is the service strict (CMIS types only)
- *
- * @return
- */
- public boolean isStrict()
- {
- return strict;
- }
-
- /**
- * Set strict mode. In strict mode only CMIS types and properties are returned
- *
- * @param strict
- */
- public void setStrict(boolean strict)
- {
- this.strict = strict;
- }
-
- /**
- * Get the all the object types ids TODO: Note there can be name collisions between types and associations. e.g.
- * app:configurations
- *
- * @return
- */
- public Collection getAllObjectTypeIds()
- {
- Collection alfrescoTypeQNames;
- Collection alfrescoAssociationQNames;
-
- if (strict)
- {
- alfrescoTypeQNames = dictionaryService.getTypes(CMISMapping.CMIS_MODEL_QNAME);
- alfrescoAssociationQNames = dictionaryService.getAssociations(CMISMapping.CMIS_MODEL_QNAME);
- }
- else
- {
- alfrescoTypeQNames = dictionaryService.getAllTypes();
- alfrescoAssociationQNames = dictionaryService.getAllAssociations();
- }
-
- Collection answer = new HashSet(alfrescoTypeQNames.size() + alfrescoAssociationQNames.size());
-
- for (QName typeQName : alfrescoTypeQNames)
- {
- if (cmisMapping.isValidCmisDocument(typeQName))
- {
- answer.add(cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, typeQName));
- }
- else if (cmisMapping.isValidCmisFolder(typeQName))
- {
- answer.add(cmisMapping.getCmisTypeId(CMISScope.FOLDER, typeQName));
- }
- else if (typeQName.equals(CMISMapping.RELATIONSHIP_QNAME))
- {
- answer.add(cmisMapping.getCmisTypeId(CMISScope.RELATIONSHIP, typeQName));
- }
- // TODO: Policy
- // For now, policies are not reported
- }
-
- for (QName associationName : alfrescoAssociationQNames)
- {
- if (cmisMapping.isValidCmisRelationship(associationName))
- {
- answer.add(cmisMapping.getCmisTypeId(CMISScope.RELATIONSHIP, associationName));
- }
- }
-
- return answer;
- }
-
- /**
- * Gets all the object type ids within a type hierarchy
- *
- * @param typeId
- * @param descendants
- * true => include all descendants, false => children only
- * @return
- */
- public Collection getChildTypeIds(CMISTypeId typeId, boolean descendants)
- {
- switch (typeId.getScope())
- {
- case RELATIONSHIP:
- if (typeId.equals(CMISMapping.RELATIONSHIP_TYPE_ID))
- {
- // all associations are sub-type of RELATIONSHIP_OBJECT_TYPE
- // NOTE: ignore descendants
- Collection alfrescoAssociationQNames = dictionaryService.getAllAssociations();
- Collection types = new HashSet(alfrescoAssociationQNames.size());
- for (QName associationName : alfrescoAssociationQNames)
- {
- if (cmisMapping.isValidCmisRelationship(associationName))
- {
- types.add(cmisMapping.getCmisTypeId(CMISScope.RELATIONSHIP, associationName));
- }
- }
- return types;
- }
- else
- {
- return Collections.emptySet();
- }
- case DOCUMENT:
- case FOLDER:
- TypeDefinition typeDefinition = dictionaryService.getType(typeId.getQName());
- if (typeDefinition != null)
- {
- if (cmisMapping.isValidCmisType(typeId.getQName()))
- {
- QName alfrescoQName = cmisMapping.getAlfrescoType(typeId.getQName());
- Collection alfrescoTypeQNames = dictionaryService.getSubTypes(alfrescoQName, descendants);
- Collection types = new HashSet(alfrescoTypeQNames.size());
- for (QName typeQName : alfrescoTypeQNames)
- {
- CMISTypeId subTypeId = cmisMapping.getCmisTypeId(typeQName);
- if (typeId != null)
- {
- types.add(subTypeId);
- }
- }
- return types;
- }
- else
- {
- return Collections.emptySet();
- }
- }
- else
- {
- return Collections.emptySet();
- }
- case POLICY:
- // TODO: Policy
- default:
- return Collections.emptySet();
- }
- }
-
- /**
- * Get the object type definition TODO: Note there can be name collisions between types and associations. e.g.
- * app:configurations Currently clashing types will give inconsistent behaviour
+ * Get Type Id
*
* @param typeId
* @return
*/
- public CMISTypeDefinition getType(CMISTypeId typeId)
- {
- switch (typeId.getScope())
- {
- case RELATIONSHIP:
- // Associations
- if (cmisMapping.isValidCmisRelationship(typeId.getQName()))
- {
- return new CMISTypeDefinition(this, typeId);
- }
- else
- {
- return null;
- }
- case DOCUMENT:
- case FOLDER:
- TypeDefinition typeDefinition = dictionaryService.getType(typeId.getQName());
- if (typeDefinition != null)
- {
- if (cmisMapping.isValidCmisType(typeId.getQName()))
- {
- return new CMISTypeDefinition(this, typeId);
- }
- else
- {
- return null;
- }
- }
- else
- {
- return null;
- }
- case POLICY:
- // TODO: Policy
- default:
- return null;
- }
- }
+ public CMISTypeId getTypeId(String typeId);
+
+ /**
+ * Get Type Id from Table Name
+ *
+ * @param table
+ * @return
+ */
+ public CMISTypeId getTypeIdFromTable(String table);
+
+ /**
+ * Get Type Id from Alfresco Class Name
+ *
+ * @param clazz
+ * @param matchingScope if provided, only return type id matching scope
+ * @return
+ */
+ public CMISTypeId getTypeId(QName clazz, CMISScope matchingScope);
/**
- * Get all the property definitions for a type
+ * Get Type Definition
*
* @param typeId
* @return
*/
- public Map getPropertyDefinitions(CMISTypeId typeId)
- {
- HashMap properties = new HashMap();
-
- switch (typeId.getScope())
- {
- case RELATIONSHIP:
- // Associations - only have CMIS properties
- AssociationDefinition associationDefinition = dictionaryService.getAssociation(typeId.getQName());
- if (associationDefinition != null)
- {
- if (cmisMapping.isValidCmisRelationship(typeId.getQName()))
- {
- return getPropertyDefinitions(CMISMapping.RELATIONSHIP_TYPE_ID);
- }
- break;
- }
-
- if (!typeId.getQName().equals(CMISMapping.RELATIONSHIP_QNAME))
- {
- break;
- }
- // Fall through for CMISMapping.RELATIONSHIP_QNAME
- case DOCUMENT:
- case FOLDER:
- TypeDefinition typeDefinition = dictionaryService.getType(typeId.getQName());
- if (typeDefinition != null)
- {
- if (cmisMapping.isValidCmisDocumentOrFolder(typeId.getQName()) || typeId.getQName().equals(CMISMapping.RELATIONSHIP_QNAME))
- {
- for (QName qname : typeDefinition.getProperties().keySet())
- {
- if (cmisMapping.getPropertyType(qname) != null)
- {
- CMISPropertyDefinition cmisPropDefinition = new CMISPropertyDefinition(this, qname, typeDefinition.getName());
- properties.put(cmisPropDefinition.getPropertyName(), cmisPropDefinition);
- }
- }
- for (AspectDefinition aspect : typeDefinition.getDefaultAspects())
- {
- for (QName qname : aspect.getProperties().keySet())
- {
- if (cmisMapping.getPropertyType(qname) != null)
- {
- CMISPropertyDefinition cmisPropDefinition = new CMISPropertyDefinition(this, qname, typeDefinition.getName());
- properties.put(cmisPropDefinition.getPropertyName(), cmisPropDefinition);
- }
- }
- }
- }
- if (cmisMapping.isValidCmisDocumentOrFolder(typeId.getQName()))
- {
- // Add CMIS properties if required
- if (!cmisMapping.isCmisCoreType(typeId.getQName()))
- {
- properties.putAll(getPropertyDefinitions(typeId.getRootTypeId()));
- }
- }
- }
- break;
- case POLICY:
- AspectDefinition aspectDefinition = dictionaryService.getAspect(typeId.getQName());
- if (aspectDefinition != null)
- {
-
- for (QName qname : aspectDefinition.getProperties().keySet())
- {
- if (cmisMapping.getPropertyType(qname) != null)
- {
- CMISPropertyDefinition cmisPropDefinition = new CMISPropertyDefinition(this, qname, aspectDefinition.getName());
- properties.put(cmisPropDefinition.getPropertyName(), cmisPropDefinition);
- }
- }
- for (AspectDefinition aspect : aspectDefinition.getDefaultAspects())
- {
- for (QName qname : aspect.getProperties().keySet())
- {
- if (cmisMapping.getPropertyType(qname) != null)
- {
- CMISPropertyDefinition cmisPropDefinition = new CMISPropertyDefinition(this, qname, aspectDefinition.getName());
- properties.put(cmisPropDefinition.getPropertyName(), cmisPropDefinition);
- }
- }
- }
-
- // Add CMIS properties if required
- if (!cmisMapping.isCmisCoreType(typeId.getQName()))
- {
- properties.putAll(getPropertyDefinitions(typeId.getRootTypeId()));
- }
-
- }
- break;
- case UNKNOWN:
- default:
- break;
- }
-
- return properties;
- }
-
+ public CMISTypeDefinition getType(CMISTypeId typeId);
+
/**
- * Get a single property definition
+ * Get All Type Definitions
*
- * @param typeId
- * @param propertyName
* @return
*/
- public CMISPropertyDefinition getPropertyDefinition(CMISTypeId typeId, String propertyName)
- {
- return getPropertyDefinitions(typeId).get(propertyName);
- }
+ public Collection getAllTypes();
+
+ /**
+ * Get Property Id for Alfresco property name
+ *
+ * @param property
+ * @return
+ */
+ public CMISPropertyId getPropertyId(QName property);
+
+ /**
+ * Get Property Id
+ *
+ * @param propertyId
+ * @return
+ */
+ public CMISPropertyId getPropertyId(String propertyId);
+
+ /**
+ * Get Property
+ *
+ * @param propertyId
+ * @return
+ */
+ public CMISPropertyDefinition getProperty(CMISPropertyId propertyId);
+
+ /**
+ * Get Data Type
+ *
+ * @param dataType
+ * @return
+ */
+ public CMISDataTypeEnum getDataType(QName dataType);
+
+
+ // public CMISTypeDef findType(CMISTypeId typeId)
+ // public CMISTypeDef findType(String typeId)
+ // public CMISTypeDef findTypeForClass(QName clazz, CMISScope matchingScope, ...)
+ // public CMISTypeDef findTypeForTable(String tableName)
+ // public CMISTypeDef getAllTypes();
+ // public CMISPropertyDefinition getProperty(QName property)
+ // public CMISPropertyDefinition getProperty(CMISTypeDef typeDef, String property)
+ // public CMISDataTypeEnum getDataType(QName dataType)
+
}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISDictionaryTest.java b/source/java/org/alfresco/cmis/dictionary/CMISDictionaryTest.java
index 40d8fd0954..7a3098be31 100644
--- a/source/java/org/alfresco/cmis/dictionary/CMISDictionaryTest.java
+++ b/source/java/org/alfresco/cmis/dictionary/CMISDictionaryTest.java
@@ -28,99 +28,48 @@ public class CMISDictionaryTest extends BaseCMISTest
{
public void testBasicTypes()
{
- cmisDictionaryService.setStrict(true);
- for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
+ for (CMISTypeDefinition type : cmisDictionaryService.getAllTypes())
{
- System.out.println(name);
+ System.out.println(type);
}
- assertEquals(3, cmisDictionaryService.getAllObjectTypeIds().size());
}
- public void testBasicTypeDefinitions()
- {
- cmisDictionaryService.setStrict(false);
- for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
- {
- System.out.println(cmisDictionaryService.getType(name));
- }
- }
-
public void testSubTypes()
{
- cmisDictionaryService.setStrict(true);
- for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
+ for (CMISTypeDefinition type : cmisDictionaryService.getAllTypes())
{
- System.out.println(name + " children (strict)");
- for (CMISTypeId subName :cmisDictionaryService.getChildTypeIds(name, false))
+ System.out.println(type.getTypeId() + " children:");
+ for (CMISTypeDefinition subType : type.getSubTypes(false))
{
- System.out.println(" " + subName);
+ System.out.println(" " + subType.getTypeId());
}
- System.out.println(name + " descendants (strict)");
- for (CMISTypeId subName :cmisDictionaryService.getChildTypeIds(name, true))
+ System.out.println(type.getTypeId() + " descendants:");
+ for (CMISTypeDefinition subType : type.getSubTypes(true))
{
- System.out.println(" " + subName);
- }
- }
- cmisDictionaryService.setStrict(false);
- for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
- {
- System.out.println(name + " children");
- for (CMISTypeId subName :cmisDictionaryService.getChildTypeIds(name, false))
- {
- System.out.println(" " + subName);
- }
- System.out.println(name + " descendants");
- for (CMISTypeId subName :cmisDictionaryService.getChildTypeIds(name, true))
- {
- System.out.println(" " + subName);
+ System.out.println(" " + subType.getTypeId());
}
}
}
public void testTypeIds()
{
- cmisDictionaryService.setStrict(false);
- for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
+ for (CMISTypeDefinition typeDef : cmisDictionaryService.getAllTypes())
{
- String typeId = name.getTypeId();
- CMISTypeId lookup = cmisMapping.getCmisTypeId(typeId);
- assertEquals(name, lookup);
- System.out.println(name + " => " + lookup);
- CMISTypeDefinition type = cmisDictionaryService.getType(lookup);
- assertNotNull(type);
- assertEquals(lookup, type.getObjectTypeId());
+ CMISTypeId typeId = typeDef.getTypeId();
+ CMISTypeDefinition typeDefLookup = cmisDictionaryService.getType(typeId);
+ assertNotNull(typeDefLookup);
+ assertEquals(typeDef, typeDefLookup);
}
}
- public void testBasicProperties()
- {
- cmisDictionaryService.setStrict(false);
- for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
- {
- for (String propertyName : cmisDictionaryService.getPropertyDefinitions(name).keySet())
- {
- System.out.println(name +" -> "+ propertyName);
- }
- }
- }
-
public void testBasicPropertyDefinitions()
{
- cmisDictionaryService.setStrict(true);
- for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
+ for (CMISTypeDefinition type : cmisDictionaryService.getAllTypes())
{
- for (CMISPropertyDefinition proDef : cmisDictionaryService.getPropertyDefinitions(name).values())
+ System.out.println(type.getTypeId() + " properties:");
+ for (CMISPropertyDefinition proDef : type.getPropertyDefinitions().values())
{
- System.out.println(proDef);
- }
- }
-
- cmisDictionaryService.setStrict(false);
- for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
- {
- for (CMISPropertyDefinition proDef : cmisDictionaryService.getPropertyDefinitions(name).values())
- {
- System.out.println(proDef);
+ System.out.println(" " + proDef);
}
}
}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISDocumentTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISDocumentTypeDefinition.java
new file mode 100644
index 0000000000..743f66b794
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/CMISDocumentTypeDefinition.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2005-20079 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.dictionary;
+
+import java.util.List;
+
+import org.alfresco.cmis.CMISContentStreamAllowedEnum;
+import org.alfresco.model.ContentModel;
+import org.alfresco.service.cmr.dictionary.AspectDefinition;
+import org.alfresco.service.cmr.dictionary.ClassDefinition;
+import org.alfresco.service.namespace.QName;
+
+
+/**
+ * CMIS Document Type Definition
+ *
+ * @author davidc
+ */
+public class CMISDocumentTypeDefinition extends CMISObjectTypeDefinition
+{
+ private static final long serialVersionUID = -7209732754962781522L;
+
+ // document specific properties
+ protected boolean fileable;
+ protected boolean versionable;
+ protected CMISContentStreamAllowedEnum contentStreamAllowed;
+
+
+ /**
+ * Construct
+ *
+ * @param cmisMapping
+ * @param typeId
+ * @param cmisClassDef
+ */
+ public CMISDocumentTypeDefinition(CMISMapping cmisMapping, CMISTypeId typeId, ClassDefinition cmisClassDef)
+ {
+ // Object type properties
+ this.cmisClassDef = cmisClassDef;
+ objectTypeId = typeId;
+ objectTypeQueryName = (typeId == CMISDictionaryModel.DOCUMENT_TYPE_ID) ? typeId.getId() : cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
+ displayName = (cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId.getId();
+ QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName());
+ if (cmisMapping.isValidCmisDocument(parentQName))
+ {
+ parentTypeId = cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, parentQName);
+ }
+ description = cmisClassDef.getDescription();
+ creatable = true;
+ queryable = true;
+ controllable = false;
+ includeInSuperTypeQuery = true;
+
+ // Document type properties
+ versionable = false;
+ List defaultAspects = cmisClassDef.getDefaultAspects();
+ for (AspectDefinition aspectDefinition : defaultAspects)
+ {
+ if (aspectDefinition.getName().equals(ContentModel.ASPECT_VERSIONABLE))
+ {
+ versionable = true;
+ break;
+ }
+ }
+ fileable = true;
+ contentStreamAllowed = CMISContentStreamAllowedEnum.ALLOWED;
+ }
+
+ /**
+ * Are objects of this type fileable?
+ *
+ * @return
+ */
+ public boolean isFileable()
+ {
+ return fileable;
+ }
+
+ /**
+ * Is this type versionable? If true this implies all instances of the type are versionable.
+ *
+ * @return true if versionable
+ */
+ public boolean isVersionable()
+ {
+ return versionable;
+ }
+
+ /**
+ * Is a content stream allowed for this type? It may be disallowed, optional or mandatory.
+ *
+ * @return
+ */
+ public CMISContentStreamAllowedEnum getContentStreamAllowed()
+ {
+ return contentStreamAllowed;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ 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 ? "" : 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("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
+ builder.append("Fileable=").append(isFileable()).append(", ");
+ builder.append("Versionable=").append(isVersionable()).append(", ");
+ builder.append("ContentStreamAllowed=").append(getContentStreamAllowed()).append(", ");
+ builder.append("SubTypes=").append(getSubTypes(false).size()).append(", ");
+ builder.append("Properties=").append(getPropertyDefinitions().size());
+ builder.append("]");
+ return builder.toString();
+ }
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISFolderTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISFolderTypeDefinition.java
new file mode 100644
index 0000000000..80eced65e1
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/CMISFolderTypeDefinition.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2005-2009 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.dictionary;
+
+import org.alfresco.service.cmr.dictionary.ClassDefinition;
+import org.alfresco.service.namespace.QName;
+
+
+/**
+ * CMIS Folder Type Definition
+ *
+ * @author davidc
+ */
+public class CMISFolderTypeDefinition extends CMISObjectTypeDefinition
+{
+ private static final long serialVersionUID = 7526155195125799106L;
+
+ /**
+ * Construct
+ * @param cmisMapping
+ * @param typeId
+ * @param cmisClassDef
+ */
+ public CMISFolderTypeDefinition(CMISMapping cmisMapping, CMISTypeId typeId, ClassDefinition cmisClassDef)
+ {
+ // Object type properties
+ this.cmisClassDef = cmisClassDef;
+ objectTypeId = typeId;
+ objectTypeQueryName = (typeId == CMISDictionaryModel.FOLDER_TYPE_ID) ? typeId.getId() : cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
+ displayName = (cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId.getId();
+ QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName());
+ if (cmisMapping.isValidCmisFolder(parentQName))
+ {
+ parentTypeId = cmisMapping.getCmisTypeId(CMISScope.FOLDER, parentQName);
+ }
+ description = cmisClassDef.getDescription();
+ creatable = true;
+ queryable = true;
+ controllable = false;
+ includeInSuperTypeQuery = true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ 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 ? "" : 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("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
+ builder.append("SubTypes=").append(getSubTypes(false).size()).append(", ");
+ builder.append("Properties=").append(getPropertyDefinitions().size());
+ builder.append("]");
+ return builder.toString();
+ }
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISMapping.java b/source/java/org/alfresco/cmis/dictionary/CMISMapping.java
index bceda6ce79..740a3231de 100644
--- a/source/java/org/alfresco/cmis/dictionary/CMISMapping.java
+++ b/source/java/org/alfresco/cmis/dictionary/CMISMapping.java
@@ -27,14 +27,13 @@ package org.alfresco.cmis.dictionary;
import java.util.Collection;
import java.util.HashMap;
-import org.alfresco.cmis.CMISPropertyTypeEnum;
+import org.alfresco.cmis.CMISDataTypeEnum;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
+import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.namespace.NamespaceException;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
@@ -61,143 +60,40 @@ public class CMISMapping
*/
public static QName CMIS_MODEL_QNAME = QName.createQName(CMIS_MODEL_URI, CMIS_MODEL_NAME);
- /**
- * The QNames for CMIS Data Types.
- */
+
+ // 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");
public static QName CMIS_DATATYPE_XML = QName.createQName(CMIS_MODEL_URI, "xml");
public static QName CMIS_DATATYPE_HTML = QName.createQName(CMIS_MODEL_URI, "html");
- /**
- * Type id for CMIS documents, from the spec.
- */
- public static String DOCUMENT_OBJECT_TYPE = "Document";
+ // CMIS Types
+ 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);
- /**
- * 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";
-
- /**
- * QName for CMIS documents in the Alfresco CMIS model.
- */
- public static QName DOCUMENT_QNAME = QName.createQName(CMIS_MODEL_URI, DOCUMENT_OBJECT_TYPE);
-
- /**
- * QName for CMIS folders in the Alfresco CMIS model
- */
- public static QName FOLDER_QNAME = QName.createQName(CMIS_MODEL_URI, FOLDER_OBJECT_TYPE);
-
- /**
- * QName for CMIS relationships in the the Alfresco CMIS model.
- */
- public static QName RELATIONSHIP_QNAME = QName.createQName(CMIS_MODEL_URI, RELATIONSHIP_OBJECT_TYPE);
-
- public static QName POLICY_QNAME = QName.createQName(CMIS_MODEL_URI, POLICY_OBJECT_TYPE);
-
- // 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_QNAME, DOCUMENT_OBJECT_TYPE.toLowerCase());
-
- public static CMISTypeId FOLDER_TYPE_ID = new CMISTypeId(CMISScope.FOLDER, FOLDER_QNAME, FOLDER_OBJECT_TYPE.toLowerCase());
-
- public static CMISTypeId RELATIONSHIP_TYPE_ID = new CMISTypeId(CMISScope.RELATIONSHIP, RELATIONSHIP_QNAME, RELATIONSHIP_OBJECT_TYPE.toLowerCase());
-
- public static CMISTypeId POLICY_TYPE_ID = new CMISTypeId(CMISScope.POLICY, POLICY_QNAME, POLICY_OBJECT_TYPE.toLowerCase());
-
- // 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";
-
- // QNames
-
- public static QName PROP_OBJECT_ID_QNAME = QName.createQName(CMIS_MODEL_URI, PROP_OBJECT_ID);
+ // Properties
+ public static QName PROP_OBJECT_ID_QNAME = QName.createQName(CMIS_MODEL_URI, CMISDictionaryModel.PROP_OBJECT_ID);
// Mappings
// - no entry means no mapping and pass through as is
private static HashMap qNameToCmisTypeId = new HashMap();
-
private static HashMap cmisToAlfrecsoTypes = new HashMap();
-
private static HashMap alfrescoToCmisTypes = new HashMap();
+ private static HashMap alfrescoPropertyTypesToCmisPropertyTypes = new HashMap();
- private static HashMap alfrescoPropertyTypesToCmisPropertyTypes = new HashMap();
-
+
/**
* Set up mappings
*/
static
{
- qNameToCmisTypeId.put(DOCUMENT_QNAME, DOCUMENT_TYPE_ID);
- qNameToCmisTypeId.put(FOLDER_QNAME, FOLDER_TYPE_ID);
- qNameToCmisTypeId.put(RELATIONSHIP_QNAME, RELATIONSHIP_TYPE_ID);
- qNameToCmisTypeId.put(POLICY_QNAME, POLICY_TYPE_ID);
+ qNameToCmisTypeId.put(DOCUMENT_QNAME, CMISDictionaryModel.DOCUMENT_TYPE_ID);
+ qNameToCmisTypeId.put(FOLDER_QNAME, CMISDictionaryModel.FOLDER_TYPE_ID);
+ qNameToCmisTypeId.put(RELATIONSHIP_QNAME, CMISDictionaryModel.RELATIONSHIP_TYPE_ID);
+ qNameToCmisTypeId.put(POLICY_QNAME, CMISDictionaryModel.POLICY_TYPE_ID);
cmisToAlfrecsoTypes.put(DOCUMENT_QNAME, ContentModel.TYPE_CONTENT);
cmisToAlfrecsoTypes.put(FOLDER_QNAME, ContentModel.TYPE_FOLDER);
@@ -209,30 +105,29 @@ public class CMISMapping
alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.ANY, null);
alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.ASSOC_REF, null);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.BOOLEAN, CMISPropertyTypeEnum.BOOLEAN);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.CATEGORY, CMISPropertyTypeEnum.ID);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.BOOLEAN, CMISDataTypeEnum.BOOLEAN);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.CATEGORY, CMISDataTypeEnum.ID);
alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.CHILD_ASSOC_REF, null);
alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.CONTENT, null);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.DATE, CMISPropertyTypeEnum.DATETIME);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.DATETIME, CMISPropertyTypeEnum.DATETIME);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.DOUBLE, CMISPropertyTypeEnum.DECIMAL);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.FLOAT, CMISPropertyTypeEnum.DECIMAL);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.INT, CMISPropertyTypeEnum.INTEGER);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.DATE, CMISDataTypeEnum.DATETIME);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.DATETIME, CMISDataTypeEnum.DATETIME);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.DOUBLE, CMISDataTypeEnum.DECIMAL);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.FLOAT, CMISDataTypeEnum.DECIMAL);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.INT, CMISDataTypeEnum.INTEGER);
alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.LOCALE, null);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.LONG, CMISPropertyTypeEnum.INTEGER);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.MLTEXT, CMISPropertyTypeEnum.STRING);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.NODE_REF, CMISPropertyTypeEnum.ID);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.LONG, CMISDataTypeEnum.INTEGER);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.MLTEXT, CMISDataTypeEnum.STRING);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.NODE_REF, CMISDataTypeEnum.ID);
alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.PATH, null);
alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.QNAME, null);
- alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.TEXT, CMISPropertyTypeEnum.STRING);
- alfrescoPropertyTypesToCmisPropertyTypes.put(CMIS_DATATYPE_ID, CMISPropertyTypeEnum.ID);
- alfrescoPropertyTypesToCmisPropertyTypes.put(CMIS_DATATYPE_URI, CMISPropertyTypeEnum.URI);
- alfrescoPropertyTypesToCmisPropertyTypes.put(CMIS_DATATYPE_XML, CMISPropertyTypeEnum.XML);
- alfrescoPropertyTypesToCmisPropertyTypes.put(CMIS_DATATYPE_HTML, CMISPropertyTypeEnum.HTML);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(DataTypeDefinition.TEXT, CMISDataTypeEnum.STRING);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(CMIS_DATATYPE_ID, CMISDataTypeEnum.ID);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(CMIS_DATATYPE_URI, CMISDataTypeEnum.URI);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(CMIS_DATATYPE_XML, CMISDataTypeEnum.XML);
+ alfrescoPropertyTypesToCmisPropertyTypes.put(CMIS_DATATYPE_HTML, CMISDataTypeEnum.HTML);
}
private DictionaryService dictionaryService;
-
private NamespaceService namespaceService;
/**
@@ -270,47 +165,35 @@ public class CMISMapping
*
* @return namespaceService
*/
- /* package */NamespaceService getNamespaceService()
+ /*package*/ NamespaceService getNamespaceService()
{
return this.namespaceService;
}
- /**
- * Id this a CMIS core type defined in the Alfresco CMIS model
- *
- * @param typeQName
- * @return
- */
- public boolean isCmisCoreType(QName typeQName)
- {
- return qNameToCmisTypeId.get(typeQName) != null;
- }
-
/**
* Gets the CMIS Type Id given the serialized type Id
*
- * @param typeId
- * type id in the form of /_
+ * @param typeId type id in the form of /_
* @return
*/
public CMISTypeId getCmisTypeId(String typeId)
{
// Is it a CMIS root object type id?
- if (typeId.equalsIgnoreCase(DOCUMENT_TYPE_ID.getTypeId()))
+ if (typeId.equalsIgnoreCase(CMISDictionaryModel.DOCUMENT_TYPE_ID.getId()))
{
- return DOCUMENT_TYPE_ID;
+ return CMISDictionaryModel.DOCUMENT_TYPE_ID;
}
- else if (typeId.equalsIgnoreCase(FOLDER_TYPE_ID.getTypeId()))
+ else if (typeId.equalsIgnoreCase(CMISDictionaryModel.FOLDER_TYPE_ID.getId()))
{
- return FOLDER_TYPE_ID;
+ return CMISDictionaryModel.FOLDER_TYPE_ID;
}
- else if (typeId.equalsIgnoreCase(RELATIONSHIP_TYPE_ID.getTypeId()))
+ else if (typeId.equalsIgnoreCase(CMISDictionaryModel.RELATIONSHIP_TYPE_ID.getId()))
{
- return RELATIONSHIP_TYPE_ID;
+ return CMISDictionaryModel.RELATIONSHIP_TYPE_ID;
}
- else if (typeId.equalsIgnoreCase(POLICY_TYPE_ID.getTypeId()))
+ else if (typeId.equalsIgnoreCase(CMISDictionaryModel.POLICY_TYPE_ID.getId()))
{
- return POLICY_TYPE_ID;
+ return CMISDictionaryModel.POLICY_TYPE_ID;
}
// Is it an Alfresco type id?
@@ -328,7 +211,7 @@ public class CMISMapping
QName typeQName = QName.resolveToQName(namespaceService, typeId.substring(2).replace('_', ':'));
// Construct CMIS Type Id
- return new CMISTypeId(scope, typeQName, typeId);
+ return new CMISTypeId(scope, typeId, typeQName);
}
/**
@@ -346,7 +229,7 @@ public class CMISMapping
builder.append(scope.discriminator());
builder.append("/");
builder.append(buildPrefixEncodedString(typeQName, false));
- return new CMISTypeId(scope, typeQName, builder.toString());
+ return new CMISTypeId(scope, builder.toString(), typeQName);
}
else
{
@@ -354,56 +237,45 @@ public class CMISMapping
}
}
- public CMISTypeId getCmisTypeId(QName typeQName)
+ public CMISTypeId getCmisTypeId(QName classQName)
{
- if (isValidCmisDocument(typeQName))
+ if (classQName.equals(ContentModel.TYPE_CONTENT))
{
- return getCmisTypeId(CMISScope.DOCUMENT, getCmisType(typeQName));
+ return getCmisTypeId(CMISScope.DOCUMENT, classQName);
}
- else if (isValidCmisFolder(typeQName))
+ if (classQName.equals(ContentModel.TYPE_FOLDER))
{
- return getCmisTypeId(CMISScope.FOLDER, getCmisType(typeQName));
+ return getCmisTypeId(CMISScope.FOLDER, classQName);
}
- else if (typeQName.equals(CMISMapping.RELATIONSHIP_QNAME))
+ if (classQName.equals(CMISMapping.RELATIONSHIP_QNAME))
{
- return getCmisTypeId(CMISScope.RELATIONSHIP, getCmisType(typeQName));
+ return getCmisTypeId(CMISScope.RELATIONSHIP, classQName);
}
- else if (typeQName.equals(ContentModel.TYPE_CONTENT))
+ if (classQName.equals(CMISMapping.POLICY_QNAME))
{
- return getCmisTypeId(CMISScope.DOCUMENT, getCmisType(typeQName));
+ return getCmisTypeId(CMISScope.POLICY, classQName);
}
- else if (typeQName.equals(ContentModel.TYPE_FOLDER))
+ if (isValidCmisDocument(classQName))
{
- return getCmisTypeId(CMISScope.FOLDER, getCmisType(typeQName));
+ return getCmisTypeId(CMISScope.DOCUMENT, classQName);
}
- else
+ if (isValidCmisFolder(classQName))
{
- ClassDefinition classDef = dictionaryService.getClass(typeQName);
- if (classDef.isAspect())
- {
- return getCmisTypeId(CMISScope.POLICY, getCmisType(typeQName));
- }
- else
- {
- return null;
- }
+ return getCmisTypeId(CMISScope.FOLDER, classQName);
+ }
+ if (isValidCmisRelationship(classQName))
+ {
+ return getCmisTypeId(CMISScope.RELATIONSHIP, classQName);
+ }
+ if (isValidCmisPolicy(classQName))
+ {
+ return getCmisTypeId(CMISScope.POLICY, classQName);
}
+ return null;
}
- /**
- * Get the query name for Alfresco qname
- *
- * @param namespaceService
- * @param typeQName
- * @return
- */
- public String getQueryName(QName typeQName)
- {
- return buildPrefixEncodedString(typeQName, false);
- }
-
- private String buildPrefixEncodedString(QName qname, boolean upperCase)
+ /*package*/ String buildPrefixEncodedString(QName qname, boolean upperCase)
{
StringBuilder builder = new StringBuilder(128);
@@ -424,21 +296,6 @@ public class CMISMapping
return builder.toString();
}
- /**
- * Is this a valid CMIS type The type must be a core CMIS type or extend cm:content or cm:folder The alfresco types
- * cm:content and cm:folder are hidden by the CMIS types
- *
- * @param dictionaryService
- * @param typeQName
- * @return
- */
- public boolean isValidCmisType(QName typeQName)
- {
- // TODO: Policy: Include aspects types as policies
- // TODO: Policy: Add isValidCmispolicy(QName typeQName)
- return isValidCmisFolder(typeQName) || isValidCmisDocument(typeQName) || isValidCmisRelationship(typeQName);
- }
-
/**
* Is this a valid cmis document or folder type (not a relationship)
*
@@ -513,10 +370,41 @@ public class CMISMapping
return true;
}
}
-
return false;
}
+ /**
+ * Is this a valid CMIS policy type?
+ *
+ * @param dictionaryService
+ * @param typeQName
+ * @return
+ */
+ public boolean isValidCmisPolicy(QName typeQName)
+ {
+ if (typeQName == null)
+ {
+ return false;
+ }
+ if (typeQName.equals(POLICY_QNAME))
+ {
+ return true;
+ }
+
+ AspectDefinition aspectDef = dictionaryService.getAspect(typeQName);
+ if (aspectDef == null)
+ {
+ return false;
+ }
+
+ if (aspectDef.getName().equals(ContentModel.ASPECT_VERSIONABLE) ||
+ aspectDef.getName().equals(ContentModel.ASPECT_AUDITABLE))
+ {
+ return false;
+ }
+ return true;
+ }
+
/**
* Is an association valid in CMIS? It must be a non-child relationship and the source and target must both be valid
* CMIS types.
@@ -572,6 +460,17 @@ public class CMISMapping
return typeQName;
}
+ /**
+ * Is Alfresco Type mapped to an alternative CMIS Type?
+ *
+ * @param typeQName
+ * @return
+ */
+ public boolean isRemappedType(QName typeQName)
+ {
+ return alfrescoToCmisTypes.containsKey(typeQName);
+ }
+
/**
* Given a CMIS model type map it to the appropriate Alfresco type.
*
@@ -600,21 +499,6 @@ public class CMISMapping
return buildPrefixEncodedString(propertyQName, false);
}
- public CMISTypeId getCmisTypeForProperty(QName propertyQName)
- {
- PropertyDefinition pDef = dictionaryService.getProperty(propertyQName);
- if (pDef != null)
- {
- QName typeQName = pDef.getContainerClass().getName();
- return getCmisTypeId(typeQName);
- }
- else
- {
- return null;
- }
-
- }
-
/**
* Get the CMIS property type for a property
*
@@ -622,22 +506,14 @@ public class CMISMapping
* @param propertyQName
* @return
*/
- public CMISPropertyTypeEnum getPropertyType(QName propertyQName)
+ public CMISDataTypeEnum getDataType(DataTypeDefinition datatype)
{
- PropertyDefinition propertyDefinition = dictionaryService.getProperty(propertyQName);
- DataTypeDefinition dataTypeDefinition;
- if (propertyDefinition != null)
- {
- dataTypeDefinition = propertyDefinition.getDataType();
- }
- else
- {
- dataTypeDefinition = dictionaryService.getDataType(propertyQName);
- }
-
- QName dQName = dataTypeDefinition.getName();
- return alfrescoPropertyTypesToCmisPropertyTypes.get(dQName);
-
+ return getDataType(datatype.getName());
+ }
+
+ public CMISDataTypeEnum getDataType(QName dataType)
+ {
+ return alfrescoPropertyTypesToCmisPropertyTypes.get(dataType);
}
/**
@@ -712,86 +588,6 @@ public class CMISMapping
}
return null;
-
- }
-
- /**
- * @param tableName
- * @return
- */
- public QName getAlfrescoClassQNameFromCmisTableName(String tableName)
- {
- if (tableName.equalsIgnoreCase(DOCUMENT_TYPE_ID.getTypeId()))
- {
- return ContentModel.TYPE_CONTENT;
- }
- else if (tableName.equalsIgnoreCase(FOLDER_TYPE_ID.getTypeId()))
- {
- return ContentModel.TYPE_FOLDER;
- }
- else if (tableName.equalsIgnoreCase(RELATIONSHIP_TYPE_ID.getTypeId()))
- {
- return null;
- }
- else if (tableName.equalsIgnoreCase(POLICY_TYPE_ID.getTypeId()))
- {
- return null;
- }
-
- // Find prefix and property name - in upper case
-
- int split = tableName.indexOf('_');
- if (split == -1)
- {
- return null;
- }
- String prefix = tableName.substring(0, split);
- String localName = tableName.substring(split + 1);
-
- // Try lower case version first.
-
- QName classQName = QName.createQName(prefix.toLowerCase(), localName.toLowerCase(), namespaceService);
- if (dictionaryService.getClass(classQName) != null)
- {
- return classQName;
- }
-
- // Full case insensitive hunt
-
- for (String test : namespaceService.getPrefixes())
- {
- if (test.equalsIgnoreCase(prefix))
- {
- prefix = test;
- break;
- }
- }
- String uri = namespaceService.getNamespaceURI(prefix);
-
- for (QName qname : dictionaryService.getAllTypes())
- {
- if (qname.getNamespaceURI().equals(uri))
- {
- if (qname.getLocalName().equalsIgnoreCase(localName))
- {
- return qname;
- }
- }
- }
-
- for (QName qname : dictionaryService.getAllAspects())
- {
- if (qname.getNamespaceURI().equals(uri))
- {
- if (qname.getLocalName().equalsIgnoreCase(localName))
- {
- return qname;
- }
- }
- }
-
- return null;
-
}
/**
@@ -808,7 +604,6 @@ public class CMISMapping
else
{
return propertyQName.toString();
-
}
}
}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISObjectTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISObjectTypeDefinition.java
new file mode 100644
index 0000000000..342b44a116
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/CMISObjectTypeDefinition.java
@@ -0,0 +1,405 @@
+/*
+ * Copyright (C) 2005-20079 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.dictionary;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.alfresco.cmis.CMISContentStreamAllowedEnum;
+import org.alfresco.cmis.dictionary.AbstractCMISDictionaryService.DictionaryRegistry;
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.service.cmr.dictionary.AspectDefinition;
+import org.alfresco.service.cmr.dictionary.ClassDefinition;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.cmr.dictionary.PropertyDefinition;
+import org.alfresco.service.namespace.QName;
+
+
+/**
+ * CMIS Object Type Definition
+ *
+ * @author davidc
+ */
+public class CMISObjectTypeDefinition implements CMISTypeDefinition, Serializable
+{
+ private static final long serialVersionUID = -3131505923356013430L;
+
+ // Object type properties
+ protected ClassDefinition cmisClassDef;
+ protected CMISTypeId objectTypeId;
+ protected String objectTypeQueryName;
+ protected String displayName;
+ protected CMISTypeId parentTypeId;
+ protected CMISTypeDefinition parentType;
+ protected CMISTypeDefinition rootType;
+ protected String description;
+ protected boolean creatable;
+ protected boolean queryable;
+ protected boolean controllable;
+ protected boolean includeInSuperTypeQuery;
+ protected Collection subTypeIds = new ArrayList();
+ protected Collection subTypes = new ArrayList();
+ protected Map properties = new HashMap();
+ protected Map inheritedProperties = new HashMap();
+
+
+ /**
+ * Construct
+ *
+ * @param cmisMapping
+ * @param dictionaryService
+ * @return
+ */
+ /*package*/ Map createProperties(CMISMapping cmisMapping, DictionaryService dictionaryService)
+ {
+ // map properties directly defined on this type
+ for (PropertyDefinition propDef : cmisClassDef.getProperties().values())
+ {
+ if (propDef.getContainerClass().equals(cmisClassDef))
+ {
+ if (cmisMapping.getDataType(propDef.getDataType()) != null)
+ {
+ CMISPropertyDefinition cmisPropDef = createProperty(cmisMapping, propDef);
+ properties.put(cmisPropDef.getPropertyId(), cmisPropDef);
+ }
+ }
+ }
+
+ // map properties directly defined on default aspects
+ for (AspectDefinition aspectDef : cmisClassDef.getDefaultAspects(false))
+ {
+ for (PropertyDefinition propDef : aspectDef.getProperties().values())
+ {
+ if (cmisMapping.getDataType(propDef.getDataType()) != null)
+ {
+ CMISPropertyDefinition cmisPropDef = createProperty(cmisMapping, propDef);
+ properties.put(cmisPropDef.getPropertyId(), cmisPropDef);
+ }
+ }
+ }
+
+ return properties;
+ }
+
+ /**
+ * Create Property Definition
+ *
+ * @param cmisMapping
+ * @param propDef
+ * @return
+ */
+ 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);
+ return new CMISPropertyDefinition(cmisMapping, cmisPropertyId, propDef, this);
+ }
+
+ /**
+ * Create Sub Types
+ *
+ * @param cmisMapping
+ * @param dictionaryService
+ */
+ /*package*/ void createSubTypes(CMISMapping cmisMapping, DictionaryService dictionaryService)
+ {
+ Collection subTypes = dictionaryService.getSubTypes(objectTypeId.getQName(), false);
+ for (QName subType : subTypes)
+ {
+ if (cmisMapping.isValidCmisDocumentOrFolder(subType))
+ {
+ CMISTypeId subTypeId = cmisMapping.getCmisTypeId(subType);
+ if (subTypeId != null)
+ {
+ subTypeIds.add(subTypeId);
+ }
+ }
+ }
+ }
+
+ /**
+ * Resolve Dependencies
+ *
+ * @param registry
+ */
+ /*package*/ void resolveDependencies(DictionaryRegistry registry)
+ {
+ if (parentTypeId != null)
+ {
+ parentType = registry.typeDefsByTypeId.get(parentTypeId);
+ if (parentType == null)
+ {
+ throw new AlfrescoRuntimeException("Failed to retrieve parent type for type id " + parentTypeId);
+ }
+ }
+ CMISTypeId rootTypeId = objectTypeId.getRootTypeId();
+ if (rootTypeId != null)
+ {
+ rootType = registry.typeDefsByTypeId.get(rootTypeId);
+ if (rootType == null)
+ {
+ throw new AlfrescoRuntimeException("Failed to retrieve root type for type id " + rootTypeId);
+ }
+ }
+ for (CMISTypeId subTypeId : subTypeIds)
+ {
+ CMISTypeDefinition subType = registry.typeDefsByTypeId.get(subTypeId);
+ if (subType == null)
+ {
+ throw new AlfrescoRuntimeException("Failed to retrieve sub type for type id " + subTypeId + " for parent type " + objectTypeId);
+ }
+ subTypes.add(subType);
+ }
+ }
+
+ /**
+ * Resolve Inheritance
+ *
+ * @param registry
+ */
+ /*package*/ void resolveInheritance(DictionaryRegistry registry)
+ {
+ inheritedProperties.putAll(properties);
+ if (parentType != null)
+ {
+ inheritedProperties.putAll(parentType.getPropertyDefinitions());
+ }
+ }
+
+
+
+ /**
+ * Get the unique identifier for the type
+ *
+ * @return - the type id
+ */
+ public CMISTypeId getTypeId()
+ {
+ return objectTypeId;
+ }
+
+ /**
+ * Get the table name used for queries against the type. This is also a unique identifier for the type. The string
+ * conforms to SQL table naming conventions. TODO: Should we impose a maximum length and if so how do we avoid
+ * collisions from truncations?
+ *
+ * @return the sql table name
+ */
+ public String getQueryName()
+ {
+ return objectTypeQueryName;
+ }
+
+ /**
+ * Get the display name for the type.
+ *
+ * @return - the display name
+ */
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ /**
+ * Get parent type
+ *
+ * @return
+ */
+ public CMISTypeDefinition getParentType()
+ {
+ return parentType;
+ }
+
+ /**
+ * Get the root type
+ *
+ * @return
+ */
+ public CMISTypeDefinition getRootType()
+ {
+ return rootType;
+ }
+
+ /**
+ * Get sub types
+ *
+ * @return
+ */
+ public Collection getSubTypes(boolean includeDescendants)
+ {
+ if (!includeDescendants)
+ {
+ return subTypes;
+ }
+
+ // recurse sub-type hierarchy
+ Collection descendants = new ArrayList();
+ LinkedList stack = new LinkedList();
+ stack.addLast(this);
+ while (stack.size() > 0)
+ {
+ CMISTypeDefinition current = stack.removeLast();
+ if (!current.equals(this)) // do not add this type
+ {
+ descendants.add(current);
+ }
+
+ // descend...
+ for (CMISTypeDefinition type : current.getSubTypes(false))
+ {
+ stack.addLast(type);
+ }
+ }
+ return descendants;
+ }
+
+ /**
+ * Get the description for the type
+ *
+ * @return - the description
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Can objects of this type be created?
+ *
+ * @return
+ */
+ public boolean isCreatable()
+ {
+ return creatable;
+ }
+
+ /**
+ * Is this type queryable? If not, the type may not appear in the FROM clause of a query. This property of the type
+ * is not inherited in the type hierarchy. It is set on each type.
+ *
+ * @return true if queryable
+ */
+ public boolean isQueryable()
+ {
+ return queryable;
+ }
+
+ /**
+ * Are objects of this type controllable.
+ *
+ * @return
+ */
+ public boolean isControllable()
+ {
+ return controllable;
+ }
+
+ /**
+ * Are objects of this type included in super type queries
+ *
+ * @return
+ */
+ public boolean isIncludeInSuperTypeQuery()
+ {
+ return includeInSuperTypeQuery;
+ }
+
+ /**
+ * Gets the property definitions for this type
+ *
+ * @return property definitions
+ */
+ public Map getPropertyDefinitions()
+ {
+ return inheritedProperties;
+ }
+
+
+ //
+ // Document Type specific
+ //
+
+ /**
+ * Is Fileable?
+ *
+ * @return
+ */
+ public boolean isFileable()
+ {
+ return false;
+ }
+
+ /**
+ * Is Versionable?
+ *
+ * @return
+ */
+ public boolean isVersionable()
+ {
+ return false;
+ }
+
+ /**
+ * Is Content Stream Allowed?
+ *
+ * @return
+ */
+ public CMISContentStreamAllowedEnum getContentStreamAllowed()
+ {
+ return CMISContentStreamAllowedEnum.NOT_ALLOWED;
+ }
+
+ //
+ // Relationship Type specific
+ //
+
+ /**
+ * Get allowed source types
+ *
+ * @return
+ */
+ public Collection getAllowedSourceTypes()
+ {
+ return Collections.emptyList();
+ }
+
+ /**
+ * Get allowed target types
+ *
+ * @return
+ */
+ public Collection getAllowedTargetTypes()
+ {
+ return Collections.emptyList();
+ }
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISPolicyTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISPolicyTypeDefinition.java
new file mode 100644
index 0000000000..b7459ac94c
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/CMISPolicyTypeDefinition.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2005-2009 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.dictionary;
+
+import java.util.Collection;
+
+import org.alfresco.cmis.dictionary.AbstractCMISDictionaryService.DictionaryRegistry;
+import org.alfresco.service.cmr.dictionary.ClassDefinition;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.namespace.QName;
+
+
+/**
+ * CMIS Policy Type Definition
+ *
+ * @author davidc
+ */
+public class CMISPolicyTypeDefinition extends CMISObjectTypeDefinition
+{
+ private static final long serialVersionUID = 1621538303752395828L;
+
+ /**
+ * Construct
+ *
+ * @param cmisMapping
+ * @param typeId
+ * @param cmisClassDef
+ */
+ public CMISPolicyTypeDefinition(CMISMapping cmisMapping, CMISTypeId typeId, ClassDefinition cmisClassDef)
+ {
+ this.cmisClassDef = cmisClassDef;
+ objectTypeId = typeId;
+ displayName = (cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId.getId();
+ if (typeId == CMISDictionaryModel.POLICY_TYPE_ID)
+ {
+ objectTypeQueryName = typeId.getId();
+ }
+ else
+ {
+ objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
+ parentTypeId = CMISDictionaryModel.POLICY_TYPE_ID;
+ }
+ description = cmisClassDef.getDescription();
+ creatable = false;
+ queryable = false;
+ controllable = false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISObjectTypeDefinition#createSubTypes(org.alfresco.cmis.dictionary.CMISMapping, org.alfresco.service.cmr.dictionary.DictionaryService)
+ */
+ @Override
+ /*package*/ void createSubTypes(CMISMapping cmisMapping, DictionaryService dictionaryService)
+ {
+ if (objectTypeId.equals(CMISDictionaryModel.POLICY_TYPE_ID))
+ {
+ // all aspects are sub-type of POLICY_OBJECT_TYPE
+ Collection aspects = dictionaryService.getAllAspects();
+ for (QName aspect : aspects)
+ {
+ if (cmisMapping.isValidCmisPolicy(aspect))
+ {
+ subTypeIds.add(cmisMapping.getCmisTypeId(CMISScope.POLICY, aspect));
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISObjectTypeDefinition#resolveInheritance(org.alfresco.cmis.dictionary.AbstractCMISDictionaryService.DictionaryRegistry)
+ */
+ @Override
+ /*package*/ void resolveInheritance(DictionaryRegistry registry)
+ {
+ // NOTE: Force no inheritance of base Policy type
+ inheritedProperties.putAll(properties);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ 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 ? "" : 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("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
+ builder.append("SubTypes=").append(getSubTypes(false).size()).append(", ");
+ builder.append("Properties=").append(getPropertyDefinitions().size());
+ builder.append("]");
+ return builder.toString();
+ }
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISPropertyDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISPropertyDefinition.java
index cc5322e638..4b343ec61b 100644
--- a/source/java/org/alfresco/cmis/dictionary/CMISPropertyDefinition.java
+++ b/source/java/org/alfresco/cmis/dictionary/CMISPropertyDefinition.java
@@ -29,7 +29,7 @@ import java.util.Collection;
import java.util.HashSet;
import org.alfresco.cmis.CMISCardinalityEnum;
-import org.alfresco.cmis.CMISPropertyTypeEnum;
+import org.alfresco.cmis.CMISDataTypeEnum;
import org.alfresco.cmis.CMISUpdatabilityEnum;
import org.alfresco.repo.dictionary.IndexTokenisationMode;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
@@ -44,171 +44,129 @@ import org.alfresco.repo.search.impl.lucene.analysis.VerbatimAnalyser;
import org.alfresco.service.cmr.dictionary.Constraint;
import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
-import org.alfresco.service.namespace.QName;
/**
- * A CMIS property definition
+ * CMIS Property Definition
*
* @author andyh
*/
public class CMISPropertyDefinition implements Serializable
{
- /**
- *
- */
private static final long serialVersionUID = -8119257313852558466L;
- private String propertyName;
-
- private String propertyId;
-
+ // Properties of Property
+ private CMISTypeDefinition typeDef;
+ private CMISPropertyId propertyId;
private String displayName;
-
private String description;
-
- private boolean isInherited;
-
- private CMISPropertyTypeEnum propertyType;
-
+ private CMISDataTypeEnum propertyType;
private CMISCardinalityEnum cardinality;
-
private int maximumLength = -1;
-
private String schemaURI = null;
-
private String encoding = null;
-
private Collection choices = new HashSet();
-
private boolean isOpenChoice = false;
-
private boolean required;
-
private String defaultValue;
-
private CMISUpdatabilityEnum updatability;
-
private boolean queryable;
-
private boolean orderable;
- public CMISPropertyDefinition(CMISDictionaryService cmisDictionary, QName propertyQName, QName typeQName)
+
+ /**
+ * Construct
+ *
+ * @param cmisMapping
+ * @param propertyId
+ * @param propDef
+ * @param typeDef
+ */
+ public CMISPropertyDefinition(CMISMapping cmisMapping, CMISPropertyId propertyId, PropertyDefinition propDef, CMISTypeDefinition typeDef)
{
- CMISMapping cmisMapping = cmisDictionary.getCMISMapping();
- PropertyDefinition propDef = cmisDictionary.getDictionaryService().getProperty(propertyQName);
- if (propDef.getContainerClass().getName().equals(CMISMapping.RELATIONSHIP_QNAME))
+ this.propertyId = propertyId;
+ this.typeDef = typeDef;
+ displayName = (propDef.getTitle() != null) ? propDef.getTitle() : propertyId.getName();
+ description = propDef.getDescription();
+ propertyType = cmisMapping.getDataType(propDef.getDataType());
+ cardinality = propDef.isMultiValued() ? CMISCardinalityEnum.MULTI_VALUED : CMISCardinalityEnum.SINGLE_VALUED;
+ for (ConstraintDefinition constraintDef : propDef.getConstraints())
{
- // Properties of associations - all the same
- propertyName = cmisMapping.getCmisPropertyName(propertyQName);
- propertyId = cmisMapping.getCmisPropertyId(propertyQName);
- displayName = (propDef.getTitle() != null) ? propDef.getTitle() : propertyName;
- description = propDef.getDescription();
- isInherited = false;
- propertyType = cmisMapping.getPropertyType(propertyQName);
- cardinality = propDef.isMultiValued() ? CMISCardinalityEnum.MULTI_VALUED : CMISCardinalityEnum.SINGLE_VALUED;
- required = propDef.isMandatory();
- defaultValue = propDef.getDefaultValue();
- updatability = propDef.isProtected() ? CMISUpdatabilityEnum.READ_ONLY : CMISUpdatabilityEnum.READ_AND_WRITE;
- queryable = false;
- orderable = false;
+ Constraint constraint = constraintDef.getConstraint();
+ if (constraint instanceof ListOfValuesConstraint)
+ {
+ int position = 1; // CMIS is 1 based (according to XSDs)
+ ListOfValuesConstraint lovc = (ListOfValuesConstraint) constraint;
+ for (String allowed : lovc.getAllowedValues())
+ {
+ CMISChoice choice = new CMISChoice(allowed, allowed, position++);
+ choices.add(choice);
+ }
+ }
+ if (constraint instanceof StringLengthConstraint)
+ {
+ StringLengthConstraint slc = (StringLengthConstraint) constraint;
+ maximumLength = slc.getMaxLength();
+ }
+ }
+ required = propDef.isMandatory();
+ defaultValue = propDef.getDefaultValue();
+ updatability = propDef.isProtected() ? CMISUpdatabilityEnum.READ_ONLY : CMISUpdatabilityEnum.READ_AND_WRITE;
+ queryable = propDef.isIndexed();
+ if (queryable)
+ {
+ IndexTokenisationMode indexTokenisationMode = IndexTokenisationMode.TRUE;
+ if (propDef.getIndexTokenisationMode() != null)
+ {
+ indexTokenisationMode = propDef.getIndexTokenisationMode();
+ }
+ switch (indexTokenisationMode)
+ {
+ case BOTH:
+ case FALSE:
+ orderable = true;
+ break;
+ case TRUE:
+ default:
+ String analyserClassName = propDef.getDataType().getAnalyserClassName();
+ if (analyserClassName.equals(DateTimeAnalyser.class.getCanonicalName())
+ || analyserClassName.equals(DoubleAnalyser.class.getCanonicalName()) || analyserClassName.equals(FloatAnalyser.class.getCanonicalName())
+ || analyserClassName.equals(IntegerAnalyser.class.getCanonicalName()) || analyserClassName.equals(LongAnalyser.class.getCanonicalName())
+ || analyserClassName.equals(PathAnalyser.class.getCanonicalName()) || analyserClassName.equals(VerbatimAnalyser.class.getCanonicalName()))
+ {
+ orderable = true;
+ }
+ else
+ {
+ orderable = false;
+ }
+ }
}
else
{
-
- propertyName = cmisMapping.getCmisPropertyName(propertyQName);
- propertyId = cmisMapping.getCmisPropertyId(propertyQName);
- displayName = (propDef.getTitle() != null) ? propDef.getTitle() : propertyName;
- description = propDef.getDescription();
- if(propDef.getContainerClass().isAspect())
- {
- isInherited = false;
- }
- else
- {
- isInherited = !propDef.getContainerClass().equals(typeQName);
- }
- propertyType = cmisMapping.getPropertyType(propertyQName);
- cardinality = propDef.isMultiValued() ? CMISCardinalityEnum.MULTI_VALUED : CMISCardinalityEnum.SINGLE_VALUED;
- for (ConstraintDefinition constraintDef : propDef.getConstraints())
- {
- Constraint constraint = constraintDef.getConstraint();
- if (constraint instanceof ListOfValuesConstraint)
- {
- int position = 1; // CMIS is 1 based (according to XSDs)
- ListOfValuesConstraint lovc = (ListOfValuesConstraint) constraint;
- for (String allowed : lovc.getAllowedValues())
- {
- CMISChoice choice = new CMISChoice(allowed, allowed, position++);
- choices.add(choice);
- }
- }
- if (constraint instanceof StringLengthConstraint)
- {
- StringLengthConstraint slc = (StringLengthConstraint) constraint;
- maximumLength = slc.getMaxLength();
- }
- }
- required = propDef.isMandatory();
- defaultValue = propDef.getDefaultValue();
- updatability = propDef.isProtected() ? CMISUpdatabilityEnum.READ_ONLY : CMISUpdatabilityEnum.READ_AND_WRITE;
- queryable = propDef.isIndexed();
- if (queryable)
- {
- IndexTokenisationMode indexTokenisationMode = IndexTokenisationMode.TRUE;
- if (propDef.getIndexTokenisationMode() != null)
- {
- indexTokenisationMode = propDef.getIndexTokenisationMode();
- }
- switch (indexTokenisationMode)
- {
- case BOTH:
- case FALSE:
- orderable = true;
- break;
- case TRUE:
- default:
- String analyserClassName = propDef.getDataType().getAnalyserClassName();
- if (analyserClassName.equals(DateTimeAnalyser.class.getCanonicalName())
- || analyserClassName.equals(DoubleAnalyser.class.getCanonicalName()) || analyserClassName.equals(FloatAnalyser.class.getCanonicalName())
- || analyserClassName.equals(IntegerAnalyser.class.getCanonicalName()) || analyserClassName.equals(LongAnalyser.class.getCanonicalName())
- || analyserClassName.equals(PathAnalyser.class.getCanonicalName()) || analyserClassName.equals(VerbatimAnalyser.class.getCanonicalName()))
- {
- orderable = true;
- }
- else
- {
- orderable = false;
- }
- }
- }
- else
- {
- orderable = false;
- }
+ orderable = false;
}
-
}
/**
- * Get the property name
+ * Get Property Id
*
* @return
*/
- public String getPropertyName()
- {
- return propertyName;
- }
-
- /**
- * Get the property id
- *
- * @return
- */
- public String getPropertyId()
+ public CMISPropertyId getPropertyId()
{
return propertyId;
}
+ /**
+ * Get Owning Type
+ *
+ * @return
+ */
+ public CMISTypeDefinition getOwningType()
+ {
+ return typeDef;
+ }
+
/**
* Get the display name
*
@@ -228,23 +186,13 @@ public class CMISPropertyDefinition implements Serializable
{
return description;
}
-
- /**
- * Is the property definition inherited?
- *
- * @return
- */
- public boolean isInherited()
- {
- return isInherited;
- }
/**
* Get the property type
*
* @return
*/
- public CMISPropertyTypeEnum getPropertyType()
+ public CMISDataTypeEnum getDataType()
{
return propertyType;
}
@@ -359,16 +307,21 @@ public class CMISPropertyDefinition implements Serializable
return orderable;
}
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("CMISPropertyDefinition[");
- builder.append("PropertyName=").append(getPropertyName()).append(", ");
- builder.append("PropertyId=").append(getPropertyId()).append(", ");
+ builder.append("OwningTypeId=").append(getOwningType().getTypeId()).append(", ");
+ builder.append("PropertyName=").append(getPropertyId().getName()).append(", ");
+ builder.append("PropertyId=").append(getPropertyId().getId()).append(", ");
builder.append("DisplayName=").append(getDisplayName()).append(", ");
builder.append("Description=").append(getDescription()).append(", ");
- builder.append("IsInherited=").append(isInherited()).append(", ");
- builder.append("PropertyType=").append(getPropertyType()).append(", ");
+ builder.append("PropertyType=").append(getDataType()).append(", ");
builder.append("Cardinality=").append(getCardinality()).append(", ");
builder.append("MaximumLength=").append(getMaximumLength()).append(", ");
builder.append("SchemaURI=").append(getSchemaURI()).append(", ");
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISPropertyId.java b/source/java/org/alfresco/cmis/dictionary/CMISPropertyId.java
new file mode 100644
index 0000000000..0d550d4503
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/CMISPropertyId.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2005-2009 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.dictionary;
+
+import java.io.Serializable;
+
+import org.alfresco.service.namespace.QName;
+
+
+/**
+ * CMIS Property Id
+ *
+ * @author davidc
+ */
+public class CMISPropertyId implements Serializable
+{
+ private static final long serialVersionUID = 4094778633095367606L;
+
+ // Id properties
+ private String propertyName;
+ private String propertyId;
+ private QName qName;
+
+
+ /**
+ * Construct
+ *
+ * @param propertyName
+ * @param propertyId
+ * @param qName
+ */
+ public CMISPropertyId(String propertyName, String propertyId, QName qName)
+ {
+ this.propertyName = propertyName;
+ this.propertyId = propertyId;
+ this.qName = qName;
+ }
+
+ /**
+ * Get property name
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return propertyName;
+ }
+
+ /**
+ * Get property id
+ *
+ * @return
+ */
+ public String getId()
+ {
+ return propertyId;
+ }
+
+ /**
+ * Get the Alfresco model QName associated with the property
+ *
+ * @return alfresco QName
+ */
+ public QName getQName()
+ {
+ return qName;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return getName();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((propertyName == null) ? 0 : propertyName.hashCode());
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final CMISPropertyId other = (CMISPropertyId) obj;
+ if (propertyName == null)
+ {
+ if (other.propertyName != null)
+ return false;
+ }
+ else if (!propertyName.equals(other.propertyName))
+ return false;
+ return true;
+ }
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISRelationshipTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISRelationshipTypeDefinition.java
new file mode 100644
index 0000000000..bc29139163
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/CMISRelationshipTypeDefinition.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright (C) 2005-2009 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.dictionary;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.alfresco.cmis.dictionary.AbstractCMISDictionaryService.DictionaryRegistry;
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.service.cmr.dictionary.AssociationDefinition;
+import org.alfresco.service.cmr.dictionary.ClassDefinition;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.namespace.QName;
+
+
+/**
+ * CMIS Relationship Type Definition
+ *
+ * @author davidc
+ */
+public class CMISRelationshipTypeDefinition extends CMISObjectTypeDefinition
+{
+ private static final long serialVersionUID = 5291428171784061346L;
+
+ // Relationship properties
+ private List allowedSourceTypeIds = new ArrayList();
+ private List allowedSourceTypes = new ArrayList();
+ private List inheritedAllowedSourceTypes = new ArrayList();
+ private List allowedTargetTypeIds = new ArrayList();
+ private List allowedTargetTypes = new ArrayList();
+ private List inheritedAllowedTargetTypes = new ArrayList();
+
+
+ /**
+ * Construct
+ *
+ * @param cmisMapping
+ * @param typeId
+ * @param cmisClassDef
+ * @param assocDef
+ */
+ public CMISRelationshipTypeDefinition(CMISMapping cmisMapping, CMISTypeId typeId, ClassDefinition cmisClassDef, AssociationDefinition assocDef)
+ {
+ this.cmisClassDef = cmisClassDef;
+ objectTypeId = typeId;
+ creatable = false;
+ queryable = false;
+ controllable = false;
+
+ if (assocDef == null)
+ {
+ // TODO: Add CMIS Association mapping??
+ displayName = (cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId.getId();
+ objectTypeQueryName = typeId.getId();
+ parentTypeId = null;
+ description = cmisClassDef.getDescription();
+ }
+ else
+ {
+ displayName = (assocDef.getTitle() != null) ? assocDef.getTitle() : typeId.getId();
+ objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
+ parentTypeId = CMISDictionaryModel.RELATIONSHIP_TYPE_ID;
+ description = assocDef.getDescription();
+
+ CMISTypeId sourceTypeId = cmisMapping.getCmisTypeId(cmisMapping.getCmisType(assocDef.getSourceClass().getName()));
+ if (sourceTypeId != null && (sourceTypeId.getScope() == CMISScope.DOCUMENT || sourceTypeId.getScope() == CMISScope.FOLDER))
+ {
+ allowedSourceTypeIds.add(sourceTypeId);
+ }
+
+ CMISTypeId targetTypeId = cmisMapping.getCmisTypeId(cmisMapping.getCmisType(assocDef.getTargetClass().getName()));
+ if (targetTypeId != null && (targetTypeId.getScope() == CMISScope.DOCUMENT || targetTypeId.getScope() == CMISScope.FOLDER))
+ {
+ allowedTargetTypeIds.add(targetTypeId);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISObjectTypeDefinition#createProperties(org.alfresco.cmis.dictionary.CMISMapping, org.alfresco.service.cmr.dictionary.DictionaryService)
+ */
+ @Override
+ /*package*/ Map createProperties(CMISMapping cmisMapping, DictionaryService dictionaryService)
+ {
+ if (objectTypeId.equals(CMISDictionaryModel.RELATIONSHIP_TYPE_ID))
+ {
+ return super.createProperties(cmisMapping, dictionaryService);
+ }
+ return properties;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISObjectTypeDefinition#createSubTypes(org.alfresco.cmis.dictionary.CMISMapping, org.alfresco.service.cmr.dictionary.DictionaryService)
+ */
+ @Override
+ /*package*/ void createSubTypes(CMISMapping cmisMapping, DictionaryService dictionaryService)
+ {
+ if (objectTypeId.equals(CMISDictionaryModel.RELATIONSHIP_TYPE_ID))
+ {
+ // all associations are sub-type of RELATIONSHIP_OBJECT_TYPE
+ Collection assocs = dictionaryService.getAllAssociations();
+ for (QName assoc : assocs)
+ {
+ if (cmisMapping.isValidCmisRelationship(assoc))
+ {
+ subTypeIds.add(cmisMapping.getCmisTypeId(CMISScope.RELATIONSHIP, assoc));
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISObjectTypeDefinition#resolveDependencies(org.alfresco.cmis.dictionary.AbstractCMISDictionaryService.DictionaryRegistry)
+ */
+ @Override
+ /*package*/ void resolveDependencies(DictionaryRegistry registry)
+ {
+ super.resolveDependencies(registry);
+ for (CMISTypeId sourceTypeId : allowedSourceTypeIds)
+ {
+ CMISTypeDefinition type = registry.typeDefsByTypeId.get(sourceTypeId);
+ if (type == null)
+ {
+ throw new AlfrescoRuntimeException("Failed to retrieve allowed source type for type id " + sourceTypeId);
+ }
+ allowedSourceTypes.add(type);
+ }
+ for (CMISTypeId targetTypeId : allowedTargetTypeIds)
+ {
+ CMISTypeDefinition type = registry.typeDefsByTypeId.get(targetTypeId);
+ if (type == null)
+ {
+ throw new AlfrescoRuntimeException("Failed to retrieve allowed target type for type id " + targetTypeId);
+ }
+ allowedTargetTypes.add(registry.typeDefsByTypeId.get(targetTypeId));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.CMISObjectTypeDefinition#resolveInheritance(org.alfresco.cmis.dictionary.AbstractCMISDictionaryService.DictionaryRegistry)
+ */
+ @Override
+ /*package*/ void resolveInheritance(DictionaryRegistry registry)
+ {
+ super.resolveInheritance(registry);
+ inheritedAllowedSourceTypes.addAll(allowedSourceTypes);
+ inheritedAllowedTargetTypes.addAll(allowedTargetTypes);
+ if (parentType != null)
+ {
+ inheritedAllowedSourceTypes.addAll(parentType.getAllowedSourceTypes());
+ inheritedAllowedTargetTypes.addAll(parentType.getAllowedTargetTypes());
+ }
+ }
+
+ /**
+ * For an association, get the collection of valid source types. For non-associations the collection will be empty.
+ *
+ * @return
+ */
+ public Collection getAllowedSourceTypes()
+ {
+ return inheritedAllowedSourceTypes;
+ }
+
+ /**
+ * For an association, get the collection of valid target types. For non-associations the collection will be empty.
+ *
+ * @return
+ */
+ public Collection getAllowedTargetTypes()
+ {
+ return inheritedAllowedTargetTypes;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ 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 ? "" : 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("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
+ builder.append("AllowedSourceTypes=[");
+ for (CMISTypeDefinition type : getAllowedSourceTypes())
+ {
+ builder.append(type.getTypeId()).append(",");
+ }
+ builder.append("], ");
+ builder.append("AllowedTargetTypes=[");
+ for (CMISTypeDefinition type : getAllowedTargetTypes())
+ {
+ builder.append(type.getTypeId()).append(",");
+ }
+ builder.append("], ");
+ builder.append("SubTypes=").append(getSubTypes(false).size()).append(", ");
+ builder.append("Properties=").append(getPropertyDefinitions().size());
+ builder.append("]");
+ return builder.toString();
+ }
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISStrictDictionaryService.java b/source/java/org/alfresco/cmis/dictionary/CMISStrictDictionaryService.java
new file mode 100644
index 0000000000..97e55d7a07
--- /dev/null
+++ b/source/java/org/alfresco/cmis/dictionary/CMISStrictDictionaryService.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2005-20079 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.dictionary;
+
+import java.util.Collection;
+
+import org.alfresco.service.cmr.dictionary.AssociationDefinition;
+import org.alfresco.service.cmr.dictionary.ClassDefinition;
+import org.alfresco.service.namespace.QName;
+
+
+/**
+ * CMIS Dictionary which provides Types that strictly conform to the CMIS specification.
+ *
+ * That is, only maps types to one of root Document, Folder, Relationship & Policy.
+ *
+ * @author davidc
+ */
+public class CMISStrictDictionaryService extends AbstractCMISDictionaryService
+{
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.cmis.dictionary.AbstractCMISDictionaryService#createDefinitions(org.alfresco.cmis.dictionary.AbstractCMISDictionaryService.DictionaryRegistry)
+ */
+ @Override
+ protected void createDefinitions(DictionaryRegistry registry)
+ {
+ createTypeDefs(registry, dictionaryService.getAllTypes());
+ createAssocDefs(registry, dictionaryService.getAllAssociations());
+ createTypeDefs(registry, dictionaryService.getAllAspects());
+ }
+
+ /**
+ * Create Type Definitions
+ *
+ * @param registry
+ * @param classQNames
+ */
+ private void createTypeDefs(DictionaryRegistry registry, Collection classQNames)
+ {
+ for (QName classQName : classQNames)
+ {
+ // skip items that are remapped to CMIS model
+ if (cmisMapping.isRemappedType(classQName))
+ continue;
+
+ // skip all items that are not mapped to CMIS model
+ CMISTypeId typeId = cmisMapping.getCmisTypeId(classQName);
+ if (typeId == null)
+ continue;
+
+ // create appropriate kind of type definition
+ ClassDefinition classDef = dictionaryService.getClass(cmisMapping.getCmisType(typeId.getQName()));
+ CMISObjectTypeDefinition objectTypeDef = null;
+ if (typeId.getScope() == CMISScope.DOCUMENT)
+ {
+ objectTypeDef = new CMISDocumentTypeDefinition(cmisMapping, typeId, classDef);
+ }
+ else if (typeId.getScope() == CMISScope.FOLDER)
+ {
+ objectTypeDef = new CMISFolderTypeDefinition(cmisMapping, typeId, classDef);
+ }
+ else if (typeId.getScope() == CMISScope.RELATIONSHIP)
+ {
+ AssociationDefinition assocDef = dictionaryService.getAssociation(classQName);
+ objectTypeDef = new CMISRelationshipTypeDefinition(cmisMapping, typeId, classDef, assocDef);
+ }
+ else if (typeId.getScope() == CMISScope.POLICY)
+ {
+ objectTypeDef = new CMISPolicyTypeDefinition(cmisMapping, typeId, classDef);
+ }
+
+ registry.registerTypeDefinition(objectTypeDef);
+ }
+ }
+
+ /**
+ * Create Relationship Definitions
+ *
+ * @param registry
+ * @param classQNames
+ */
+ private void createAssocDefs(DictionaryRegistry registry, Collection classQNames)
+ {
+ for (QName classQName : classQNames)
+ {
+ if (!cmisMapping.isValidCmisRelationship(classQName))
+ continue;
+
+ // create appropriate kind of type definition
+ CMISTypeId typeId = cmisMapping.getCmisTypeId(CMISScope.RELATIONSHIP, classQName);
+ AssociationDefinition assocDef = dictionaryService.getAssociation(classQName);
+ CMISObjectTypeDefinition objectTypeDef = new CMISRelationshipTypeDefinition(cmisMapping, typeId, null, assocDef);
+
+ registry.registerTypeDefinition(objectTypeDef);
+ }
+ }
+
+}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISTypeDefinition.java
index b6377bedd4..17dc6437a8 100644
--- a/source/java/org/alfresco/cmis/dictionary/CMISTypeDefinition.java
+++ b/source/java/org/alfresco/cmis/dictionary/CMISTypeDefinition.java
@@ -22,249 +22,26 @@
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
-
package org.alfresco.cmis.dictionary;
-import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.List;
import java.util.Map;
import org.alfresco.cmis.CMISContentStreamAllowedEnum;
-import org.alfresco.model.ContentModel;
-import org.alfresco.service.cmr.dictionary.AspectDefinition;
-import org.alfresco.service.cmr.dictionary.AssociationDefinition;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.cmr.dictionary.TypeDefinition;
-import org.alfresco.service.namespace.QName;
/**
* The base type definition for CMIS
*
* @author andyh
*/
-public class CMISTypeDefinition implements Serializable
+public interface CMISTypeDefinition
{
- /**
- *
- */
- private static final long serialVersionUID = -2216695347624799934L;
-
- private CMISDictionaryService cmisDictionary;
-
- private CMISTypeId objectTypeId;
-
- private String objectTypeQueryName;
-
- private String displayName;
-
- private CMISTypeId parentTypeId;
-
- private String rootTypeQueryName;
-
- private String description;
-
- private boolean creatable;
-
- private boolean fileable;
-
- private boolean queryable;
-
- // TODO: Policy - report controllable true as policies can be applied
- private boolean controllable;
-
- private boolean versionable;
-
- private boolean includedInSupertypeQuery;
-
- private CMISContentStreamAllowedEnum contentStreamAllowed;
-
- private boolean isAssociation;
-
- private ArrayList allowedSourceTypes = new ArrayList(1);
-
- private ArrayList allowedTargetTypes = new ArrayList(1);
-
-
- /**
- * Construct
- *
- * @param cmisDictionary
- * @param typeId
- */
- public CMISTypeDefinition(CMISDictionaryService cmisDictionary, CMISTypeId typeId)
- {
- this.cmisDictionary = cmisDictionary;
- DictionaryService dictionaryService = this.cmisDictionary.getDictionaryService();
- CMISMapping cmisMapping = cmisDictionary.getCMISMapping();
-
- switch (typeId.getScope())
- {
- case RELATIONSHIP:
- AssociationDefinition associationDefinition = dictionaryService.getAssociation(typeId.getQName());
- if (associationDefinition != null)
- {
- objectTypeId = typeId;
- objectTypeQueryName = cmisMapping.getQueryName(typeId.getQName());
- displayName = (associationDefinition.getTitle() != null) ? associationDefinition.getTitle() : typeId.getTypeId();
- parentTypeId = CMISMapping.RELATIONSHIP_TYPE_ID;
- rootTypeQueryName = cmisMapping.getQueryName(CMISMapping.RELATIONSHIP_QNAME);
- description = associationDefinition.getDescription();
- creatable = false;
- fileable = false;
- queryable = false;
- controllable = false;
- versionable = false;
- includedInSupertypeQuery = true;
- contentStreamAllowed = CMISContentStreamAllowedEnum.NOT_ALLOWED;
- isAssociation = true;
-
- QName sourceType = cmisMapping.getCmisType(associationDefinition.getSourceClass().getName());
- if (cmisMapping.isValidCmisDocument(sourceType))
- {
- allowedSourceTypes.add(cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, sourceType));
- }
- else if (cmisMapping.isValidCmisFolder(sourceType))
- {
- allowedSourceTypes.add(cmisMapping.getCmisTypeId(CMISScope.FOLDER, sourceType));
- }
-
- QName targetType = cmisMapping.getCmisType(associationDefinition.getTargetClass().getName());
- if (cmisMapping.isValidCmisDocument(targetType))
- {
- allowedTargetTypes.add(cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, targetType));
- }
- else if (cmisMapping.isValidCmisFolder(targetType))
- {
- allowedTargetTypes.add(cmisMapping.getCmisTypeId(CMISScope.FOLDER, targetType));
- }
- }
- else
- {
- // TODO: Add CMIS Association mapping??
- TypeDefinition typeDefinition = dictionaryService.getType(typeId.getQName());
- objectTypeId = typeId;
- objectTypeQueryName = cmisMapping.getQueryName(typeId.getQName());
- displayName = (typeDefinition.getTitle() != null) ? typeDefinition.getTitle() : typeId.getTypeId();
- parentTypeId = null;
- rootTypeQueryName = cmisMapping.getQueryName(CMISMapping.RELATIONSHIP_QNAME);
- description = typeDefinition.getDescription();
- creatable = false;
- fileable = false;
- queryable = false;
- controllable = false;
- versionable = false;
- includedInSupertypeQuery = true;
- contentStreamAllowed = CMISContentStreamAllowedEnum.NOT_ALLOWED;
- isAssociation = true;
- }
- break;
- case DOCUMENT:
- case FOLDER:
- ClassDefinition typeDefinition = dictionaryService.getType(typeId.getQName());
- if (typeDefinition != null)
- {
- objectTypeId = typeId;
-
- objectTypeQueryName = cmisMapping.getQueryName(typeId.getQName());
-
- displayName = (typeDefinition.getTitle() != null) ? typeDefinition.getTitle() : typeId.getTypeId();
-
- QName parentTypeQName = cmisMapping.getCmisType(typeDefinition.getParentName());
- if (parentTypeQName == null)
- {
- // Core and unknown types
- parentTypeId = null;
- }
- else
- {
- if (cmisMapping.isValidCmisDocument(parentTypeQName))
- {
- parentTypeId = cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, parentTypeQName);
- }
- else if (cmisMapping.isValidCmisFolder(parentTypeQName))
- {
- parentTypeId = cmisMapping.getCmisTypeId(CMISScope.FOLDER, parentTypeQName);
- }
- }
-
- rootTypeQueryName = cmisMapping.getQueryName(typeId.getRootTypeId().getQName());
-
- description = typeDefinition.getDescription();
-
- creatable = true;
-
- fileable = true;
-
- queryable = true;
-
- controllable = false;
-
- versionable = false;
-
- includedInSupertypeQuery = true;
-
- if (typeId.getScope() == CMISScope.DOCUMENT)
- {
- List defaultAspects = typeDefinition.getDefaultAspects();
- for (AspectDefinition aspectDefinition : defaultAspects)
- {
- if (aspectDefinition.getName().equals(ContentModel.ASPECT_VERSIONABLE))
- {
- versionable = true;
- break;
- }
- }
- }
-
- if (typeId.getScope() == CMISScope.DOCUMENT)
- {
- contentStreamAllowed = CMISContentStreamAllowedEnum.ALLOWED;
- }
- else
- {
- contentStreamAllowed = CMISContentStreamAllowedEnum.NOT_ALLOWED;
- }
- }
-
- break;
- case POLICY:
- ClassDefinition classDefinition = dictionaryService.getType(typeId.getQName());
- if (classDefinition != null)
- {
- objectTypeId = typeId;
- objectTypeQueryName = cmisMapping.getQueryName(typeId.getQName());
- displayName = (classDefinition.getTitle() != null) ? classDefinition.getTitle() : typeId.getTypeId();
- parentTypeId = CMISMapping.POLICY_TYPE_ID;
- rootTypeQueryName = cmisMapping.getQueryName(CMISMapping.POLICY_QNAME);
- description = classDefinition.getDescription();
- creatable = false;
- fileable = false;
- queryable = false;
- controllable = false;
- versionable = false;
- includedInSupertypeQuery = true;
- contentStreamAllowed = CMISContentStreamAllowedEnum.NOT_ALLOWED;
- }
- break;
- case UNKNOWN:
- default:
- break;
- }
-
- }
-
/**
* Get the unique identifier for the type
*
* @return - the type id
*/
- public CMISTypeId getObjectTypeId()
- {
- return objectTypeId;
- }
+ public CMISTypeId getTypeId();
/**
* Get the table name used for queries against the type. This is also a unique identifier for the type. The string
@@ -273,80 +50,50 @@ public class CMISTypeDefinition implements Serializable
*
* @return the sql table name
*/
- public String getObjectTypeQueryName()
- {
- return objectTypeQueryName;
- }
+ public String getQueryName();
/**
* Get the display name for the type.
*
* @return - the display name
*/
- public String getObjectTypeDisplayName()
- {
- return displayName;
- }
+ public String getDisplayName();
/**
* Get the type id for the parent
*
* @return - the parent type id
*/
- public CMISTypeId getParentTypeId()
- {
- return parentTypeId;
- }
+ public CMISTypeDefinition getParentType();
+ public Collection getSubTypes(boolean descendants);
+
/**
* Get the root type id
* @return - the root type id
*/
- public CMISTypeId getRootTypeId()
- {
- return objectTypeId.getRootTypeId();
- }
+ public CMISTypeDefinition getRootType();
- /**
- * Get the sql table name for the root type of this type This will be getObjectTypeQueryName() for the base folder,
- * document or association
- *
- * @return - the sql table name for the root type
- */
- public String getRootTypeQueryName()
- {
- return rootTypeQueryName;
- }
-
/**
* Get the description for the type
*
* @return - the description
*/
- public String getDescription()
- {
- return description;
- }
+ public String getDescription();
/**
* Can objects of this type be created?
*
* @return
*/
- public boolean isCreatable()
- {
- return creatable;
- }
+ public boolean isCreatable();
/**
* Are objects of this type fileable?
*
* @return
*/
- public boolean isFileable()
- {
- return fileable;
- }
+ public boolean isFileable();
/**
* Is this type queryable? If not, the type may not appear in the FROM clause of a query. This property of the type
@@ -354,112 +101,55 @@ public class CMISTypeDefinition implements Serializable
*
* @return true if queryable
*/
- public boolean isQueryable()
- {
- return queryable;
- }
+ public boolean isQueryable();
/**
* Are objects of this type controllable.
*
* @return
*/
- public boolean isControllable()
- {
- return controllable;
- }
+ public boolean isControllable();
/**
* Are objects of this type included in super type queries
*
* @return
*/
- public boolean isIncludedInSupertypeQuery()
- {
- return includedInSupertypeQuery;
- }
+ public boolean isIncludeInSuperTypeQuery();
/**
* Is this type versionable? If true this implies all instances of the type are versionable.
*
* @return true if versionable
*/
- public boolean isVersionable()
- {
- return versionable;
- }
+ public boolean isVersionable();
/**
* Is a content stream allowed for this type? It may be disallowed, optional or mandatory.
*
* @return
*/
- public CMISContentStreamAllowedEnum getContentStreamAllowed()
- {
- return contentStreamAllowed;
- }
-
- /**
- * Is this an association type?
- *
- * @return true for an association type.
- */
- public boolean isAssociation()
- {
- return isAssociation;
- }
+ public CMISContentStreamAllowedEnum getContentStreamAllowed();
/**
* For an association, get the collection of valid source types. For non-associations the collection will be empty.
*
* @return
*/
- public Collection getAllowedSourceTypes()
- {
- return allowedSourceTypes;
- }
+ public Collection getAllowedSourceTypes();
/**
* For an association, get the collection of valid target types. For non-associations the collection will be empty.
*
* @return
*/
- public Collection getAllowedTargetTypes()
- {
- return allowedTargetTypes;
- }
+ public Collection getAllowedTargetTypes();
/**
* Gets the property definitions for this type
*
* @return property definitions
*/
- public Map getPropertyDefinitions()
- {
- return cmisDictionary.getPropertyDefinitions(objectTypeId);
- }
-
-
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append("CMISTypeDefinition[");
- builder.append("ObjectTypeId=").append(getObjectTypeId()).append(", ");
- builder.append("ObjectTypeQueryName=").append(getObjectTypeQueryName()).append(", ");
- builder.append("ObjectTypeDisplayName=").append(getObjectTypeDisplayName()).append(", ");
- builder.append("ParentTypeId=").append(getParentTypeId()).append(", ");
- builder.append("RootTypeQueryName=").append(getRootTypeQueryName()).append(", ");
- builder.append("Description=").append(getDescription()).append(", ");
- builder.append("Creatable=").append(isCreatable()).append(", ");
- builder.append("Fileable=").append(isFileable()).append(", ");
- builder.append("Queryable=").append(isQueryable()).append(", ");
- builder.append("Controllable=").append(isControllable()).append(", ");
- builder.append("Versionable=").append(isVersionable()).append(", ");
- builder.append("ContentStreamAllowed=").append(getContentStreamAllowed()).append(", ");
- builder.append("IsAssociation=").append(isAssociation()).append(", ");
- builder.append("AllowedSourceTypes=").append(getAllowedSourceTypes()).append(", ");
- builder.append("AllowedTargetTypes=").append(getAllowedTargetTypes());
- builder.append("]");
- return builder.toString();
- }
+ public Map getPropertyDefinitions();
+
}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISTypeId.java b/source/java/org/alfresco/cmis/dictionary/CMISTypeId.java
index 34dee0ab68..f57369e7e0 100644
--- a/source/java/org/alfresco/cmis/dictionary/CMISTypeId.java
+++ b/source/java/org/alfresco/cmis/dictionary/CMISTypeId.java
@@ -29,49 +29,42 @@ import java.io.Serializable;
import org.alfresco.service.namespace.QName;
/**
- * A CMIS property type id
+ * CMIS Type Id
*
* @author andyh
*
*/
public class CMISTypeId implements Serializable
{
- /**
- *
- */
private static final long serialVersionUID = -4709046883083948302L;
private String typeId;
-
private CMISScope scope;
-
private QName qName;
- public CMISTypeId(CMISScope scope, QName qName, String typeId)
+ /**
+ * Construct
+ *
+ * @param scope
+ * @param typeId
+ * @param qName
+ */
+ public CMISTypeId(CMISScope scope, String typeId, QName qName)
{
this.scope = scope;
- this.qName = qName;
this.typeId = typeId;
+ this.qName = qName;
}
/**
* Get the CMIS type id string
* @return
*/
- public String getTypeId()
+ public String getId()
{
return typeId;
}
- /**
- * Get the Alfresco model QName associated with the type
- * @return
- */
- public QName getQName()
- {
- return qName;
- }
-
/**
* Get the scope for the type (Doc, Folder, Relationship or unknown)
* @return
@@ -81,6 +74,16 @@ public class CMISTypeId implements Serializable
return scope;
}
+ /**
+ * Get the Alfresco model QName associated with the type
+ *
+ * @return alfresco QName
+ */
+ public QName getQName()
+ {
+ return qName;
+ }
+
/**
* Get the root type id
* @return
@@ -90,13 +93,13 @@ public class CMISTypeId implements Serializable
switch (scope)
{
case DOCUMENT:
- return CMISMapping.DOCUMENT_TYPE_ID;
+ return CMISDictionaryModel.DOCUMENT_TYPE_ID;
case FOLDER:
- return CMISMapping.FOLDER_TYPE_ID;
+ return CMISDictionaryModel.FOLDER_TYPE_ID;
case RELATIONSHIP:
- return CMISMapping.RELATIONSHIP_TYPE_ID;
+ return CMISDictionaryModel.RELATIONSHIP_TYPE_ID;
case POLICY:
- return CMISMapping.POLICY_TYPE_ID;
+ return CMISDictionaryModel.POLICY_TYPE_ID;
case UNKNOWN:
default:
return null;
@@ -105,7 +108,7 @@ public class CMISTypeId implements Serializable
public String toString()
{
- return getTypeId();
+ return getId();
}
@Override
diff --git a/source/java/org/alfresco/cmis/property/CMISPropertyServiceImpl.java b/source/java/org/alfresco/cmis/property/CMISPropertyServiceImpl.java
index 2fc8d55f7e..23a6078ae0 100644
--- a/source/java/org/alfresco/cmis/property/CMISPropertyServiceImpl.java
+++ b/source/java/org/alfresco/cmis/property/CMISPropertyServiceImpl.java
@@ -32,6 +32,7 @@ import java.util.Map;
import org.alfresco.cmis.CMISContentStreamAllowedEnum;
import org.alfresco.cmis.CMISService;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.error.AlfrescoRuntimeException;
@@ -257,37 +258,37 @@ public class CMISPropertyServiceImpl implements CMISPropertyService, Initializin
// CMIS Object
addNamedPropertyAccessor(getObjectIdPropertyAccessor());
- addNamedPropertyAccessor(getFixedValuePropertyAccessor(CMISMapping.PROP_URI, null, CMISScope.OBJECT));
+ addNamedPropertyAccessor(getFixedValuePropertyAccessor(CMISDictionaryModel.PROP_URI, null, CMISScope.OBJECT));
addNamedPropertyAccessor(getObjectTypeIdPropertyAccessor());
- addNamedPropertyAccessor(getSimplePropertyAccessor(CMISMapping.PROP_CREATED_BY, ContentModel.PROP_CREATOR, CMISScope.OBJECT));
- addNamedPropertyAccessor(getSimplePropertyAccessor(CMISMapping.PROP_CREATION_DATE, ContentModel.PROP_CREATED, CMISScope.OBJECT));
- addNamedPropertyAccessor(getSimplePropertyAccessor(CMISMapping.PROP_LAST_MODIFIED_BY, ContentModel.PROP_MODIFIER, CMISScope.OBJECT));
- addNamedPropertyAccessor(getSimplePropertyAccessor(CMISMapping.PROP_LAST_MODIFICATION_DATE, ContentModel.PROP_MODIFIED, CMISScope.OBJECT));
- addNamedPropertyAccessor(getFixedValuePropertyAccessor(CMISMapping.PROP_CHANGE_TOKEN, null, CMISScope.OBJECT));
+ addNamedPropertyAccessor(getSimplePropertyAccessor(CMISDictionaryModel.PROP_CREATED_BY, ContentModel.PROP_CREATOR, CMISScope.OBJECT));
+ addNamedPropertyAccessor(getSimplePropertyAccessor(CMISDictionaryModel.PROP_CREATION_DATE, ContentModel.PROP_CREATED, CMISScope.OBJECT));
+ addNamedPropertyAccessor(getSimplePropertyAccessor(CMISDictionaryModel.PROP_LAST_MODIFIED_BY, ContentModel.PROP_MODIFIER, CMISScope.OBJECT));
+ addNamedPropertyAccessor(getSimplePropertyAccessor(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE, ContentModel.PROP_MODIFIED, CMISScope.OBJECT));
+ addNamedPropertyAccessor(getFixedValuePropertyAccessor(CMISDictionaryModel.PROP_CHANGE_TOKEN, null, CMISScope.OBJECT));
// CMIS Document and Folder
- addNamedPropertyAccessor(getSimplePropertyAccessor(CMISMapping.PROP_NAME, ContentModel.PROP_NAME, CMISScope.OBJECT));
+ addNamedPropertyAccessor(getSimplePropertyAccessor(CMISDictionaryModel.PROP_NAME, ContentModel.PROP_NAME, CMISScope.OBJECT));
// CMIS Document
addNamedPropertyAccessor(getIsImmutablePropertyAccessor());
addNamedPropertyAccessor(getIsLatestVersionPropertyAccessor());
addNamedPropertyAccessor(getIsMajorVersionPropertyAccessor());
addNamedPropertyAccessor(getIsLatestMajorVersionPropertyAccessor());
- addNamedPropertyAccessor(getSimplePropertyAccessor(CMISMapping.PROP_VERSION_LABEL, ContentModel.PROP_VERSION_LABEL, CMISScope.DOCUMENT));
+ addNamedPropertyAccessor(getSimplePropertyAccessor(CMISDictionaryModel.PROP_VERSION_LABEL, ContentModel.PROP_VERSION_LABEL, CMISScope.DOCUMENT));
addNamedPropertyAccessor(getVersionSeriesIdPropertyAccessor());
addNamedPropertyAccessor(getVersionSeriesIsCheckedOutPropertyAccessor());
addNamedPropertyAccessor(getVersionSeriesCheckedOutByPropertyAccessor());
addNamedPropertyAccessor(getVersionSeriesCheckedOutIdPropertyAccessor());
addNamedPropertyAccessor(getCheckinCommentPropertyAccessor());
- addNamedPropertyAccessor(getFixedValuePropertyAccessor(CMISMapping.PROP_CONTENT_STREAM_ALLOWED, CMISContentStreamAllowedEnum.ALLOWED.toString(), CMISScope.DOCUMENT));
+ addNamedPropertyAccessor(getFixedValuePropertyAccessor(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED, CMISContentStreamAllowedEnum.ALLOWED.toString(), CMISScope.DOCUMENT));
addNamedPropertyAccessor(getContentStreamLengthPropertyAccessor());
addNamedPropertyAccessor(getContentStreamMimetypePropertyAccessor());
- addNamedPropertyAccessor(getSimplePropertyAccessor(CMISMapping.PROP_CONTENT_STREAM_FILENAME, ContentModel.PROP_NAME, CMISScope.DOCUMENT));
+ addNamedPropertyAccessor(getSimplePropertyAccessor(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME, ContentModel.PROP_NAME, CMISScope.DOCUMENT));
addNamedPropertyAccessor(getContentStreamUriPropertyAccessor());
// CMIS Folder
addNamedPropertyAccessor(getParentPropertyAccessor());
- addNamedPropertyAccessor(getFixedValuePropertyAccessor(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS, null, CMISScope.FOLDER));
+ addNamedPropertyAccessor(getFixedValuePropertyAccessor(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS, null, CMISScope.FOLDER));
}
public void addNamedPropertyAccessor(NamedPropertyAccessor namedPropertyAccessor)
diff --git a/source/java/org/alfresco/cmis/property/CMISPropertyServiceTest.java b/source/java/org/alfresco/cmis/property/CMISPropertyServiceTest.java
index 67b1bc83e8..6b6f7d80eb 100644
--- a/source/java/org/alfresco/cmis/property/CMISPropertyServiceTest.java
+++ b/source/java/org/alfresco/cmis/property/CMISPropertyServiceTest.java
@@ -31,7 +31,7 @@ import java.util.Map;
import org.alfresco.cmis.CMISContentStreamAllowedEnum;
import org.alfresco.cmis.dictionary.BaseCMISTest;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.cmr.lock.LockType;
@@ -47,35 +47,35 @@ public class CMISPropertyServiceTest extends BaseCMISTest
{
NodeRef folder = fileFolderService.create(rootNodeRef, "BaseFolder", ContentModel.TYPE_FOLDER).getNodeRef();
Map properties = cmisPropertyService.getProperties(folder);
- assertEquals(folder.toString(), properties.get(CMISMapping.PROP_OBJECT_ID));
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(CMISMapping.FOLDER_TYPE_ID.getTypeId(), properties.get(CMISMapping.PROP_OBJECT_TYPE_ID));
- assertEquals(authenticationComponent.getCurrentUserName(), properties.get(CMISMapping.PROP_CREATED_BY));
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(authenticationComponent.getCurrentUserName(), properties.get(CMISMapping.PROP_LAST_MODIFIED_BY));
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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(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));
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals("BaseFolder", properties.get(CMISMapping.PROP_NAME));
+ assertEquals("BaseFolder", properties.get(CMISDictionaryModel.PROP_NAME));
- assertNull(properties.get(CMISMapping.PROP_IS_IMMUTABLE));
- assertNull(properties.get(CMISMapping.PROP_IS_LATEST_VERSION));
- assertNull(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION));
- assertNull(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION));
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertNull(properties.get(CMISMapping.PROP_VERSION_SERIES_ID));
- assertNull(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
- assertNull(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY));
- assertNull(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID));
- assertNull(properties.get(CMISMapping.PROP_CHECKIN_COMMENT));
- assertNull(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED));
- assertNull(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH));
- assertNull(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE));
- assertNull(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME));
- assertNull(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI));
+ assertNull(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION));
+ assertNull(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION));
+ assertNull(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION));
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
+ 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));
- assertEquals(rootNodeRef.toString(), properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertEquals(rootNodeRef.toString(), properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
}
@@ -90,34 +90,34 @@ public class CMISPropertyServiceTest extends BaseCMISTest
NodeRef content = fileFolderService.create(rootNodeRef, "BaseContent", ContentModel.TYPE_CONTENT).getNodeRef();
Map properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
}
public void testContentProperties()
@@ -125,35 +125,35 @@ public class CMISPropertyServiceTest extends BaseCMISTest
NodeRef content = fileFolderService.create(rootNodeRef, "BaseContent", ContentModel.TYPE_CONTENT).getNodeRef();
Map properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
ContentData contentData = new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK);
@@ -167,11 +167,11 @@ public class CMISPropertyServiceTest extends BaseCMISTest
long size = writer.getSize();
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), size);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "text/plain");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(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));
}
public void testLock()
@@ -179,82 +179,82 @@ public class CMISPropertyServiceTest extends BaseCMISTest
NodeRef content = fileFolderService.create(rootNodeRef, "BaseContent", ContentModel.TYPE_CONTENT).getNodeRef();
Map properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
serviceRegistry.getLockService().lock(content, LockType.READ_ONLY_LOCK);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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);
serviceRegistry.getLockService().unlock(content);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
}
@@ -263,193 +263,193 @@ public class CMISPropertyServiceTest extends BaseCMISTest
NodeRef content = fileFolderService.create(rootNodeRef, "BaseContent", ContentModel.TYPE_CONTENT).getNodeRef();
Map properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
NodeRef pwc = serviceRegistry.getCheckOutCheckInService().checkout(content);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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);
properties = cmisPropertyService.getProperties(pwc);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), pwc.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent (Working Copy)");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
serviceRegistry.getCheckOutCheckInService().cancelCheckout(pwc);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
pwc = serviceRegistry.getCheckOutCheckInService().checkout(content);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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);
properties = cmisPropertyService.getProperties(pwc);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), pwc.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent (Working Copy)");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
serviceRegistry.getCheckOutCheckInService().checkin(pwc, null);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
}
@@ -458,193 +458,193 @@ public class CMISPropertyServiceTest extends BaseCMISTest
NodeRef content = fileFolderService.create(rootNodeRef, "BaseContent", ContentModel.TYPE_CONTENT).getNodeRef();
Map properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
nodeService.addAspect(content, ContentModel.ASPECT_VERSIONABLE, null);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
NodeRef pwc = serviceRegistry.getCheckOutCheckInService().checkout(content);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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);
properties = cmisPropertyService.getProperties(pwc);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), pwc.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent (Working Copy)");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
serviceRegistry.getCheckOutCheckInService().cancelCheckout(pwc);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
pwc = serviceRegistry.getCheckOutCheckInService().checkout(content);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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);
properties = cmisPropertyService.getProperties(pwc);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), pwc.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent (Working Copy)");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
Map versionProperties = new HashMap();
versionProperties.put(Version.PROP_DESCRIPTION, "Meep");
@@ -652,81 +652,81 @@ public class CMISPropertyServiceTest extends BaseCMISTest
serviceRegistry.getCheckOutCheckInService().checkin(pwc, versionProperties);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString()+"/1.0");
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_LABEL), "1.0");
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), "Meep");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL), "1.0");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
pwc = serviceRegistry.getCheckOutCheckInService().checkout(content);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_LABEL), "1.0");
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), "Meep");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL), "1.0");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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), "Meep");
properties = cmisPropertyService.getProperties(pwc);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), pwc.toString());
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent (Working Copy)");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertNull(properties.get(CMISMapping.PROP_VERSION_LABEL));
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), authenticationComponent.getCurrentUserName());
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), pwc.toString());
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), null);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent (Working Copy)");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(pwc));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertNull(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), true);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
versionProperties = new HashMap();
versionProperties.put(Version.PROP_DESCRIPTION, "Woof");
@@ -734,69 +734,69 @@ public class CMISPropertyServiceTest extends BaseCMISTest
serviceRegistry.getCheckOutCheckInService().checkin(pwc, versionProperties);
properties = cmisPropertyService.getProperties(content);
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_ID), content.toString()+"/1.1");
- assertNull(properties.get(CMISMapping.PROP_URI));
- assertEquals(properties.get(CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.DOCUMENT_TYPE_ID.getTypeId());
- assertEquals(properties.get(CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_CREATION_DATE));
- assertEquals(properties.get(CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(properties.get(CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(properties.get(CMISMapping.PROP_CHANGE_TOKEN));
+ 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_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(properties.get(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(properties.get(CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(properties.get(CMISMapping.PROP_NAME), "BaseContent");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_NAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_IS_IMMUTABLE), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_VERSION), true);
- assertEquals(properties.get(CMISMapping.PROP_IS_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_LABEL), "1.1");
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_ID), content.toString());
- assertEquals(properties.get(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY), null);
- assertEquals(properties.get(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID), null);
- assertEquals(properties.get(CMISMapping.PROP_CHECKIN_COMMENT), "Woof");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_ALLOWED), CMISContentStreamAllowedEnum.ALLOWED.toString());
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_LENGTH), 0L);
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE), "application/octet-stream");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_FILENAME), "BaseContent");
- assertEquals(properties.get(CMISMapping.PROP_CONTENT_STREAM_URI), createContentUri(content));
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_IMMUTABLE), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_VERSION), true);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION), false);
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_LABEL), "1.1");
+ assertEquals(properties.get(CMISDictionaryModel.PROP_VERSION_SERIES_ID), content.toString());
+ assertEquals(properties.get(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT), false);
+ 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));
- assertNull(properties.get(CMISMapping.PROP_PARENT_ID));
- assertNull(properties.get(CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertNull(properties.get(CMISDictionaryModel.PROP_PARENT_ID));
+ assertNull(properties.get(CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
}
public void testSinglePropertyFolderAccess()
{
NodeRef folder = fileFolderService.create(rootNodeRef, "BaseFolder", ContentModel.TYPE_FOLDER).getNodeRef();
- assertEquals(cmisPropertyService.getProperty(folder, CMISMapping.PROP_OBJECT_ID), folder.toString());
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_URI));
- assertEquals(cmisPropertyService.getProperty(folder, CMISMapping.PROP_OBJECT_TYPE_ID), CMISMapping.FOLDER_TYPE_ID.getTypeId());
- assertEquals(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CREATION_DATE));
- assertEquals(cmisPropertyService.getProperty(folder, CMISMapping.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
- assertNotNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_LAST_MODIFICATION_DATE));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CHANGE_TOKEN));
+ assertEquals(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_OBJECT_ID), folder.toString());
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_URI));
+ assertEquals(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_OBJECT_TYPE_ID), CMISDictionaryModel.FOLDER_TYPE_ID.getId());
+ assertEquals(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CREATED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CREATION_DATE));
+ assertEquals(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_LAST_MODIFIED_BY), authenticationComponent.getCurrentUserName());
+ assertNotNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CHANGE_TOKEN));
- assertEquals(cmisPropertyService.getProperty(folder, CMISMapping.PROP_NAME), "BaseFolder");
+ assertEquals(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_NAME), "BaseFolder");
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_IS_IMMUTABLE));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_IS_LATEST_VERSION));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_IS_MAJOR_VERSION));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_IS_LATEST_MAJOR_VERSION));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_VERSION_LABEL));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_VERSION_SERIES_ID));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CHECKIN_COMMENT));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CONTENT_STREAM_ALLOWED));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CONTENT_STREAM_LENGTH));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CONTENT_STREAM_FILENAME));
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_CONTENT_STREAM_URI));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_IS_IMMUTABLE));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_IS_LATEST_VERSION));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_IS_MAJOR_VERSION));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_VERSION_LABEL));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_VERSION_SERIES_ID));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CHECKIN_COMMENT));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME));
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_CONTENT_STREAM_URI));
- assertEquals(cmisPropertyService.getProperty(folder, CMISMapping.PROP_PARENT_ID), rootNodeRef.toString());
- assertNull(cmisPropertyService.getProperty(folder, CMISMapping.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
+ assertEquals(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_PARENT_ID), rootNodeRef.toString());
+ assertNull(cmisPropertyService.getProperty(folder, CMISDictionaryModel.PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS));
assertEquals(cmisPropertyService.getProperty(folder, "CM_NAME"), "BaseFolder");
assertEquals(cmisPropertyService.getProperty(folder, "cm_name"), "BaseFolder");
diff --git a/source/java/org/alfresco/cmis/property/CheckinCommentPropertyAccessor.java b/source/java/org/alfresco/cmis/property/CheckinCommentPropertyAccessor.java
index 2fd1c3c648..fa90857fbd 100644
--- a/source/java/org/alfresco/cmis/property/CheckinCommentPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/CheckinCommentPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
@@ -45,7 +46,7 @@ public class CheckinCommentPropertyAccessor extends AbstractNamedPropertyAccesso
{
protected CheckinCommentPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_CHECKIN_COMMENT);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_CHECKIN_COMMENT);
}
diff --git a/source/java/org/alfresco/cmis/property/ContentStreamLengthPropertyAccessor.java b/source/java/org/alfresco/cmis/property/ContentStreamLengthPropertyAccessor.java
index 6b40951f5f..9ba8b3d57a 100644
--- a/source/java/org/alfresco/cmis/property/ContentStreamLengthPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/ContentStreamLengthPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -55,7 +56,7 @@ public class ContentStreamLengthPropertyAccessor extends AbstractNamedPropertyAc
protected ContentStreamLengthPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_CONTENT_STREAM_LENGTH);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/ContentStreamMimetypePropertyAccessor.java b/source/java/org/alfresco/cmis/property/ContentStreamMimetypePropertyAccessor.java
index ebc3abaa6c..00d71463cc 100644
--- a/source/java/org/alfresco/cmis/property/ContentStreamMimetypePropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/ContentStreamMimetypePropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -55,7 +56,7 @@ public class ContentStreamMimetypePropertyAccessor extends AbstractNamedProperty
protected ContentStreamMimetypePropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/ContentStreamUriPropertyAccessor.java b/source/java/org/alfresco/cmis/property/ContentStreamUriPropertyAccessor.java
index 99be25f6c7..ec76040754 100644
--- a/source/java/org/alfresco/cmis/property/ContentStreamUriPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/ContentStreamUriPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -47,7 +48,7 @@ public class ContentStreamUriPropertyAccessor extends AbstractNamedPropertyAcces
protected ContentStreamUriPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_CONTENT_STREAM_URI);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_CONTENT_STREAM_URI);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/IsImmutablePropertyAccessor.java b/source/java/org/alfresco/cmis/property/IsImmutablePropertyAccessor.java
index 06960e450c..5b143a09fd 100644
--- a/source/java/org/alfresco/cmis/property/IsImmutablePropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/IsImmutablePropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -49,7 +50,7 @@ public class IsImmutablePropertyAccessor extends AbstractNamedPropertyAccessor
protected IsImmutablePropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_IMMUTABLE);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_IS_IMMUTABLE);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/IsLatestMajorVersionPropertyAccessor.java b/source/java/org/alfresco/cmis/property/IsLatestMajorVersionPropertyAccessor.java
index 4e2fede877..d89fc4336c 100644
--- a/source/java/org/alfresco/cmis/property/IsLatestMajorVersionPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/IsLatestMajorVersionPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -49,7 +50,7 @@ public class IsLatestMajorVersionPropertyAccessor extends AbstractNamedPropertyA
protected IsLatestMajorVersionPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_LATEST_MAJOR_VERSION);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/IsLatestVersionPropertyAccessor.java b/source/java/org/alfresco/cmis/property/IsLatestVersionPropertyAccessor.java
index b20f1f529a..f19c97483e 100644
--- a/source/java/org/alfresco/cmis/property/IsLatestVersionPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/IsLatestVersionPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -47,7 +48,7 @@ public class IsLatestVersionPropertyAccessor extends AbstractNamedPropertyAccess
protected IsLatestVersionPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_LATEST_VERSION);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_IS_LATEST_VERSION);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/IsMajorVersionPropertyAccessor.java b/source/java/org/alfresco/cmis/property/IsMajorVersionPropertyAccessor.java
index 1725e1eb3f..48362f1c09 100644
--- a/source/java/org/alfresco/cmis/property/IsMajorVersionPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/IsMajorVersionPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -49,7 +50,7 @@ public class IsMajorVersionPropertyAccessor extends AbstractNamedPropertyAccesso
protected IsMajorVersionPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_MAJOR_VERSION);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_IS_MAJOR_VERSION);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/IsVersionSeriesCheckedOutPropertyAccessor.java b/source/java/org/alfresco/cmis/property/IsVersionSeriesCheckedOutPropertyAccessor.java
index 4d1aab8f33..4e455376f2 100644
--- a/source/java/org/alfresco/cmis/property/IsVersionSeriesCheckedOutPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/IsVersionSeriesCheckedOutPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -48,7 +49,7 @@ public class IsVersionSeriesCheckedOutPropertyAccessor extends AbstractNamedProp
protected IsVersionSeriesCheckedOutPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/ObjectIdPropertyAccessor.java b/source/java/org/alfresco/cmis/property/ObjectIdPropertyAccessor.java
index 9d3d8798f6..ef4dd02c09 100644
--- a/source/java/org/alfresco/cmis/property/ObjectIdPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/ObjectIdPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.cmis.search.CMISQueryException;
@@ -55,7 +56,7 @@ public class ObjectIdPropertyAccessor extends AbstractNamedPropertyAccessor
protected ObjectIdPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.OBJECT, CMISMapping.PROP_OBJECT_ID);
+ super(cmisMapping, serviceRegistry, CMISScope.OBJECT, CMISDictionaryModel.PROP_OBJECT_ID);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/ObjectTypeIdPropertyAccessor.java b/source/java/org/alfresco/cmis/property/ObjectTypeIdPropertyAccessor.java
index 09e242197d..2f2bd8a6d1 100644
--- a/source/java/org/alfresco/cmis/property/ObjectTypeIdPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/ObjectTypeIdPropertyAccessor.java
@@ -28,6 +28,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.cmis.dictionary.CMISTypeId;
@@ -55,7 +56,7 @@ public class ObjectTypeIdPropertyAccessor extends AbstractNamedPropertyAccessor
{
protected ObjectTypeIdPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.OBJECT, CMISMapping.PROP_OBJECT_TYPE_ID);
+ super(cmisMapping, serviceRegistry, CMISScope.OBJECT, CMISDictionaryModel.PROP_OBJECT_TYPE_ID);
}
public Serializable getProperty(NodeRef nodeRef)
@@ -74,7 +75,7 @@ public class ObjectTypeIdPropertyAccessor extends AbstractNamedPropertyAccessor
{
scope = CMISScope.UNKNOWN;
}
- return getCMISMapping().getCmisTypeId(scope, typeQName).getTypeId();
+ return getCMISMapping().getCmisTypeId(scope, typeQName).getId();
}
public void setProperty(NodeRef nodeRef, Serializable value)
diff --git a/source/java/org/alfresco/cmis/property/ParentPropertyAccessor.java b/source/java/org/alfresco/cmis/property/ParentPropertyAccessor.java
index 72ddaaca29..67f9bfe9b6 100644
--- a/source/java/org/alfresco/cmis/property/ParentPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/ParentPropertyAccessor.java
@@ -28,6 +28,7 @@ import java.io.Serializable;
import java.util.Collection;
import org.alfresco.cmis.CMISService;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
@@ -57,7 +58,7 @@ public class ParentPropertyAccessor extends AbstractNamedPropertyAccessor
protected ParentPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, CMISService cmisService)
{
- super(cmisMapping, serviceRegistry, CMISScope.FOLDER, CMISMapping.PROP_PARENT_ID);
+ super(cmisMapping, serviceRegistry, CMISScope.FOLDER, CMISDictionaryModel.PROP_PARENT_ID);
this.cmisService = cmisService;
}
diff --git a/source/java/org/alfresco/cmis/property/VersionSeriesCheckedOutByPropertyAccessor.java b/source/java/org/alfresco/cmis/property/VersionSeriesCheckedOutByPropertyAccessor.java
index 9cb918cf10..6383c2e56c 100644
--- a/source/java/org/alfresco/cmis/property/VersionSeriesCheckedOutByPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/VersionSeriesCheckedOutByPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -48,7 +49,7 @@ public class VersionSeriesCheckedOutByPropertyAccessor extends AbstractNamedProp
protected VersionSeriesCheckedOutByPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/VersionSeriesCheckedOutIdPropertyAccessor.java b/source/java/org/alfresco/cmis/property/VersionSeriesCheckedOutIdPropertyAccessor.java
index 89f448912e..e4f46c28f9 100644
--- a/source/java/org/alfresco/cmis/property/VersionSeriesCheckedOutIdPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/VersionSeriesCheckedOutIdPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -47,7 +48,7 @@ public class VersionSeriesCheckedOutIdPropertyAccessor extends AbstractNamedProp
{
protected VersionSeriesCheckedOutIdPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID);
}
public Serializable getProperty(NodeRef nodeRef)
diff --git a/source/java/org/alfresco/cmis/property/VersionSeriesIdPropertyAccessor.java b/source/java/org/alfresco/cmis/property/VersionSeriesIdPropertyAccessor.java
index 911cb37cc2..2ad9939486 100644
--- a/source/java/org/alfresco/cmis/property/VersionSeriesIdPropertyAccessor.java
+++ b/source/java/org/alfresco/cmis/property/VersionSeriesIdPropertyAccessor.java
@@ -27,6 +27,7 @@ package org.alfresco.cmis.property;
import java.io.Serializable;
import java.util.Collection;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.model.ContentModel;
@@ -44,7 +45,7 @@ public class VersionSeriesIdPropertyAccessor extends AbstractNamedPropertyAccess
{
protected VersionSeriesIdPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
{
- super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_VERSION_SERIES_ID);
+ super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISDictionaryModel.PROP_VERSION_SERIES_ID);
}
/*
diff --git a/source/java/org/alfresco/cmis/search/CMISResultSetColumn.java b/source/java/org/alfresco/cmis/search/CMISResultSetColumn.java
index 84a6e5a7cc..b66e3b9209 100644
--- a/source/java/org/alfresco/cmis/search/CMISResultSetColumn.java
+++ b/source/java/org/alfresco/cmis/search/CMISResultSetColumn.java
@@ -24,7 +24,7 @@
*/
package org.alfresco.cmis.search;
-import org.alfresco.cmis.CMISPropertyTypeEnum;
+import org.alfresco.cmis.CMISDataTypeEnum;
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
/**
@@ -51,5 +51,5 @@ public interface CMISResultSetColumn
* The type of the column
* @return - the CMIS type for the column
*/
- public CMISPropertyTypeEnum getPropertyType();
+ public CMISDataTypeEnum getPropertyType();
}
diff --git a/source/java/org/alfresco/cmis/search/CMISResultSetColumnImpl.java b/source/java/org/alfresco/cmis/search/CMISResultSetColumnImpl.java
index 622996d14e..6583f86791 100644
--- a/source/java/org/alfresco/cmis/search/CMISResultSetColumnImpl.java
+++ b/source/java/org/alfresco/cmis/search/CMISResultSetColumnImpl.java
@@ -24,7 +24,7 @@
*/
package org.alfresco.cmis.search;
-import org.alfresco.cmis.CMISPropertyTypeEnum;
+import org.alfresco.cmis.CMISDataTypeEnum;
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
/**
@@ -38,9 +38,9 @@ public class CMISResultSetColumnImpl implements CMISResultSetColumn
private CMISPropertyDefinition propertyDefinition;
- private CMISPropertyTypeEnum propertyType;
+ private CMISDataTypeEnum propertyType;
- CMISResultSetColumnImpl(String name, CMISPropertyDefinition propertyDefinition, CMISPropertyTypeEnum propertyType)
+ CMISResultSetColumnImpl(String name, CMISPropertyDefinition propertyDefinition, CMISDataTypeEnum propertyType)
{
this.name = name;
this.propertyDefinition = propertyDefinition;
@@ -67,7 +67,7 @@ public class CMISResultSetColumnImpl implements CMISResultSetColumn
/* (non-Javadoc)
* @see org.alfresco.cmis.search.CMISResultSetColumn#getPropertyType()
*/
- public CMISPropertyTypeEnum getPropertyType()
+ public CMISDataTypeEnum getPropertyType()
{
return propertyType;
}
diff --git a/source/java/org/alfresco/cmis/search/CMISResultSetMetaDataImpl.java b/source/java/org/alfresco/cmis/search/CMISResultSetMetaDataImpl.java
index af87b6bc67..12b2ac7822 100644
--- a/source/java/org/alfresco/cmis/search/CMISResultSetMetaDataImpl.java
+++ b/source/java/org/alfresco/cmis/search/CMISResultSetMetaDataImpl.java
@@ -28,10 +28,12 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.alfresco.cmis.CMISPropertyTypeEnum;
+import org.alfresco.cmis.CMISDataTypeEnum;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
+import org.alfresco.cmis.dictionary.CMISPropertyId;
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
+import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.repo.search.impl.querymodel.Column;
import org.alfresco.repo.search.impl.querymodel.PropertyArgument;
import org.alfresco.repo.search.impl.querymodel.Query;
@@ -63,7 +65,8 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
selectorMetaData = new LinkedHashMap();
for(Selector selector : selectors.values())
{
- CMISTypeDefinition type = new CMISTypeDefinition(cmisDictionaryService, cmisDictionaryService.getCMISMapping().getCmisTypeId(selector.getType()));
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
+ CMISTypeDefinition type = cmisDictionaryService.getType(typeId);
CMISResultSetSelector smd = new CMISResultSetSelectorImpl(selector.getAlias(), type);
selectorMetaData.put(smd.getName(), smd);
}
@@ -75,18 +78,18 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
for (Column column : query.getColumns())
{
CMISPropertyDefinition propertyDefinition = null;
- CMISPropertyTypeEnum type = null;
+ CMISDataTypeEnum type = null;
if (column.getFunction().getName().equals(PropertyAccessor.NAME))
{
PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
QName propertyQName = arg.getPropertyName();
- QName typeQname = selectors.get(arg.getSelector()).getType();
- propertyDefinition = new CMISPropertyDefinition(cmisDictionaryService, propertyQName, typeQname);
- type = propertyDefinition.getPropertyType();
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
+ propertyDefinition = cmisDictionaryService.getProperty(propertyId);
+ type = propertyDefinition.getDataType();
}
if (type == null)
{
- type = cmisDictionaryService.getCMISMapping().getPropertyType(column.getFunction().getReturnType());
+ type = cmisDictionaryService.getDataType(column.getFunction().getReturnType());
}
CMISResultSetColumn cmd = new CMISResultSetColumnImpl(column.getAlias(), propertyDefinition, type);
columnMetaData.put(cmd.getName(), cmd);
diff --git a/source/java/org/alfresco/cmis/search/CmisFunctionEvaluationContext.java b/source/java/org/alfresco/cmis/search/CmisFunctionEvaluationContext.java
index d6b22c8b0c..384fec1034 100644
--- a/source/java/org/alfresco/cmis/search/CmisFunctionEvaluationContext.java
+++ b/source/java/org/alfresco/cmis/search/CmisFunctionEvaluationContext.java
@@ -29,6 +29,7 @@ import java.util.Collection;
import java.util.Map;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
+import org.alfresco.cmis.dictionary.CMISPropertyId;
import org.alfresco.cmis.property.CMISPropertyService;
import org.alfresco.cmis.property.CMISPropertyServiceImpl;
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
@@ -130,8 +131,8 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
*/
public Serializable getProperty(NodeRef nodeRef, QName propertyQName)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
- return cmisPropertyService.getProperty(nodeRef, propertyName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
+ return cmisPropertyService.getProperty(nodeRef, propertyId.getName());
}
/*
@@ -165,9 +166,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneEquality(lqp, propertyName, value, mode);
+ return impl.buildLuceneEquality(lqp, propertyId.getName(), value, mode);
}
else
{
@@ -185,9 +186,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneExists(lqp, propertyName, not);
+ return impl.buildLuceneExists(lqp, propertyId.getName(), not);
}
else
{
@@ -206,9 +207,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneGreaterThan(lqp, propertyName, value, mode);
+ return impl.buildLuceneGreaterThan(lqp, propertyId.getName(), value, mode);
}
else
{
@@ -227,9 +228,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneGreaterThanOrEquals(lqp, propertyName, value, mode);
+ return impl.buildLuceneGreaterThanOrEquals(lqp, propertyId.getName(), value, mode);
}
else
{
@@ -248,9 +249,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneIn(lqp, propertyName, values, not, mode);
+ return impl.buildLuceneIn(lqp, propertyId.getName(), values, not, mode);
}
else
{
@@ -269,9 +270,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneInequality(lqp, propertyName, value, mode);
+ return impl.buildLuceneInequality(lqp, propertyId.getName(), value, mode);
}
else
{
@@ -290,9 +291,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneLessThan(lqp, propertyName, value, mode);
+ return impl.buildLuceneLessThan(lqp, propertyId.getName(), value, mode);
}
else
{
@@ -311,9 +312,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneLessThanOrEquals(lqp, propertyName, value, mode);
+ return impl.buildLuceneLessThanOrEquals(lqp, propertyId.getName(), value, mode);
}
else
{
@@ -331,9 +332,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.buildLuceneLike(lqp, propertyName, value, not);
+ return impl.buildLuceneLike(lqp, propertyId.getName(), value, not);
}
else
{
@@ -348,9 +349,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
- String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
- return impl.getLuceneSortField(propertyName);
+ return impl.getLuceneSortField(propertyId.getName());
}
else
{
diff --git a/source/java/org/alfresco/cmis/search/QueryTest.java b/source/java/org/alfresco/cmis/search/QueryTest.java
index 30851da1c4..ceba9d0350 100644
--- a/source/java/org/alfresco/cmis/search/QueryTest.java
+++ b/source/java/org/alfresco/cmis/search/QueryTest.java
@@ -35,7 +35,8 @@ import java.util.Locale;
import java.util.Map;
import org.alfresco.cmis.dictionary.BaseCMISTest;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
+import org.alfresco.cmis.dictionary.CMISTypeDefinition;
import org.alfresco.cmis.search.CMISQueryOptions.CMISQueryMode;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.impl.parsers.CMISLexer;
@@ -916,31 +917,31 @@ public class QueryTest extends BaseCMISTest
public void test_CHANGE_TOKEN()
{
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken = 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken <> 'test'", 10, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken < 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken <= 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken > 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken >= 'test'", 0, false, "ObjectId", new String(), false);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken = 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken <> 'test'", 10, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken < 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken <= 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken > 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken >= 'test'", 0, false, "ObjectId", new String(), true);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IN ('test')", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken NOT IN ('test')", 10, false, "ObjectId", new String(), false);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IN ('test')", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken NOT IN ('test')", 10, false, "ObjectId", new String(), true);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken LIKE 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken NOT LIKE 'test'", 0, false, "ObjectId", new String(), false);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken LIKE 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken NOT LIKE 'test'", 0, false, "ObjectId", new String(), true);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IS NOT NULL", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IS NULL", 10, false, "ObjectId", new String(), false);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IS NOT NULL", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IS NULL", 10, false, "ObjectId", new String(), true);
- testQuery("SELECT ChangeToken FROM Folder WHERE 'test' = ANY ChangeToken", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE 'test' <> ANY ChangeToken", 10, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE 'test' < ANY ChangeToken", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE 'test' <= ANY ChangeToken", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE 'test' > ANY ChangeToken", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE 'test' >= ANY ChangeToken", 0, false, "ObjectId", new String(), false);
+ testQuery("SELECT ChangeToken FROM Folder WHERE 'test' = ANY ChangeToken", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE 'test' <> ANY ChangeToken", 10, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE 'test' < ANY ChangeToken", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE 'test' <= ANY ChangeToken", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE 'test' > ANY ChangeToken", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE 'test' >= ANY ChangeToken", 0, false, "ObjectId", new String(), true);
- testQuery("SELECT ChangeToken FROM Folder WHERE ANY ChangeToken IN ('test')", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT ChangeToken FROM Folder WHERE ANY ChangeToken NOT IN ('test')", 10, false, "ObjectId", new String(), false);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ANY ChangeToken IN ('test')", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT ChangeToken FROM Folder WHERE ANY ChangeToken NOT IN ('test')", 10, false, "ObjectId", new String(), true);
}
public void test_LAST_MODIFICATION_DATE()
@@ -1314,38 +1315,38 @@ public class QueryTest extends BaseCMISTest
public void test_URI()
{
- testQuery("SELECT Uri FROM Folder WHERE Uri = 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE Uri <> 'test'", 10, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE Uri < 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE Uri <= 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE Uri > 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE Uri >= 'test'", 0, false, "ObjectId", new String(), false);
+ testQuery("SELECT Uri FROM Folder WHERE Uri = 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE Uri <> 'test'", 10, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE Uri < 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE Uri <= 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE Uri > 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE Uri >= 'test'", 0, false, "ObjectId", new String(), true);
- testQuery("SELECT Uri FROM Folder WHERE Uri IN ('test')", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE Uri NOT IN ('test')", 10, false, "ObjectId", new String(), false);
+ testQuery("SELECT Uri FROM Folder WHERE Uri IN ('test')", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE Uri NOT IN ('test')", 10, false, "ObjectId", new String(), true);
- testQuery("SELECT Uri FROM Folder WHERE Uri LIKE 'test'", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE Uri NOT LIKE 'test'", 0, false, "ObjectId", new String(), false);
+ testQuery("SELECT Uri FROM Folder WHERE Uri LIKE 'test'", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE Uri NOT LIKE 'test'", 0, false, "ObjectId", new String(), true);
- testQuery("SELECT Uri FROM Folder WHERE Uri IS NOT NULL", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE Uri IS NULL", 10, false, "ObjectId", new String(), false);
+ testQuery("SELECT Uri FROM Folder WHERE Uri IS NOT NULL", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE Uri IS NULL", 10, false, "ObjectId", new String(), true);
- testQuery("SELECT Uri FROM Folder WHERE 'test' = ANY Uri", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE 'test' <> ANY Uri", 10, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE 'test' < ANY Uri", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE 'test' <= ANY Uri", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE 'test' > ANY Uri", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE 'test' >= ANY Uri", 0, false, "ObjectId", new String(), false);
+ testQuery("SELECT Uri FROM Folder WHERE 'test' = ANY Uri", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE 'test' <> ANY Uri", 10, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE 'test' < ANY Uri", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE 'test' <= ANY Uri", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE 'test' > ANY Uri", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE 'test' >= ANY Uri", 0, false, "ObjectId", new String(), true);
- testQuery("SELECT Uri FROM Folder WHERE ANY Uri IN ('test')", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT Uri FROM Folder WHERE ANY Uri NOT IN ('test')", 10, false, "ObjectId", new String(), false);
+ testQuery("SELECT Uri FROM Folder WHERE ANY Uri IN ('test')", 0, false, "ObjectId", new String(), true);
+ testQuery("SELECT Uri FROM Folder WHERE ANY Uri NOT IN ('test')", 10, false, "ObjectId", new String(), true);
}
public void test_ObjectId()
{
String companyHomeId = testQuery("SELECT ObjectId FROM Folder WHERE Name = '\"Folder 0\"'", 1, false, "ObjectId", new String(), false);
- Serializable ser = cmisPropertyService.getProperty(f0, CMISMapping.PROP_OBJECT_ID);
+ Serializable ser = cmisPropertyService.getProperty(f0, CMISDictionaryModel.PROP_OBJECT_ID);
String id = DefaultTypeConverter.INSTANCE.convert(String.class, ser);
assertEquals(companyHomeId, id);
@@ -1473,8 +1474,8 @@ public class QueryTest extends BaseCMISTest
{
testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL", 10, false, "ObjectId", new String(), false);
testQuery("SELECT * FROM Folder WHERE Name IS NULL", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT * FROM Document WHERE Uri IS NOT NULL", 0, false, "ObjectId", new String(), false);
- testQuery("SELECT * FROM Document WHERE Uri IS NULL", 10, false, "ObjectId", new String(), false);
+ testQuery("SELECT * FROM Document WHERE Name IS NOT NULL", 10, false, "ObjectId", new String(), false);
+ testQuery("SELECT * FROM Document WHERE Name IS NULL", 0, false, "ObjectId", new String(), false);
}
public void testObjectEquals()
@@ -1489,7 +1490,7 @@ public class QueryTest extends BaseCMISTest
public void testFolderEquals()
{
- Serializable ser = cmisPropertyService.getProperty(f0, CMISMapping.PROP_NAME);
+ Serializable ser = cmisPropertyService.getProperty(f0, CMISDictionaryModel.PROP_NAME);
String Name = DefaultTypeConverter.INSTANCE.convert(String.class, ser);
testQuery("SELECT * FROM Folder WHERE Name = '" + Name + "'", 1, false, "ObjectId", new String(), false);
@@ -1500,7 +1501,7 @@ public class QueryTest extends BaseCMISTest
public void test_IN_TREE()
{
- Serializable ser = cmisPropertyService.getProperty(f0, CMISMapping.PROP_OBJECT_ID);
+ Serializable ser = cmisPropertyService.getProperty(f0, CMISDictionaryModel.PROP_OBJECT_ID);
String id = DefaultTypeConverter.INSTANCE.convert(String.class, ser);
testQuery("SELECT * FROM Folder WHERE IN_TREE('" + id + "')", 6, false, "ObjectId", new String(), false);
@@ -1508,7 +1509,7 @@ public class QueryTest extends BaseCMISTest
public void test_IN_FOLDER()
{
- Serializable ser = cmisPropertyService.getProperty(f0, CMISMapping.PROP_OBJECT_ID);
+ Serializable ser = cmisPropertyService.getProperty(f0, CMISDictionaryModel.PROP_OBJECT_ID);
String id = DefaultTypeConverter.INSTANCE.convert(String.class, ser);
testQuery("SELECT * FROM Folder WHERE IN_FOLDER('" + id + "')", 2, false, "ObjectId", new String(), false);
@@ -1538,8 +1539,9 @@ public class QueryTest extends BaseCMISTest
CMISResultSet rs = cmisQueryService.query(options);
CMISResultSetMetaData md = rs.getMetaData();
assertNotNull(md.getQueryOptions());
- assertEquals(cmisDictionaryService.getPropertyDefinitions(CMISMapping.DOCUMENT_TYPE_ID).size(), md.getColumnNames().length);
- assertNotNull(md.getColumn(CMISMapping.PROP_OBJECT_ID));
+ CMISTypeDefinition typeDef = cmisDictionaryService.getType(CMISDictionaryModel.DOCUMENT_TYPE_ID);
+ assertEquals(typeDef.getPropertyDefinitions().size(), md.getColumnNames().length);
+ assertNotNull(md.getColumn(CMISDictionaryModel.PROP_OBJECT_ID));
assertEquals(1, md.getSelectors().length);
assertNotNull(md.getSelector(""));
rs.close();
diff --git a/source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java b/source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java
index ec5279a640..4eb124a467 100644
--- a/source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java
+++ b/source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java
@@ -35,14 +35,13 @@ import java.util.StringTokenizer;
import org.alfresco.cmis.CMISCardinalityEnum;
import org.alfresco.cmis.CMISJoinEnum;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
-import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
+import org.alfresco.cmis.dictionary.CMISPropertyId;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.cmis.search.CMISQueryException;
import org.alfresco.cmis.search.CMISQueryOptions;
-import org.alfresco.cmis.search.CMISQueryOptions.CMISQueryMode;
import org.alfresco.repo.search.impl.parsers.CMISLexer;
import org.alfresco.repo.search.impl.parsers.CMISParser;
import org.alfresco.repo.search.impl.parsers.FTSLexer;
@@ -101,15 +100,12 @@ public class CMISQueryParser
private CMISDictionaryService cmisDictionaryService;
- private CMISMapping cmisMapping;
-
private CMISJoinEnum joinSupport;
- public CMISQueryParser(CMISQueryOptions options, CMISDictionaryService cmisDictionaryService, CMISMapping cmisMapping, CMISJoinEnum joinSupport)
+ public CMISQueryParser(CMISQueryOptions options, CMISDictionaryService cmisDictionaryService, CMISJoinEnum joinSupport)
{
this.options = options;
this.cmisDictionaryService = cmisDictionaryService;
- this.cmisMapping = cmisMapping;
this.joinSupport = joinSupport;
}
@@ -600,35 +596,32 @@ public class CMISQueryParser
{
throw new CMISQueryException("No selector for " + qualifier);
}
- QName cmisType = cmisMapping.getCmisType(selector.getType());
- CMISTypeId typeId = null;
- if (cmisMapping.isValidCmisDocument(cmisType))
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, cmisType);
- }
- else if (cmisMapping.isValidCmisFolder(cmisType))
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.FOLDER, cmisType);
- }
- else
+
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
+ if (typeId == null || (typeId.getScope() != CMISScope.DOCUMENT && typeId.getScope() != CMISScope.FOLDER))
{
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
}
- CMISPropertyDefinition definition = cmisDictionaryService.getPropertyDefinition(typeId, columnName);
- if (definition == null)
+ CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
+ CMISPropertyDefinition propDef = null;
+ CMISPropertyId propId = cmisDictionaryService.getPropertyId(columnName);
+ if (propId != null)
{
- throw new CMISQueryException("Invalid column for " + cmisMapping.getQueryName(typeId.getQName()) + "." + columnName);
+ propDef = typeDef.getPropertyDefinitions().get(propId);
+ }
+ if (propDef == null)
+ {
+ throw new CMISQueryException("Invalid column for " + typeDef.getQueryName() + "." + columnName);
}
Function function = factory.getFunction(PropertyAccessor.NAME);
- QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName());
- Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(),
- propertyQName);
+ Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, propDef.isQueryable(), propDef.isOrderable(), selector.getAlias(),
+ propDef.getPropertyId().getQName());
Map functionArguments = new LinkedHashMap();
functionArguments.put(arg.getName(), arg);
- String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyName() : definition.getPropertyName();
+ String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getName() : propDef.getPropertyId().getName();
match = factory.createColumn(function, functionArguments, alias);
}
@@ -642,36 +635,32 @@ public class CMISQueryParser
{
throw new CMISQueryException("No selector for " + qualifier);
}
- QName cmisType = cmisMapping.getCmisType(selector.getType());
- CMISTypeId typeId = null;
- if (cmisMapping.isValidCmisDocument(cmisType))
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, cmisType);
- }
- else if (cmisMapping.isValidCmisFolder(cmisType))
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.FOLDER, cmisType);
- }
- else
+
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
+ if (typeId == null || (typeId.getScope() != CMISScope.DOCUMENT && typeId.getScope() != CMISScope.FOLDER))
{
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
}
- CMISPropertyDefinition definition = cmisDictionaryService.getPropertyDefinition(typeId, columnName);
-
- if (definition == null)
+
+ CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
+ CMISPropertyDefinition propDef = null;
+ CMISPropertyId propId = cmisDictionaryService.getPropertyId(columnName);
+ if (propId != null)
{
- throw new CMISQueryException("Invalid column for "
- + cmisMapping.getQueryName(typeId.getQName()) + "." + columnName + " selector alias " + selector.getAlias());
+ propDef = typeDef.getPropertyDefinitions().get(propId);
}
-
+ if (propDef == null)
+ {
+ throw new CMISQueryException("Invalid column for " + typeDef.getQueryName() + "." + columnName + " selector alias " + selector.getAlias());
+ }
+
Function function = factory.getFunction(PropertyAccessor.NAME);
- QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName());
- Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(),
- propertyQName);
+ Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, propDef.isQueryable(), propDef.isOrderable(), selector.getAlias(),
+ propDef.getPropertyId().getQName());
Map functionArguments = new LinkedHashMap();
functionArguments.put(arg.getName(), arg);
- String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyName() : definition.getPropertyName();
+ String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getName() : propDef.getPropertyId().getName();
orderColumn = factory.createColumn(function, functionArguments, alias);
}
@@ -699,39 +688,23 @@ public class CMISQueryParser
{
for (Selector selector : selectors.values())
{
- QName cmisType = cmisMapping.getCmisType(selector.getType());
- CMISTypeId typeId = null;
- if (cmisMapping.isValidCmisDocument(cmisType))
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
+ if (typeId == null || (typeId.getScope() == CMISScope.RELATIONSHIP))
{
- typeId = cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, cmisType);
+ throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
}
- else if (cmisMapping.isValidCmisFolder(cmisType))
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.FOLDER, cmisType);
- }
- else
- {
- if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
- {
- throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
- }
- else
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.POLICY, cmisType);
- }
- }
- Map propDefs = cmisDictionaryService.getPropertyDefinitions(typeId);
+ CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
+ Map propDefs = typeDef.getPropertyDefinitions();
for (CMISPropertyDefinition definition : propDefs.values())
{
if (definition.getCardinality() == CMISCardinalityEnum.SINGLE_VALUED)
{
Function function = factory.getFunction(PropertyAccessor.NAME);
- QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName());
Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(),
- propertyQName);
+ definition.getPropertyId().getQName());
Map functionArguments = new LinkedHashMap();
functionArguments.put(arg.getName(), arg);
- String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyName() : definition.getPropertyName();
+ String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyId().getName() : definition.getPropertyId().getName();
Column column = factory.createColumn(function, functionArguments, alias);
columns.add(column);
}
@@ -752,40 +725,24 @@ public class CMISQueryParser
{
throw new CMISQueryException("No selector for " + qualifier + " in " + qualifier + ".*");
}
- QName cmisType = cmisMapping.getCmisType(selector.getType());
- CMISTypeId typeId = null;
- if (cmisMapping.isValidCmisDocument(cmisType))
+
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
+ if (typeId == null || (typeId.getScope() == CMISScope.RELATIONSHIP))
{
- typeId = cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, cmisType);
+ throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
}
- else if (cmisMapping.isValidCmisFolder(cmisType))
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.FOLDER, cmisType);
- }
- else
- {
- if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
- {
- throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
- }
- else
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.POLICY, cmisType);
- }
-
- }
- Map propDefs = cmisDictionaryService.getPropertyDefinitions(typeId);
+ CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
+ Map propDefs = typeDef.getPropertyDefinitions();
for (CMISPropertyDefinition definition : propDefs.values())
{
if (definition.getCardinality() == CMISCardinalityEnum.SINGLE_VALUED)
{
Function function = factory.getFunction(PropertyAccessor.NAME);
- QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName());
Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(),
- propertyQName);
+ definition.getPropertyId().getQName());
Map functionArguments = new LinkedHashMap();
functionArguments.put(arg.getName(), arg);
- String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyName() : definition.getPropertyName();
+ String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyId().getName() : definition.getPropertyId().getName();
Column column = factory.createColumn(function, functionArguments, alias);
columns.add(column);
}
@@ -808,43 +765,31 @@ public class CMISQueryParser
{
throw new CMISQueryException("No selector for " + qualifier);
}
- QName cmisType = cmisMapping.getCmisType(selector.getType());
- CMISTypeId typeId = null;
- if (cmisMapping.isValidCmisDocument(cmisType))
+
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
+ if (typeId == null || (typeId.getScope() == CMISScope.RELATIONSHIP))
{
- typeId = cmisMapping.getCmisTypeId(CMISScope.DOCUMENT, cmisType);
+ throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
}
- else if (cmisMapping.isValidCmisFolder(cmisType))
+ CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
+ CMISPropertyDefinition propDef = null;
+ CMISPropertyId propId = cmisDictionaryService.getPropertyId(columnName);
+ if (propId != null)
{
- typeId = cmisMapping.getCmisTypeId(CMISScope.FOLDER, cmisType);
+ propDef = typeDef.getPropertyDefinitions().get(propId);
}
- else
+ if (propDef == null)
{
- if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
- {
- throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
- }
- else
- {
- typeId = cmisMapping.getCmisTypeId(CMISScope.POLICY, cmisType);
- }
-
- }
- CMISPropertyDefinition definition = cmisDictionaryService.getPropertyDefinition(typeId, columnName);
-
- if (definition == null)
- {
- throw new CMISQueryException("Invalid column for " + cmisMapping.getQueryName(typeId.getQName()) + "." + columnName);
+ throw new CMISQueryException("Invalid column for " + typeDef.getQueryName() + "." + columnName);
}
Function function = factory.getFunction(PropertyAccessor.NAME);
- QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName());
- Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(),
- propertyQName);
+ Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, propDef.isQueryable(), propDef.isOrderable(), selector.getAlias(),
+ propDef.getPropertyId().getQName());
Map functionArguments = new LinkedHashMap();
functionArguments.put(arg.getName(), arg);
- String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyName() : definition.getPropertyName();
+ String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + propDef.getPropertyId().getName() : propDef.getPropertyId().getName();
if (columnNode.getChildCount() > 1)
{
alias = columnNode.getChild(1).getText();
@@ -963,13 +908,12 @@ public class CMISQueryParser
}
else
{
- QName propertyQName = cmisMapping.getPropertyQName(id);
- CMISTypeId typeId = cmisMapping.getCmisTypeForProperty(propertyQName);
- CMISPropertyDefinition propDef = cmisDictionaryService.getPropertyDefinition(typeId, id);
- PropertyArgument arg = factory.createPropertyArgument(definition.getName(), propDef.isQueryable(), propDef.isOrderable(), "", propertyQName);
+ CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(id);
+ CMISPropertyDefinition propDef = cmisDictionaryService.getProperty(propertyId);
+ PropertyArgument arg = factory.createPropertyArgument(definition.getName(), propDef.isQueryable(), propDef.isOrderable(), "", propDef.getPropertyId().getQName());
if(!arg.isQueryable())
{
- throw new CMISQueryException("Column refers to unqueryable property "+arg.getPropertyName());
+ throw new CMISQueryException("Column refers to unqueryable property " + arg.getPropertyName());
}
return arg;
}
@@ -1117,12 +1061,12 @@ public class CMISQueryParser
{
alias = singleTableNode.getChild(1).getText();
}
- QName classQName = cmisMapping.getAlfrescoClassQNameFromCmisTableName(tableName);
- if (classQName == null)
+
+ CMISTypeId typeId = cmisDictionaryService.getTypeIdFromTable(tableName);
+ if (typeId == null)
{
throw new CMISQueryException("Type is unsupported in query " + tableName);
}
- CMISTypeId typeId = cmisMapping.getCmisTypeId(classQName);
if (typeId.getScope() != CMISScope.POLICY)
{
CMISTypeDefinition cmisType = cmisDictionaryService.getType(typeId);
@@ -1131,7 +1075,7 @@ public class CMISQueryParser
throw new CMISQueryException("Type is not queryable " + tableName + " -> " + cmisType);
}
}
- return factory.createSelector(classQName, alias);
+ return factory.createSelector(typeId.getQName(), alias);
}
else
{
@@ -1150,12 +1094,11 @@ public class CMISQueryParser
{
alias = singleTableNode.getChild(1).getText();
}
- QName classQName = cmisMapping.getAlfrescoClassQNameFromCmisTableName(tableName);
- if (classQName == null)
+ CMISTypeId typeId = cmisDictionaryService.getTypeIdFromTable(tableName);
+ if (typeId == null)
{
throw new CMISQueryException("Type is unsupported in query " + tableName);
}
- CMISTypeId typeId = cmisMapping.getCmisTypeId(classQName);
if (typeId.getScope() != CMISScope.POLICY)
{
CMISTypeDefinition cmisType = cmisDictionaryService.getType(typeId);
@@ -1164,7 +1107,7 @@ public class CMISQueryParser
throw new CMISQueryException("Type is not queryable " + tableName + " -> " + cmisType);
}
}
- Source lhs = factory.createSelector(classQName, alias);
+ Source lhs = factory.createSelector(typeId.getQName(), alias);
List list = (List) (source.getChildren());
for (CommonTree joinNode : list)
@@ -1226,18 +1169,9 @@ public class CMISQueryParser
{
qualifer = columnReferenceNode.getChild(1).getText();
}
- QName propertyQName = cmisMapping.getPropertyQName(cmisPropertyName);
- CMISTypeId typeId = cmisMapping.getCmisTypeForProperty(propertyQName);
- CMISPropertyDefinition propDef = cmisDictionaryService.getPropertyDefinition(typeId, cmisPropertyName);
- if (typeId.getScope() == CMISScope.POLICY)
- {
- // TODO: Policy - fix to be correct ....when we have properties
- return factory.createPropertyArgument(argumentName, true, true, qualifer, propertyQName);
- }
- else
- {
- return factory.createPropertyArgument(argumentName, propDef.isQueryable(), propDef.isOrderable(), qualifer, propertyQName);
- }
+ CMISPropertyId propId = cmisDictionaryService.getPropertyId(cmisPropertyName);
+ CMISPropertyDefinition propDef = cmisDictionaryService.getProperty(propId);
+ return factory.createPropertyArgument(argumentName, propDef.isQueryable(), propDef.isOrderable(), qualifer, propDef.getPropertyId().getQName());
}
public String getFunctionName(CommonTree functionNameNode)
diff --git a/source/java/org/alfresco/cmis/search/impl/CMISQueryServiceImpl.java b/source/java/org/alfresco/cmis/search/impl/CMISQueryServiceImpl.java
index 71e4300f52..1d1296c7c5 100644
--- a/source/java/org/alfresco/cmis/search/impl/CMISQueryServiceImpl.java
+++ b/source/java/org/alfresco/cmis/search/impl/CMISQueryServiceImpl.java
@@ -57,8 +57,6 @@ public class CMISQueryServiceImpl implements CMISQueryService
private CMISPropertyService cmisPropertyService;
- private CMISMapping cmisMapping;
-
private QueryEngine queryEngine;
private NodeService nodeService;
@@ -81,15 +79,6 @@ public class CMISQueryServiceImpl implements CMISQueryService
this.cmisDictionaryService = cmisDictionaryService;
}
- /**
- * @param cmisMapping
- * the cmisMapping to set
- */
- public void setCmisMapping(CMISMapping cmisMapping)
- {
- this.cmisMapping = cmisMapping;
- }
-
/**
* @param queryEngine
* the queryEngine to set
@@ -129,7 +118,7 @@ public class CMISQueryServiceImpl implements CMISQueryService
{
joinSupport = CMISJoinEnum.INNER_JOIN_SUPPORT;
}
- CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, cmisMapping, joinSupport);
+ CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, joinSupport);
Query query = parser.parse(queryEngine.getQueryModelFactory());
CmisFunctionEvaluationContext functionContext = new CmisFunctionEvaluationContext();
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryBootstrap.java b/source/java/org/alfresco/repo/dictionary/DictionaryBootstrap.java
index 7b27e2cee7..4c4b2d2705 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryBootstrap.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryBootstrap.java
@@ -41,7 +41,7 @@ import org.apache.commons.logging.LogFactory;
* @author David Caruana
*
*/
-public class DictionaryBootstrap implements DictionaryDeployer
+public class DictionaryBootstrap implements DictionaryListener
{
// The list of models to bootstrap with
private List models = new ArrayList();
@@ -105,7 +105,7 @@ public class DictionaryBootstrap implements DictionaryDeployer
*/
public void bootstrap()
{
- initDictionary();
+ onDictionaryInit();
initStaticMessages();
register();
@@ -119,10 +119,11 @@ public class DictionaryBootstrap implements DictionaryDeployer
dictionaryDAO.register(this);
}
- /**
- * Populate the Dictionary
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.repo.dictionary.DictionaryListener#onInit()
*/
- public void initDictionary()
+ public void onDictionaryInit()
{
if ((tenantService == null) || (! tenantService.isTenantUser()))
{
@@ -149,6 +150,14 @@ public class DictionaryBootstrap implements DictionaryDeployer
}
}
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.repo.dictionary.DictionaryListener#afterInit()
+ */
+ public void afterDictionaryInit()
+ {
+ }
/**
* Register the static resource bundles
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryDAO.java b/source/java/org/alfresco/repo/dictionary/DictionaryDAO.java
index f57f1edbb2..717e973869 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryDAO.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryDAO.java
@@ -164,7 +164,7 @@ public interface DictionaryDAO extends ModelQuery
*
* @param dictionaryDeployer
*/
- public void register(DictionaryDeployer dictionaryDeployer);
+ public void register(DictionaryListener dictionaryDeployer);
/**
* Reset the Dictionary - destroy & re-initialise
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryDAOImpl.java b/source/java/org/alfresco/repo/dictionary/DictionaryDAOImpl.java
index 1efde7dd49..3185ea7d64 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryDAOImpl.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryDAOImpl.java
@@ -90,8 +90,8 @@ public class DictionaryDAOImpl implements DictionaryDAO
// Map of model name to compiled model
private SimpleCache> compiledModelsCache;
- // Static list of registered dictionary deployers
- private List dictionaryDeployers = new ArrayList();
+ // Static list of registered dictionary listeners
+ private List dictionaryListeners = new ArrayList();
// Logger
private static Log logger = LogFactory.getLog(DictionaryDAO.class);
@@ -129,11 +129,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
/**
* Register with the Dictionary
*/
- public void register(DictionaryDeployer dictionaryDeployer)
+ public void register(DictionaryListener dictionaryDeployer)
{
- if (! dictionaryDeployers.contains(dictionaryDeployer))
+ if (! dictionaryListeners.contains(dictionaryDeployer))
{
- dictionaryDeployers.add(dictionaryDeployer);
+ dictionaryListeners.add(dictionaryDeployer);
}
}
@@ -151,9 +151,15 @@ public class DictionaryDAOImpl implements DictionaryDAO
namespaceDAO.init();
// populate the dictionary
- for (DictionaryDeployer dictionaryDeployer : dictionaryDeployers)
+ for (DictionaryListener dictionaryListener : dictionaryListeners)
{
- dictionaryDeployer.initDictionary();
+ dictionaryListener.onDictionaryInit();
+ }
+
+ // populate the dictionary
+ for (DictionaryListener dictionaryListener : dictionaryListeners)
+ {
+ dictionaryListener.afterDictionaryInit();
}
logger.info("Dictionary initialised");
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryDeployer.java b/source/java/org/alfresco/repo/dictionary/DictionaryListener.java
similarity index 88%
rename from source/java/org/alfresco/repo/dictionary/DictionaryDeployer.java
rename to source/java/org/alfresco/repo/dictionary/DictionaryListener.java
index 7502876e8e..0128c1f92b 100755
--- a/source/java/org/alfresco/repo/dictionary/DictionaryDeployer.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryListener.java
@@ -32,14 +32,11 @@ package org.alfresco.repo.dictionary;
* Dictionary Deployer components must register with the DictionaryService.
*
*/
-
-public interface DictionaryDeployer
+public interface DictionaryListener
{
// callback for (re-)initialising the Dictionary caches
- public void initDictionary();
+ public void onDictionaryInit();
- // register prior to bootstrap
- public void register();
+ // callback once initialisation is complete
+ public void afterDictionaryInit();
}
-
-
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java b/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java
index 43a1da6403..5a01f83066 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java
@@ -56,7 +56,7 @@ import org.springframework.context.ApplicationEvent;
*
* @author Roy Wetherall, JanV
*/
-public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean implements TenantDeployer, DictionaryDeployer, MessageDeployer
+public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean implements TenantDeployer, DictionaryListener, MessageDeployer
{
// Logging support
private static Log logger = LogFactory
@@ -204,7 +204,7 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
{
public Object execute() throws Exception
{
- initDictionary();
+ onDictionaryInit();
initMessages();
return (Object)null;
@@ -217,7 +217,11 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
// NOOP - will be destroyed directly via DictionaryComponent
}
- public void initDictionary()
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.repo.dictionary.DictionaryListener#onInit()
+ */
+ public void onDictionaryInit()
{
if (this.repositoryModelsLocations != null)
{
@@ -281,6 +285,14 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.repo.dictionary.DictionaryListener#afterInit()
+ */
+ public void afterDictionaryInit()
+ {
+ }
+
public void initMessages()
{
if (this.repositoryMessagesLocations != null)
diff --git a/source/java/org/alfresco/repo/dictionary/M2AnonymousTypeDefinition.java b/source/java/org/alfresco/repo/dictionary/M2AnonymousTypeDefinition.java
index b4d7d6c090..812206898b 100644
--- a/source/java/org/alfresco/repo/dictionary/M2AnonymousTypeDefinition.java
+++ b/source/java/org/alfresco/repo/dictionary/M2AnonymousTypeDefinition.java
@@ -93,6 +93,13 @@ import org.alfresco.service.namespace.QName;
return type.getDefaultAspects();
}
+ /* (non-Javadoc)
+ * @see org.alfresco.service.cmr.dictionary.ClassDefinition#getDefaultAspects(boolean)
+ */
+ public List getDefaultAspects(boolean inherited)
+ {
+ return type.getDefaultAspects(inherited);
+ }
/* (non-Javadoc)
* @see org.alfresco.repo.dictionary.ClassDefinition#getName()
diff --git a/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java b/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java
index 12c4bfe78a..a212968d8e 100644
--- a/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java
+++ b/source/java/org/alfresco/repo/dictionary/M2ClassDefinition.java
@@ -429,6 +429,14 @@ import org.alfresco.service.namespace.QName;
return inheritedDefaultAspects;
}
+ /**
+ * @see org.alfresco.service.cmr.dictionary.ClassDefinition#getDefaultAspects(boolean)
+ */
+ public List getDefaultAspects(boolean inherited)
+ {
+ return inherited ? getDefaultAspects() : defaultAspects;
+ }
+
/* (non-Javadoc)
* @see org.alfresco.service.cmr.dictionary.ClassDefinition#isContainer()
*/
diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseJoin.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseJoin.java
index 7a049b326b..bd1cb3941d 100644
--- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseJoin.java
+++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseJoin.java
@@ -38,10 +38,8 @@ import org.alfresco.repo.search.impl.querymodel.FunctionalConstraint;
import org.alfresco.repo.search.impl.querymodel.Join;
import org.alfresco.repo.search.impl.querymodel.JoinType;
import org.alfresco.repo.search.impl.querymodel.PropertyArgument;
-import org.alfresco.repo.search.impl.querymodel.QueryModelException;
import org.alfresco.repo.search.impl.querymodel.Selector;
import org.alfresco.repo.search.impl.querymodel.Source;
-import org.alfresco.repo.search.impl.querymodel.StaticArgument;
import org.alfresco.repo.search.impl.querymodel.impl.functions.Equals;
import org.alfresco.service.namespace.QName;
diff --git a/source/java/org/alfresco/service/cmr/dictionary/ClassDefinition.java b/source/java/org/alfresco/service/cmr/dictionary/ClassDefinition.java
index e4f9ae0581..bdf7383223 100644
--- a/source/java/org/alfresco/service/cmr/dictionary/ClassDefinition.java
+++ b/source/java/org/alfresco/service/cmr/dictionary/ClassDefinition.java
@@ -115,4 +115,10 @@ public interface ClassDefinition
*/
public List getDefaultAspects();
+ /**
+ * @param inherited include default aspects inherited from super types
+ * @return the default aspects
+ */
+ public List getDefaultAspects(boolean inherited);
+
}