mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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-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"/>
|
<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"/]
|
[@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/]"/>
|
<link rel="cmis-repository" href="[@serviceuri/]"/>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
[#assign typedef = cmistype(node)]
|
[#assign typedef = cmistype(node)]
|
||||||
[#list typedef.propertyDefinitions?values as propdef]
|
[#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]
|
[/#list]
|
||||||
</cmis:properties>
|
</cmis:properties>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
[/#if]
|
[/#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-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-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/]"/>
|
<link rel="cmis-repository" href="[@serviceuri/]"/>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
|
|
||||||
[#assign typedef = cmistype(node)]
|
[#assign typedef = cmistype(node)]
|
||||||
[#list typedef.propertyDefinitions?values as propdef]
|
[#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]
|
[/#list]
|
||||||
</cmis:properties>
|
</cmis:properties>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
@@ -311,12 +311,12 @@
|
|||||||
[#macro typedef typedef includeProperties=true includeInheritedProperties=true ns=""]
|
[#macro typedef typedef includeProperties=true includeInheritedProperties=true ns=""]
|
||||||
[@entry ns=ns]
|
[@entry ns=ns]
|
||||||
<author><name>${person.properties.userName}</name></author>
|
<author><name>${person.properties.userName}</name></author>
|
||||||
<content>${typedef.objectTypeId}</content> [#-- TODO --]
|
<content>${typedef.typeId.id}</content> [#-- TODO --]
|
||||||
<id>urn:uuid:type-${typedef.objectTypeId}</id>
|
<id>urn:uuid:type-${typedef.typeId.id}</id>
|
||||||
<link rel="self" href="${absurl(url.serviceContext)}/api/type/${typedef.objectTypeId}"/>
|
<link rel="self" href="${absurl(url.serviceContext)}/api/type/${typedef.typeId.id}"/>
|
||||||
[@typedefCMISLinks typedef/]
|
[@typedefCMISLinks typedef/]
|
||||||
<summary>[#if typedef.description??]${typedef.description?xml}[#else]${typedef.objectTypeDisplayName?xml}[/#if]</summary>
|
<summary>[#if typedef.description??]${typedef.description?xml}[#else]${typedef.displayName?xml}[/#if]</summary>
|
||||||
<title>${typedef.objectTypeDisplayName}</title>
|
<title>${typedef.displayName}</title>
|
||||||
<updated>${xmldate(date)}</updated> [#-- TODO --]
|
<updated>${xmldate(date)}</updated> [#-- TODO --]
|
||||||
[@typedefCMISProps typedef includeProperties/]
|
[@typedefCMISProps typedef includeProperties/]
|
||||||
<cmis:terminator/>
|
<cmis:terminator/>
|
||||||
@@ -324,23 +324,23 @@
|
|||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro typedefCMISLinks typedef]
|
[#macro typedefCMISLinks typedef]
|
||||||
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${typedef.objectTypeId}"/>
|
<link rel="cmis-type" href="${absurl(url.serviceContext)}/api/type/${typedef.typeId.id}"/>
|
||||||
[#if typedef.parentTypeId??]
|
[#if typedef.parentType??]
|
||||||
<link rel="cmis-parent" href="${absurl(url.serviceContext)}/api/type/${typedef.parentTypeId}"/>
|
<link rel="cmis-parent" href="${absurl(url.serviceContext)}/api/type/${typedef.parentType.typeId.id}"/>
|
||||||
[/#if]
|
[/#if]
|
||||||
<link rel="cmis-children" href="${absurl(url.serviceContext)}/api/type/${typedef.objectTypeId}/children"/>
|
<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.objectTypeId}/descendants"/>
|
<link rel="cmis-descendants" href="${absurl(url.serviceContext)}/api/type/${typedef.typeId.id}/descendants"/>
|
||||||
<link rel="cmis-repository" href="[@serviceuri/]"/>
|
<link rel="cmis-repository" href="[@serviceuri/]"/>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro typedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
|
[#macro typedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
|
||||||
[#if typedef.rootTypeId.toString() = "document"]
|
[#if typedef.rootType.typeId.id = "document"]
|
||||||
[@documenttypedefCMISProps typedef includeProperties includeInheritedProperties/]
|
[@documenttypedefCMISProps typedef includeProperties includeInheritedProperties/]
|
||||||
[#elseif typedef.rootTypeId.toString() = "folder"]
|
[#elseif typedef.rootType.typeId.id = "folder"]
|
||||||
[@foldertypedefCMISProps typedef includeProperties includeInheritedProperties/]
|
[@foldertypedefCMISProps typedef includeProperties includeInheritedProperties/]
|
||||||
[#elseif typedef.rootTypeId.toString() = "relationship"]
|
[#elseif typedef.rootType.typeId.id = "relationship"]
|
||||||
[@relationshiptypedefCMISProps typedef includeProperties includeInheritedProperties/]
|
[@relationshiptypedefCMISProps typedef includeProperties includeInheritedProperties/]
|
||||||
[#elseif typedef.rootTypeId.toString() = "policy"]
|
[#elseif typedef.rootType.typeId.id = "policy"]
|
||||||
[@policytypedefCMISProps typedef includeProperties includeInheritedProperties/]
|
[@policytypedefCMISProps typedef includeProperties includeInheritedProperties/]
|
||||||
[/#if]
|
[/#if]
|
||||||
[/#macro]
|
[/#macro]
|
||||||
@@ -373,125 +373,126 @@
|
|||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro objecttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
|
[#macro objecttypedefCMISProps typedef includeProperties=true includeInheritedProperties=true]
|
||||||
<cmis:typeId>${typedef.objectTypeId}</cmis:typeId>
|
<cmis:typeId>${typedef.typeId.id}</cmis:typeId>
|
||||||
<cmis:queryName>${typedef.objectTypeQueryName}</cmis:queryName>
|
<cmis:queryName>${typedef.queryName}</cmis:queryName>
|
||||||
<cmis:displayName>[#if typedef.objectTypeDisplayName??]${typedef.objectTypeDisplayName?xml}[/#if]</cmis:displayName>
|
<cmis:displayName>[#if typedef.displayName??]${typedef.displayName?xml}[/#if]</cmis:displayName>
|
||||||
<cmis:baseType>${typedef.rootTypeId}</cmis:baseType> [#-- TODO: remove spec issue 36 --]
|
<cmis:baseType>${typedef.rootType.typeId.id}</cmis:baseType> [#-- TODO: remove spec issue 36 --]
|
||||||
<cmis:baseTypeQueryName>${typedef.rootTypeQueryName}</cmis:baseTypeQueryName>
|
<cmis:baseTypeQueryName>${typedef.rootType.queryName}</cmis:baseTypeQueryName>
|
||||||
[#if typedef.parentTypeId??]
|
[#if typedef.parentType??]
|
||||||
<cmis:parentId>${typedef.parentTypeId}</cmis:parentId>
|
<cmis:parentId>${typedef.parentType.typeId.id}</cmis:parentId>
|
||||||
[/#if]
|
[/#if]
|
||||||
<cmis:description>[#if typedef.description??]${typedef.description?xml}[/#if]</cmis:description>
|
<cmis:description>[#if typedef.description??]${typedef.description?xml}[/#if]</cmis:description>
|
||||||
<cmis:creatable>${typedef.creatable?string}</cmis:creatable>
|
<cmis:creatable>${typedef.creatable?string}</cmis:creatable>
|
||||||
<cmis:fileable>${typedef.fileable?string}</cmis:fileable>
|
<cmis:fileable>${typedef.fileable?string}</cmis:fileable>
|
||||||
<cmis:queryable>${typedef.queryable?string}</cmis:queryable>
|
<cmis:queryable>${typedef.queryable?string}</cmis:queryable>
|
||||||
<cmis:controllable>${typedef.controllable?string}</cmis:controllable>
|
<cmis:controllable>${typedef.controllable?string}</cmis:controllable>
|
||||||
<cmis:includedInSupertypeQuery>${typedef.includedInSupertypeQuery?string}</cmis:includedInSupertypeQuery>
|
<cmis:includedInSupertypeQuery>${typedef.includeInSuperTypeQuery?string}</cmis:includedInSupertypeQuery>
|
||||||
[#if includeProperties]
|
[#if includeProperties]
|
||||||
[#list typedef.propertyDefinitions?values as propdef]
|
[#list typedef.propertyDefinitions?values as propdef]
|
||||||
[#if includeInheritedProperties || !propdef.inherited]
|
[#assign inherited = (propdef.owningType != typedef)]
|
||||||
[@propdefCMISProps propdef/]
|
[#if includeInheritedProperties || !inherited]
|
||||||
|
[@propdefCMISProps propdef inherited/]
|
||||||
[/#if]
|
[/#if]
|
||||||
[/#list]
|
[/#list]
|
||||||
[/#if]
|
[/#if]
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro propdefCMISProps propdef]
|
[#macro propdefCMISProps propdef inherited=false]
|
||||||
[#if propdef.propertyType == "BOOLEAN"]
|
[#if propdef.dataType == "BOOLEAN"]
|
||||||
[@booleanpropdefCMISProps propdef/]
|
[@booleanpropdefCMISProps propdef inherited/]
|
||||||
[#elseif propdef.propertyType == "ID"]
|
[#elseif propdef.dataType == "ID"]
|
||||||
[@idpropdefCMISProps propdef/]
|
[@idpropdefCMISProps propdef inherited/]
|
||||||
[#elseif propdef.propertyType == "INTEGER"]
|
[#elseif propdef.dataType == "INTEGER"]
|
||||||
[@integerpropdefCMISProps propdef/]
|
[@integerpropdefCMISProps propdef inherited/]
|
||||||
[#elseif propdef.propertyType == "DATETIME"]
|
[#elseif propdef.dataType == "DATETIME"]
|
||||||
[@datetimepropdefCMISProps propdef/]
|
[@datetimepropdefCMISProps propdef inherited/]
|
||||||
[#elseif propdef.propertyType == "DECIMAL"]
|
[#elseif propdef.dataType == "DECIMAL"]
|
||||||
[@decimalpropdefCMISProps propdef/]
|
[@decimalpropdefCMISProps propdef inherited/]
|
||||||
[#elseif propdef.propertyType == "HTML"]
|
[#elseif propdef.dataType == "HTML"]
|
||||||
[@htmlpropdefCMISProps propdef/]
|
[@htmlpropdefCMISProps propdef inherited/]
|
||||||
[#elseif propdef.propertyType == "STRING"]
|
[#elseif propdef.dataType == "STRING"]
|
||||||
[@stringpropdefCMISProps propdef/]
|
[@stringpropdefCMISProps propdef inherited/]
|
||||||
[#elseif propdef.propertyType == "URI"]
|
[#elseif propdef.dataType == "URI"]
|
||||||
[@uripropdefCMISProps propdef/]
|
[@uripropdefCMISProps propdef inherited/]
|
||||||
[#elseif propdef.propertyType == "XML"]
|
[#elseif propdef.dataType == "XML"]
|
||||||
[@xmlpropdefCMISProps propdef/]
|
[@xmlpropdefCMISProps propdef inherited/]
|
||||||
[/#if]
|
[/#if]
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro booleanpropdefCMISProps propdef]
|
[#macro booleanpropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyBooleanDefinition>
|
<cmis:propertyBooleanDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
</cmis:propertyBooleanDefinition>
|
</cmis:propertyBooleanDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro idpropdefCMISProps propdef]
|
[#macro idpropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyIdDefinition>
|
<cmis:propertyIdDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
</cmis:propertyIdDefinition>
|
</cmis:propertyIdDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro integerpropdefCMISProps propdef]
|
[#macro integerpropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyIntegerDefinition>
|
<cmis:propertyIntegerDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
[#-- TODO: minValue, maxValue --]
|
[#-- TODO: minValue, maxValue --]
|
||||||
</cmis:propertyIntegerDefinition>
|
</cmis:propertyIntegerDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro datetimepropdefCMISProps propdef]
|
[#macro datetimepropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyDateTimeDefinition>
|
<cmis:propertyDateTimeDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
</cmis:propertyDateTimeDefinition>
|
</cmis:propertyDateTimeDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro decimalpropdefCMISProps propdef]
|
[#macro decimalpropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyDecimalDefinition>
|
<cmis:propertyDecimalDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
</cmis:propertyDecimalDefinition>
|
</cmis:propertyDecimalDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro htmlpropdefCMISProps propdef]
|
[#macro htmlpropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyHtmlDefinition>
|
<cmis:propertyHtmlDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
</cmis:propertyHtmlDefinition>
|
</cmis:propertyHtmlDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro stringpropdefCMISProps propdef]
|
[#macro stringpropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyStringDefinition>
|
<cmis:propertyStringDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
[#if propdef.maximumLength != -1]
|
[#if propdef.maximumLength != -1]
|
||||||
<cmis:maxLength>${propdef.maximumLength}</cmis:maxLength>
|
<cmis:maxLength>${propdef.maximumLength}</cmis:maxLength>
|
||||||
[/#if]
|
[/#if]
|
||||||
</cmis:propertyStringDefinition>
|
</cmis:propertyStringDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro uripropdefCMISProps propdef]
|
[#macro uripropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyUriDefinition>
|
<cmis:propertyUriDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
</cmis:propertyUriDefinition>
|
</cmis:propertyUriDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro xmlpropdefCMISProps propdef]
|
[#macro xmlpropdefCMISProps propdef inherited=false]
|
||||||
<cmis:propertyXmlDefinition>
|
<cmis:propertyXmlDefinition>
|
||||||
[@abstractpropdefCMISProps propdef/]
|
[@abstractpropdefCMISProps propdef inherited/]
|
||||||
[#-- TODO: scheme, uri --]
|
[#-- TODO: scheme, uri --]
|
||||||
</cmis:propertyXmlDefinition>
|
</cmis:propertyXmlDefinition>
|
||||||
[/#macro]
|
[/#macro]
|
||||||
|
|
||||||
[#macro abstractpropdefCMISProps propdef]
|
[#macro abstractpropdefCMISProps propdef inherited=false]
|
||||||
<cmis:name>${propdef.propertyName}</cmis:name>
|
<cmis:name>${propdef.propertyId.name}</cmis:name>
|
||||||
<cmis:id>${propdef.propertyId}</cmis:id>
|
<cmis:id>${propdef.propertyId}</cmis:id>
|
||||||
<cmis:displayName>[#if propdef.displayName??]${propdef.displayName?xml}[/#if]</cmis:displayName>
|
<cmis:displayName>[#if propdef.displayName??]${propdef.displayName?xml}[/#if]</cmis:displayName>
|
||||||
[#if propdef.description??]
|
[#if propdef.description??]
|
||||||
<cmis:description>${propdef.description?xml}</cmis:description>
|
<cmis:description>${propdef.description?xml}</cmis:description>
|
||||||
[/#if]
|
[/#if]
|
||||||
<cmis:propertyType>${propdef.propertyType.label}</cmis:propertyType>
|
<cmis:propertyType>${propdef.dataType.label}</cmis:propertyType>
|
||||||
<cmis:cardinality>${propdef.cardinality.label}</cmis:cardinality>
|
<cmis:cardinality>${propdef.cardinality.label}</cmis:cardinality>
|
||||||
<cmis:updateability>${propdef.updatability.label}</cmis:updateability>
|
<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:required>${propdef.required?string}</cmis:required>
|
||||||
<cmis:queryable>${propdef.queryable?string}</cmis:queryable>
|
<cmis:queryable>${propdef.queryable?string}</cmis:queryable>
|
||||||
<cmis:orderable>${propdef.orderable?string}</cmis:orderable>
|
<cmis:orderable>${propdef.orderable?string}</cmis:orderable>
|
||||||
[@cmisChoices propdef.choices propdef.propertyType/]
|
[@cmisChoices propdef.choices propdef.dataType/]
|
||||||
<cmis:openChoice>${propdef.openChoice?string}</cmis:openChoice>
|
<cmis:openChoice>${propdef.openChoice?string}</cmis:openChoice>
|
||||||
[#if propdef.defaultValue??]
|
[#if propdef.defaultValue??]
|
||||||
[#-- TODO: defaults for HTML and XML property types --]
|
[#-- TODO: defaults for HTML and XML property types --]
|
||||||
|
@@ -25,7 +25,7 @@ function createNode(parent, entry, slug)
|
|||||||
|
|
||||||
// construct node of folder or file
|
// construct node of folder or file
|
||||||
var name = (slug !== null) ? slug : entry.title;
|
var name = (slug !== null) ? slug : entry.title;
|
||||||
var baseType = type.rootTypeId.typeId;
|
var baseType = type.typeId.rootTypeId.id;
|
||||||
if (baseType == "document")
|
if (baseType == "document")
|
||||||
{
|
{
|
||||||
node = parent.createFile(name);
|
node = parent.createFile(name);
|
||||||
@@ -44,10 +44,10 @@ function createNode(parent, entry, slug)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// specialize to required custom type
|
// specialize to required custom type
|
||||||
var objectType = type.objectTypeId.typeId;
|
var objectType = type.typeId.id;
|
||||||
if (objectType != "document" && objectType != "folder")
|
if (objectType != "document" && objectType != "folder")
|
||||||
{
|
{
|
||||||
if (!node.specializeType(type.objectTypeId.QName))
|
if (!node.specializeType(type.typeId.QName))
|
||||||
{
|
{
|
||||||
status.code = 400;
|
status.code = 400;
|
||||||
status.message = "Cannot create object of type " + typeId;
|
status.message = "Cannot create object of type " + typeId;
|
||||||
@@ -107,7 +107,7 @@ function updateNode(node, entry, propNames, pwc)
|
|||||||
if (propDef === null)
|
if (propDef === null)
|
||||||
{
|
{
|
||||||
status.code = 400;
|
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;
|
status.redirect = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -102,34 +102,29 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="templateObjects">
|
<property name="templateObjects">
|
||||||
<map merge="true">
|
<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">
|
<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>
|
<constructor-arg><ref bean="CMISDictionaryService"/></constructor-arg>
|
||||||
</bean>
|
</bean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="cmisproperty">
|
<entry key="cmisproperty">
|
||||||
<bean class="org.alfresco.repo.cmis.rest.CMISPropertyValueMethod">
|
<bean class="org.alfresco.repo.cmis.rest.CMISPropertyValueMethod">
|
||||||
<constructor-arg><ref bean="CMISPropertyService"/></constructor-arg>
|
<constructor-arg><ref bean="CMISPropertyService"/></constructor-arg>
|
||||||
</bean>
|
</bean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="cmisresultset">
|
<entry key="cmisresultset">
|
||||||
<bean class="org.alfresco.repo.cmis.rest.CMISResultSetMethod">
|
<bean class="org.alfresco.repo.cmis.rest.CMISResultSetMethod">
|
||||||
<constructor-arg><ref bean="ServiceRegistry"/></constructor-arg>
|
<constructor-arg><ref bean="ServiceRegistry"/></constructor-arg>
|
||||||
<constructor-arg><ref bean="webscripts.repo.imageresolver"/></constructor-arg>
|
<constructor-arg><ref bean="webscripts.repo.imageresolver"/></constructor-arg>
|
||||||
</bean>
|
</bean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="cmischildren">
|
<entry key="cmischildren">
|
||||||
<bean class="org.alfresco.repo.cmis.rest.CMISChildrenMethod">
|
<bean class="org.alfresco.repo.cmis.rest.CMISChildrenMethod">
|
||||||
<constructor-arg><ref bean="CMISService"/></constructor-arg>
|
<constructor-arg><ref bean="CMISService"/></constructor-arg>
|
||||||
<constructor-arg><ref bean="ServiceRegistry"/></constructor-arg>
|
<constructor-arg><ref bean="ServiceRegistry"/></constructor-arg>
|
||||||
<constructor-arg><ref bean="webscripts.repo.imageresolver"/></constructor-arg>
|
<constructor-arg><ref bean="webscripts.repo.imageresolver"/></constructor-arg>
|
||||||
</bean>
|
</bean>
|
||||||
</entry>
|
</entry>
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
<property name="registryFactory">
|
<property name="registryFactory">
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.cmis.rest;
|
package org.alfresco.repo.cmis.rest;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
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.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.namespace.QName;
|
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)
|
public PagedResults queryTypes(Page page)
|
||||||
{
|
{
|
||||||
Collection<CMISTypeId> typeIds = cmisDictionaryService.getAllObjectTypeIds();
|
Collection<CMISTypeDefinition> typeDefs = cmisDictionaryService.getAllTypes();
|
||||||
Cursor cursor = paging.createCursor(typeIds.size(), page);
|
Cursor cursor = paging.createCursor(typeDefs.size(), page);
|
||||||
|
|
||||||
// skip
|
// skip
|
||||||
Iterator<CMISTypeId> iterTypeIds = typeIds.iterator();
|
Iterator<CMISTypeDefinition> iterTypeDefs = typeDefs.iterator();
|
||||||
for (int i = 0; i < cursor.getStartRow(); i++)
|
for (int i = 0; i < cursor.getStartRow(); i++)
|
||||||
{
|
{
|
||||||
iterTypeIds.next();
|
iterTypeDefs.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get types for page
|
// get types for page
|
||||||
CMISTypeDefinition[] types = new CMISTypeDefinition[cursor.getRowCount()];
|
CMISTypeDefinition[] types = new CMISTypeDefinition[cursor.getRowCount()];
|
||||||
for (int i = cursor.getStartRow(); i <= cursor.getEndRow(); i++)
|
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);
|
PagedResults results = paging.createPagedResults(types, cursor);
|
||||||
@@ -358,23 +356,23 @@ public class CMISScript extends BaseScopableProcessorExtension
|
|||||||
* @param page
|
* @param page
|
||||||
* @return paged result set of types
|
* @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);
|
Collection<CMISTypeDefinition> subTypes = typeDef.getSubTypes(descendants);
|
||||||
Cursor cursor = paging.createCursor(typeIds.size(), page);
|
Cursor cursor = paging.createCursor(subTypes.size(), page);
|
||||||
|
|
||||||
// skip
|
// skip
|
||||||
Iterator<CMISTypeId> iterTypeIds = typeIds.iterator();
|
Iterator<CMISTypeDefinition> iterSubTypes = subTypes.iterator();
|
||||||
for (int i = 0; i < cursor.getStartRow(); i++)
|
for (int i = 0; i < cursor.getStartRow(); i++)
|
||||||
{
|
{
|
||||||
iterTypeIds.next();
|
iterSubTypes.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get types for page
|
// get types for page
|
||||||
CMISTypeDefinition[] types = new CMISTypeDefinition[cursor.getRowCount()];
|
CMISTypeDefinition[] types = new CMISTypeDefinition[cursor.getRowCount()];
|
||||||
for (int i = cursor.getStartRow(); i <= cursor.getEndRow(); i++)
|
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);
|
PagedResults results = paging.createPagedResults(types, cursor);
|
||||||
@@ -391,7 +389,7 @@ public class CMISScript extends BaseScopableProcessorExtension
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CMISTypeId cmisTypeId = cmisDictionaryService.getCMISMapping().getCmisTypeId(typeId);
|
CMISTypeId cmisTypeId = cmisDictionaryService.getTypeId(typeId);
|
||||||
return cmisDictionaryService.getType(cmisTypeId);
|
return cmisDictionaryService.getType(cmisTypeId);
|
||||||
}
|
}
|
||||||
catch(AlfrescoRuntimeException e)
|
catch(AlfrescoRuntimeException e)
|
||||||
@@ -411,7 +409,7 @@ public class CMISScript extends BaseScopableProcessorExtension
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
QName typeQName = node.getQNameType();
|
QName typeQName = node.getQNameType();
|
||||||
CMISTypeId cmisTypeId = cmisDictionaryService.getCMISMapping().getCmisTypeId(typeQName);
|
CMISTypeId cmisTypeId = cmisDictionaryService.getTypeId(typeQName, null);
|
||||||
return cmisDictionaryService.getType(cmisTypeId);
|
return cmisDictionaryService.getType(cmisTypeId);
|
||||||
}
|
}
|
||||||
catch(AlfrescoRuntimeException e)
|
catch(AlfrescoRuntimeException e)
|
||||||
|
@@ -26,7 +26,8 @@ package org.alfresco.repo.cmis.rest;
|
|||||||
|
|
||||||
import java.util.List;
|
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.cmis.dictionary.CMISTypeId;
|
||||||
import org.alfresco.repo.template.TemplateNode;
|
import org.alfresco.repo.template.TemplateNode;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -38,23 +39,23 @@ import freemarker.template.TemplateModelException;
|
|||||||
/**
|
/**
|
||||||
* Custom FreeMarker Template language method.
|
* Custom FreeMarker Template language method.
|
||||||
* <p>
|
* <p>
|
||||||
* Retrieve the CMIS Type Id for an Alfresco node
|
* Retrieve the CMIS Type Definition for an Alfresco node
|
||||||
* <p>
|
* <p>
|
||||||
* Usage: cmistypeid(TemplateNode node)
|
* Usage: cmistype(TemplateNode node)
|
||||||
* cmistypeid(QName nodeType)
|
* cmistype(QName nodeType)
|
||||||
*
|
*
|
||||||
* @author davidc
|
* @author davidc
|
||||||
*/
|
*/
|
||||||
public class CMISTypeIdMethod implements TemplateMethodModelEx
|
public class CMISTypeDefinitionMethod implements TemplateMethodModelEx
|
||||||
{
|
{
|
||||||
private CMISMapping mappingService;
|
private CMISDictionaryService dictionaryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct
|
* 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")
|
@SuppressWarnings("unchecked")
|
||||||
public Object exec(List args) throws TemplateModelException
|
public Object exec(List args) throws TemplateModelException
|
||||||
{
|
{
|
||||||
CMISTypeId result = null;
|
CMISTypeDefinition result = null;
|
||||||
|
|
||||||
if (args.size() == 1)
|
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)
|
if (nodeType != null)
|
||||||
{
|
{
|
||||||
result = mappingService.getCmisTypeId(nodeType);
|
CMISTypeId typeId = dictionaryService.getTypeId(nodeType, null);
|
||||||
|
if (typeId != null)
|
||||||
|
{
|
||||||
|
result = dictionaryService.getType(typeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -67,8 +67,8 @@ public class CMISTest extends BaseCMISWebScriptTest
|
|||||||
// setRemoteServer(server);
|
// setRemoteServer(server);
|
||||||
// setArgsAsHeaders(false);
|
// setArgsAsHeaders(false);
|
||||||
// setValidateResponse(false);
|
// setValidateResponse(false);
|
||||||
// setListener(new CMISTestListener(System.out));
|
setListener(new CMISTestListener(System.out));
|
||||||
// setTraceReqRes(true);
|
setTraceReqRes(true);
|
||||||
|
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
@@ -40,8 +40,11 @@ import javax.xml.datatype.DatatypeFactory;
|
|||||||
import javax.xml.datatype.XMLGregorianCalendar;
|
import javax.xml.datatype.XMLGregorianCalendar;
|
||||||
|
|
||||||
import org.alfresco.cmis.CMISService;
|
import org.alfresco.cmis.CMISService;
|
||||||
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
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.property.CMISPropertyService;
|
||||||
import org.alfresco.cmis.search.CMISQueryService;
|
import org.alfresco.cmis.search.CMISQueryService;
|
||||||
import org.alfresco.model.ContentModel;
|
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.VersionService;
|
||||||
import org.alfresco.service.cmr.version.VersionType;
|
import org.alfresco.service.cmr.version.VersionType;
|
||||||
import org.alfresco.service.descriptor.DescriptorService;
|
import org.alfresco.service.descriptor.DescriptorService;
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all CMIS web services
|
* Base class for all CMIS web services
|
||||||
@@ -282,58 +284,57 @@ public class DMAbstractServicePort
|
|||||||
|
|
||||||
protected CmisPropertiesType getPropertiesType(Map<String, Serializable> alfrescoProperties, PropertyFilter filter)
|
protected CmisPropertiesType getPropertiesType(Map<String, Serializable> alfrescoProperties, PropertyFilter filter)
|
||||||
{
|
{
|
||||||
CMISMapping cmisMapping = cmisDictionaryService.getCMISMapping();
|
String objectTypeId = (String) alfrescoProperties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID);
|
||||||
String objectTypeId = (String) alfrescoProperties.get(CMISMapping.PROP_OBJECT_TYPE_ID);
|
CMISTypeId cmisTypeId = cmisDictionaryService.getTypeId(objectTypeId);
|
||||||
QName cmisType = cmisMapping.getCmisTypeId(objectTypeId).getQName();
|
|
||||||
|
|
||||||
CmisPropertiesType properties = new CmisPropertiesType();
|
CmisPropertiesType properties = new CmisPropertiesType();
|
||||||
|
|
||||||
if (cmisMapping.isValidCmisDocument(cmisType))
|
if (cmisTypeId.getScope() == CMISScope.DOCUMENT)
|
||||||
{
|
{
|
||||||
addBooleanProperty(properties, filter, CMISMapping.PROP_IS_IMMUTABLE, alfrescoProperties);
|
addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_IMMUTABLE, alfrescoProperties);
|
||||||
addBooleanProperty(properties, filter, CMISMapping.PROP_IS_LATEST_VERSION, alfrescoProperties);
|
addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_LATEST_VERSION, alfrescoProperties);
|
||||||
addBooleanProperty(properties, filter, CMISMapping.PROP_IS_MAJOR_VERSION, alfrescoProperties);
|
addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_MAJOR_VERSION, alfrescoProperties);
|
||||||
addBooleanProperty(properties, filter, CMISMapping.PROP_IS_LATEST_MAJOR_VERSION, alfrescoProperties);
|
addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION, alfrescoProperties);
|
||||||
addBooleanProperty(properties, filter, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT, alfrescoProperties);
|
addBooleanProperty(properties, filter, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT, alfrescoProperties);
|
||||||
addDateTimeProperty(properties, filter, CMISMapping.PROP_CREATION_DATE, alfrescoProperties);
|
addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_CREATION_DATE, alfrescoProperties);
|
||||||
addDateTimeProperty(properties, filter, CMISMapping.PROP_LAST_MODIFICATION_DATE, alfrescoProperties);
|
addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE, alfrescoProperties);
|
||||||
addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_ID, alfrescoProperties);
|
addIDProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_ID, alfrescoProperties);
|
||||||
addIDProperty(properties, filter, CMISMapping.PROP_VERSION_SERIES_ID, alfrescoProperties);
|
addIDProperty(properties, filter, CMISDictionaryModel.PROP_VERSION_SERIES_ID, alfrescoProperties);
|
||||||
addIDProperty(properties, filter, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID, alfrescoProperties);
|
addIDProperty(properties, filter, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID, alfrescoProperties);
|
||||||
addIntegerProperty(properties, filter, CMISMapping.PROP_CONTENT_STREAM_LENGTH, alfrescoProperties);
|
addIntegerProperty(properties, filter, CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_NAME, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_NAME, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, "document");
|
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, "document");
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_OBJECT_TYPE_ID, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_TYPE_ID, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_CREATED_BY, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_CREATED_BY, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_LAST_MODIFIED_BY, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_LAST_MODIFIED_BY, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_CONTENT_STREAM_FILENAME, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_VERSION_LABEL, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_VERSION_LABEL, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_CHECKIN_COMMENT, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_CHECKIN_COMMENT, alfrescoProperties);
|
||||||
addURIProperty(properties, filter, CMISMapping.PROP_CONTENT_STREAM_URI, 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, CMISDictionaryModel.PROP_CREATION_DATE, alfrescoProperties);
|
||||||
addDateTimeProperty(properties, filter, CMISMapping.PROP_LAST_MODIFICATION_DATE, alfrescoProperties);
|
addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE, alfrescoProperties);
|
||||||
addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_ID, alfrescoProperties);
|
addIDProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_ID, alfrescoProperties);
|
||||||
addIDProperty(properties, filter, CMISMapping.PROP_PARENT_ID, alfrescoProperties);
|
addIDProperty(properties, filter, CMISDictionaryModel.PROP_PARENT_ID, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_NAME, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_NAME, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, "folder");
|
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, "folder");
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_OBJECT_TYPE_ID, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_TYPE_ID, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_CREATED_BY, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_CREATED_BY, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_LAST_MODIFIED_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);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_TYPE_ID, alfrescoProperties);
|
||||||
addIDProperty(properties, filter, CMISMapping.PROP_OBJECT_ID, alfrescoProperties);
|
addIDProperty(properties, filter, CMISDictionaryModel.PROP_OBJECT_ID, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, alfrescoProperties);
|
addStringProperty(properties, filter, BASE_TYPE_PROPERTY_NAME, alfrescoProperties);
|
||||||
addStringProperty(properties, filter, CMISMapping.PROP_CREATED_BY, alfrescoProperties);
|
addStringProperty(properties, filter, CMISDictionaryModel.PROP_CREATED_BY, alfrescoProperties);
|
||||||
addDateTimeProperty(properties, filter, CMISMapping.PROP_CREATION_DATE, alfrescoProperties);
|
addDateTimeProperty(properties, filter, CMISDictionaryModel.PROP_CREATION_DATE, alfrescoProperties);
|
||||||
addIDProperty(properties, filter, CMISMapping.PROP_SOURCE_ID, alfrescoProperties);
|
addIDProperty(properties, filter, CMISDictionaryModel.PROP_SOURCE_ID, alfrescoProperties);
|
||||||
addIDProperty(properties, filter, CMISMapping.PROP_TARGET_ID, alfrescoProperties);
|
addIDProperty(properties, filter, CMISDictionaryModel.PROP_TARGET_ID, alfrescoProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
@@ -342,13 +343,13 @@ public class DMAbstractServicePort
|
|||||||
private Map<String, Serializable> createBaseRelationshipProperties(AssociationRef association)
|
private Map<String, Serializable> createBaseRelationshipProperties(AssociationRef association)
|
||||||
{
|
{
|
||||||
Map<String, Serializable> result = new HashMap<String, Serializable>();
|
Map<String, Serializable> result = new HashMap<String, Serializable>();
|
||||||
result.put(CMISMapping.PROP_OBJECT_TYPE_ID, cmisDictionaryService.getCMISMapping().getCmisType(association.getTypeQName()));
|
result.put(CMISDictionaryModel.PROP_OBJECT_TYPE_ID, cmisDictionaryService.getTypeId(association.getTypeQName(), CMISScope.RELATIONSHIP));
|
||||||
result.put(CMISMapping.PROP_OBJECT_ID, association.toString());
|
result.put(CMISDictionaryModel.PROP_OBJECT_ID, association.toString());
|
||||||
result.put(BASE_TYPE_PROPERTY_NAME, CMISMapping.RELATIONSHIP_TYPE_ID.getTypeId());
|
result.put(BASE_TYPE_PROPERTY_NAME, CMISDictionaryModel.RELATIONSHIP_TYPE_ID.getId());
|
||||||
result.put(CMISMapping.PROP_CREATED_BY, AuthenticationUtil.getFullyAuthenticatedUser());
|
result.put(CMISDictionaryModel.PROP_CREATED_BY, AuthenticationUtil.getFullyAuthenticatedUser());
|
||||||
result.put(CMISMapping.PROP_CREATION_DATE, new Date());
|
result.put(CMISDictionaryModel.PROP_CREATION_DATE, new Date());
|
||||||
result.put(CMISMapping.PROP_SOURCE_ID, association.getSourceRef());
|
result.put(CMISDictionaryModel.PROP_SOURCE_ID, association.getSourceRef());
|
||||||
result.put(CMISMapping.PROP_TARGET_ID, association.getTargetRef());
|
result.put(CMISDictionaryModel.PROP_TARGET_ID, association.getTargetRef());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,7 +571,7 @@ public class DMAbstractServicePort
|
|||||||
{
|
{
|
||||||
// TODO: properties setting
|
// TODO: properties setting
|
||||||
|
|
||||||
String name = (String) PropertyUtil.getProperty(properties, CMISMapping.PROP_NAME);
|
String name = (String) PropertyUtil.getProperty(properties, CMISDictionaryModel.PROP_NAME);
|
||||||
if (name != null)
|
if (name != null)
|
||||||
{
|
{
|
||||||
nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, name);
|
nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, name);
|
||||||
@@ -622,5 +623,30 @@ public class DMAbstractServicePort
|
|||||||
}
|
}
|
||||||
return checkOutCheckInService.checkout(documentNodeReference);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ package org.alfresco.repo.cmis.ws;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
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.CMISQueryOptions;
|
||||||
import org.alfresco.cmis.search.CMISResultSet;
|
import org.alfresco.cmis.search.CMISResultSet;
|
||||||
import org.alfresco.cmis.search.CMISResultSetColumn;
|
import org.alfresco.cmis.search.CMISResultSetColumn;
|
||||||
@@ -91,41 +91,41 @@ public class DMDiscoveryServicePort extends DMAbstractServicePort implements Dis
|
|||||||
// for each column...
|
// for each column...
|
||||||
for (CMISResultSetColumn column : columns)
|
for (CMISResultSetColumn column : columns)
|
||||||
{
|
{
|
||||||
CMISPropertyTypeEnum type = column.getPropertyType();
|
CMISDataTypeEnum type = column.getPropertyType();
|
||||||
if (type == CMISPropertyTypeEnum.BOOLEAN)
|
if (type == CMISDataTypeEnum.BOOLEAN)
|
||||||
{
|
{
|
||||||
addBooleanProperty(properties, filter, column.getName(), values);
|
addBooleanProperty(properties, filter, column.getName(), values);
|
||||||
}
|
}
|
||||||
else if (type == CMISPropertyTypeEnum.DATETIME)
|
else if (type == CMISDataTypeEnum.DATETIME)
|
||||||
{
|
{
|
||||||
addDateTimeProperty(properties, filter, column.getName(), values);
|
addDateTimeProperty(properties, filter, column.getName(), values);
|
||||||
}
|
}
|
||||||
else if (type == CMISPropertyTypeEnum.DECIMAL)
|
else if (type == CMISDataTypeEnum.DECIMAL)
|
||||||
{
|
{
|
||||||
addDecimalProperty(properties, filter, column.getName(), values);
|
addDecimalProperty(properties, filter, column.getName(), values);
|
||||||
}
|
}
|
||||||
else if (type == CMISPropertyTypeEnum.ID)
|
else if (type == CMISDataTypeEnum.ID)
|
||||||
{
|
{
|
||||||
addIDProperty(properties, filter, column.getName(), values);
|
addIDProperty(properties, filter, column.getName(), values);
|
||||||
}
|
}
|
||||||
else if (type == CMISPropertyTypeEnum.INTEGER)
|
else if (type == CMISDataTypeEnum.INTEGER)
|
||||||
{
|
{
|
||||||
addIntegerProperty(properties, filter, column.getName(), values);
|
addIntegerProperty(properties, filter, column.getName(), values);
|
||||||
}
|
}
|
||||||
else if (type == CMISPropertyTypeEnum.STRING)
|
else if (type == CMISDataTypeEnum.STRING)
|
||||||
{
|
{
|
||||||
addStringProperty(properties, filter, column.getName(), values);
|
addStringProperty(properties, filter, column.getName(), values);
|
||||||
}
|
}
|
||||||
else if (type == CMISPropertyTypeEnum.URI)
|
else if (type == CMISDataTypeEnum.URI)
|
||||||
{
|
{
|
||||||
addURIProperty(properties, filter, column.getName(), values);
|
addURIProperty(properties, filter, column.getName(), values);
|
||||||
}
|
}
|
||||||
else if (type == CMISPropertyTypeEnum.XML)
|
else if (type == CMISDataTypeEnum.XML)
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
else if (type == CMISPropertyTypeEnum.HTML)
|
else if (type == CMISDataTypeEnum.HTML)
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@@ -34,8 +34,9 @@ import java.util.Map;
|
|||||||
import javax.activation.DataHandler;
|
import javax.activation.DataHandler;
|
||||||
import javax.xml.ws.Holder;
|
import javax.xml.ws.Holder;
|
||||||
|
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
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.dictionary.CMISTypeId;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.cmis.PropertyFilter;
|
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.AlfrescoObjectType;
|
||||||
import org.alfresco.repo.cmis.ws.utils.CmisObjectsUtils;
|
import org.alfresco.repo.cmis.ws.utils.CmisObjectsUtils;
|
||||||
import org.alfresco.repo.cmis.ws.utils.CmisObjectsUtils.IdentifierConversionResults;
|
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.AssociationDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.lock.NodeLockedException;
|
import org.alfresco.service.cmr.lock.NodeLockedException;
|
||||||
@@ -110,25 +112,23 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
|||||||
checkRepositoryId(repositoryId);
|
checkRepositoryId(repositoryId);
|
||||||
|
|
||||||
Map<String, Serializable> propertiesMap = getPropertiesMap(properties);
|
Map<String, Serializable> propertiesMap = getPropertiesMap(properties);
|
||||||
CMISMapping cmisMapping = cmisDictionaryService.getCMISMapping();
|
CMISTypeId cmisTypeId = getCmisTypeId(typeId);
|
||||||
CMISTypeId cmisTypeId = cmisMapping.getCmisTypeId(typeId);
|
if (cmisTypeId.getScope() != CMISScope.DOCUMENT)
|
||||||
|
|
||||||
if (cmisMapping.getCmisTypeId(typeId).equals(CMISMapping.DOCUMENT_TYPE_ID) == false)
|
|
||||||
{
|
{
|
||||||
throw new ConstraintViolationException("Invalid document type " + typeId);
|
throw new ConstraintViolationException("Invalid document type " + typeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRef parentNodeRef = safeGetFolderNodeRef(folderId);
|
NodeRef parentNodeRef = safeGetFolderNodeRef(folderId);
|
||||||
|
|
||||||
String documentName = (String) propertiesMap.get(CMISMapping.PROP_NAME);
|
String documentName = (String) propertiesMap.get(CMISDictionaryModel.PROP_NAME);
|
||||||
if (documentName == null)
|
if (documentName == null)
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException("Name property not found");
|
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);
|
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)
|
if (mimeType != null)
|
||||||
{
|
{
|
||||||
writer.setMimetype(mimeType);
|
writer.setMimetype(mimeType);
|
||||||
@@ -165,7 +165,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
|||||||
break;
|
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) ?
|
return versionLabel != null && versionLabel.contains(VERSION_DELIMETER) ?
|
||||||
newDocumentNodeRef.toString() + CmisObjectsUtils.NODE_REFERENCE_ID_DELIMETER + versionLabel :
|
newDocumentNodeRef.toString() + CmisObjectsUtils.NODE_REFERENCE_ID_DELIMETER + versionLabel :
|
||||||
newDocumentNodeRef.toString();
|
newDocumentNodeRef.toString();
|
||||||
@@ -194,17 +194,14 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
|||||||
checkRepositoryId(repositoryId);
|
checkRepositoryId(repositoryId);
|
||||||
NodeRef folderNodeRef = cmisObjectsUtils.getIdentifierInstance(folderId, AlfrescoObjectType.FOLDER_OBJECT).getConvertedIdentifier();
|
NodeRef folderNodeRef = cmisObjectsUtils.getIdentifierInstance(folderId, AlfrescoObjectType.FOLDER_OBJECT).getConvertedIdentifier();
|
||||||
|
|
||||||
CMISTypeId cmisTypeId = getCmisTypeId(typeId);
|
CMISTypeDefinition type = getCmisTypeDefinition(typeId);
|
||||||
assertTypeExists(cmisTypeId);
|
if (type == null || type.getTypeId().getScope() != CMISScope.FOLDER)
|
||||||
|
|
||||||
CMISMapping cmisMapping = cmisDictionaryService.getCMISMapping();
|
|
||||||
if (cmisMapping.isValidCmisFolder(cmisTypeId.getQName()) == false)
|
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException(typeId + " isn't a folder type");
|
throw new TypeNotFoundException(typeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Serializable> propertiesMap = getPropertiesMap(properties);
|
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)
|
if (name == null)
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException("Name property not found");
|
throw new InvalidArgumentException("Name property not found");
|
||||||
@@ -214,10 +211,10 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NodeRef newFolderNodeRef = fileFolderService.create(folderNodeRef, name, cmisMapping.getAlfrescoType(cmisTypeId.getQName())).getNodeRef();
|
NodeRef newFolderNodeRef = fileFolderService.create(folderNodeRef, name, type.getTypeId().getQName()).getNodeRef();
|
||||||
// TODO:
|
// TODO:
|
||||||
// cmisPropertyService.setProperties(newFolderNodeRef, propertiesMap);
|
// 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)
|
catch (FileExistsException e)
|
||||||
{
|
{
|
||||||
@@ -289,17 +286,13 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMISTypeId relationshipTypeId;
|
CMISTypeId relationshipTypeId = getCmisTypeId(typeId);
|
||||||
try
|
if (relationshipTypeId.getScope() != CMISScope.RELATIONSHIP)
|
||||||
{
|
{
|
||||||
relationshipTypeId = cmisDictionaryService.getCMISMapping().getCmisTypeId(typeId);
|
throw new TypeNotFoundException(typeId);
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new InvalidArgumentException("Invalid typeId format: " + typeId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QName relationshipTypeQName = cmisDictionaryService.getCMISMapping().getAlfrescoType(relationshipTypeId.getQName());
|
QName relationshipTypeQName = relationshipTypeId.getQName();
|
||||||
AssociationDefinition associationDef = dictionaryService.getAssociation(relationshipTypeQName);
|
AssociationDefinition associationDef = dictionaryService.getAssociation(relationshipTypeQName);
|
||||||
if (associationDef != null)
|
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();
|
NodeRef objectNodeReference = cmisObjectsUtils.getIdentifierInstance(objectId, AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT).getConvertedIdentifier();
|
||||||
checkForRootObject(repositoryId, objectId);
|
checkForRootObject(repositoryId, objectId);
|
||||||
checkObjectTypeAndAppropriateStates(objectNodeReference, this.cmisDictionaryService.getCMISMapping().getCmisType(this.nodeService.getType(objectNodeReference)));
|
checkObjectTypeAndAppropriateStates(objectNodeReference, nodeService.getType(objectNodeReference));
|
||||||
if (!cmisObjectsUtils.deleteObject(objectNodeReference))
|
if (!cmisObjectsUtils.deleteObject(objectNodeReference))
|
||||||
{
|
{
|
||||||
throw new PermissionDeniedException("Currently authenticated User has no appropriate Permissions to delete specified Object");
|
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.setLength(BigInteger.valueOf(reader.getSize()));
|
||||||
response.setMimeType(reader.getMimetype());
|
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.setFilename(filename);
|
||||||
response.setStream(new DataHandler(new ContentReaderDataSource(reader, filename)));
|
response.setStream(new DataHandler(new ContentReaderDataSource(reader, filename)));
|
||||||
|
|
||||||
@@ -568,7 +561,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
|||||||
// TODO: change token
|
// TODO: change token
|
||||||
|
|
||||||
// no new version
|
// 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;
|
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)
|
private boolean changeObjectParentAssociation(NodeRef objectNodeRef, NodeRef targetFolderNodeRef, NodeRef sourceFolderNodeReference)
|
||||||
throws UpdateConflictException, PermissionDeniedException
|
throws UpdateConflictException, PermissionDeniedException
|
||||||
{
|
{
|
||||||
@@ -726,7 +699,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
|||||||
throw new InvalidArgumentException("Specified Object has invalid Object Type");
|
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");
|
throw new ConstraintViolationException("Could not delete folder with at least one Child");
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,8 @@ import java.math.BigInteger;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.PropertyFilter;
|
||||||
import org.alfresco.repo.cmis.ws.utils.AlfrescoObjectType;
|
import org.alfresco.repo.cmis.ws.utils.AlfrescoObjectType;
|
||||||
import org.alfresco.repo.web.util.paging.Cursor;
|
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 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;
|
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());
|
PropertyFilter propertyFilter = createPropertyFilter(parameters.getFilter());
|
||||||
NodeRef objectNodeRef = (NodeRef) cmisObjectsUtils.getIdentifierInstance(parameters.getObjectId(), AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT).getConvertedIdentifier();
|
NodeRef objectNodeRef = (NodeRef) cmisObjectsUtils.getIdentifierInstance(parameters.getObjectId(), AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT).getConvertedIdentifier();
|
||||||
@@ -143,7 +146,8 @@ public class DMRelationshipServicePort extends DMAbstractServicePort implements
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return cmisDictionaryService.getCMISMapping().isValidCmisRelationship(qname) && relationshipType.equals(qname);
|
CMISTypeId typeId = cmisDictionaryService.getTypeId(qname, CMISScope.RELATIONSHIP);
|
||||||
|
return typeId != null && relationshipType.equals(qname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,15 +38,14 @@ import javax.xml.bind.JAXBElement;
|
|||||||
|
|
||||||
import org.alfresco.cmis.CMISCardinalityEnum;
|
import org.alfresco.cmis.CMISCardinalityEnum;
|
||||||
import org.alfresco.cmis.CMISContentStreamAllowedEnum;
|
import org.alfresco.cmis.CMISContentStreamAllowedEnum;
|
||||||
|
import org.alfresco.cmis.CMISDataTypeEnum;
|
||||||
import org.alfresco.cmis.CMISFullTextSearchEnum;
|
import org.alfresco.cmis.CMISFullTextSearchEnum;
|
||||||
import org.alfresco.cmis.CMISJoinEnum;
|
import org.alfresco.cmis.CMISJoinEnum;
|
||||||
import org.alfresco.cmis.CMISPropertyTypeEnum;
|
|
||||||
import org.alfresco.cmis.CMISUpdatabilityEnum;
|
import org.alfresco.cmis.CMISUpdatabilityEnum;
|
||||||
import org.alfresco.cmis.dictionary.CMISChoice;
|
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.CMISPropertyDefinition;
|
||||||
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
||||||
import org.alfresco.cmis.dictionary.CMISTypeId;
|
|
||||||
import org.alfresco.repo.web.util.paging.Cursor;
|
import org.alfresco.repo.web.util.paging.Cursor;
|
||||||
import org.alfresco.service.descriptor.Descriptor;
|
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<CMISContentStreamAllowedEnum, EnumContentStreamAllowed> contentStreamAllowedEnumMapping;
|
||||||
private static Map<CMISUpdatabilityEnum, EnumUpdateability> updatabilityEnumMapping;
|
private static Map<CMISUpdatabilityEnum, EnumUpdateability> updatabilityEnumMapping;
|
||||||
private static Map<CMISCardinalityEnum, EnumCardinality> cardinalityEnumMapping;
|
private static Map<CMISCardinalityEnum, EnumCardinality> cardinalityEnumMapping;
|
||||||
private static Map<CMISPropertyTypeEnum, EnumPropertyType> propertyTypeEnumMapping;
|
private static Map<CMISDataTypeEnum, EnumPropertyType> propertyTypeEnumMapping;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
@@ -91,16 +90,16 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
cardinalityEnumMapping.put(CMISCardinalityEnum.MULTI_VALUED, EnumCardinality.MULTI);
|
cardinalityEnumMapping.put(CMISCardinalityEnum.MULTI_VALUED, EnumCardinality.MULTI);
|
||||||
cardinalityEnumMapping.put(CMISCardinalityEnum.SINGLE_VALUED, EnumCardinality.SINGLE);
|
cardinalityEnumMapping.put(CMISCardinalityEnum.SINGLE_VALUED, EnumCardinality.SINGLE);
|
||||||
|
|
||||||
propertyTypeEnumMapping = new HashMap<CMISPropertyTypeEnum, EnumPropertyType>();
|
propertyTypeEnumMapping = new HashMap<CMISDataTypeEnum, EnumPropertyType>();
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.BOOLEAN, EnumPropertyType.BOOLEAN);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.BOOLEAN, EnumPropertyType.BOOLEAN);
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.DATETIME, EnumPropertyType.DATETIME);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.DATETIME, EnumPropertyType.DATETIME);
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.DECIMAL, EnumPropertyType.DECIMAL);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.DECIMAL, EnumPropertyType.DECIMAL);
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.HTML, EnumPropertyType.HTML);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.HTML, EnumPropertyType.HTML);
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.ID, EnumPropertyType.ID);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.ID, EnumPropertyType.ID);
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.INTEGER, EnumPropertyType.INTEGER);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.INTEGER, EnumPropertyType.INTEGER);
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.STRING, EnumPropertyType.STRING);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.STRING, EnumPropertyType.STRING);
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.URI, EnumPropertyType.URI);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.URI, EnumPropertyType.URI);
|
||||||
propertyTypeEnumMapping.put(CMISPropertyTypeEnum.XML, EnumPropertyType.XML);
|
propertyTypeEnumMapping.put(CMISDataTypeEnum.XML, EnumPropertyType.XML);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +146,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
repositoryInfoType.setRepositoryName(serverDescriptor.getName());
|
repositoryInfoType.setRepositoryName(serverDescriptor.getName());
|
||||||
repositoryInfoType.setRepositoryRelationship("self");
|
repositoryInfoType.setRepositoryRelationship("self");
|
||||||
repositoryInfoType.setRepositoryDescription("");
|
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.setVendorName("Alfresco");
|
||||||
repositoryInfoType.setProductName("Alfresco Repository (" + serverDescriptor.getEdition() + ")");
|
repositoryInfoType.setProductName("Alfresco Repository (" + serverDescriptor.getEdition() + ")");
|
||||||
repositoryInfoType.setProductVersion(serverDescriptor.getVersion());
|
repositoryInfoType.setProductVersion(serverDescriptor.getVersion());
|
||||||
@@ -173,7 +172,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
* @param propertyType type of property
|
* @param propertyType type of property
|
||||||
* @return web service choice
|
* @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;
|
JAXBElement<? extends CmisChoiceType> result = null;
|
||||||
|
|
||||||
@@ -239,7 +238,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
* @param choices repository choice object
|
* @param choices repository choice object
|
||||||
* @param cmisChoices web service 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)
|
for (CMISChoice choice : choices)
|
||||||
{
|
{
|
||||||
@@ -260,7 +259,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
* @param choices repository choice object
|
* @param choices repository choice object
|
||||||
* @param cmisChoices web service 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)
|
for (CMISChoice choice : choices)
|
||||||
{
|
{
|
||||||
@@ -280,21 +279,21 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
* @param propertyDefinition repository property definition
|
* @param propertyDefinition repository property definition
|
||||||
* @param wsPropertyDefs web service 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();
|
CmisPropertyDefinitionType wsPropertyDef = new CmisPropertyDefinitionType();
|
||||||
wsPropertyDef.setName(propertyDefinition.getPropertyName());
|
wsPropertyDef.setName(propertyDefinition.getPropertyId().getName());
|
||||||
wsPropertyDef.setId(propertyDefinition.getPropertyId());
|
wsPropertyDef.setId(propertyDefinition.getPropertyId().getId());
|
||||||
wsPropertyDef.setDisplayName(propertyDefinition.getDisplayName());
|
wsPropertyDef.setDisplayName(propertyDefinition.getDisplayName());
|
||||||
wsPropertyDef.setDescription(propertyDefinition.getDescription());
|
wsPropertyDef.setDescription(propertyDefinition.getDescription());
|
||||||
wsPropertyDef.setPropertyType(propertyTypeEnumMapping.get(propertyDefinition.getPropertyType()));
|
wsPropertyDef.setPropertyType(propertyTypeEnumMapping.get(propertyDefinition.getDataType()));
|
||||||
wsPropertyDef.setCardinality(cardinalityEnumMapping.get(propertyDefinition.getCardinality()));
|
wsPropertyDef.setCardinality(cardinalityEnumMapping.get(propertyDefinition.getCardinality()));
|
||||||
wsPropertyDef.setUpdateability(updatabilityEnumMapping.get(propertyDefinition.getUpdatability()));
|
wsPropertyDef.setUpdateability(updatabilityEnumMapping.get(propertyDefinition.getUpdatability()));
|
||||||
wsPropertyDef.setInherited(propertyDefinition.isInherited());
|
wsPropertyDef.setInherited(propertyDefinition.getOwningType().equals(typeDefinition));
|
||||||
wsPropertyDef.setRequired(propertyDefinition.isRequired());
|
wsPropertyDef.setRequired(propertyDefinition.isRequired());
|
||||||
wsPropertyDef.setQueryable(propertyDefinition.isQueryable());
|
wsPropertyDef.setQueryable(propertyDefinition.isQueryable());
|
||||||
wsPropertyDef.setOrderable(propertyDefinition.isOrderable());
|
wsPropertyDef.setOrderable(propertyDefinition.isOrderable());
|
||||||
addChoices(propertyDefinition.getPropertyType(), propertyDefinition.getChoices(), wsPropertyDef.getChoice());
|
addChoices(propertyDefinition.getDataType(), propertyDefinition.getChoices(), wsPropertyDef.getChoice());
|
||||||
wsPropertyDef.setOpenChoice(propertyDefinition.isOpenChoice());
|
wsPropertyDef.setOpenChoice(propertyDefinition.isOpenChoice());
|
||||||
|
|
||||||
wsPropertyDefs.add(wsPropertyDef);
|
wsPropertyDefs.add(wsPropertyDef);
|
||||||
@@ -309,25 +308,25 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
*/
|
*/
|
||||||
private void setCmisTypeDefinitionProperties(CmisTypeDefinitionType cmisTypeDefinition, CMISTypeDefinition typeDefinition, boolean includeProperties)
|
private void setCmisTypeDefinitionProperties(CmisTypeDefinitionType cmisTypeDefinition, CMISTypeDefinition typeDefinition, boolean includeProperties)
|
||||||
{
|
{
|
||||||
cmisTypeDefinition.setTypeId(typeDefinition.getObjectTypeId().getTypeId());
|
cmisTypeDefinition.setTypeId(typeDefinition.getTypeId().getId());
|
||||||
cmisTypeDefinition.setQueryName(typeDefinition.getObjectTypeQueryName());
|
cmisTypeDefinition.setQueryName(typeDefinition.getQueryName());
|
||||||
cmisTypeDefinition.setDisplayName(typeDefinition.getObjectTypeDisplayName());
|
cmisTypeDefinition.setDisplayName(typeDefinition.getDisplayName());
|
||||||
cmisTypeDefinition.setBaseType(EnumObjectType.fromValue(typeDefinition.getRootTypeId().getTypeId()));
|
cmisTypeDefinition.setBaseType(EnumObjectType.fromValue(typeDefinition.getRootType().getTypeId().getId()));
|
||||||
cmisTypeDefinition.setParentId(typeDefinition.getParentTypeId().getTypeId());
|
cmisTypeDefinition.setParentId(typeDefinition.getParentType().getTypeId().getId());
|
||||||
cmisTypeDefinition.setBaseTypeQueryName(typeDefinition.getRootTypeQueryName());
|
cmisTypeDefinition.setBaseTypeQueryName(typeDefinition.getRootType().getQueryName());
|
||||||
cmisTypeDefinition.setDescription(typeDefinition.getDescription());
|
cmisTypeDefinition.setDescription(typeDefinition.getDescription());
|
||||||
cmisTypeDefinition.setCreatable(typeDefinition.isCreatable());
|
cmisTypeDefinition.setCreatable(typeDefinition.isCreatable());
|
||||||
cmisTypeDefinition.setFileable(typeDefinition.isFileable());
|
cmisTypeDefinition.setFileable(typeDefinition.isFileable());
|
||||||
cmisTypeDefinition.setQueryable(typeDefinition.isQueryable());
|
cmisTypeDefinition.setQueryable(typeDefinition.isQueryable());
|
||||||
cmisTypeDefinition.setControllable(typeDefinition.isControllable());
|
cmisTypeDefinition.setControllable(typeDefinition.isControllable());
|
||||||
cmisTypeDefinition.setIncludedInSupertypeQuery(typeDefinition.isIncludedInSupertypeQuery());
|
cmisTypeDefinition.setIncludedInSupertypeQuery(typeDefinition.isIncludeInSuperTypeQuery());
|
||||||
|
|
||||||
if (includeProperties)
|
if (includeProperties)
|
||||||
{
|
{
|
||||||
List<CmisPropertyDefinitionType> propertyDefs = cmisTypeDefinition.getPropertyDefinition();
|
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
|
* @return web service type definition
|
||||||
* @throws ObjectNotFoundException if type id not found
|
* @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);
|
if (typeDef.getParentType() == null)
|
||||||
CMISTypeDefinition typeDefinition = cmisDictionaryService.getType(cmisTypeId);
|
|
||||||
|
|
||||||
if (typeDefinition.getParentTypeId() == null)
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeDefinition == null)
|
if (typeDef == null)
|
||||||
{
|
{
|
||||||
throw new ObjectNotFoundException("Type not found");
|
throw new ObjectNotFoundException("Type not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
JAXBElement<? extends CmisTypeDefinitionType> result = null;
|
JAXBElement<? extends CmisTypeDefinitionType> result = null;
|
||||||
|
|
||||||
switch (cmisTypeId.getScope())
|
switch (typeDef.getTypeId().getScope())
|
||||||
{
|
{
|
||||||
case DOCUMENT:
|
case DOCUMENT:
|
||||||
CmisTypeDocumentDefinitionType documentDefinitionType = new CmisTypeDocumentDefinitionType();
|
CmisTypeDocumentDefinitionType documentDefinitionType = new CmisTypeDocumentDefinitionType();
|
||||||
setCmisTypeDefinitionProperties(documentDefinitionType, typeDefinition, includeProperties);
|
setCmisTypeDefinitionProperties(documentDefinitionType, typeDef, includeProperties);
|
||||||
documentDefinitionType.setVersionable(typeDefinition.isVersionable());
|
documentDefinitionType.setVersionable(typeDef.isVersionable());
|
||||||
documentDefinitionType.setContentStreamAllowed(contentStreamAllowedEnumMapping.get(typeDefinition.getContentStreamAllowed()));
|
documentDefinitionType.setContentStreamAllowed(contentStreamAllowedEnumMapping.get(typeDef.getContentStreamAllowed()));
|
||||||
result = cmisObjectFactory.createDocumentType(documentDefinitionType);
|
result = cmisObjectFactory.createDocumentType(documentDefinitionType);
|
||||||
break;
|
break;
|
||||||
case FOLDER:
|
case FOLDER:
|
||||||
CmisTypeFolderDefinitionType folderDefinitionType = new CmisTypeFolderDefinitionType();
|
CmisTypeFolderDefinitionType folderDefinitionType = new CmisTypeFolderDefinitionType();
|
||||||
setCmisTypeDefinitionProperties(folderDefinitionType, typeDefinition, includeProperties);
|
setCmisTypeDefinitionProperties(folderDefinitionType, typeDef, includeProperties);
|
||||||
result = cmisObjectFactory.createFolderType(folderDefinitionType);
|
result = cmisObjectFactory.createFolderType(folderDefinitionType);
|
||||||
break;
|
break;
|
||||||
case POLICY:
|
case POLICY:
|
||||||
CmisTypePolicyDefinitionType policyDefinitionType = new CmisTypePolicyDefinitionType();
|
CmisTypePolicyDefinitionType policyDefinitionType = new CmisTypePolicyDefinitionType();
|
||||||
setCmisTypeDefinitionProperties(policyDefinitionType, typeDefinition, includeProperties);
|
setCmisTypeDefinitionProperties(policyDefinitionType, typeDef, includeProperties);
|
||||||
result = cmisObjectFactory.createPolicyType(policyDefinitionType);
|
result = cmisObjectFactory.createPolicyType(policyDefinitionType);
|
||||||
break;
|
break;
|
||||||
case RELATIONSHIP:
|
case RELATIONSHIP:
|
||||||
CmisTypeRelationshipDefinitionType relationshipDefinitionType = new CmisTypeRelationshipDefinitionType();
|
CmisTypeRelationshipDefinitionType relationshipDefinitionType = new CmisTypeRelationshipDefinitionType();
|
||||||
setCmisTypeDefinitionProperties(relationshipDefinitionType, typeDefinition, includeProperties);
|
setCmisTypeDefinitionProperties(relationshipDefinitionType, typeDef, includeProperties);
|
||||||
result = cmisObjectFactory.createRelationshipType(relationshipDefinitionType);
|
result = cmisObjectFactory.createRelationshipType(relationshipDefinitionType);
|
||||||
break;
|
break;
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
@@ -407,28 +403,29 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
{
|
{
|
||||||
checkRepositoryId(parameters.getRepositoryId());
|
checkRepositoryId(parameters.getRepositoryId());
|
||||||
|
|
||||||
Collection<CMISTypeId> typeIds;
|
Collection<CMISTypeDefinition> typeDefs;
|
||||||
if (parameters.getTypeId() == null)
|
if (parameters.getTypeId() == null)
|
||||||
{
|
{
|
||||||
typeIds = cmisDictionaryService.getAllObjectTypeIds();
|
typeDefs = cmisDictionaryService.getAllTypes();
|
||||||
}
|
}
|
||||||
else
|
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();
|
GetTypesResponse response = new GetTypesResponse();
|
||||||
if (parameters.getMaxItems() != null)
|
if (parameters.getMaxItems() != null)
|
||||||
{
|
{
|
||||||
response.setHasMoreItems(parameters.getMaxItems().getValue().intValue() < typeIds.size());
|
response.setHasMoreItems(parameters.getMaxItems().getValue().intValue() < typeDefs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip
|
// skip
|
||||||
Cursor cursor = createCursor(typeIds.size(), parameters.getSkipCount() != null ? parameters.getSkipCount().getValue() : null, parameters.getMaxItems() != null ? parameters.getMaxItems().getValue() : null);
|
Cursor cursor = createCursor(typeDefs.size(), parameters.getSkipCount() != null ? parameters.getSkipCount().getValue() : null, parameters.getMaxItems() != null ? parameters.getMaxItems().getValue() : null);
|
||||||
Iterator<CMISTypeId> iterTypeIds = typeIds.iterator();
|
Iterator<CMISTypeDefinition> iterTypeDefs = typeDefs.iterator();
|
||||||
for (int i = 0; i < cursor.getStartRow(); i++)
|
for (int i = 0; i < cursor.getStartRow(); i++)
|
||||||
{
|
{
|
||||||
iterTypeIds.next();
|
iterTypeDefs.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean returnPropertyDefinitions = parameters.getReturnPropertyDefinitions() == null ? false : parameters.getReturnPropertyDefinitions().getValue();
|
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();
|
List<JAXBElement<? extends CmisTypeDefinitionType>> types = response.getType();
|
||||||
for (int i = cursor.getStartRow(); i <= cursor.getEndRow(); i++)
|
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)
|
if (element != null)
|
||||||
{
|
{
|
||||||
types.add(element);
|
types.add(element);
|
||||||
@@ -466,7 +463,8 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
|||||||
checkRepositoryId(parameters.getRepositoryId());
|
checkRepositoryId(parameters.getRepositoryId());
|
||||||
|
|
||||||
GetTypeDefinitionResponse response = new GetTypeDefinitionResponse();
|
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;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.xml.ws.Holder;
|
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.model.ContentModel;
|
||||||
import org.alfresco.repo.cmis.PropertyFilter;
|
import org.alfresco.repo.cmis.PropertyFilter;
|
||||||
import org.alfresco.repo.cmis.ws.utils.AlfrescoObjectType;
|
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));
|
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);
|
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;
|
contentCopied.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ import java.io.Serializable;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,29 +44,29 @@ public class PropertyUtil
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_IMMUTABLE, new Pair<String, Boolean>("IsImmutable", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_IS_IMMUTABLE, new Pair<String, Boolean>("IsImmutable", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_IS_LATEST_VERSION, new Pair<String, Boolean>("IsLatestVersion", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.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(CMISDictionaryModel.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(CMISDictionaryModel.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(CMISDictionaryModel.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(CMISDictionaryModel.PROP_CREATION_DATE, new Pair<String, Boolean>("CreationDate", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_LAST_MODIFICATION_DATE, new Pair<String, Boolean>("LastModificationDate", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_LAST_MODIFICATION_DATE, new Pair<String, Boolean>("LastModificationDate", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_OBJECT_ID, new Pair<String, Boolean>("ObjectId", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_OBJECT_ID, new Pair<String, Boolean>("ObjectId", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_ID, new Pair<String, Boolean>("VersionSeriesId", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.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(CMISDictionaryModel.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(CMISDictionaryModel.PROP_CONTENT_STREAM_LENGTH, new Pair<String, Boolean>("ContentStreamLength", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_NAME, new Pair<String, Boolean>("Name", false));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_NAME, new Pair<String, Boolean>("Name", false));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_OBJECT_TYPE_ID, new Pair<String, Boolean>("ObjectTypeId", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_OBJECT_TYPE_ID, new Pair<String, Boolean>("ObjectTypeId", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CREATED_BY, new Pair<String, Boolean>("CreatedBy", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CREATED_BY, new Pair<String, Boolean>("CreatedBy", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_LAST_MODIFIED_BY, new Pair<String, Boolean>("LastModifiedBy", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.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(CMISDictionaryModel.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(CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME, new Pair<String, Boolean>("ContentStreamFilename", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_LABEL, new Pair<String, Boolean>("VersionLabel", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_VERSION_LABEL, new Pair<String, Boolean>("VersionLabel", true));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CHECKIN_COMMENT, new Pair<String, Boolean>("checkinComment", false));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.PROP_CHECKIN_COMMENT, new Pair<String, Boolean>("checkinComment", false));
|
||||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_URI, new Pair<String, Boolean>("contentStreamUri", true));
|
cmisToRepoPropertiesNamesMapping.put(CMISDictionaryModel.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(CMISDictionaryModel.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(CMISDictionaryModel.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_CONTENT_STREAM_ALLOWED, new Pair<String, Boolean>("ContentStreamAllowed", true));
|
||||||
|
|
||||||
for (Map.Entry<String, Pair<String, Boolean>> entry : cmisToRepoPropertiesNamesMapping.entrySet())
|
for (Map.Entry<String, Pair<String, Boolean>> entry : cmisToRepoPropertiesNamesMapping.entrySet())
|
||||||
{
|
{
|
||||||
|
@@ -28,7 +28,6 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
|
||||||
import org.alfresco.cmis.dictionary.CMISScope;
|
import org.alfresco.cmis.dictionary.CMISScope;
|
||||||
import org.alfresco.cmis.dictionary.CMISTypeId;
|
import org.alfresco.cmis.dictionary.CMISTypeId;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
@@ -73,7 +72,6 @@ public class CmisObjectsUtils
|
|||||||
private AuthorityService authorityService;
|
private AuthorityService authorityService;
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
private LockService lockService;
|
private LockService lockService;
|
||||||
private CMISMapping cmisMapping;
|
|
||||||
|
|
||||||
private Throwable lastOperationException;
|
private Throwable lastOperationException;
|
||||||
|
|
||||||
@@ -81,7 +79,6 @@ public class CmisObjectsUtils
|
|||||||
public void setCmisDictionaryService(CMISDictionaryService cmisDictionaryService)
|
public void setCmisDictionaryService(CMISDictionaryService cmisDictionaryService)
|
||||||
{
|
{
|
||||||
this.cmisDictionaryService = cmisDictionaryService;
|
this.cmisDictionaryService = cmisDictionaryService;
|
||||||
this.cmisMapping = this.cmisDictionaryService.getCMISMapping();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
@@ -217,12 +214,24 @@ public class CmisObjectsUtils
|
|||||||
|
|
||||||
public boolean isFolder(NodeRef folderNodeRef)
|
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)
|
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)
|
public boolean isRelationship(String identifier)
|
||||||
@@ -354,7 +363,7 @@ public class CmisObjectsUtils
|
|||||||
|
|
||||||
private AlfrescoObjectType determineActualObjectType(AlfrescoObjectType expectedType, QName objectType)
|
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)
|
if ((expectedType == AlfrescoObjectType.DOCUMENT_OBJECT || expectedType == AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT)
|
||||||
&& typeId.getScope() == CMISScope.DOCUMENT)
|
&& typeId.getScope() == CMISScope.DOCUMENT)
|
||||||
{
|
{
|
||||||
|
@@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Michael Shavnev
|
* @author Michael Shavnev
|
||||||
@@ -109,7 +109,7 @@ public abstract class AbstractServiceTest extends TestCase
|
|||||||
{
|
{
|
||||||
CmisObjectType object = response.getObject();
|
CmisObjectType object = response.getObject();
|
||||||
CmisPropertiesType properties = object.getProperties();
|
CmisPropertiesType properties = object.getProperties();
|
||||||
property = (String) PropertyUtil.getProperty(properties, CMISMapping.PROP_NAME);
|
property = (String) PropertyUtil.getProperty(properties, CMISDictionaryModel.PROP_NAME);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -166,7 +166,7 @@ public abstract class AbstractServiceTest extends TestCase
|
|||||||
{
|
{
|
||||||
CmisObjectType object = response.getObject();
|
CmisObjectType object = response.getObject();
|
||||||
CmisPropertiesType properties = object.getProperties();
|
CmisPropertiesType properties = object.getProperties();
|
||||||
property = (String) PropertyUtil.getProperty(properties, CMISMapping.PROP_OBJECT_ID);
|
property = (String) PropertyUtil.getProperty(properties, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -180,7 +180,7 @@ public abstract class AbstractServiceTest extends TestCase
|
|||||||
for (CmisObjectType object : objects)
|
for (CmisObjectType object : objects)
|
||||||
{
|
{
|
||||||
CmisPropertiesType properties = object.getProperties();
|
CmisPropertiesType properties = object.getProperties();
|
||||||
String name = (String) PropertyUtil.getProperty(properties, CMISMapping.PROP_NAME);
|
String name = (String) PropertyUtil.getProperty(properties, CMISDictionaryModel.PROP_NAME);
|
||||||
assertNotNull(name);
|
assertNotNull(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ import javax.xml.ws.Service;
|
|||||||
|
|
||||||
import junit.framework.TestCase;
|
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.cmis.dictionary.CMISTypeId;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
|
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
|
||||||
@@ -194,7 +194,7 @@ public class CmisServiceTestHelper extends TestCase
|
|||||||
CmisPropertiesType properties = new CmisPropertiesType();
|
CmisPropertiesType properties = new CmisPropertiesType();
|
||||||
List<CmisProperty> propertiesList = properties.getProperty();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setValue(name);
|
cmisProperty.setValue(name);
|
||||||
propertiesList.add(cmisProperty);
|
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,
|
// public String createDocument(String repositoryId, String typeId, CmisPropertiesType properties, String folderId, CmisContentStreamType contentStream,
|
||||||
// EnumVersioningState versioningState)
|
// 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);
|
EnumVersioningState.MAJOR);
|
||||||
// assertNotNull(objectId);
|
// assertNotNull(objectId);
|
||||||
return objectId;
|
return objectId;
|
||||||
@@ -220,7 +220,7 @@ public class CmisServiceTestHelper extends TestCase
|
|||||||
CmisPropertiesType properties = new CmisPropertiesType();
|
CmisPropertiesType properties = new CmisPropertiesType();
|
||||||
List<CmisProperty> propertiesList = properties.getProperty();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setValue(name);
|
cmisProperty.setValue(name);
|
||||||
propertiesList.add(cmisProperty);
|
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,
|
// public String createDocument(String repositoryId, String typeId, CmisPropertiesType properties, String folderId, CmisContentStreamType contentStream,
|
||||||
// EnumVersioningState versioningState)
|
// 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);
|
// assertNotNull(objectId);
|
||||||
return objectId;
|
return objectId;
|
||||||
}
|
}
|
||||||
@@ -251,13 +251,13 @@ public class CmisServiceTestHelper extends TestCase
|
|||||||
CmisPropertiesType properties = new CmisPropertiesType();
|
CmisPropertiesType properties = new CmisPropertiesType();
|
||||||
List<CmisProperty> propertiesList = properties.getProperty();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setValue(name + dataSource.getName());
|
cmisProperty.setValue(name + dataSource.getName());
|
||||||
propertiesList.add(cmisProperty);
|
propertiesList.add(cmisProperty);
|
||||||
|
|
||||||
// public String createDocument(String repositoryId, String typeId, CmisPropertiesType properties, String folderId, CmisContentStreamType contentStream,
|
// public String createDocument(String repositoryId, String typeId, CmisPropertiesType properties, String folderId, CmisContentStreamType contentStream,
|
||||||
// EnumVersioningState versioningState)
|
// 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);
|
EnumVersioningState.MAJOR);
|
||||||
// assertNotNull(objectId);
|
// assertNotNull(objectId);
|
||||||
return objectId;
|
return objectId;
|
||||||
@@ -276,14 +276,14 @@ public class CmisServiceTestHelper extends TestCase
|
|||||||
List<CmisProperty> propertiesList = properties.getProperty();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
|
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setPropertyType(EnumPropertyType.STRING);
|
cmisProperty.setPropertyType(EnumPropertyType.STRING);
|
||||||
cmisProperty.setIndex(BigInteger.valueOf(1));
|
cmisProperty.setIndex(BigInteger.valueOf(1));
|
||||||
cmisProperty.setValue(name);
|
cmisProperty.setValue(name);
|
||||||
propertiesList.add(cmisProperty);
|
propertiesList.add(cmisProperty);
|
||||||
|
|
||||||
// public String createFolder(String repositoryId, String typeId, CmisPropertiesType properties, String folderId)
|
// 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);
|
// assertNotNull(objectId);
|
||||||
return objectId;
|
return objectId;
|
||||||
}
|
}
|
||||||
@@ -295,14 +295,14 @@ public class CmisServiceTestHelper extends TestCase
|
|||||||
List<CmisProperty> propertiesList = properties.getProperty();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
|
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setPropertyType(EnumPropertyType.STRING);
|
cmisProperty.setPropertyType(EnumPropertyType.STRING);
|
||||||
cmisProperty.setIndex(BigInteger.valueOf(1));
|
cmisProperty.setIndex(BigInteger.valueOf(1));
|
||||||
cmisProperty.setValue(name);
|
cmisProperty.setValue(name);
|
||||||
propertiesList.add(cmisProperty);
|
propertiesList.add(cmisProperty);
|
||||||
|
|
||||||
// public String createFolder(String repositoryId, String typeId, CmisPropertiesType properties, String folderId)
|
// 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);
|
// assertNotNull(objectId);
|
||||||
return objectId;
|
return objectId;
|
||||||
}
|
}
|
||||||
@@ -418,9 +418,9 @@ public class CmisServiceTestHelper extends TestCase
|
|||||||
GetChildrenResponse response = getChildren(companyHomeId, EnumTypesOfFileableObjects.FOLDERS, 0, "*");
|
GetChildrenResponse response = getChildren(companyHomeId, EnumTypesOfFileableObjects.FOLDERS, 0, "*");
|
||||||
for (CmisObjectType object : response.getObject())
|
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();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
|
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setPropertyType(EnumPropertyType.STRING);
|
cmisProperty.setPropertyType(EnumPropertyType.STRING);
|
||||||
cmisProperty.setIndex(BigInteger.valueOf(1));
|
cmisProperty.setIndex(BigInteger.valueOf(1));
|
||||||
cmisProperty.setValue(name);
|
cmisProperty.setValue(name);
|
||||||
propertiesList.add(cmisProperty);
|
propertiesList.add(cmisProperty);
|
||||||
|
|
||||||
// createRelationship(String repositoryId, String typeId, CmisPropertiesType properties, String sourceObjectId, String targetObjectId)
|
// 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);
|
assertNotNull(objectId);
|
||||||
|
|
||||||
return objectId;
|
return objectId;
|
||||||
|
@@ -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 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 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()
|
public DMDiscoveryServiceTest()
|
||||||
{
|
{
|
||||||
|
@@ -26,7 +26,7 @@ package org.alfresco.repo.cmis.ws;
|
|||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
|
|
||||||
public class DMMultiFilingServiceTest extends AbstractServiceTest
|
public class DMMultiFilingServiceTest extends AbstractServiceTest
|
||||||
{
|
{
|
||||||
@@ -71,9 +71,9 @@ public class DMMultiFilingServiceTest extends AbstractServiceTest
|
|||||||
{
|
{
|
||||||
((MultiFilingServicePort) servicePort).addObjectToFolder(repositoryId, documentId, anotherFolderId);
|
((MultiFilingServicePort) servicePort).addObjectToFolder(repositoryId, documentId, anotherFolderId);
|
||||||
boolean found = false;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import javax.xml.ws.Holder;
|
import javax.xml.ws.Holder;
|
||||||
|
|
||||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alexander Tsvetkov
|
* @author Alexander Tsvetkov
|
||||||
@@ -103,7 +103,7 @@ public class DMNavigationServiceTest extends AbstractServiceTest
|
|||||||
helper.versioningServicePort.checkIn(repositoryId, documentIdHolder, null, null, null, null);
|
helper.versioningServicePort.checkIn(repositoryId, documentIdHolder, null, null, null, null);
|
||||||
|
|
||||||
response = getCheckedoutDocs(companyHomeId, 0, 0);
|
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 folderName1 = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
|
||||||
String folderId1 = helper.createFolder(folderName1, folderId);
|
String folderId1 = helper.createFolder(folderName1, folderId);
|
||||||
String documentName1 = "Test cmis document (" + System.currentTimeMillis() + ")";
|
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);
|
response = getChildren(folderId, EnumTypesOfFileableObjects.ANY, 0);
|
||||||
assertEquals(2, response.getObject().size());
|
assertEquals(2, response.getObject().size());
|
||||||
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(documentName1));
|
assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISDictionaryModel.PROP_NAME).equals(documentName1));
|
||||||
|
|
||||||
response = getChildren(folderId, EnumTypesOfFileableObjects.FOLDERS, 0);
|
response = getChildren(folderId, EnumTypesOfFileableObjects.FOLDERS, 0);
|
||||||
assertTrue(response.getObject().size() == 1);
|
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);
|
response = getChildren(folderId, EnumTypesOfFileableObjects.DOCUMENTS, 0);
|
||||||
assertTrue(response.getObject().size() == 1);
|
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
|
// FIXME: bug • If maxItems > 0, Bool hasMoreItems
|
||||||
// Should return 1 item
|
// Should return 1 item
|
||||||
@@ -180,20 +180,20 @@ public class DMNavigationServiceTest extends AbstractServiceTest
|
|||||||
folderName = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
|
folderName = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
|
||||||
String folderId1 = helper.createFolder(folderName, folderId);
|
String folderId1 = helper.createFolder(folderName, folderId);
|
||||||
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
|
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);
|
response = getDescendants(folderId, EnumTypesOfFileableObjects.FOLDERS, 1);
|
||||||
assertTrue(response.getObject().size() == 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);
|
response = getDescendants(folderId, EnumTypesOfFileableObjects.DOCUMENTS, 2);
|
||||||
assertTrue(response.getObject().size() == 1);
|
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);
|
response = getDescendants(folderId, EnumTypesOfFileableObjects.ANY, 2);
|
||||||
assertTrue(response.getObject().size() == 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(0).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName));
|
||||||
assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISMapping.PROP_NAME).equals(documentName));
|
assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISDictionaryModel.PROP_NAME).equals(documentName));
|
||||||
|
|
||||||
response = getDescendants(folderId, EnumTypesOfFileableObjects.ANY, -1);
|
response = getDescendants(folderId, EnumTypesOfFileableObjects.ANY, -1);
|
||||||
assertTrue(response.getObject().size() == 2);
|
assertTrue(response.getObject().size() == 2);
|
||||||
@@ -236,14 +236,14 @@ public class DMNavigationServiceTest extends AbstractServiceTest
|
|||||||
folderId1 = helper.createFolder(folderName1, folderId);
|
folderId1 = helper.createFolder(folderName1, folderId);
|
||||||
|
|
||||||
response = getFolderParent(folderId1, false);
|
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 folderName2 = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
|
||||||
String folderId2 = helper.createFolder(folderName2, folderId1);
|
String folderId2 = helper.createFolder(folderName2, folderId1);
|
||||||
|
|
||||||
response = getFolderParent(folderId2, true);
|
response = getFolderParent(folderId2, true);
|
||||||
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));
|
assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISDictionaryModel.PROP_NAME).equals(folderName));
|
||||||
assertTrue(response.getObject().size() >= 3);
|
assertTrue(response.getObject().size() >= 3);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -267,11 +267,11 @@ public class DMNavigationServiceTest extends AbstractServiceTest
|
|||||||
String folderName1 = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
|
String folderName1 = "Test Cmis Folder (" + System.currentTimeMillis() + ")";
|
||||||
folderId1 = helper.createFolder(folderName1, folderId);
|
folderId1 = helper.createFolder(folderName1, folderId);
|
||||||
String documentName1 = "Test cmis document (" + System.currentTimeMillis() + ")";
|
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, "*");
|
response = helper.getObjectParents(documentId1, "*");
|
||||||
assertTrue(response.getObject().size() == 1);
|
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
|
// TODO: not implemented
|
||||||
// assertNotNull(response.getObject().get(0).getAllowableActions());
|
// assertNotNull(response.getObject().get(0).getAllowableActions());
|
||||||
@@ -284,7 +284,7 @@ public class DMNavigationServiceTest extends AbstractServiceTest
|
|||||||
|
|
||||||
response = helper.getObjectParents(documentId1);
|
response = helper.getObjectParents(documentId1);
|
||||||
assertTrue(response.getObject().size() == 1);
|
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));
|
// assertTrue(PropertyUtil.getProperty(response.getObject().get(1).getProperties(), CMISMapping.PROP_NAME).equals(folderName));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ import java.util.List;
|
|||||||
import javax.activation.DataHandler;
|
import javax.activation.DataHandler;
|
||||||
import javax.xml.ws.Holder;
|
import javax.xml.ws.Holder;
|
||||||
|
|
||||||
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
CmisPropertiesType properties = new CmisPropertiesType();
|
CmisPropertiesType properties = new CmisPropertiesType();
|
||||||
List<CmisProperty> propertiesList = properties.getProperty();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setValue(documentName);
|
cmisProperty.setValue(documentName);
|
||||||
propertiesList.add(cmisProperty);
|
propertiesList.add(cmisProperty);
|
||||||
|
|
||||||
@@ -98,17 +99,17 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
String documentId;
|
String documentId;
|
||||||
// MAJOR
|
// MAJOR
|
||||||
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
|
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);
|
propertiesResponse = helper.getObjectProperties(documentId);
|
||||||
// assertTrue(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_MAJOR_VERSION));
|
// 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);
|
helper.deleteDocument(documentId);
|
||||||
|
|
||||||
// MINOR
|
// MINOR
|
||||||
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
|
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);
|
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));
|
// assertTrue(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_MAJOR_VERSION));
|
||||||
helper.deleteDocument(documentId);
|
helper.deleteDocument(documentId);
|
||||||
|
|
||||||
@@ -118,17 +119,17 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
{
|
{
|
||||||
// CHECKEDOUT
|
// CHECKEDOUT
|
||||||
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
|
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);
|
propertiesResponse = helper.getObjectProperties(documentId);
|
||||||
assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_VERSION_SERIES_ID));
|
assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_VERSION_SERIES_ID));
|
||||||
// Bug
|
// Bug
|
||||||
assertTrue(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
|
assertTrue(getPropertyBooleanValue(propertiesResponse, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
|
||||||
assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY));
|
assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY));
|
||||||
assertTrue(getPropertyValue(propertiesResponse, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID).equals(documentId));
|
assertTrue(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_ID).equals(documentId));
|
||||||
|
|
||||||
Holder<String> documentIdHolder = new Holder<String>(documentId);
|
Holder<String> documentIdHolder = new Holder<String>(documentId);
|
||||||
helper.checkIn(documentIdHolder, "checkin Comment", true);
|
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);
|
// documentId = (String) PropertyUtil.getProperty(response.getObject().iterator().next().getProperties(), CMISMapping.PROP_OBJECT_ID);
|
||||||
// deleteDocument(documentId);
|
// deleteDocument(documentId);
|
||||||
@@ -140,7 +141,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
documentName = "Test cmis document (" + System.currentTimeMillis() + ")";
|
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();
|
fail();
|
||||||
}
|
}
|
||||||
catch (FolderNotValidException e)
|
catch (FolderNotValidException e)
|
||||||
@@ -158,11 +159,11 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
{
|
{
|
||||||
String folderId1;
|
String folderId1;
|
||||||
folderName = "Test Cmis Folder (" + System.currentTimeMillis() + ")" + "testCreateFolder";
|
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);
|
propertiesResponse = helper.getObjectProperties(folderId1);
|
||||||
assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_NAME));
|
assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_NAME));
|
||||||
assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_PARENT_ID));
|
assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_PARENT_ID));
|
||||||
|
|
||||||
helper.deleteFolder(folderId1);
|
helper.deleteFolder(folderId1);
|
||||||
}
|
}
|
||||||
@@ -172,10 +173,10 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
String filter;
|
String filter;
|
||||||
filter = "*";
|
filter = "*";
|
||||||
propertiesResponse = helper.getObjectProperties(documentId, filter);
|
propertiesResponse = helper.getObjectProperties(documentId, filter);
|
||||||
assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_NAME));
|
assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_NAME));
|
||||||
assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_CONTENT_STREAM_FILENAME));
|
assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME));
|
||||||
assertNotNull(getPropertyValue(propertiesResponse, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE));
|
assertNotNull(getPropertyValue(propertiesResponse, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE));
|
||||||
assertTrue(getPropertyBooleanValue(propertiesResponse, CMISMapping.PROP_IS_LATEST_VERSION));
|
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
|
// 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.
|
// arbitrary number of spaces are allowed before or after each comma.
|
||||||
@@ -198,21 +199,21 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
helper.checkOut(documentIdHolder, contentCopied);
|
helper.checkOut(documentIdHolder, contentCopied);
|
||||||
// new version of doc
|
// new version of doc
|
||||||
response = helper.getObjectProperties(documentIdHolder.value);
|
response = helper.getObjectProperties(documentIdHolder.value);
|
||||||
assertNotNull(getPropertyValue(response, CMISMapping.PROP_NAME));
|
assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_NAME));
|
||||||
assertNotNull(getPropertyValue(response, CMISMapping.PROP_CONTENT_STREAM_FILENAME));
|
assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME));
|
||||||
assertNotNull(getPropertyValue(response, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE));
|
assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE));
|
||||||
assertTrue(getPropertyBooleanValue(response, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT));
|
assertTrue(getPropertyBooleanValue(response, CMISDictionaryModel.PROP_IS_VERSION_SERIES_CHECKED_OUT));
|
||||||
assertNotNull(getPropertyValue(response, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY));
|
assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_VERSION_SERIES_CHECKED_OUT_BY));
|
||||||
|
|
||||||
helper.checkIn(documentIdHolder, checkinComment, true);
|
helper.checkIn(documentIdHolder, checkinComment, true);
|
||||||
|
|
||||||
response = helper.getObjectProperties(documentId);
|
response = helper.getObjectProperties(documentId);
|
||||||
assertNotNull(getPropertyValue(response, CMISMapping.PROP_NAME));
|
assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_NAME));
|
||||||
assertNotNull(getPropertyValue(response, CMISMapping.PROP_CONTENT_STREAM_FILENAME));
|
assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_CONTENT_STREAM_FILENAME));
|
||||||
assertNotNull(getPropertyValue(response, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE));
|
assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE));
|
||||||
assertTrue(getPropertyBooleanValue(response, CMISMapping.PROP_IS_LATEST_VERSION));
|
assertTrue(getPropertyBooleanValue(response, CMISDictionaryModel.PROP_IS_LATEST_VERSION));
|
||||||
assertTrue(getPropertyBooleanValue(response, CMISMapping.PROP_IS_LATEST_MAJOR_VERSION));
|
assertTrue(getPropertyBooleanValue(response, CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION));
|
||||||
assertTrue(getPropertyBooleanValue(response, CMISMapping.PROP_IS_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.
|
// Returns the list of all document versions for the specified version series, sorted by CREATION_DATE descending.
|
||||||
GetAllVersionsResponse responseVersions = helper.getAllVersions(documentId);
|
GetAllVersionsResponse responseVersions = helper.getAllVersions(documentId);
|
||||||
@@ -220,9 +221,9 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
// Last version
|
// Last version
|
||||||
|
|
||||||
assertEquals(3, responseVersions.getObject().size());
|
assertEquals(3, responseVersions.getObject().size());
|
||||||
assertTrue("Initial version was not returned", isExistItemWithProperty(responseVersions.getObject(), CMISMapping.PROP_VERSION_LABEL, "1.0"));
|
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(), CMISMapping.PROP_IS_LATEST_VERSION));
|
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(), CMISMapping.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
|
// 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();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
|
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setPropertyType(EnumPropertyType.STRING);
|
cmisProperty.setPropertyType(EnumPropertyType.STRING);
|
||||||
cmisProperty.setIndex(BigInteger.valueOf(1));
|
cmisProperty.setIndex(BigInteger.valueOf(1));
|
||||||
cmisProperty.setValue("Cmis Test Policy");
|
cmisProperty.setValue("Cmis Test Policy");
|
||||||
@@ -544,11 +545,11 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
CmisObjectType objectType = response.getObject();
|
CmisObjectType objectType = response.getObject();
|
||||||
|
|
||||||
assertNotNull(objectType);
|
assertNotNull(objectType);
|
||||||
assertNotNull(getPropertyValue(response, CMISMapping.PROP_NAME));
|
assertNotNull(getPropertyValue(response, CMISDictionaryModel.PROP_NAME));
|
||||||
|
|
||||||
GetObjectParentsResponse parentsResponse = helper.getObjectParents(documentId, "*");
|
GetObjectParentsResponse parentsResponse = helper.getObjectParents(documentId, "*");
|
||||||
assertTrue(parentsResponse.getObject().size() == 1);
|
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
|
// Alfresco create new version of document
|
||||||
propertiesResponse = helper.getObjectProperties(documentIdHolder.value);
|
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);
|
GetAllVersionsResponse responseVersions = helper.getAllVersions(documentId);
|
||||||
assertTrue("new version of document should be created", responseVersions.getObject().size() > 1);
|
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
|
// now we can not set any property (beside name) when we create new document - so this case not working
|
||||||
propertiesResponse = helper.getObjectProperties(documentId);
|
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)
|
if (contentStreamAllowed != null && contentStreamAllowed == false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -675,7 +676,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
CmisPropertiesType properties = new CmisPropertiesType();
|
CmisPropertiesType properties = new CmisPropertiesType();
|
||||||
List<CmisProperty> propertiesList = properties.getProperty();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_NAME);
|
cmisProperty.setName(CMISDictionaryModel.PROP_NAME);
|
||||||
cmisProperty.setValue(newName);
|
cmisProperty.setValue(newName);
|
||||||
propertiesList.add(cmisProperty);
|
propertiesList.add(cmisProperty);
|
||||||
|
|
||||||
@@ -695,7 +696,7 @@ public class DMObjectServiceTest extends AbstractServiceTest
|
|||||||
properties = new CmisPropertiesType();
|
properties = new CmisPropertiesType();
|
||||||
List<CmisProperty> propertiesList = properties.getProperty();
|
List<CmisProperty> propertiesList = properties.getProperty();
|
||||||
CmisPropertyString cmisProperty = new CmisPropertyString();
|
CmisPropertyString cmisProperty = new CmisPropertyString();
|
||||||
cmisProperty.setName(CMISMapping.PROP_OBJECT_ID);
|
cmisProperty.setName(CMISDictionaryModel.PROP_OBJECT_ID);
|
||||||
cmisProperty.setValue("new id value");
|
cmisProperty.setValue("new id value");
|
||||||
propertiesList.add(cmisProperty);
|
propertiesList.add(cmisProperty);
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ package org.alfresco.repo.cmis.ws;
|
|||||||
import javax.activation.DataHandler;
|
import javax.activation.DataHandler;
|
||||||
import javax.xml.ws.Holder;
|
import javax.xml.ws.Holder;
|
||||||
|
|
||||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
|
|
||||||
public class DMVersioningServiceTest extends AbstractServiceTest
|
public class DMVersioningServiceTest extends AbstractServiceTest
|
||||||
@@ -81,7 +81,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
|
|||||||
String checkinComment = "Test checkin" + System.currentTimeMillis();
|
String checkinComment = "Test checkin" + System.currentTimeMillis();
|
||||||
((VersioningServicePort) servicePort).checkIn(repositoryId, documentIdHolder, Boolean.TRUE, properties, contentStream, checkinComment);
|
((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
|
public void testCheckOutCheckInDefault() throws Exception
|
||||||
@@ -108,7 +108,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
|
|||||||
|
|
||||||
// Cancel check out
|
// Cancel check out
|
||||||
((VersioningServicePort) servicePort).cancelCheckOut(repositoryId, documentIdHolder.value);
|
((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
|
public void testCheckinNoExistsCheckOut() throws Exception
|
||||||
@@ -159,7 +159,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
|
|||||||
assertNotNull(response.getObject());
|
assertNotNull(response.getObject());
|
||||||
CmisObjectType objectType = response.getObject();
|
CmisObjectType objectType = response.getObject();
|
||||||
assertNotNull(objectType.getProperties());
|
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
|
public void testGetPropertiesOfLatestVersionDefault() throws Exception
|
||||||
@@ -172,7 +172,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
|
|||||||
assertNotNull(response.getObject());
|
assertNotNull(response.getObject());
|
||||||
CmisObjectType objectType = response.getObject();
|
CmisObjectType objectType = response.getObject();
|
||||||
assertNotNull(objectType.getProperties());
|
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
|
public void testGetAllVersionsDefault() throws Exception
|
||||||
@@ -192,7 +192,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
|
|||||||
GetAllVersionsResponse response = ((VersioningServicePort) servicePort).getAllVersions(request);
|
GetAllVersionsResponse response = ((VersioningServicePort) servicePort).getAllVersions(request);
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertNotNull(response.getObject());
|
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
|
public void testGetAllVersions() throws Exception
|
||||||
@@ -215,7 +215,7 @@ public class DMVersioningServiceTest extends AbstractServiceTest
|
|||||||
GetAllVersionsResponse response = ((VersioningServicePort) servicePort).getAllVersions(request);
|
GetAllVersionsResponse response = ((VersioningServicePort) servicePort).getAllVersions(request);
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertNotNull(response.getObject());
|
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
|
public void testGetAllVersionsForNoVersionHistory() throws Exception
|
||||||
@@ -256,11 +256,11 @@ public class DMVersioningServiceTest extends AbstractServiceTest
|
|||||||
{
|
{
|
||||||
if (!checkedOutfound)
|
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)
|
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);
|
assertTrue("No checked out version found", checkedOutfound);
|
||||||
|
@@ -28,7 +28,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||||
|
|
||||||
public class MultiThreadsServiceTest extends AbstractServiceTest
|
public class MultiThreadsServiceTest extends AbstractServiceTest
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ public class MultiThreadsServiceTest extends AbstractServiceTest
|
|||||||
|
|
||||||
GetPropertiesResponse propertiesResponse;
|
GetPropertiesResponse propertiesResponse;
|
||||||
propertiesResponse = helper.getObjectProperties(documentId);
|
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
|
try
|
||||||
{
|
{
|
||||||
String newName = "New Name" + System.currentTimeMillis() + generator.nextDouble();
|
String newName = "New Name" + System.currentTimeMillis() + generator.nextDouble();
|
||||||
helper.updateProperty(documentId, CMISMapping.PROP_NAME, newName);
|
helper.updateProperty(documentId, CMISDictionaryModel.PROP_NAME, newName);
|
||||||
lastName = newName;
|
lastName = newName;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
Reference in New Issue
Block a user