iterSubTypes = subTypes.iterator();
for (int i = 0; i < cursor.getStartRow(); i++)
{
- iterTypeIds.next();
+ iterSubTypes.next();
}
// get types for page
CMISTypeDefinition[] types = new CMISTypeDefinition[cursor.getRowCount()];
for (int i = cursor.getStartRow(); i <= cursor.getEndRow(); i++)
{
- types[i - cursor.getStartRow()] = cmisDictionaryService.getType(iterTypeIds.next());
+ types[i - cursor.getStartRow()] = iterSubTypes.next();
}
PagedResults results = paging.createPagedResults(types, cursor);
@@ -391,7 +389,7 @@ public class CMISScript extends BaseScopableProcessorExtension
{
try
{
- CMISTypeId cmisTypeId = cmisDictionaryService.getCMISMapping().getCmisTypeId(typeId);
+ CMISTypeId cmisTypeId = cmisDictionaryService.getTypeId(typeId);
return cmisDictionaryService.getType(cmisTypeId);
}
catch(AlfrescoRuntimeException e)
@@ -411,7 +409,7 @@ public class CMISScript extends BaseScopableProcessorExtension
try
{
QName typeQName = node.getQNameType();
- CMISTypeId cmisTypeId = cmisDictionaryService.getCMISMapping().getCmisTypeId(typeQName);
+ CMISTypeId cmisTypeId = cmisDictionaryService.getTypeId(typeQName, null);
return cmisDictionaryService.getType(cmisTypeId);
}
catch(AlfrescoRuntimeException e)
diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISTypeIdMethod.java b/source/java/org/alfresco/repo/cmis/rest/CMISTypeDefinitionMethod.java
similarity index 76%
rename from source/java/org/alfresco/repo/cmis/rest/CMISTypeIdMethod.java
rename to source/java/org/alfresco/repo/cmis/rest/CMISTypeDefinitionMethod.java
index a82a992320..0b8952fdba 100644
--- a/source/java/org/alfresco/repo/cmis/rest/CMISTypeIdMethod.java
+++ b/source/java/org/alfresco/repo/cmis/rest/CMISTypeDefinitionMethod.java
@@ -26,7 +26,8 @@ package org.alfresco.repo.cmis.rest;
import java.util.List;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryService;
+import org.alfresco.cmis.dictionary.CMISTypeDefinition;
import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.repo.template.TemplateNode;
import org.alfresco.service.namespace.QName;
@@ -38,23 +39,23 @@ import freemarker.template.TemplateModelException;
/**
* Custom FreeMarker Template language method.
*
- * Retrieve the CMIS Type Id for an Alfresco node
+ * Retrieve the CMIS Type Definition for an Alfresco node
*
- * Usage: cmistypeid(TemplateNode node)
- * cmistypeid(QName nodeType)
+ * Usage: cmistype(TemplateNode node)
+ * cmistype(QName nodeType)
*
* @author davidc
*/
-public class CMISTypeIdMethod implements TemplateMethodModelEx
+public class CMISTypeDefinitionMethod implements TemplateMethodModelEx
{
- private CMISMapping mappingService;
+ private CMISDictionaryService dictionaryService;
/**
* Construct
*/
- public CMISTypeIdMethod(CMISMapping mappingService)
+ public CMISTypeDefinitionMethod(CMISDictionaryService dictionaryService)
{
- this.mappingService = mappingService;
+ this.dictionaryService = dictionaryService;
}
/**
@@ -63,7 +64,7 @@ public class CMISTypeIdMethod implements TemplateMethodModelEx
@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException
{
- CMISTypeId result = null;
+ CMISTypeDefinition result = null;
if (args.size() == 1)
{
@@ -85,10 +86,14 @@ public class CMISTypeIdMethod implements TemplateMethodModelEx
}
}
- // convert to CMIS type id
+ // convert to CMIS type
if (nodeType != null)
{
- result = mappingService.getCmisTypeId(nodeType);
+ CMISTypeId typeId = dictionaryService.getTypeId(nodeType, null);
+ if (typeId != null)
+ {
+ result = dictionaryService.getType(typeId);
+ }
}
}
}
diff --git a/source/java/org/alfresco/repo/cmis/rest/CMISTypeMethod.java b/source/java/org/alfresco/repo/cmis/rest/CMISTypeMethod.java
deleted file mode 100644
index bb1b621f4b..0000000000
--- a/source/java/org/alfresco/repo/cmis/rest/CMISTypeMethod.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2005-2007 Alfresco Software Limited.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- * As a special exception to the terms and conditions of version 2.0 of
- * the GPL, you may redistribute this Program in connection with Free/Libre
- * and Open Source Software ("FLOSS") applications as described in Alfresco's
- * FLOSS exception. You should have recieved a copy of the text describing
- * the FLOSS exception, and it is also available here:
- * http://www.alfresco.com/legal/licensing"
- */
-package org.alfresco.repo.cmis.rest;
-
-import java.util.List;
-
-import org.alfresco.cmis.dictionary.CMISDictionaryService;
-import org.alfresco.cmis.dictionary.CMISTypeId;
-
-import freemarker.template.TemplateModelException;
-
-/**
- * Custom FreeMarker Template language method.
- *
- * Retrieve the CMIS Type for an Alfresco node
- *
- * Usage: cmistype(TemplateNode node)
- * cmistype(QName nodeType)
- *
- * @author davidc
- */
-public class CMISTypeMethod extends CMISTypeIdMethod
-{
- private CMISDictionaryService dictionaryService;
-
- /**
- * Construct
- */
- public CMISTypeMethod(CMISDictionaryService dictionaryService)
- {
- super(dictionaryService.getCMISMapping());
- this.dictionaryService = dictionaryService;
- }
-
- /**
- * @see freemarker.template.TemplateMethodModel#exec(java.util.List)
- */
- @SuppressWarnings("unchecked")
- public Object exec(List args) throws TemplateModelException
- {
- Object result = null;
- Object typeId = super.exec(args);
- if (typeId != null)
- {
- result = dictionaryService.getType((CMISTypeId)typeId);
- }
- return result;
- }
-}
diff --git a/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java b/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java
index 27aedb1320..e87c56dff6 100644
--- a/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java
+++ b/source/java/org/alfresco/repo/cmis/rest/test/CMISTest.java
@@ -67,8 +67,8 @@ public class CMISTest extends BaseCMISWebScriptTest
// setRemoteServer(server);
// setArgsAsHeaders(false);
// setValidateResponse(false);
-// setListener(new CMISTestListener(System.out));
-// setTraceReqRes(true);
+ setListener(new CMISTestListener(System.out));
+ setTraceReqRes(true);
super.setUp();
}
diff --git a/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java
index d240b11fc5..26dfceb7cc 100644
--- a/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java
+++ b/source/java/org/alfresco/repo/cmis/ws/DMAbstractServicePort.java
@@ -40,8 +40,11 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.alfresco.cmis.CMISService;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISScope;
+import org.alfresco.cmis.dictionary.CMISTypeDefinition;
+import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.cmis.property.CMISPropertyService;
import org.alfresco.cmis.search.CMISQueryService;
import org.alfresco.model.ContentModel;
@@ -63,7 +66,6 @@ import org.alfresco.service.cmr.version.VersionHistory;
import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.cmr.version.VersionType;
import org.alfresco.service.descriptor.DescriptorService;
-import org.alfresco.service.namespace.QName;
/**
* Base class for all CMIS web services
@@ -282,58 +284,57 @@ public class DMAbstractServicePort
protected CmisPropertiesType getPropertiesType(Map alfrescoProperties, PropertyFilter filter)
{
- CMISMapping cmisMapping = cmisDictionaryService.getCMISMapping();
- String objectTypeId = (String) alfrescoProperties.get(CMISMapping.PROP_OBJECT_TYPE_ID);
- QName cmisType = cmisMapping.getCmisTypeId(objectTypeId).getQName();
+ String objectTypeId = (String) alfrescoProperties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID);
+ CMISTypeId cmisTypeId = cmisDictionaryService.getTypeId(objectTypeId);
CmisPropertiesType properties = new CmisPropertiesType();
- if (cmisMapping.isValidCmisDocument(cmisType))
+ if (cmisTypeId.getScope() == CMISScope.DOCUMENT)
{
- addBooleanProperty(properties, filter, CMISMapping.PROP_IS_IMMUTABLE, alfrescoProperties);
- addBooleanProperty(properties, filter, CMISMapping.PROP_IS_LATEST_VERSION, alfrescoProperties);
- addBooleanProperty(properties, filter, CMISMapping.PROP_IS_MAJOR_VERSION, alfrescoProperties);
- addBooleanProperty(properties, filter, CMISMapping.PROP_IS_LATEST_MAJOR_VERSION, alfrescoProperties);
- addBooleanProperty(properties, filter, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT, alfrescoProperties);
- addDateTimeProperty(properties, filter, CMISMapping.PROP_CREATION_DATE, alfrescoProperties);
- addDateTimeProperty(properties, filter, CMISMapping.PROP_LAST_MODIFICATION_DATE, alfrescoProperties);
- addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_ID, alfrescoProperties);
- addIDProperty(properties, filter, CMISMapping.PROP_VERSION_SERIES_ID, alfrescoProperties);
- addIDProperty(properties, filter, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID, alfrescoProperties);
- addIntegerProperty(properties, filter, CMISMapping.PROP_CONTENT_STREAM_LENGTH, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_NAME, alfrescoProperties);
+ addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_IMMUTABLE, alfrescoProperties);
+ addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_LATEST_VERSION, alfrescoProperties);
+ addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_MAJOR_VERSION, alfrescoProperties);
+ addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION, alfrescoProperties);
+ addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT, alfrescoProperties);
+ addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_CREATION_DATE, alfrescoProperties);
+ addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE, alfrescoProperties);
+ addIDProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_ID, alfrescoProperties);
+ addIDProperty(properties, filter, CMISDictionaryModel.PROP_VERSION_SERIES_ID, alfrescoProperties);
+ addIDProperty(properties, filter, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID, alfrescoProperties);
+ addIntegerProperty(properties, filter, CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_NAME, alfrescoProperties);
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, "document");
- addStringProperty(properties, filter, CMISMapping.PROP_OBJECT_TYPE_ID, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_CREATED_BY, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_LAST_MODIFIED_BY, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_CONTENT_STREAM_FILENAME, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_VERSION_LABEL, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_CHECKIN_COMMENT, alfrescoProperties);
- addURIProperty(properties, filter, CMISMapping.PROP_CONTENT_STREAM_URI, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_TYPE_ID, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_CREATED_BY, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_LAST_MODIFIED_BY, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_VERSION_LABEL, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_CHECKIN_COMMENT, alfrescoProperties);
+ addURIProperty(properties, filter, CMISDictionaryModel.PROP_CONTENT_STREAM_URI, alfrescoProperties);
}
- else if (cmisMapping.isValidCmisFolder(cmisType))
+ else if (cmisTypeId.getScope() == CMISScope.FOLDER)
{
- addDateTimeProperty(properties, filter, CMISMapping.PROP_CREATION_DATE, alfrescoProperties);
- addDateTimeProperty(properties, filter, CMISMapping.PROP_LAST_MODIFICATION_DATE, alfrescoProperties);
- addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_ID, alfrescoProperties);
- addIDProperty(properties, filter, CMISMapping.PROP_PARENT_ID, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_NAME, alfrescoProperties);
+ addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_CREATION_DATE, alfrescoProperties);
+ addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE, alfrescoProperties);
+ addIDProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_ID, alfrescoProperties);
+ addIDProperty(properties, filter, CMISDictionaryModel.PROP_PARENT_ID, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_NAME, alfrescoProperties);
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, "folder");
- addStringProperty(properties, filter, CMISMapping.PROP_OBJECT_TYPE_ID, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_CREATED_BY, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_LAST_MODIFIED_BY, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_TYPE_ID, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_CREATED_BY, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_LAST_MODIFIED_BY, alfrescoProperties);
}
- else if (cmisMapping.isValidCmisRelationship(cmisType))
+ else if (cmisTypeId.getScope() == CMISScope.RELATIONSHIP)
{
- addStringProperty(properties, filter, CMISMapping.PROP_OBJECT_TYPE_ID, alfrescoProperties);
- addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_ID, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_TYPE_ID, alfrescoProperties);
+ addIDProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_ID, alfrescoProperties);
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, alfrescoProperties);
- addStringProperty(properties, filter, CMISMapping.PROP_CREATED_BY, alfrescoProperties);
- addDateTimeProperty(properties, filter, CMISMapping.PROP_CREATION_DATE, alfrescoProperties);
- addIDProperty(properties, filter, CMISMapping.PROP_SOURCE_ID, alfrescoProperties);
- addIDProperty(properties, filter, CMISMapping.PROP_TARGET_ID, alfrescoProperties);
+ addStringProperty(properties, filter, CMISDictionaryModel.PROP_CREATED_BY, alfrescoProperties);
+ addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_CREATION_DATE, alfrescoProperties);
+ addIDProperty(properties, filter, CMISDictionaryModel.PROP_SOURCE_ID, alfrescoProperties);
+ addIDProperty(properties, filter, CMISDictionaryModel.PROP_TARGET_ID, alfrescoProperties);
}
return properties;
@@ -342,13 +343,13 @@ public class DMAbstractServicePort
private Map createBaseRelationshipProperties(AssociationRef association)
{
Map result = new HashMap();
- result.put(CMISMapping.PROP_OBJECT_TYPE_ID, cmisDictionaryService.getCMISMapping().getCmisType(association.getTypeQName()));
- result.put(CMISMapping.PROP_OBJECT_ID, association.toString());
- result.put(BASE_TYPE_PROPERTY_NAME, CMISMapping.RELATIONSHIP_TYPE_ID.getTypeId());
- result.put(CMISMapping.PROP_CREATED_BY, AuthenticationUtil.getFullyAuthenticatedUser());
- result.put(CMISMapping.PROP_CREATION_DATE, new Date());
- result.put(CMISMapping.PROP_SOURCE_ID, association.getSourceRef());
- result.put(CMISMapping.PROP_TARGET_ID, association.getTargetRef());
+ result.put(CMISDictionaryModel.PROP_OBJECT_TYPE_ID, cmisDictionaryService.getTypeId(association.getTypeQName(), CMISScope.RELATIONSHIP));
+ result.put(CMISDictionaryModel.PROP_OBJECT_ID, association.toString());
+ result.put(BASE_TYPE_PROPERTY_NAME, CMISDictionaryModel.RELATIONSHIP_TYPE_ID.getId());
+ result.put(CMISDictionaryModel.PROP_CREATED_BY, AuthenticationUtil.getFullyAuthenticatedUser());
+ result.put(CMISDictionaryModel.PROP_CREATION_DATE, new Date());
+ result.put(CMISDictionaryModel.PROP_SOURCE_ID, association.getSourceRef());
+ result.put(CMISDictionaryModel.PROP_TARGET_ID, association.getTargetRef());
return result;
}
@@ -570,7 +571,7 @@ public class DMAbstractServicePort
{
// TODO: properties setting
- String name = (String) PropertyUtil.getProperty(properties, CMISMapping.PROP_NAME);
+ String name = (String) PropertyUtil.getProperty(properties, CMISDictionaryModel.PROP_NAME);
if (name != null)
{
nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, name);
@@ -622,5 +623,30 @@ public class DMAbstractServicePort
}
return checkOutCheckInService.checkout(documentNodeReference);
}
-
+
+ protected CMISTypeId getCmisTypeId(String typeId) throws InvalidArgumentException
+ {
+ try
+ {
+ return cmisDictionaryService.getTypeId(typeId);
+ }
+ catch (Exception e)
+ {
+ throw new InvalidArgumentException("Invalid typeId " + typeId);
+ }
+ }
+
+ protected CMISTypeDefinition getCmisTypeDefinition(String typeId) throws InvalidArgumentException
+ {
+ try
+ {
+ CMISTypeId cmisTypeId = cmisDictionaryService.getTypeId(typeId);
+ return cmisDictionaryService.getType(cmisTypeId);
+ }
+ catch (Exception e)
+ {
+ throw new InvalidArgumentException("Invalid typeId " + typeId);
+ }
+ }
+
}
diff --git a/source/java/org/alfresco/repo/cmis/ws/DMDiscoveryServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMDiscoveryServicePort.java
index 8611fe2b54..4663adcee8 100755
--- a/source/java/org/alfresco/repo/cmis/ws/DMDiscoveryServicePort.java
+++ b/source/java/org/alfresco/repo/cmis/ws/DMDiscoveryServicePort.java
@@ -27,7 +27,7 @@ package org.alfresco.repo.cmis.ws;
import java.io.Serializable;
import java.util.Map;
-import org.alfresco.cmis.CMISPropertyTypeEnum;
+import org.alfresco.cmis.CMISDataTypeEnum;
import org.alfresco.cmis.search.CMISQueryOptions;
import org.alfresco.cmis.search.CMISResultSet;
import org.alfresco.cmis.search.CMISResultSetColumn;
@@ -91,41 +91,41 @@ public class DMDiscoveryServicePort extends DMAbstractServicePort implements Dis
// for each column...
for (CMISResultSetColumn column : columns)
{
- CMISPropertyTypeEnum type = column.getPropertyType();
- if (type == CMISPropertyTypeEnum.BOOLEAN)
+ CMISDataTypeEnum type = column.getPropertyType();
+ if (type == CMISDataTypeEnum.BOOLEAN)
{
addBooleanProperty(properties, filter, column.getName(), values);
}
- else if (type == CMISPropertyTypeEnum.DATETIME)
+ else if (type == CMISDataTypeEnum.DATETIME)
{
addDateTimeProperty(properties, filter, column.getName(), values);
}
- else if (type == CMISPropertyTypeEnum.DECIMAL)
+ else if (type == CMISDataTypeEnum.DECIMAL)
{
addDecimalProperty(properties, filter, column.getName(), values);
}
- else if (type == CMISPropertyTypeEnum.ID)
+ else if (type == CMISDataTypeEnum.ID)
{
addIDProperty(properties, filter, column.getName(), values);
}
- else if (type == CMISPropertyTypeEnum.INTEGER)
+ else if (type == CMISDataTypeEnum.INTEGER)
{
addIntegerProperty(properties, filter, column.getName(), values);
}
- else if (type == CMISPropertyTypeEnum.STRING)
+ else if (type == CMISDataTypeEnum.STRING)
{
addStringProperty(properties, filter, column.getName(), values);
}
- else if (type == CMISPropertyTypeEnum.URI)
+ else if (type == CMISDataTypeEnum.URI)
{
addURIProperty(properties, filter, column.getName(), values);
}
- else if (type == CMISPropertyTypeEnum.XML)
+ else if (type == CMISDataTypeEnum.XML)
{
// TODO:
throw new UnsupportedOperationException();
}
- else if (type == CMISPropertyTypeEnum.HTML)
+ else if (type == CMISDataTypeEnum.HTML)
{
// TODO:
throw new UnsupportedOperationException();
diff --git a/source/java/org/alfresco/repo/cmis/ws/DMObjectServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMObjectServicePort.java
index e4869fbbdc..330dfb4a66 100644
--- a/source/java/org/alfresco/repo/cmis/ws/DMObjectServicePort.java
+++ b/source/java/org/alfresco/repo/cmis/ws/DMObjectServicePort.java
@@ -34,8 +34,9 @@ import java.util.Map;
import javax.activation.DataHandler;
import javax.xml.ws.Holder;
-import org.alfresco.repo.security.permissions.AccessDeniedException;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
+import org.alfresco.cmis.dictionary.CMISScope;
+import org.alfresco.cmis.dictionary.CMISTypeDefinition;
import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.cmis.PropertyFilter;
@@ -43,6 +44,7 @@ import org.alfresco.repo.cmis.ws.DeleteTreeResponse.FailedToDelete;
import org.alfresco.repo.cmis.ws.utils.AlfrescoObjectType;
import org.alfresco.repo.cmis.ws.utils.CmisObjectsUtils;
import org.alfresco.repo.cmis.ws.utils.CmisObjectsUtils.IdentifierConversionResults;
+import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.lock.NodeLockedException;
@@ -110,25 +112,23 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
checkRepositoryId(repositoryId);
Map propertiesMap = getPropertiesMap(properties);
- CMISMapping cmisMapping = cmisDictionaryService.getCMISMapping();
- CMISTypeId cmisTypeId = cmisMapping.getCmisTypeId(typeId);
-
- if (cmisMapping.getCmisTypeId(typeId).equals(CMISMapping.DOCUMENT_TYPE_ID) == false)
+ CMISTypeId cmisTypeId = getCmisTypeId(typeId);
+ if (cmisTypeId.getScope() != CMISScope.DOCUMENT)
{
throw new ConstraintViolationException("Invalid document type " + typeId);
}
NodeRef parentNodeRef = safeGetFolderNodeRef(folderId);
- String documentName = (String) propertiesMap.get(CMISMapping.PROP_NAME);
+ String documentName = (String) propertiesMap.get(CMISDictionaryModel.PROP_NAME);
if (documentName == null)
{
throw new InvalidArgumentException("Name property not found");
}
- NodeRef newDocumentNodeRef = fileFolderService.create(parentNodeRef, documentName, cmisMapping.getAlfrescoType(cmisTypeId.getQName())).getNodeRef();
+ NodeRef newDocumentNodeRef = fileFolderService.create(parentNodeRef, documentName, cmisTypeId.getQName()).getNodeRef();
ContentWriter writer = fileFolderService.getWriter(newDocumentNodeRef);
- String mimeType = (String) propertiesMap.get(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE);
+ String mimeType = (String) propertiesMap.get(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE);
if (mimeType != null)
{
writer.setMimetype(mimeType);
@@ -165,7 +165,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
break;
}
- String versionLabel = (String) cmisPropertyService.getProperty(newDocumentNodeRef, CMISMapping.PROP_VERSION_LABEL);
+ String versionLabel = (String) cmisPropertyService.getProperty(newDocumentNodeRef, CMISDictionaryModel.PROP_VERSION_LABEL);
return versionLabel != null && versionLabel.contains(VERSION_DELIMETER) ?
newDocumentNodeRef.toString() + CmisObjectsUtils.NODE_REFERENCE_ID_DELIMETER + versionLabel :
newDocumentNodeRef.toString();
@@ -194,17 +194,14 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
checkRepositoryId(repositoryId);
NodeRef folderNodeRef = cmisObjectsUtils.getIdentifierInstance(folderId, AlfrescoObjectType.FOLDER_OBJECT).getConvertedIdentifier();
- CMISTypeId cmisTypeId = getCmisTypeId(typeId);
- assertTypeExists(cmisTypeId);
-
- CMISMapping cmisMapping = cmisDictionaryService.getCMISMapping();
- if (cmisMapping.isValidCmisFolder(cmisTypeId.getQName()) == false)
+ CMISTypeDefinition type = getCmisTypeDefinition(typeId);
+ if (type == null || type.getTypeId().getScope() != CMISScope.FOLDER)
{
- throw new InvalidArgumentException(typeId + " isn't a folder type");
+ throw new TypeNotFoundException(typeId);
}
Map propertiesMap = getPropertiesMap(properties);
- String name = (String) propertiesMap.get(CMISMapping.PROP_NAME);
+ String name = (String) propertiesMap.get(CMISDictionaryModel.PROP_NAME);
if (name == null)
{
throw new InvalidArgumentException("Name property not found");
@@ -214,10 +211,10 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
try
{
- NodeRef newFolderNodeRef = fileFolderService.create(folderNodeRef, name, cmisMapping.getAlfrescoType(cmisTypeId.getQName())).getNodeRef();
+ NodeRef newFolderNodeRef = fileFolderService.create(folderNodeRef, name, type.getTypeId().getQName()).getNodeRef();
// TODO:
// cmisPropertyService.setProperties(newFolderNodeRef, propertiesMap);
- return (String) cmisPropertyService.getProperty(newFolderNodeRef, CMISMapping.PROP_OBJECT_ID);
+ return (String) cmisPropertyService.getProperty(newFolderNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
}
catch (FileExistsException e)
{
@@ -289,17 +286,13 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
throw e;
}
- CMISTypeId relationshipTypeId;
- try
+ CMISTypeId relationshipTypeId = getCmisTypeId(typeId);
+ if (relationshipTypeId.getScope() != CMISScope.RELATIONSHIP)
{
- relationshipTypeId = cmisDictionaryService.getCMISMapping().getCmisTypeId(typeId);
- }
- catch (Exception e)
- {
- throw new InvalidArgumentException("Invalid typeId format: " + typeId);
+ throw new TypeNotFoundException(typeId);
}
- QName relationshipTypeQName = cmisDictionaryService.getCMISMapping().getAlfrescoType(relationshipTypeId.getQName());
+ QName relationshipTypeQName = relationshipTypeId.getQName();
AssociationDefinition associationDef = dictionaryService.getAssociation(relationshipTypeQName);
if (associationDef != null)
{
@@ -365,7 +358,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
NodeRef objectNodeReference = cmisObjectsUtils.getIdentifierInstance(objectId, AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT).getConvertedIdentifier();
checkForRootObject(repositoryId, objectId);
- checkObjectTypeAndAppropriateStates(objectNodeReference, this.cmisDictionaryService.getCMISMapping().getCmisType(this.nodeService.getType(objectNodeReference)));
+ checkObjectTypeAndAppropriateStates(objectNodeReference, nodeService.getType(objectNodeReference));
if (!cmisObjectsUtils.deleteObject(objectNodeReference))
{
throw new PermissionDeniedException("Currently authenticated User has no appropriate Permissions to delete specified Object");
@@ -451,7 +444,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
response.setLength(BigInteger.valueOf(reader.getSize()));
response.setMimeType(reader.getMimetype());
- String filename = (String) cmisPropertyService.getProperty(nodeRef, CMISMapping.PROP_NAME);
+ String filename = (String) cmisPropertyService.getProperty(nodeRef, CMISDictionaryModel.PROP_NAME);
response.setFilename(filename);
response.setStream(new DataHandler(new ContentReaderDataSource(reader, filename)));
@@ -568,7 +561,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
// TODO: change token
// no new version
- objectId.value = (String) cmisPropertyService.getProperty(objectNodeRef, CMISMapping.PROP_OBJECT_ID);
+ objectId.value = (String) cmisPropertyService.getProperty(objectNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
}
/**
@@ -636,26 +629,6 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
return properties;
}
- private void assertTypeExists(CMISTypeId cmisTypeId) throws TypeNotFoundException
- {
- if (cmisDictionaryService.getCMISMapping().isValidCmisType(cmisTypeId.getQName()) == false)
- {
- throw new TypeNotFoundException(cmisTypeId.toString());
- }
- }
-
- private CMISTypeId getCmisTypeId(String typeId) throws InvalidArgumentException
- {
- try
- {
- return cmisDictionaryService.getCMISMapping().getCmisTypeId(typeId);
- }
- catch (Exception e)
- {
- throw new InvalidArgumentException("Invalid typeId " + typeId);
- }
- }
-
private boolean changeObjectParentAssociation(NodeRef objectNodeRef, NodeRef targetFolderNodeRef, NodeRef sourceFolderNodeReference)
throws UpdateConflictException, PermissionDeniedException
{
@@ -726,7 +699,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
throw new InvalidArgumentException("Specified Object has invalid Object Type");
}
- if (objectType.equals(CMISMapping.FOLDER_QNAME) && (nodeService.getChildAssocs(objectNodeReference).size() > 0))
+ if (objectType.equals(ContentModel.TYPE_FOLDER) && (nodeService.getChildAssocs(objectNodeReference).size() > 0))
{
throw new ConstraintViolationException("Could not delete folder with at least one Child");
}
diff --git a/source/java/org/alfresco/repo/cmis/ws/DMRelationshipServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMRelationshipServicePort.java
index 37a9f32195..b25a8cd8a2 100755
--- a/source/java/org/alfresco/repo/cmis/ws/DMRelationshipServicePort.java
+++ b/source/java/org/alfresco/repo/cmis/ws/DMRelationshipServicePort.java
@@ -28,6 +28,8 @@ import java.math.BigInteger;
import java.util.LinkedList;
import java.util.List;
+import org.alfresco.cmis.dictionary.CMISScope;
+import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.repo.cmis.PropertyFilter;
import org.alfresco.repo.cmis.ws.utils.AlfrescoObjectType;
import org.alfresco.repo.web.util.paging.Cursor;
@@ -81,7 +83,8 @@ public class DMRelationshipServicePort extends DMAbstractServicePort implements
BigInteger skipCount = ((parameters.getSkipCount() != null) && (parameters.getSkipCount().getValue() != null)) ? parameters.getSkipCount().getValue() : BigInteger.ZERO;
BigInteger maxItems = ((parameters.getMaxItems() != null) && (parameters.getMaxItems().getValue() != null)) ? parameters.getMaxItems().getValue() : BigInteger.ZERO;
- QName associationType = cmisDictionaryService.getCMISMapping().getAlfrescoType(cmisDictionaryService.getCMISMapping().getCmisTypeId(typeId).getQName());
+ CMISTypeId cmisTypeId = getCmisTypeId(typeId);
+ QName associationType = cmisTypeId.getQName();
PropertyFilter propertyFilter = createPropertyFilter(parameters.getFilter());
NodeRef objectNodeRef = (NodeRef) cmisObjectsUtils.getIdentifierInstance(parameters.getObjectId(), AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT).getConvertedIdentifier();
@@ -143,7 +146,8 @@ public class DMRelationshipServicePort extends DMAbstractServicePort implements
}
else
{
- return cmisDictionaryService.getCMISMapping().isValidCmisRelationship(qname) && relationshipType.equals(qname);
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(qname, CMISScope.RELATIONSHIP);
+ return typeId != null && relationshipType.equals(qname);
}
}
}
diff --git a/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java
index 60c03ce935..75207e0f06 100644
--- a/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java
+++ b/source/java/org/alfresco/repo/cmis/ws/DMRepositoryServicePort.java
@@ -38,15 +38,14 @@ import javax.xml.bind.JAXBElement;
import org.alfresco.cmis.CMISCardinalityEnum;
import org.alfresco.cmis.CMISContentStreamAllowedEnum;
+import org.alfresco.cmis.CMISDataTypeEnum;
import org.alfresco.cmis.CMISFullTextSearchEnum;
import org.alfresco.cmis.CMISJoinEnum;
-import org.alfresco.cmis.CMISPropertyTypeEnum;
import org.alfresco.cmis.CMISUpdatabilityEnum;
import org.alfresco.cmis.dictionary.CMISChoice;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
-import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.repo.web.util.paging.Cursor;
import org.alfresco.service.descriptor.Descriptor;
@@ -63,7 +62,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
private static Map contentStreamAllowedEnumMapping;
private static Map updatabilityEnumMapping;
private static Map cardinalityEnumMapping;
- private static Map propertyTypeEnumMapping;
+ private static Map propertyTypeEnumMapping;
static
{
@@ -91,16 +90,16 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
cardinalityEnumMapping.put(CMISCardinalityEnum.MULTI_VALUED, EnumCardinality.MULTI);
cardinalityEnumMapping.put(CMISCardinalityEnum.SINGLE_VALUED, EnumCardinality.SINGLE);
- propertyTypeEnumMapping = new HashMap();
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.BOOLEAN, EnumPropertyType.BOOLEAN);
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.DATETIME, EnumPropertyType.DATETIME);
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.DECIMAL, EnumPropertyType.DECIMAL);
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.HTML, EnumPropertyType.HTML);
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.ID, EnumPropertyType.ID);
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.INTEGER, EnumPropertyType.INTEGER);
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.STRING, EnumPropertyType.STRING);
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.URI, EnumPropertyType.URI);
- propertyTypeEnumMapping.put(CMISPropertyTypeEnum.XML, EnumPropertyType.XML);
+ propertyTypeEnumMapping = new HashMap();
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.BOOLEAN, EnumPropertyType.BOOLEAN);
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.DATETIME, EnumPropertyType.DATETIME);
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.DECIMAL, EnumPropertyType.DECIMAL);
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.HTML, EnumPropertyType.HTML);
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.ID, EnumPropertyType.ID);
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.INTEGER, EnumPropertyType.INTEGER);
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.STRING, EnumPropertyType.STRING);
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.URI, EnumPropertyType.URI);
+ propertyTypeEnumMapping.put(CMISDataTypeEnum.XML, EnumPropertyType.XML);
}
/**
@@ -147,7 +146,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
repositoryInfoType.setRepositoryName(serverDescriptor.getName());
repositoryInfoType.setRepositoryRelationship("self");
repositoryInfoType.setRepositoryDescription("");
- repositoryInfoType.setRootFolderId((String) cmisPropertyService.getProperty(cmisService.getDefaultRootNodeRef(), CMISMapping.PROP_OBJECT_ID));
+ repositoryInfoType.setRootFolderId((String) cmisPropertyService.getProperty(cmisService.getDefaultRootNodeRef(), CMISDictionaryModel.PROP_OBJECT_ID));
repositoryInfoType.setVendorName("Alfresco");
repositoryInfoType.setProductName("Alfresco Repository (" + serverDescriptor.getEdition() + ")");
repositoryInfoType.setProductVersion(serverDescriptor.getVersion());
@@ -173,7 +172,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
* @param propertyType type of property
* @return web service choice
*/
- private JAXBElement extends CmisChoiceType> getCmisChoiceType(CMISChoice choice, CMISPropertyTypeEnum propertyType)
+ private JAXBElement extends CmisChoiceType> getCmisChoiceType(CMISChoice choice, CMISDataTypeEnum propertyType)
{
JAXBElement extends CmisChoiceType> result = null;
@@ -239,7 +238,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
* @param choices repository choice object
* @param cmisChoices web service choice object
*/
- private void addChoiceChildrens(CMISPropertyTypeEnum propertyType, Collection choices, List> cmisChoices)
+ private void addChoiceChildrens(CMISDataTypeEnum propertyType, Collection choices, List> cmisChoices)
{
for (CMISChoice choice : choices)
{
@@ -260,7 +259,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
* @param choices repository choice object
* @param cmisChoices web service choice object
*/
- private void addChoices(CMISPropertyTypeEnum propertyType, Collection choices, List cmisChoices)
+ private void addChoices(CMISDataTypeEnum propertyType, Collection choices, List cmisChoices)
{
for (CMISChoice choice : choices)
{
@@ -280,21 +279,21 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
* @param propertyDefinition repository property definition
* @param wsPropertyDefs web service property definition
*/
- private void addPropertyDefs(CMISPropertyDefinition propertyDefinition, List wsPropertyDefs)
+ private void addPropertyDefs(CMISTypeDefinition typeDefinition, CMISPropertyDefinition propertyDefinition, List wsPropertyDefs)
{
CmisPropertyDefinitionType wsPropertyDef = new CmisPropertyDefinitionType();
- wsPropertyDef.setName(propertyDefinition.getPropertyName());
- wsPropertyDef.setId(propertyDefinition.getPropertyId());
+ wsPropertyDef.setName(propertyDefinition.getPropertyId().getName());
+ wsPropertyDef.setId(propertyDefinition.getPropertyId().getId());
wsPropertyDef.setDisplayName(propertyDefinition.getDisplayName());
wsPropertyDef.setDescription(propertyDefinition.getDescription());
- wsPropertyDef.setPropertyType(propertyTypeEnumMapping.get(propertyDefinition.getPropertyType()));
+ wsPropertyDef.setPropertyType(propertyTypeEnumMapping.get(propertyDefinition.getDataType()));
wsPropertyDef.setCardinality(cardinalityEnumMapping.get(propertyDefinition.getCardinality()));
wsPropertyDef.setUpdateability(updatabilityEnumMapping.get(propertyDefinition.getUpdatability()));
- wsPropertyDef.setInherited(propertyDefinition.isInherited());
+ wsPropertyDef.setInherited(propertyDefinition.getOwningType().equals(typeDefinition));
wsPropertyDef.setRequired(propertyDefinition.isRequired());
wsPropertyDef.setQueryable(propertyDefinition.isQueryable());
wsPropertyDef.setOrderable(propertyDefinition.isOrderable());
- addChoices(propertyDefinition.getPropertyType(), propertyDefinition.getChoices(), wsPropertyDef.getChoice());
+ addChoices(propertyDefinition.getDataType(), propertyDefinition.getChoices(), wsPropertyDef.getChoice());
wsPropertyDef.setOpenChoice(propertyDefinition.isOpenChoice());
wsPropertyDefs.add(wsPropertyDef);
@@ -309,25 +308,25 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
*/
private void setCmisTypeDefinitionProperties(CmisTypeDefinitionType cmisTypeDefinition, CMISTypeDefinition typeDefinition, boolean includeProperties)
{
- cmisTypeDefinition.setTypeId(typeDefinition.getObjectTypeId().getTypeId());
- cmisTypeDefinition.setQueryName(typeDefinition.getObjectTypeQueryName());
- cmisTypeDefinition.setDisplayName(typeDefinition.getObjectTypeDisplayName());
- cmisTypeDefinition.setBaseType(EnumObjectType.fromValue(typeDefinition.getRootTypeId().getTypeId()));
- cmisTypeDefinition.setParentId(typeDefinition.getParentTypeId().getTypeId());
- cmisTypeDefinition.setBaseTypeQueryName(typeDefinition.getRootTypeQueryName());
+ cmisTypeDefinition.setTypeId(typeDefinition.getTypeId().getId());
+ cmisTypeDefinition.setQueryName(typeDefinition.getQueryName());
+ cmisTypeDefinition.setDisplayName(typeDefinition.getDisplayName());
+ cmisTypeDefinition.setBaseType(EnumObjectType.fromValue(typeDefinition.getRootType().getTypeId().getId()));
+ cmisTypeDefinition.setParentId(typeDefinition.getParentType().getTypeId().getId());
+ cmisTypeDefinition.setBaseTypeQueryName(typeDefinition.getRootType().getQueryName());
cmisTypeDefinition.setDescription(typeDefinition.getDescription());
cmisTypeDefinition.setCreatable(typeDefinition.isCreatable());
cmisTypeDefinition.setFileable(typeDefinition.isFileable());
cmisTypeDefinition.setQueryable(typeDefinition.isQueryable());
cmisTypeDefinition.setControllable(typeDefinition.isControllable());
- cmisTypeDefinition.setIncludedInSupertypeQuery(typeDefinition.isIncludedInSupertypeQuery());
+ cmisTypeDefinition.setIncludedInSupertypeQuery(typeDefinition.isIncludeInSuperTypeQuery());
if (includeProperties)
{
List propertyDefs = cmisTypeDefinition.getPropertyDefinition();
- for (CMISPropertyDefinition cmisPropDef : cmisDictionaryService.getPropertyDefinitions(typeDefinition.getObjectTypeId()).values())
+ for (CMISPropertyDefinition cmisPropDef : typeDefinition.getPropertyDefinitions().values())
{
- addPropertyDefs(cmisPropDef, propertyDefs);
+ addPropertyDefs(typeDefinition, cmisPropDef, propertyDefs);
}
}
}
@@ -340,45 +339,42 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
* @return web service type definition
* @throws ObjectNotFoundException if type id not found
*/
- private JAXBElement extends CmisTypeDefinitionType> getCmisTypeDefinition(String typeId, boolean includeProperties) throws ObjectNotFoundException
+ private JAXBElement extends CmisTypeDefinitionType> getCmisTypeDefinition(CMISTypeDefinition typeDef, boolean includeProperties) throws ObjectNotFoundException
{
- CMISTypeId cmisTypeId = cmisDictionaryService.getCMISMapping().getCmisTypeId(typeId);
- CMISTypeDefinition typeDefinition = cmisDictionaryService.getType(cmisTypeId);
-
- if (typeDefinition.getParentTypeId() == null)
+ if (typeDef.getParentType() == null)
{
return null;
}
- if (typeDefinition == null)
+ if (typeDef == null)
{
throw new ObjectNotFoundException("Type not found");
}
JAXBElement extends CmisTypeDefinitionType> result = null;
- switch (cmisTypeId.getScope())
+ switch (typeDef.getTypeId().getScope())
{
case DOCUMENT:
CmisTypeDocumentDefinitionType documentDefinitionType = new CmisTypeDocumentDefinitionType();
- setCmisTypeDefinitionProperties(documentDefinitionType, typeDefinition, includeProperties);
- documentDefinitionType.setVersionable(typeDefinition.isVersionable());
- documentDefinitionType.setContentStreamAllowed(contentStreamAllowedEnumMapping.get(typeDefinition.getContentStreamAllowed()));
+ setCmisTypeDefinitionProperties(documentDefinitionType, typeDef, includeProperties);
+ documentDefinitionType.setVersionable(typeDef.isVersionable());
+ documentDefinitionType.setContentStreamAllowed(contentStreamAllowedEnumMapping.get(typeDef.getContentStreamAllowed()));
result = cmisObjectFactory.createDocumentType(documentDefinitionType);
break;
case FOLDER:
CmisTypeFolderDefinitionType folderDefinitionType = new CmisTypeFolderDefinitionType();
- setCmisTypeDefinitionProperties(folderDefinitionType, typeDefinition, includeProperties);
+ setCmisTypeDefinitionProperties(folderDefinitionType, typeDef, includeProperties);
result = cmisObjectFactory.createFolderType(folderDefinitionType);
break;
case POLICY:
CmisTypePolicyDefinitionType policyDefinitionType = new CmisTypePolicyDefinitionType();
- setCmisTypeDefinitionProperties(policyDefinitionType, typeDefinition, includeProperties);
+ setCmisTypeDefinitionProperties(policyDefinitionType, typeDef, includeProperties);
result = cmisObjectFactory.createPolicyType(policyDefinitionType);
break;
case RELATIONSHIP:
CmisTypeRelationshipDefinitionType relationshipDefinitionType = new CmisTypeRelationshipDefinitionType();
- setCmisTypeDefinitionProperties(relationshipDefinitionType, typeDefinition, includeProperties);
+ setCmisTypeDefinitionProperties(relationshipDefinitionType, typeDef, includeProperties);
result = cmisObjectFactory.createRelationshipType(relationshipDefinitionType);
break;
case UNKNOWN:
@@ -407,28 +403,29 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
{
checkRepositoryId(parameters.getRepositoryId());
- Collection typeIds;
+ Collection typeDefs;
if (parameters.getTypeId() == null)
{
- typeIds = cmisDictionaryService.getAllObjectTypeIds();
+ typeDefs = cmisDictionaryService.getAllTypes();
}
else
{
- typeIds = cmisDictionaryService.getChildTypeIds(cmisDictionaryService.getCMISMapping().getCmisTypeId(parameters.getTypeId().getValue()), true);
+ CMISTypeDefinition typeDef = cmisDictionaryService.getType(cmisDictionaryService.getTypeId(parameters.getTypeId().getValue()));
+ typeDefs = typeDef.getSubTypes(true);
}
GetTypesResponse response = new GetTypesResponse();
if (parameters.getMaxItems() != null)
{
- response.setHasMoreItems(parameters.getMaxItems().getValue().intValue() < typeIds.size());
+ response.setHasMoreItems(parameters.getMaxItems().getValue().intValue() < typeDefs.size());
}
// skip
- Cursor cursor = createCursor(typeIds.size(), parameters.getSkipCount() != null ? parameters.getSkipCount().getValue() : null, parameters.getMaxItems() != null ? parameters.getMaxItems().getValue() : null);
- Iterator iterTypeIds = typeIds.iterator();
+ Cursor cursor = createCursor(typeDefs.size(), parameters.getSkipCount() != null ? parameters.getSkipCount().getValue() : null, parameters.getMaxItems() != null ? parameters.getMaxItems().getValue() : null);
+ Iterator iterTypeDefs = typeDefs.iterator();
for (int i = 0; i < cursor.getStartRow(); i++)
{
- iterTypeIds.next();
+ iterTypeDefs.next();
}
boolean returnPropertyDefinitions = parameters.getReturnPropertyDefinitions() == null ? false : parameters.getReturnPropertyDefinitions().getValue();
@@ -436,7 +433,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
List> types = response.getType();
for (int i = cursor.getStartRow(); i <= cursor.getEndRow(); i++)
{
- JAXBElement extends CmisTypeDefinitionType> element = getCmisTypeDefinition(iterTypeIds.next().getTypeId(), returnPropertyDefinitions);
+ JAXBElement extends CmisTypeDefinitionType> element = getCmisTypeDefinition(iterTypeDefs.next(), returnPropertyDefinitions);
if (element != null)
{
types.add(element);
@@ -466,7 +463,8 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
checkRepositoryId(parameters.getRepositoryId());
GetTypeDefinitionResponse response = new GetTypeDefinitionResponse();
- response.setType(getCmisTypeDefinition(parameters.getTypeId(), true));
+ CMISTypeDefinition typeDef = cmisDictionaryService.getType(cmisDictionaryService.getTypeId(parameters.getTypeId()));
+ response.setType(getCmisTypeDefinition(typeDef, true));
return response;
}
diff --git a/source/java/org/alfresco/repo/cmis/ws/DMVersioningServicePort.java b/source/java/org/alfresco/repo/cmis/ws/DMVersioningServicePort.java
index 0aeb8c43bd..c360fa07be 100755
--- a/source/java/org/alfresco/repo/cmis/ws/DMVersioningServicePort.java
+++ b/source/java/org/alfresco/repo/cmis/ws/DMVersioningServicePort.java
@@ -28,7 +28,7 @@ import java.util.List;
import javax.xml.ws.Holder;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.cmis.PropertyFilter;
import org.alfresco.repo.cmis.ws.utils.AlfrescoObjectType;
@@ -125,7 +125,7 @@ public class DMVersioningServicePort extends DMAbstractServicePort implements Ve
}
NodeRef nodeRef = checkOutCheckInService.checkin(workingCopyNodeRef, createVersionProperties(checkinComment, major != null && major ? VersionType.MAJOR : VersionType.MINOR));
- documentId.value = (String) cmisPropertyService.getProperty(nodeRef, CMISMapping.PROP_OBJECT_ID);
+ documentId.value = (String) cmisPropertyService.getProperty(nodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
}
/**
@@ -157,7 +157,7 @@ public class DMVersioningServicePort extends DMAbstractServicePort implements Ve
}
NodeRef pwcNodeRef = checkoutNode(documentNodeRef);
- documentId.value = (String) cmisPropertyService.getProperty(pwcNodeRef, CMISMapping.PROP_OBJECT_ID);
+ documentId.value = (String) cmisPropertyService.getProperty(pwcNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
contentCopied.value = true;
}
diff --git a/source/java/org/alfresco/repo/cmis/ws/PropertyUtil.java b/source/java/org/alfresco/repo/cmis/ws/PropertyUtil.java
index f749b766fc..7efe619bc6 100755
--- a/source/java/org/alfresco/repo/cmis/ws/PropertyUtil.java
+++ b/source/java/org/alfresco/repo/cmis/ws/PropertyUtil.java
@@ -28,7 +28,7 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.util.Pair;
/**
@@ -44,29 +44,29 @@ public class PropertyUtil
static
{
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_IMMUTABLE, new Pair("IsImmutable", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_LATEST_VERSION, new Pair("IsLatestVersion", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_MAJOR_VERSION, new Pair("IsMajorVersion", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION, new Pair("IsLatestMajorVersion", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT, new Pair("IsVersionSeriesCheckedOut", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CREATION_DATE, new Pair("CreationDate", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_LAST_MODIFICATION_DATE, new Pair("LastModificationDate", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_OBJECT_ID, new Pair("ObjectId", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_ID, new Pair("VersionSeriesId", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID, new Pair("VersionSeriesCheckedOutId", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_LENGTH, new Pair("ContentStreamLength", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_NAME, new Pair("Name", false));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_OBJECT_TYPE_ID, new Pair("ObjectTypeId", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CREATED_BY, new Pair("CreatedBy", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_LAST_MODIFIED_BY, new Pair("LastModifiedBy", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE, new Pair("ContentStreamMimeType", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_FILENAME, new Pair("ContentStreamFilename", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_LABEL, new Pair("VersionLabel", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CHECKIN_COMMENT, new Pair("checkinComment", false));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_URI, new Pair("contentStreamUri", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY, new Pair("VersionSeriesCheckedOutBy", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_PARENT_ID, new Pair("ParentId", true));
- cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_ALLOWED, new Pair("ContentStreamAllowed", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_IMMUTABLE, new Pair("IsImmutable", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_LATEST_VERSION, new Pair("IsLatestVersion", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_MAJOR_VERSION, new Pair("IsMajorVersion", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION, new Pair("IsLatestMajorVersion", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT, new Pair("IsVersionSeriesCheckedOut", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CREATION_DATE, new Pair("CreationDate", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE, new Pair("LastModificationDate", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_OBJECT_ID, new Pair("ObjectId", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_SERIES_ID, new Pair("VersionSeriesId", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID, new Pair("VersionSeriesCheckedOutId", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH, new Pair("ContentStreamLength", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_NAME, new Pair("Name", false));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_OBJECT_TYPE_ID, new Pair("ObjectTypeId", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CREATED_BY, new Pair("CreatedBy", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_LAST_MODIFIED_BY, new Pair("LastModifiedBy", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE, new Pair("ContentStreamMimeType", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME, new Pair("ContentStreamFilename", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_LABEL, new Pair("VersionLabel", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CHECKIN_COMMENT, new Pair("checkinComment", false));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_URI, new Pair("contentStreamUri", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY, new Pair("VersionSeriesCheckedOutBy", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_PARENT_ID, new Pair("ParentId", true));
+ cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED, new Pair("ContentStreamAllowed", true));
for (Map.Entry> entry : cmisToRepoPropertiesNamesMapping.entrySet())
{
diff --git a/source/java/org/alfresco/repo/cmis/ws/utils/CmisObjectsUtils.java b/source/java/org/alfresco/repo/cmis/ws/utils/CmisObjectsUtils.java
index a4ad9aa4f8..ec6821a7b7 100755
--- a/source/java/org/alfresco/repo/cmis/ws/utils/CmisObjectsUtils.java
+++ b/source/java/org/alfresco/repo/cmis/ws/utils/CmisObjectsUtils.java
@@ -28,7 +28,6 @@ import java.util.LinkedList;
import java.util.List;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
-import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.model.ContentModel;
@@ -73,7 +72,6 @@ public class CmisObjectsUtils
private AuthorityService authorityService;
private NodeService nodeService;
private LockService lockService;
- private CMISMapping cmisMapping;
private Throwable lastOperationException;
@@ -81,7 +79,6 @@ public class CmisObjectsUtils
public void setCmisDictionaryService(CMISDictionaryService cmisDictionaryService)
{
this.cmisDictionaryService = cmisDictionaryService;
- this.cmisMapping = this.cmisDictionaryService.getCMISMapping();
}
public void setNodeService(NodeService nodeService)
@@ -217,12 +214,24 @@ public class CmisObjectsUtils
public boolean isFolder(NodeRef folderNodeRef)
{
- return (folderNodeRef != null) && cmisMapping.isValidCmisFolder(cmisMapping.getCmisType(nodeService.getType(folderNodeRef)));
+ if (folderNodeRef == null)
+ {
+ return false;
+ }
+ QName typeQName = nodeService.getType(folderNodeRef);
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(typeQName, CMISScope.FOLDER);
+ return typeId != null;
}
public boolean isDocument(NodeRef documentNodeRef)
{
- return (documentNodeRef != null) && cmisMapping.isValidCmisDocument(cmisMapping.getCmisType(nodeService.getType(documentNodeRef)));
+ if (documentNodeRef == null)
+ {
+ return false;
+ }
+ QName typeQName = nodeService.getType(documentNodeRef);
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(typeQName, CMISScope.DOCUMENT);
+ return typeId != null;
}
public boolean isRelationship(String identifier)
@@ -354,7 +363,7 @@ public class CmisObjectsUtils
private AlfrescoObjectType determineActualObjectType(AlfrescoObjectType expectedType, QName objectType)
{
- CMISTypeId typeId = cmisMapping.getCmisTypeId(objectType);
+ CMISTypeId typeId = cmisDictionaryService.getTypeId(objectType, null);
if ((expectedType == AlfrescoObjectType.DOCUMENT_OBJECT || expectedType == AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT)
&& typeId.getScope() == CMISScope.DOCUMENT)
{
diff --git a/source/test/java/org/alfresco/repo/cmis/ws/AbstractServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/AbstractServiceTest.java
index 110b533019..63214ff4ac 100644
--- a/source/test/java/org/alfresco/repo/cmis/ws/AbstractServiceTest.java
+++ b/source/test/java/org/alfresco/repo/cmis/ws/AbstractServiceTest.java
@@ -28,7 +28,7 @@ import java.util.List;
import junit.framework.TestCase;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
/**
* @author Michael Shavnev
@@ -109,7 +109,7 @@ public abstract class AbstractServiceTest extends TestCase
{
CmisObjectType object = response.getObject();
CmisPropertiesType properties = object.getProperties();
- property = (String) PropertyUtil.getProperty(properties, CMISMapping.PROP_NAME);
+ property = (String) PropertyUtil.getProperty(properties, CMISDictionaryModel.PROP_NAME);
}
else
{
@@ -166,7 +166,7 @@ public abstract class AbstractServiceTest extends TestCase
{
CmisObjectType object = response.getObject();
CmisPropertiesType properties = object.getProperties();
- property = (String) PropertyUtil.getProperty(properties, CMISMapping.PROP_OBJECT_ID);
+ property = (String) PropertyUtil.getProperty(properties, CMISDictionaryModel.PROP_OBJECT_ID);
}
else
{
@@ -180,7 +180,7 @@ public abstract class AbstractServiceTest extends TestCase
for (CmisObjectType object : objects)
{
CmisPropertiesType properties = object.getProperties();
- String name = (String) PropertyUtil.getProperty(properties, CMISMapping.PROP_NAME);
+ String name = (String) PropertyUtil.getProperty(properties, CMISDictionaryModel.PROP_NAME);
assertNotNull(name);
}
diff --git a/source/test/java/org/alfresco/repo/cmis/ws/CmisServiceTestHelper.java b/source/test/java/org/alfresco/repo/cmis/ws/CmisServiceTestHelper.java
index 50e90569cd..1309b8f47a 100755
--- a/source/test/java/org/alfresco/repo/cmis/ws/CmisServiceTestHelper.java
+++ b/source/test/java/org/alfresco/repo/cmis/ws/CmisServiceTestHelper.java
@@ -44,7 +44,7 @@ import javax.xml.ws.Service;
import junit.framework.TestCase;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.repo.content.MimetypeMap;
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
@@ -194,7 +194,7 @@ public class CmisServiceTestHelper extends TestCase
CmisPropertiesType properties = new CmisPropertiesType();
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setValue(name);
propertiesList.add(cmisProperty);
@@ -207,7 +207,7 @@ public class CmisServiceTestHelper extends TestCase
// public String createDocument(String repositoryId, String typeId, CmisPropertiesType properties, String folderId, CmisContentStreamType contentStream,
// EnumVersioningState versioningState)
- String objectId = objectServicePort.createDocument(repositoryId, CMISMapping.DOCUMENT_TYPE_ID.getTypeId(), properties, parentFolderId, cmisStream,
+ String objectId = objectServicePort.createDocument(repositoryId, CMISDictionaryModel.DOCUMENT_TYPE_ID.getId(), properties, parentFolderId, cmisStream,
EnumVersioningState.MAJOR);
// assertNotNull(objectId);
return objectId;
@@ -220,7 +220,7 @@ public class CmisServiceTestHelper extends TestCase
CmisPropertiesType properties = new CmisPropertiesType();
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setValue(name);
propertiesList.add(cmisProperty);
@@ -233,7 +233,7 @@ public class CmisServiceTestHelper extends TestCase
// public String createDocument(String repositoryId, String typeId, CmisPropertiesType properties, String folderId, CmisContentStreamType contentStream,
// EnumVersioningState versioningState)
- String objectId = objectServicePort.createDocument(repositoryId, typeId.getTypeId(), properties, parentFolderId, cmisStream, enumVersioningState);
+ String objectId = objectServicePort.createDocument(repositoryId, typeId.getId(), properties, parentFolderId, cmisStream, enumVersioningState);
// assertNotNull(objectId);
return objectId;
}
@@ -251,13 +251,13 @@ public class CmisServiceTestHelper extends TestCase
CmisPropertiesType properties = new CmisPropertiesType();
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setValue(name + dataSource.getName());
propertiesList.add(cmisProperty);
// public String createDocument(String repositoryId, String typeId, CmisPropertiesType properties, String folderId, CmisContentStreamType contentStream,
// EnumVersioningState versioningState)
- String objectId = objectServicePort.createDocument(repositoryId, CMISMapping.DOCUMENT_TYPE_ID.getTypeId(), properties, parentFolderId, cmisStream,
+ String objectId = objectServicePort.createDocument(repositoryId, CMISDictionaryModel.DOCUMENT_TYPE_ID.getId(), properties, parentFolderId, cmisStream,
EnumVersioningState.MAJOR);
// assertNotNull(objectId);
return objectId;
@@ -276,14 +276,14 @@ public class CmisServiceTestHelper extends TestCase
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setPropertyType(EnumPropertyType.STRING);
cmisProperty.setIndex(BigInteger.valueOf(1));
cmisProperty.setValue(name);
propertiesList.add(cmisProperty);
// public String createFolder(String repositoryId, String typeId, CmisPropertiesType properties, String folderId)
- String objectId = objectServicePort.createFolder(repositoryId, CMISMapping.FOLDER_TYPE_ID.getTypeId(), properties, parentFolderId);
+ String objectId = objectServicePort.createFolder(repositoryId, CMISDictionaryModel.FOLDER_TYPE_ID.getId(), properties, parentFolderId);
// assertNotNull(objectId);
return objectId;
}
@@ -295,14 +295,14 @@ public class CmisServiceTestHelper extends TestCase
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setPropertyType(EnumPropertyType.STRING);
cmisProperty.setIndex(BigInteger.valueOf(1));
cmisProperty.setValue(name);
propertiesList.add(cmisProperty);
// public String createFolder(String repositoryId, String typeId, CmisPropertiesType properties, String folderId)
- String objectId = objectServicePort.createFolder(repositoryId, cmisTypeId.getTypeId(), properties, parentFolderId);
+ String objectId = objectServicePort.createFolder(repositoryId, cmisTypeId.getId(), properties, parentFolderId);
// assertNotNull(objectId);
return objectId;
}
@@ -418,9 +418,9 @@ public class CmisServiceTestHelper extends TestCase
GetChildrenResponse response = getChildren(companyHomeId, EnumTypesOfFileableObjects.FOLDERS, 0, "*");
for (CmisObjectType object : response.getObject())
{
- if (PropertyUtil.getProperty(object.getProperties(), CMISMapping.PROP_NAME).equals("User Homes"))
+ if (PropertyUtil.getProperty(object.getProperties(), CMISDictionaryModel.PROP_NAME).equals("User Homes"))
{
- return (String) PropertyUtil.getProperty(object.getProperties(), CMISMapping.PROP_OBJECT_ID);
+ return (String) PropertyUtil.getProperty(object.getProperties(), CMISDictionaryModel.PROP_OBJECT_ID);
}
}
@@ -608,14 +608,14 @@ public class CmisServiceTestHelper extends TestCase
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setPropertyType(EnumPropertyType.STRING);
cmisProperty.setIndex(BigInteger.valueOf(1));
cmisProperty.setValue(name);
propertiesList.add(cmisProperty);
// createRelationship(String repositoryId, String typeId, CmisPropertiesType properties, String sourceObjectId, String targetObjectId)
- objectId = objectServicePort.createRelationship(repositoryId, CMISMapping.RELATIONSHIP_TYPE_ID.getTypeId(), properties, documentId, folderId);
+ objectId = objectServicePort.createRelationship(repositoryId, CMISDictionaryModel.RELATIONSHIP_TYPE_ID.getId(), properties, documentId, folderId);
assertNotNull(objectId);
return objectId;
diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMDiscoveryServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMDiscoveryServiceTest.java
index 36c2eeaecc..e05a29ac08 100755
--- a/source/test/java/org/alfresco/repo/cmis/ws/DMDiscoveryServiceTest.java
+++ b/source/test/java/org/alfresco/repo/cmis/ws/DMDiscoveryServiceTest.java
@@ -35,7 +35,7 @@ public class DMDiscoveryServiceTest extends AbstractServiceTest
public final static String SERVICE_WSDL_LOCATION = CmisServiceTestHelper.ALFRESCO_URL + "/cmis/DiscoveryService?wsdl";
public final static QName SERVICE_NAME = new QName("http://www.cmis.org/ns/1.0", "DiscoveryService");
- public final static String STATEMENT = "SELECT * FROM aiim_content";
+ public final static String STATEMENT = "SELECT * FROM Document";
public DMDiscoveryServiceTest()
{
diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMMultiFilingServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMMultiFilingServiceTest.java
index 1246cf4e20..82c3c883ac 100755
--- a/source/test/java/org/alfresco/repo/cmis/ws/DMMultiFilingServiceTest.java
+++ b/source/test/java/org/alfresco/repo/cmis/ws/DMMultiFilingServiceTest.java
@@ -26,7 +26,7 @@ package org.alfresco.repo.cmis.ws;
import javax.xml.namespace.QName;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
public class DMMultiFilingServiceTest extends AbstractServiceTest
{
@@ -71,9 +71,9 @@ public class DMMultiFilingServiceTest extends AbstractServiceTest
{
((MultiFilingServicePort) servicePort).addObjectToFolder(repositoryId, documentId, anotherFolderId);
boolean found = false;
- for (CmisObjectType cmisObjectType : helper.getChildren(anotherFolderId, EnumTypesOfFileableObjects.DOCUMENTS, 0, CMISMapping.PROP_OBJECT_ID).getObject())
+ for (CmisObjectType cmisObjectType : helper.getChildren(anotherFolderId, EnumTypesOfFileableObjects.DOCUMENTS, 0, CMISDictionaryModel.PROP_OBJECT_ID).getObject())
{
- if ((found = PropertyUtil.getProperty(cmisObjectType.getProperties(), CMISMapping.PROP_OBJECT_ID).equals(documentId)))
+ if ((found = PropertyUtil.getProperty(cmisObjectType.getProperties(), CMISDictionaryModel.PROP_OBJECT_ID).equals(documentId)))
{
break;
}
diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMNavigationServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMNavigationServiceTest.java
index 6845b1fed5..a1d0f32ef6 100755
--- a/source/test/java/org/alfresco/repo/cmis/ws/DMNavigationServiceTest.java
+++ b/source/test/java/org/alfresco/repo/cmis/ws/DMNavigationServiceTest.java
@@ -28,7 +28,7 @@ import java.math.BigInteger;
import javax.xml.ws.Holder;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
/**
* @author Alexander Tsvetkov
@@ -103,7 +103,7 @@ public class DMNavigationServiceTest extends AbstractServiceTest
helper.versioningServicePort.checkIn(repositoryId, documentIdHolder, null, null, null, null);
response = getCheckedoutDocs(companyHomeId, 0, 0);
- assertFalse("Wrong results", isExistItemWithProperty(response.getObject(), CMISMapping.PROP_NAME, documentName));
+ assertFalse("Wrong results", isExistItemWithProperty(response.getObject(), CMISDictionaryModel.PROP_NAME, documentName));
}
@@ -124,20 +124,20 @@ public class DMNavigationServiceTest extends AbstractServiceTest
String folderName1 = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
String folderId1 = helper.createFolder(folderName1, folderId);
String documentName1 = "Test cmis document (" + System.currentTimeMillis() + ")";
- String documentId1 = helper.createDocument(documentName1, folderId, CMISMapping.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
+ String documentId1 = helper.createDocument(documentName1, folderId, CMISDictionaryModel.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
response = getChildren(folderId, EnumTypesOfFileableObjects.ANY, 0);
assertEquals(2, response.getObject().size());
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName1));
- assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISMapping.PROP_NAME).equals(documentName1));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName1));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISDictionaryModel.PROP_NAME).equals(documentName1));
response = getChildren(folderId, EnumTypesOfFileableObjects.FOLDERS, 0);
assertTrue(response.getObject().size() == 1);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName1));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName1));
response = getChildren(folderId, EnumTypesOfFileableObjects.DOCUMENTS, 0);
assertTrue(response.getObject().size() == 1);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(documentName1));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(documentName1));
// FIXME: bug • If maxItems > 0, Bool hasMoreItems
// Should return 1 item
@@ -180,20 +180,20 @@ public class DMNavigationServiceTest extends AbstractServiceTest
folderName = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
String folderId1 = helper.createFolder(folderName, folderId);
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
- String documentId1 = helper.createDocument(documentName, folderId1, CMISMapping.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
+ String documentId1 = helper.createDocument(documentName, folderId1, CMISDictionaryModel.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
response = getDescendants(folderId, EnumTypesOfFileableObjects.FOLDERS, 1);
assertTrue(response.getObject().size() == 1);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName));
response = getDescendants(folderId, EnumTypesOfFileableObjects.DOCUMENTS, 2);
assertTrue(response.getObject().size() == 1);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(documentName));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(documentName));
response = getDescendants(folderId, EnumTypesOfFileableObjects.ANY, 2);
assertTrue(response.getObject().size() == 2);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName));
- assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISMapping.PROP_NAME).equals(documentName));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISDictionaryModel.PROP_NAME).equals(documentName));
response = getDescendants(folderId, EnumTypesOfFileableObjects.ANY, -1);
assertTrue(response.getObject().size() == 2);
@@ -236,14 +236,14 @@ public class DMNavigationServiceTest extends AbstractServiceTest
folderId1 = helper.createFolder(folderName1, folderId);
response = getFolderParent(folderId1, false);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName));
String folderName2 = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
String folderId2 = helper.createFolder(folderName2, folderId1);
response = getFolderParent(folderId2, true);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName1));
- assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISMapping.PROP_NAME).equals(folderName));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName1));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName));
assertTrue(response.getObject().size() >= 3);
}
@@ -267,11 +267,11 @@ public class DMNavigationServiceTest extends AbstractServiceTest
String folderName1 = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
folderId1 = helper.createFolder(folderName1, folderId);
String documentName1 = "Test cmis document (" + System.currentTimeMillis() + ")";
- documentId1 = helper.createDocument(documentName1, folderId1, CMISMapping.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
+ documentId1 = helper.createDocument(documentName1, folderId1, CMISDictionaryModel.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
response = helper.getObjectParents(documentId1, "*");
assertTrue(response.getObject().size() == 1);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName1));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName1));
// TODO: not implemented
// assertNotNull(response.getObject().get(0).getAllowableActions());
@@ -284,7 +284,7 @@ public class DMNavigationServiceTest extends AbstractServiceTest
response = helper.getObjectParents(documentId1);
assertTrue(response.getObject().size() == 1);
- assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName1));
+ assertTrue(PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName1));
// assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISMapping.PROP_NAME).equals(folderName));
}
diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServiceTest.java
index 342c0762bb..d765ef5c48 100644
--- a/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServiceTest.java
+++ b/source/test/java/org/alfresco/repo/cmis/ws/DMObjectServiceTest.java
@@ -30,6 +30,7 @@ import java.util.List;
import javax.activation.DataHandler;
import javax.xml.ws.Holder;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.repo.content.MimetypeMap;
@@ -81,7 +82,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
CmisPropertiesType properties = new CmisPropertiesType();
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setValue(documentName);
propertiesList.add(cmisProperty);
@@ -98,17 +99,17 @@ public class DMObjectServiceTest extends AbstractServiceTest
String documentId;
// MAJOR
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
- documentId = helper.createDocument(documentName, folderId, CMISMapping.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
+ documentId = helper.createDocument(documentName, folderId, CMISDictionaryModel.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
propertiesResponse = helper.getObjectProperties(documentId);
// assertTrue(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_MAJOR_VERSION));
- assertFalse(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
+ assertFalse(getPropertyBooleanValue(propertiesResponse, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
helper.deleteDocument(documentId);
// MINOR
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
- documentId = helper.createDocument(documentName, folderId, CMISMapping.DOCUMENT_TYPE_ID, EnumVersioningState.MINOR);
+ documentId = helper.createDocument(documentName, folderId, CMISDictionaryModel.DOCUMENT_TYPE_ID, EnumVersioningState.MINOR);
propertiesResponse = helper.getObjectProperties(documentId);
- assertFalse(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
+ assertFalse(getPropertyBooleanValue(propertiesResponse, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
// assertTrue(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_MAJOR_VERSION));
helper.deleteDocument(documentId);
@@ -118,17 +119,17 @@ public class DMObjectServiceTest extends AbstractServiceTest
{
// CHECKEDOUT
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
- String documentId = helper.createDocument(documentName, folderId, CMISMapping.DOCUMENT_TYPE_ID, EnumVersioningState.CHECKEDOUT);
+ String documentId = helper.createDocument(documentName, folderId, CMISDictionaryModel.DOCUMENT_TYPE_ID, EnumVersioningState.CHECKEDOUT);
propertiesResponse = helper.getObjectProperties(documentId);
- assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_VERSION_SERIES_ID));
+ assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_VERSION_SERIES_ID));
// Bug
- assertTrue(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
- assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY));
- assertTrue(getPropertyValue(propertiesResponse, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID).equals(documentId));
+ assertTrue(getPropertyBooleanValue(propertiesResponse, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
+ assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY));
+ assertTrue(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID).equals(documentId));
Holder documentIdHolder = new Holder(documentId);
helper.checkIn(documentIdHolder, "checkin Comment", true);
- assertTrue(getPropertyValue(propertiesResponse, CMISMapping.PROP_VERSION_LABEL).equals("1.0"));
+ assertTrue(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_VERSION_LABEL).equals("1.0"));
// documentId = (String) PropertyUtil.getProperty(response.getObject().iterator().next().getProperties(), CMISMapping.PROP_OBJECT_ID);
// deleteDocument(documentId);
@@ -140,7 +141,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
try
{
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
- documentId = helper.createDocument(documentName, null, CMISMapping.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
+ documentId = helper.createDocument(documentName, null, CMISDictionaryModel.DOCUMENT_TYPE_ID, EnumVersioningState.MAJOR);
fail();
}
catch (FolderNotValidException e)
@@ -158,11 +159,11 @@ public class DMObjectServiceTest extends AbstractServiceTest
{
String folderId1;
folderName = "Test Cmis Folder (" + System.currentTimeMillis() + ")" + "testCreateFolder";
- folderId1 = helper.createFolder(folderName, folderId, CMISMapping.FOLDER_TYPE_ID);
+ folderId1 = helper.createFolder(folderName, folderId, CMISDictionaryModel.FOLDER_TYPE_ID);
propertiesResponse = helper.getObjectProperties(folderId1);
- assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_NAME));
- assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_PARENT_ID));
+ assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_NAME));
+ assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_PARENT_ID));
helper.deleteFolder(folderId1);
}
@@ -172,10 +173,10 @@ public class DMObjectServiceTest extends AbstractServiceTest
String filter;
filter = "*";
propertiesResponse = helper.getObjectProperties(documentId, filter);
- assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_NAME));
- assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_CONTENT_STREAM_FILENAME));
- assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE));
- assertTrue(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_LATEST_VERSION));
+ assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_NAME));
+ assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME));
+ assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE));
+ assertTrue(getPropertyBooleanValue(propertiesResponse, CMISDictionaryModel.PROP_IS_LATEST_VERSION));
// A property filter is a string that contains either ‘*’ (to return all properties) or a comma-separated list of property names (to return selected properties). An
// arbitrary number of spaces are allowed before or after each comma.
@@ -198,21 +199,21 @@ public class DMObjectServiceTest extends AbstractServiceTest
helper.checkOut(documentIdHolder, contentCopied);
// new version of doc
response = helper.getObjectProperties(documentIdHolder.value);
- assertNotNull(getPropertyValue(response, CMISMapping.PROP_NAME));
- assertNotNull(getPropertyValue(response, CMISMapping.PROP_CONTENT_STREAM_FILENAME));
- assertNotNull(getPropertyValue(response, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE));
- assertTrue(getPropertyBooleanValue(response, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
- assertNotNull(getPropertyValue(response, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY));
+ assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_NAME));
+ assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME));
+ assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE));
+ assertTrue(getPropertyBooleanValue(response, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
+ assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY));
helper.checkIn(documentIdHolder, checkinComment, true);
response = helper.getObjectProperties(documentId);
- assertNotNull(getPropertyValue(response, CMISMapping.PROP_NAME));
- assertNotNull(getPropertyValue(response, CMISMapping.PROP_CONTENT_STREAM_FILENAME));
- assertNotNull(getPropertyValue(response, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE));
- assertTrue(getPropertyBooleanValue(response, CMISMapping.PROP_IS_LATEST_VERSION));
- assertTrue(getPropertyBooleanValue(response, CMISMapping.PROP_IS_LATEST_MAJOR_VERSION));
- assertTrue(getPropertyBooleanValue(response, CMISMapping.PROP_IS_MAJOR_VERSION));
+ assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_NAME));
+ assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME));
+ assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE));
+ assertTrue(getPropertyBooleanValue(response, CMISDictionaryModel.PROP_IS_LATEST_VERSION));
+ assertTrue(getPropertyBooleanValue(response, CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION));
+ assertTrue(getPropertyBooleanValue(response, CMISDictionaryModel.PROP_IS_MAJOR_VERSION));
// Returns the list of all document versions for the specified version series, sorted by CREATION_DATE descending.
GetAllVersionsResponse responseVersions = helper.getAllVersions(documentId);
@@ -220,9 +221,9 @@ public class DMObjectServiceTest extends AbstractServiceTest
// Last version
assertEquals(3, responseVersions.getObject().size());
- assertTrue("Initial version was not returned", isExistItemWithProperty(responseVersions.getObject(), CMISMapping.PROP_VERSION_LABEL, "1.0"));
- assertTrue("Invalid response ordering: First object is not latest version", (Boolean) PropertyUtil.getProperty(responseVersions.getObject().get(0).getProperties(), CMISMapping.PROP_IS_LATEST_VERSION));
- assertTrue("Invalid response ordering: Second object is not head version", (Boolean) PropertyUtil.getProperty(responseVersions.getObject().get(1).getProperties(), CMISMapping.PROP_IS_LATEST_VERSION));
+ assertTrue("Initial version was not returned", isExistItemWithProperty(responseVersions.getObject(), CMISDictionaryModel.PROP_VERSION_LABEL, "1.0"));
+ assertTrue("Invalid response ordering: First object is not latest version", (Boolean) PropertyUtil.getProperty(responseVersions.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_IS_LATEST_VERSION));
+ assertTrue("Invalid response ordering: Second object is not head version", (Boolean) PropertyUtil.getProperty(responseVersions.getObject().get(1).getProperties(), CMISDictionaryModel.PROP_IS_LATEST_VERSION));
}
// This test don't asserts until CMIS setProperty()/setProperties() logic is unimplemented
@@ -315,7 +316,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setPropertyType(EnumPropertyType.STRING);
cmisProperty.setIndex(BigInteger.valueOf(1));
cmisProperty.setValue("Cmis Test Policy");
@@ -544,11 +545,11 @@ public class DMObjectServiceTest extends AbstractServiceTest
CmisObjectType objectType = response.getObject();
assertNotNull(objectType);
- assertNotNull(getPropertyValue(response, CMISMapping.PROP_NAME));
+ assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_NAME));
GetObjectParentsResponse parentsResponse = helper.getObjectParents(documentId, "*");
assertTrue(parentsResponse.getObject().size() == 1);
- assertTrue(PropertyUtil.getProperty(parentsResponse.getObject().get(0).getProperties(), CMISMapping.PROP_NAME).equals(folderName));
+ assertTrue(PropertyUtil.getProperty(parentsResponse.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName));
}
@@ -604,7 +605,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
// Alfresco create new version of document
propertiesResponse = helper.getObjectProperties(documentIdHolder.value);
- assertFalse("new version of document should be created", getPropertyValue(propertiesResponse, CMISMapping.PROP_OBJECT_ID).equals(documentId));
+ assertFalse("new version of document should be created", getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_OBJECT_ID).equals(documentId));
GetAllVersionsResponse responseVersions = helper.getAllVersions(documentId);
assertTrue("new version of document should be created", responseVersions.getObject().size() > 1);
@@ -644,7 +645,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
// now we can not set any property (beside name) when we create new document - so this case not working
propertiesResponse = helper.getObjectProperties(documentId);
- Boolean contentStreamAllowed = getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_CONTENT_STREAM_ALLOWED);
+ Boolean contentStreamAllowed = getPropertyBooleanValue(propertiesResponse, CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED);
if (contentStreamAllowed != null && contentStreamAllowed == false)
{
try
@@ -675,7 +676,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
CmisPropertiesType properties = new CmisPropertiesType();
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_NAME);
+ cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
cmisProperty.setValue(newName);
propertiesList.add(cmisProperty);
@@ -695,7 +696,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
properties = new CmisPropertiesType();
List propertiesList = properties.getProperty();
CmisPropertyString cmisProperty = new CmisPropertyString();
- cmisProperty.setName(CMISMapping.PROP_OBJECT_ID);
+ cmisProperty.setName(CMISDictionaryModel.PROP_OBJECT_ID);
cmisProperty.setValue("new id value");
propertiesList.add(cmisProperty);
diff --git a/source/test/java/org/alfresco/repo/cmis/ws/DMVersioningServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/DMVersioningServiceTest.java
index cb85451b7d..471f9b74d0 100755
--- a/source/test/java/org/alfresco/repo/cmis/ws/DMVersioningServiceTest.java
+++ b/source/test/java/org/alfresco/repo/cmis/ws/DMVersioningServiceTest.java
@@ -27,7 +27,7 @@ package org.alfresco.repo.cmis.ws;
import javax.activation.DataHandler;
import javax.xml.ws.Holder;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
import org.alfresco.repo.content.MimetypeMap;
public class DMVersioningServiceTest extends AbstractServiceTest
@@ -81,7 +81,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
String checkinComment = "Test checkin" + System.currentTimeMillis();
((VersioningServicePort) servicePort).checkIn(repositoryId, documentIdHolder, Boolean.TRUE, properties, contentStream, checkinComment);
- assertEquals(checkinComment, PropertyUtil.getProperty(helper.getObjectProperties(documentId).getObject().getProperties(), CMISMapping.PROP_CHECKIN_COMMENT));
+ assertEquals(checkinComment, PropertyUtil.getProperty(helper.getObjectProperties(documentId).getObject().getProperties(), CMISDictionaryModel.PROP_CHECKIN_COMMENT));
}
public void testCheckOutCheckInDefault() throws Exception
@@ -108,7 +108,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
// Cancel check out
((VersioningServicePort) servicePort).cancelCheckOut(repositoryId, documentIdHolder.value);
- assertFalse((Boolean) PropertyUtil.getProperty(helper.getObjectProperties(documentId).getObject().getProperties(), CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
+ assertFalse((Boolean) PropertyUtil.getProperty(helper.getObjectProperties(documentId).getObject().getProperties(), CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
}
public void testCheckinNoExistsCheckOut() throws Exception
@@ -159,7 +159,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
assertNotNull(response.getObject());
CmisObjectType objectType = response.getObject();
assertNotNull(objectType.getProperties());
- assertTrue((Boolean) PropertyUtil.getProperty(objectType.getProperties(), CMISMapping.PROP_IS_LATEST_VERSION));
+ assertTrue((Boolean) PropertyUtil.getProperty(objectType.getProperties(), CMISDictionaryModel.PROP_IS_LATEST_VERSION));
}
public void testGetPropertiesOfLatestVersionDefault() throws Exception
@@ -172,7 +172,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
assertNotNull(response.getObject());
CmisObjectType objectType = response.getObject();
assertNotNull(objectType.getProperties());
- assertTrue((Boolean) PropertyUtil.getProperty(objectType.getProperties(), CMISMapping.PROP_IS_LATEST_VERSION));
+ assertTrue((Boolean) PropertyUtil.getProperty(objectType.getProperties(), CMISDictionaryModel.PROP_IS_LATEST_VERSION));
}
public void testGetAllVersionsDefault() throws Exception
@@ -192,7 +192,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
GetAllVersionsResponse response = ((VersioningServicePort) servicePort).getAllVersions(request);
assertNotNull(response);
assertNotNull(response.getObject());
- assertEquals(checkinComment, PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_CHECKIN_COMMENT));
+ assertEquals(checkinComment, PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_CHECKIN_COMMENT));
}
public void testGetAllVersions() throws Exception
@@ -215,7 +215,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
GetAllVersionsResponse response = ((VersioningServicePort) servicePort).getAllVersions(request);
assertNotNull(response);
assertNotNull(response.getObject());
- assertEquals(checkinComment, PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISMapping.PROP_CHECKIN_COMMENT));
+ assertEquals(checkinComment, PropertyUtil.getProperty(response.getObject().get(0).getProperties(), CMISDictionaryModel.PROP_CHECKIN_COMMENT));
}
public void testGetAllVersionsForNoVersionHistory() throws Exception
@@ -256,11 +256,11 @@ public class DMVersioningServiceTest extends AbstractServiceTest
{
if (!checkedOutfound)
{
- checkedOutfound = (Boolean) PropertyUtil.getProperty(cmisObjectType.getProperties(), CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT);
+ checkedOutfound = (Boolean) PropertyUtil.getProperty(cmisObjectType.getProperties(), CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT);
}
if (!pwcFound)
{
- pwcFound = ((String) PropertyUtil.getProperty(cmisObjectType.getProperties(), CMISMapping.PROP_OBJECT_ID)).startsWith(documentIdHolder.value);
+ pwcFound = ((String) PropertyUtil.getProperty(cmisObjectType.getProperties(), CMISDictionaryModel.PROP_OBJECT_ID)).startsWith(documentIdHolder.value);
}
}
assertTrue("No checked out version found", checkedOutfound);
diff --git a/source/test/java/org/alfresco/repo/cmis/ws/MultiThreadsServiceTest.java b/source/test/java/org/alfresco/repo/cmis/ws/MultiThreadsServiceTest.java
index 6361edb3d2..2ba86e8297 100755
--- a/source/test/java/org/alfresco/repo/cmis/ws/MultiThreadsServiceTest.java
+++ b/source/test/java/org/alfresco/repo/cmis/ws/MultiThreadsServiceTest.java
@@ -28,7 +28,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
-import org.alfresco.cmis.dictionary.CMISMapping;
+import org.alfresco.cmis.dictionary.CMISDictionaryModel;
public class MultiThreadsServiceTest extends AbstractServiceTest
{
@@ -97,7 +97,7 @@ public class MultiThreadsServiceTest extends AbstractServiceTest
GetPropertiesResponse propertiesResponse;
propertiesResponse = helper.getObjectProperties(documentId);
- assertEquals(lastName, getPropertyValue(propertiesResponse, CMISMapping.PROP_NAME));
+ assertEquals(lastName, getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_NAME));
}
}
@@ -171,7 +171,7 @@ public class MultiThreadsServiceTest extends AbstractServiceTest
try
{
String newName = "New Name" + System.currentTimeMillis() + generator.nextDouble();
- helper.updateProperty(documentId, CMISMapping.PROP_NAME, newName);
+ helper.updateProperty(documentId, CMISDictionaryModel.PROP_NAME, newName);
lastName = newName;
}
catch (Exception e)