CMIS Dictionary Refactor

- follows pattern of Alfresco Dictionary
- simplified and much reduced DictionaryService interface
- model now compiled and cached (no more lots of small continuous object creations)
- walk model via simple getters
- validated (no dangling references)
- fix up property inheritance
- fix up sub-types for all types
- implements strict mode only for now (i.e. doesn't go outside of CMIS doc, folder, rel and policy)
- abstract helper for building other CMIS dictionaries (e.g. mapping all types in Alfresco)

Alfresco Dictionary:
- add event for initialized or re-initialized

Fix up usage in CMIS REST, Web Services and query. Tests pass.

REST support for custom sub-types and properties now reliable as constrained by validated CMIS model.

TODO:
- hook property value accessors into CMIS Dictionary

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13768 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-03-27 23:13:29 +00:00
parent b4aa000b9f
commit 509708b273
23 changed files with 423 additions and 484 deletions

View File

@@ -45,7 +45,7 @@
<link rel="cmis-parents" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/parents"/>
<link rel="cmis-allversions" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/versions"/>
[@linkstream node "cmis-stream"/]
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${cmistypeid(node)}"/>
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${cmistype(node).typeId.id!"unknown"}"/>
<link rel="cmis-repository" href="[@serviceuri/]"/>
[/#macro]
@@ -56,7 +56,7 @@
[#assign typedef = cmistype(node)]
[#list typedef.propertyDefinitions?values as propdef]
[@filter propfilter propdef.propertyName][@prop propdef.propertyName node propdef.propertyType/][/@filter]
[@filter propfilter propdef.propertyId.name][@prop propdef.propertyId.name node propdef.dataType/][/@filter]
[/#list]
</cmis:properties>
[/#macro]
@@ -165,7 +165,7 @@
[/#if]
<link rel="cmis-children" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/children"/>
<link rel="cmis-descendants" href="${absurl(url.serviceContext)}/api/node/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/descendants"/>
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${cmistypeid(node)}"/>
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${cmistype(node).typeId.id!"unknown"}"/>
<link rel="cmis-repository" href="[@serviceuri/]"/>
[/#macro]
@@ -176,7 +176,7 @@
[#assign typedef = cmistype(node)]
[#list typedef.propertyDefinitions?values as propdef]
[@filter propfilter propdef.propertyName][@prop propdef.propertyName node propdef.propertyType/][/@filter]
[@filter propfilter propdef.propertyId.name][@prop propdef.propertyId.name node propdef.dataType/][/@filter]
[/#list]
</cmis:properties>
[/#macro]
@@ -311,12 +311,12 @@
[#macro typedef typedef includeProperties=true includeInheritedProperties=true ns=""]
[@entry ns=ns]
<author><name>${person.properties.userName}</name></author>
<content>${typedef.objectTypeId}</content> [#-- TODO --]
<id>urn:uuid:type-${typedef.objectTypeId}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/type/${typedef.objectTypeId}"/>
<content>${typedef.typeId.id}</content> [#-- TODO --]
<id>urn:uuid:type-${typedef.typeId.id}</id>
<link rel="self" href="${absurl(url.serviceContext)}/api/type/${typedef.typeId.id}"/>
[@typedefCMISLinks typedef/]
<summary>[#if typedef.description??]${typedef.description?xml}[#else]${typedef.objectTypeDisplayName?xml}[/#if]</summary>
<title>${typedef.objectTypeDisplayName}</title>
<summary>[#if typedef.description??]${typedef.description?xml}[#else]${typedef.displayName?xml}[/#if]</summary>
<title>${typedef.displayName}</title>
<updated>${xmldate(date)}</updated> [#-- TODO --]
[@typedefCMISProps typedef includeProperties/]
<cmis:terminator/>
@@ -324,23 +324,23 @@
[/#macro]
[#macro typedefCMISLinks typedef]
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${typedef.objectTypeId}"/>
[#if typedef.parentTypeId??]
<link rel="cmis-parent" href="${absurl(url.serviceContext)}/api/type/${typedef.parentTypeId}"/>
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${typedef.typeId.id}"/>
[#if typedef.parentType??]
<link rel="cmis-parent" href="${absurl(url.serviceContext)}/api/type/${typedef.parentType.typeId.id}"/>
[/#if]
<link rel="cmis-children" href="${absurl(url.serviceContext)}/api/type/${typedef.objectTypeId}/children"/>
<link rel="cmis-descendants" href="${absurl(url.serviceContext)}/api/type/${typedef.objectTypeId}/descendants"/>
<link rel="cmis-children" href="${absurl(url.serviceContext)}/api/type/${typedef.typeId.id}/children"/>
<link rel="cmis-descendants" href="${absurl(url.serviceContext)}/api/type/${typedef.typeId.id}/descendants"/>
<link rel="cmis-repository" href="[@serviceuri/]"/>
[/#macro]
[#macro typedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
[#if typedef.rootTypeId.toString() = "document"]
[#if typedef.rootType.typeId.id = "document"]
[@documenttypedefCMISProps typedef includeProperties includeInheritedProperties/]
[#elseif typedef.rootTypeId.toString() = "folder"]
[#elseif typedef.rootType.typeId.id = "folder"]
[@foldertypedefCMISProps typedef includeProperties includeInheritedProperties/]
[#elseif typedef.rootTypeId.toString() = "relationship"]
[#elseif typedef.rootType.typeId.id = "relationship"]
[@relationshiptypedefCMISProps typedef includeProperties includeInheritedProperties/]
[#elseif typedef.rootTypeId.toString() = "policy"]
[#elseif typedef.rootType.typeId.id = "policy"]
[@policytypedefCMISProps typedef includeProperties includeInheritedProperties/]
[/#if]
[/#macro]
@@ -373,125 +373,126 @@
[/#macro]
[#macro objecttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
<cmis:typeId>${typedef.objectTypeId}</cmis:typeId>
<cmis:queryName>${typedef.objectTypeQueryName}</cmis:queryName>
<cmis:displayName>[#if typedef.objectTypeDisplayName??]${typedef.objectTypeDisplayName?xml}[/#if]</cmis:displayName>
<cmis:baseType>${typedef.rootTypeId}</cmis:baseType> [#-- TODO: remove spec issue 36 --]
<cmis:baseTypeQueryName>${typedef.rootTypeQueryName}</cmis:baseTypeQueryName>
[#if typedef.parentTypeId??]
<cmis:parentId>${typedef.parentTypeId}</cmis:parentId>
<cmis:typeId>${typedef.typeId.id}</cmis:typeId>
<cmis:queryName>${typedef.queryName}</cmis:queryName>
<cmis:displayName>[#if typedef.displayName??]${typedef.displayName?xml}[/#if]</cmis:displayName>
<cmis:baseType>${typedef.rootType.typeId.id}</cmis:baseType> [#-- TODO: remove spec issue 36 --]
<cmis:baseTypeQueryName>${typedef.rootType.queryName}</cmis:baseTypeQueryName>
[#if typedef.parentType??]
<cmis:parentId>${typedef.parentType.typeId.id}</cmis:parentId>
[/#if]
<cmis:description>[#if typedef.description??]${typedef.description?xml}[/#if]</cmis:description>
<cmis:creatable>${typedef.creatable?string}</cmis:creatable>
<cmis:fileable>${typedef.fileable?string}</cmis:fileable>
<cmis:queryable>${typedef.queryable?string}</cmis:queryable>
<cmis:controllable>${typedef.controllable?string}</cmis:controllable>
<cmis:includedInSupertypeQuery>${typedef.includedInSupertypeQuery?string}</cmis:includedInSupertypeQuery>
<cmis:includedInSupertypeQuery>${typedef.includeInSuperTypeQuery?string}</cmis:includedInSupertypeQuery>
[#if includeProperties]
[#list typedef.propertyDefinitions?values as propdef]
[#if includeInheritedProperties || !propdef.inherited]
[@propdefCMISProps propdef/]
[#assign inherited = (propdef.owningType != typedef)]
[#if includeInheritedProperties || !inherited]
[@propdefCMISProps propdef inherited/]
[/#if]
[/#list]
[/#if]
[/#macro]
[#macro propdefCMISProps propdef]
[#if propdef.propertyType == "BOOLEAN"]
[@booleanpropdefCMISProps propdef/]
[#elseif propdef.propertyType == "ID"]
[@idpropdefCMISProps propdef/]
[#elseif propdef.propertyType == "INTEGER"]
[@integerpropdefCMISProps propdef/]
[#elseif propdef.propertyType == "DATETIME"]
[@datetimepropdefCMISProps propdef/]
[#elseif propdef.propertyType == "DECIMAL"]
[@decimalpropdefCMISProps propdef/]
[#elseif propdef.propertyType == "HTML"]
[@htmlpropdefCMISProps propdef/]
[#elseif propdef.propertyType == "STRING"]
[@stringpropdefCMISProps propdef/]
[#elseif propdef.propertyType == "URI"]
[@uripropdefCMISProps propdef/]
[#elseif propdef.propertyType == "XML"]
[@xmlpropdefCMISProps propdef/]
[#macro propdefCMISProps propdef inherited=false]
[#if propdef.dataType == "BOOLEAN"]
[@booleanpropdefCMISProps propdef inherited/]
[#elseif propdef.dataType == "ID"]
[@idpropdefCMISProps propdef inherited/]
[#elseif propdef.dataType == "INTEGER"]
[@integerpropdefCMISProps propdef inherited/]
[#elseif propdef.dataType == "DATETIME"]
[@datetimepropdefCMISProps propdef inherited/]
[#elseif propdef.dataType == "DECIMAL"]
[@decimalpropdefCMISProps propdef inherited/]
[#elseif propdef.dataType == "HTML"]
[@htmlpropdefCMISProps propdef inherited/]
[#elseif propdef.dataType == "STRING"]
[@stringpropdefCMISProps propdef inherited/]
[#elseif propdef.dataType == "URI"]
[@uripropdefCMISProps propdef inherited/]
[#elseif propdef.dataType == "XML"]
[@xmlpropdefCMISProps propdef inherited/]
[/#if]
[/#macro]
[#macro booleanpropdefCMISProps propdef]
[#macro booleanpropdefCMISProps propdef inherited=false]
<cmis:propertyBooleanDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
</cmis:propertyBooleanDefinition>
[/#macro]
[#macro idpropdefCMISProps propdef]
[#macro idpropdefCMISProps propdef inherited=false]
<cmis:propertyIdDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
</cmis:propertyIdDefinition>
[/#macro]
[#macro integerpropdefCMISProps propdef]
[#macro integerpropdefCMISProps propdef inherited=false]
<cmis:propertyIntegerDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
[#-- TODO: minValue, maxValue --]
</cmis:propertyIntegerDefinition>
[/#macro]
[#macro datetimepropdefCMISProps propdef]
[#macro datetimepropdefCMISProps propdef inherited=false]
<cmis:propertyDateTimeDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
</cmis:propertyDateTimeDefinition>
[/#macro]
[#macro decimalpropdefCMISProps propdef]
[#macro decimalpropdefCMISProps propdef inherited=false]
<cmis:propertyDecimalDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
</cmis:propertyDecimalDefinition>
[/#macro]
[#macro htmlpropdefCMISProps propdef]
[#macro htmlpropdefCMISProps propdef inherited=false]
<cmis:propertyHtmlDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
</cmis:propertyHtmlDefinition>
[/#macro]
[#macro stringpropdefCMISProps propdef]
[#macro stringpropdefCMISProps propdef inherited=false]
<cmis:propertyStringDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
[#if propdef.maximumLength != -1]
<cmis:maxLength>${propdef.maximumLength}</cmis:maxLength>
[/#if]
</cmis:propertyStringDefinition>
[/#macro]
[#macro uripropdefCMISProps propdef]
[#macro uripropdefCMISProps propdef inherited=false]
<cmis:propertyUriDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
</cmis:propertyUriDefinition>
[/#macro]
[#macro xmlpropdefCMISProps propdef]
[#macro xmlpropdefCMISProps propdef inherited=false]
<cmis:propertyXmlDefinition>
[@abstractpropdefCMISProps propdef/]
[@abstractpropdefCMISProps propdef inherited/]
[#-- TODO: scheme, uri --]
</cmis:propertyXmlDefinition>
[/#macro]
[#macro abstractpropdefCMISProps propdef]
<cmis:name>${propdef.propertyName}</cmis:name>
[#macro abstractpropdefCMISProps propdef inherited=false]
<cmis:name>${propdef.propertyId.name}</cmis:name>
<cmis:id>${propdef.propertyId}</cmis:id>
<cmis:displayName>[#if propdef.displayName??]${propdef.displayName?xml}[/#if]</cmis:displayName>
[#if propdef.description??]
<cmis:description>${propdef.description?xml}</cmis:description>
[/#if]
<cmis:propertyType>${propdef.propertyType.label}</cmis:propertyType>
<cmis:propertyType>${propdef.dataType.label}</cmis:propertyType>
<cmis:cardinality>${propdef.cardinality.label}</cmis:cardinality>
<cmis:updateability>${propdef.updatability.label}</cmis:updateability>
<cmis:inherited>${propdef.inherited?string}</cmis:inherited>
<cmis:inherited>${inherited?string}</cmis:inherited>
<cmis:required>${propdef.required?string}</cmis:required>
<cmis:queryable>${propdef.queryable?string}</cmis:queryable>
<cmis:orderable>${propdef.orderable?string}</cmis:orderable>
[@cmisChoices propdef.choices propdef.propertyType/]
[@cmisChoices propdef.choices propdef.dataType/]
<cmis:openChoice>${propdef.openChoice?string}</cmis:openChoice>
[#if propdef.defaultValue??]
[#-- TODO: defaults for HTML and XML property types --]

View File

@@ -25,7 +25,7 @@ function createNode(parent, entry, slug)
// construct node of folder or file
var name = (slug !== null) ? slug : entry.title;
var baseType = type.rootTypeId.typeId;
var baseType = type.typeId.rootTypeId.id;
if (baseType == "document")
{
node = parent.createFile(name);
@@ -44,10 +44,10 @@ function createNode(parent, entry, slug)
}
// specialize to required custom type
var objectType = type.objectTypeId.typeId;
var objectType = type.typeId.id;
if (objectType != "document" && objectType != "folder")
{
if (!node.specializeType(type.objectTypeId.QName))
if (!node.specializeType(type.typeId.QName))
{
status.code = 400;
status.message = "Cannot create object of type " + typeId;
@@ -107,7 +107,7 @@ function updateNode(node, entry, propNames, pwc)
if (propDef === null)
{
status.code = 400;
status.message = "Property " + propName + " is not a known property for type " + typeDef.objectTypeId;
status.message = "Property " + propName + " is not a known property for type " + typeDef.typeId;
status.redirect = true;
return null;
}

View File

@@ -102,13 +102,8 @@
</property>
<property name="templateObjects">
<map merge="true">
<entry key="cmistypeid">
<bean class="org.alfresco.repo.cmis.rest.CMISTypeIdMethod">
<constructor-arg><ref bean="CMISMapping"/></constructor-arg>
</bean>
</entry>
<entry key="cmistype">
<bean class="org.alfresco.repo.cmis.rest.CMISTypeMethod">
<bean class="org.alfresco.repo.cmis.rest.CMISTypeDefinitionMethod">
<constructor-arg><ref bean="CMISDictionaryService"/></constructor-arg>
</bean>
</entry>

View File

@@ -24,7 +24,6 @@
*/
package org.alfresco.repo.cmis.rest;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
@@ -51,7 +50,6 @@ import org.alfresco.repo.web.util.paging.Paging;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.mozilla.javascript.Scriptable;
/**
@@ -331,21 +329,21 @@ public class CMISScript extends BaseScopableProcessorExtension
*/
public PagedResults queryTypes(Page page)
{
Collection<CMISTypeId> typeIds = cmisDictionaryService.getAllObjectTypeIds();
Cursor cursor = paging.createCursor(typeIds.size(), page);
Collection<CMISTypeDefinition> typeDefs = cmisDictionaryService.getAllTypes();
Cursor cursor = paging.createCursor(typeDefs.size(), page);
// skip
Iterator<CMISTypeId> iterTypeIds = typeIds.iterator();
Iterator<CMISTypeDefinition> iterTypeDefs = typeDefs.iterator();
for (int i = 0; i < cursor.getStartRow(); i++)
{
iterTypeIds.next();
iterTypeDefs.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()] = iterTypeDefs.next();
}
PagedResults results = paging.createPagedResults(types, cursor);
@@ -358,23 +356,23 @@ public class CMISScript extends BaseScopableProcessorExtension
* @param page
* @return paged result set of types
*/
public PagedResults queryTypeHierarchy(CMISTypeDefinition typedef, boolean descendants, Page page)
public PagedResults queryTypeHierarchy(CMISTypeDefinition typeDef, boolean descendants, Page page)
{
Collection<CMISTypeId> typeIds = cmisDictionaryService.getChildTypeIds(typedef.getObjectTypeId(), descendants);
Cursor cursor = paging.createCursor(typeIds.size(), page);
Collection<CMISTypeDefinition> subTypes = typeDef.getSubTypes(descendants);
Cursor cursor = paging.createCursor(subTypes.size(), page);
// skip
Iterator<CMISTypeId> iterTypeIds = typeIds.iterator();
Iterator<CMISTypeDefinition> 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)

View File

@@ -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.
* <p>
* Retrieve the CMIS Type Id for an Alfresco node
* Retrieve the CMIS Type Definition for an Alfresco node
* <p>
* 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);
}
}
}
}

View File

@@ -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.
* <p>
* Retrieve the CMIS Type for an Alfresco node
* <p>
* 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;
}
}

View File

@@ -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();
}

View File

@@ -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<String, Serializable> 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<String, Serializable> createBaseRelationshipProperties(AssociationRef association)
{
Map<String, Serializable> result = new HashMap<String, Serializable>();
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);
@@ -623,4 +624,29 @@ 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);
}
}
}

View File

@@ -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();

View File

@@ -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<String, Serializable> 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<String, Serializable> 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");
}

View File

@@ -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);
}
}
}

View File

@@ -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<CMISContentStreamAllowedEnum, EnumContentStreamAllowed> contentStreamAllowedEnumMapping;
private static Map<CMISUpdatabilityEnum, EnumUpdateability> updatabilityEnumMapping;
private static Map<CMISCardinalityEnum, EnumCardinality> cardinalityEnumMapping;
private static Map<CMISPropertyTypeEnum, EnumPropertyType> propertyTypeEnumMapping;
private static Map<CMISDataTypeEnum, EnumPropertyType> 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<CMISPropertyTypeEnum, EnumPropertyType>();
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<CMISDataTypeEnum, EnumPropertyType>();
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<CMISChoice> choices, List<JAXBElement<? extends CmisChoiceType>> cmisChoices)
private void addChoiceChildrens(CMISDataTypeEnum propertyType, Collection<CMISChoice> choices, List<JAXBElement<? extends CmisChoiceType>> 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<CMISChoice> choices, List<CmisChoiceType> cmisChoices)
private void addChoices(CMISDataTypeEnum propertyType, Collection<CMISChoice> choices, List<CmisChoiceType> 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<CmisPropertyDefinitionType> wsPropertyDefs)
private void addPropertyDefs(CMISTypeDefinition typeDefinition, CMISPropertyDefinition propertyDefinition, List<CmisPropertyDefinitionType> 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<CmisPropertyDefinitionType> 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<CMISTypeId> typeIds;
Collection<CMISTypeDefinition> 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<CMISTypeId> iterTypeIds = typeIds.iterator();
Cursor cursor = createCursor(typeDefs.size(), parameters.getSkipCount() != null ? parameters.getSkipCount().getValue() : null, parameters.getMaxItems() != null ? parameters.getMaxItems().getValue() : null);
Iterator<CMISTypeDefinition> 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<JAXBElement<? extends CmisTypeDefinitionType>> 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;
}

View File

@@ -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;
}

View File

@@ -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<String, Boolean>("IsImmutable", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_LATEST_VERSION, new Pair<String, Boolean>("IsLatestVersion", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_MAJOR_VERSION, new Pair<String, Boolean>("IsMajorVersion", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_LATEST_MAJOR_VERSION, new Pair<String, Boolean>("IsLatestMajorVersion", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT, new Pair<String, Boolean>("IsVersionSeriesCheckedOut", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CREATION_DATE, new Pair<String, Boolean>("CreationDate", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_LAST_MODIFICATION_DATE, new Pair<String, Boolean>("LastModificationDate", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_OBJECT_ID, new Pair<String, Boolean>("ObjectId", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_ID, new Pair<String, Boolean>("VersionSeriesId", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID, new Pair<String, Boolean>("VersionSeriesCheckedOutId", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_LENGTH, new Pair<String, Boolean>("ContentStreamLength", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_NAME, new Pair<String, Boolean>("Name", false));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_OBJECT_TYPE_ID, new Pair<String, Boolean>("ObjectTypeId", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CREATED_BY, new Pair<String, Boolean>("CreatedBy", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_LAST_MODIFIED_BY, new Pair<String, Boolean>("LastModifiedBy", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE, new Pair<String, Boolean>("ContentStreamMimeType", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_FILENAME, new Pair<String, Boolean>("ContentStreamFilename", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_LABEL, new Pair<String, Boolean>("VersionLabel", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CHECKIN_COMMENT, new Pair<String, Boolean>("checkinComment", false));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_URI, new Pair<String, Boolean>("contentStreamUri", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY, new Pair<String, Boolean>("VersionSeriesCheckedOutBy", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_PARENT_ID, new Pair<String, Boolean>("ParentId", true));
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_ALLOWED, new Pair<String, Boolean>("ContentStreamAllowed", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_IMMUTABLE, new Pair<String, Boolean>("IsImmutable", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_LATEST_VERSION, new Pair<String, Boolean>("IsLatestVersion", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_MAJOR_VERSION, new Pair<String, Boolean>("IsMajorVersion", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION, new Pair<String, Boolean>("IsLatestMajorVersion", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT, new Pair<String, Boolean>("IsVersionSeriesCheckedOut", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CREATION_DATE, new Pair<String, Boolean>("CreationDate", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE, new Pair<String, Boolean>("LastModificationDate", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_OBJECT_ID, new Pair<String, Boolean>("ObjectId", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_SERIES_ID, new Pair<String, Boolean>("VersionSeriesId", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID, new Pair<String, Boolean>("VersionSeriesCheckedOutId", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH, new Pair<String, Boolean>("ContentStreamLength", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_NAME, new Pair<String, Boolean>("Name", false));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_OBJECT_TYPE_ID, new Pair<String, Boolean>("ObjectTypeId", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CREATED_BY, new Pair<String, Boolean>("CreatedBy", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_LAST_MODIFIED_BY, new Pair<String, Boolean>("LastModifiedBy", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE, new Pair<String, Boolean>("ContentStreamMimeType", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME, new Pair<String, Boolean>("ContentStreamFilename", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_LABEL, new Pair<String, Boolean>("VersionLabel", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CHECKIN_COMMENT, new Pair<String, Boolean>("checkinComment", false));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_URI, new Pair<String, Boolean>("contentStreamUri", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY, new Pair<String, Boolean>("VersionSeriesCheckedOutBy", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_PARENT_ID, new Pair<String, Boolean>("ParentId", true));
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CONTENT_STREAM_ALLOWED, new Pair<String, Boolean>("ContentStreamAllowed", true));
for (Map.Entry<String, Pair<String, Boolean>> entry : cmisToRepoPropertiesNamesMapping.entrySet())
{

View File

@@ -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)
{

View File

@@ -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);
}

View File

@@ -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<CmisProperty> 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<CmisProperty> 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<CmisProperty> 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<CmisProperty> 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<CmisProperty> 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<CmisProperty> 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;

View File

@@ -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()
{

View File

@@ -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;
}

View File

@@ -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));
}

View File

@@ -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<CmisProperty> 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<String> documentIdHolder = new Holder<String>(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<CmisProperty> 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<CmisProperty> 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<CmisProperty> 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);

View File

@@ -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);

View File

@@ -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)