Merged DEV/SWIFT to HEAD

26012: OpenCMIS server bug fixes: PWC properties update and document version delete
   26205: - integrated the CMIS Client API project into the build
          - made the local CMIS client use the Alfresco OpenCMIS Extension
          - updated OpenCMIS
   26300: expose all non-child associations through OpenCMIS and check relationship source and target instead of the relationship type
   26356: OpenCMIS update
   26378: added more CMIS client examples
   26380: added helper methods for CMIS client
   26500: - fixed CMIS date aspect property encoding 
          - fixed CMIS rendition filter handling
   26519: OpenCMIS update
   26523: fixed CMISConnectionManager
   26596: renamed CMIS JavaScript root objects (cmis -> cmisserver, cmisclient -> cmis)
   26651: removed the cmis-client-api project and replaced it with a jar in 3rd-party
   26652: - corrected CMIS samples
   26656: - removed cmis-client-api from build
   26658: - removed the last bit of cmis-client-api
   26663: - added CMIS samples (browser and upload)
   26742: CMIS webscripts samples update
   26743: CMIS webscripts samples update
   26939: removed duplicate commons-fileupload
   26942: updated commons-lang to 2.6
   26943: updated OpenCMIS (browser binding is now included in the server framework)
   26953: refactored OpenCMIS client integration
   26974: Update classpath for Florian - OpenCMIS browser bindings are now rolled into the main jar, no need for their own one
   26975: removed outdated CMIS browser binding demo page
   27048: port of the Spring Surf CMIS browser plus a few new features (create folder, create document, delete object)
   27077: bug fix: CMIS id for associations
   27079: OpenCMIS update
   27085: added check if CMIS is supported
   27086: OpenCMIS client bindings update (force JAX-WS RI)
   27138: clean up
   27764: CMIS default connection handling
   27879: OpenCMIS client: moved server definitions to separate config file
   27880: OpenCMIS client: removed test repositories from configuration
   27918: changed CMIS server configuration tag name to match Spring Surf configuration
   27920: enabled relationships in CMIS browser
   27924: Updated Spring Surf and added the Spring Surf CMIS framework
          [Merge note: Kept most recent HEAD jars where conflicts occured]
   27926: Updated Spring Surf source jars
          [Merge note: Kept most recent HEAD jars where conflicts occured]

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28219 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-06-06 19:49:42 +00:00
parent 25632c2a96
commit 1387dcaf2a
6 changed files with 75 additions and 51 deletions

View File

@@ -1415,7 +1415,8 @@ public class AlfrescoCmisService extends AbstractCmisService
{ {
if (connector.getNodeService().getChildAssocs(nodeRef).size() > 0) if (connector.getNodeService().getChildAssocs(nodeRef).size() > 0)
{ {
throw new CmisConstraintException("Could not delete folder with at least one Child"); throw new CmisConstraintException(
"Could not delete folder with at least one child!");
} }
connector.getNodeService().deleteNode(nodeRef); connector.getNodeService().deleteNode(nodeRef);
@@ -1437,6 +1438,11 @@ public class AlfrescoCmisService extends AbstractCmisService
return true; return true;
} }
if (variant == ObjectVariantEnum.VERSION)
{
nodeRef = connector.getNodeRef(connector.getCurrentVersionId(objectId));
}
// remove not primary parent associations // remove not primary parent associations
List<ChildAssociationRef> childAssociations = connector.getNodeService().getParentAssocs( List<ChildAssociationRef> childAssociations = connector.getNodeService().getParentAssocs(
nodeRef); nodeRef);

View File

@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.HashMap; import java.util.HashMap;
@@ -33,6 +34,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.TimeZone;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@@ -1554,6 +1556,13 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
private String convertAspectPropertyValue(Object value) private String convertAspectPropertyValue(Object value)
{ {
if (value instanceof Date)
{
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.setTime((Date) value);
value = cal;
}
if (value instanceof GregorianCalendar) if (value instanceof GregorianCalendar)
{ {
DatatypeFactory df; DatatypeFactory df;
@@ -1759,11 +1768,13 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
for (AssociationRef assocRef : assocs) for (AssociationRef assocRef : assocs)
{ {
TypeDefinitionWrapper assocTypeDef = cmisDictionaryService.findAssocType(assocRef.getTypeQName()); TypeDefinitionWrapper assocTypeDef = cmisDictionaryService.findAssocType(assocRef.getTypeQName());
if (assocTypeDef != null) if (assocTypeDef == null || getType(assocRef.getSourceRef()) == null
|| getType(assocRef.getTargetRef()) == null)
{ {
result.add(createCMISObject(assocRef, null, false, IncludeRelationships.NONE, RENDITION_NONE, false, continue;
false));
} }
result.add(createCMISObject(assocRef, null, false, IncludeRelationships.NONE, RENDITION_NONE, false, false));
} }
return result; return result;
@@ -1807,31 +1818,34 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
for (AssociationRef assocRef : assocs) for (AssociationRef assocRef : assocs)
{ {
TypeDefinitionWrapper assocTypeDef = cmisDictionaryService.findAssocType(assocRef.getTypeQName()); TypeDefinitionWrapper assocTypeDef = cmisDictionaryService.findAssocType(assocRef.getTypeQName());
if (assocTypeDef != null) if (assocTypeDef == null || getType(assocRef.getSourceRef()) == null
|| getType(assocRef.getTargetRef()) == null)
{ {
if ((typeId != null) && !assocRef.getId().equals(typeId)) continue;
{ }
continue;
}
counter++; if ((typeId != null) && !assocRef.getId().equals(typeId))
{
continue;
}
if (skip > 0) counter++;
{
skip--;
continue;
}
max--; if (skip > 0)
if (max > 0) {
{ skip--;
result.getObjects().add( continue;
createCMISObject(assocRef, filter, includeAllowableActions, IncludeRelationships.NONE, }
RENDITION_NONE, false, false));
} else max--;
{ if (max > 0)
hasMore = true; {
} result.getObjects().add(
createCMISObject(assocRef, filter, includeAllowableActions, IncludeRelationships.NONE,
RENDITION_NONE, false, false));
} else
{
hasMore = true;
} }
} }
} }
@@ -2458,8 +2472,10 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
throw new CmisInvalidArgumentException("Property " + property.getId() + " is unknown!"); throw new CmisInvalidArgumentException("Property " + property.getId() + " is unknown!");
} }
if ((propDef.getPropertyDefinition().getUpdatability() == Updatability.READONLY) Updatability updatability = propDef.getPropertyDefinition().getUpdatability();
|| (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))) if ((updatability == Updatability.READONLY)
|| (updatability == Updatability.WHENCHECKEDOUT && !nodeService.hasAspect(nodeRef,
ContentModel.ASPECT_WORKING_COPY)))
{ {
throw new CmisInvalidArgumentException("Property " + property.getId() + " is read-only!"); throw new CmisInvalidArgumentException("Property " + property.getId() + " is read-only!");
} }

View File

@@ -165,7 +165,7 @@ public class CMISRenditionMapping
} }
ContentReader reader = contentService.getReader(rendNodeRef, contentProperty); ContentReader reader = contentService.getReader(rendNodeRef, contentProperty);
if ((reader == null) || (reader.exists())) if ((reader == null) || (!reader.exists()))
{ {
// no content -> no rendition // no content -> no rendition
continue; continue;
@@ -188,7 +188,7 @@ public class CMISRenditionMapping
{ {
// found a kind, not a MIME type // found a kind, not a MIME type
List<String> renditionNames = kindToRenditionNames.get(f); List<String> renditionNames = kindToRenditionNames.get(f);
if (renditionNames.contains(rendName)) if (renditionNames != null && renditionNames.contains(rendName))
{ {
include = true; include = true;
break; break;
@@ -239,6 +239,11 @@ public class CMISRenditionMapping
} }
} }
if (filterSet == null || filterSet.contains("cmis:thumbnail"))
{
}
return result; return result;
} }

View File

@@ -20,6 +20,7 @@ package org.alfresco.opencmis.dictionary;
import java.util.Collection; import java.util.Collection;
import org.alfresco.cmis.mapping.CMISMapping;
import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.dictionary.ClassDefinition; import org.alfresco.service.cmr.dictionary.ClassDefinition;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -71,10 +72,6 @@ public class CMISStrictDictionaryService extends CMISAbstractDictionaryService
{ {
typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_FOLDER, classQName); typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_FOLDER, classQName);
objectTypeDef = new FolderTypeDefintionWrapper(cmisMapping, serviceRegistry, typeId, classDef); objectTypeDef = new FolderTypeDefintionWrapper(cmisMapping, serviceRegistry, typeId, classDef);
} else if (cmisMapping.isValidCmisRelationship(classQName))
{
typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_RELATIONSHIP, classQName);
objectTypeDef = new RelationshipTypeDefintionWrapper(cmisMapping, serviceRegistry, typeId, classDef);
} else if (cmisMapping.isValidCmisPolicy(classQName)) } else if (cmisMapping.isValidCmisPolicy(classQName))
{ {
typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_POLICY, classQName); typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_POLICY, classQName);
@@ -96,6 +93,14 @@ public class CMISStrictDictionaryService extends CMISAbstractDictionaryService
*/ */
private void createAssocDefs(DictionaryRegistry registry, Collection<QName> classQNames) private void createAssocDefs(DictionaryRegistry registry, Collection<QName> classQNames)
{ {
// register base type
String typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_RELATIONSHIP, CMISMapping.RELATIONSHIP_QNAME);
RelationshipTypeDefintionWrapper objectTypeDef = new RelationshipTypeDefintionWrapper(cmisMapping,
serviceRegistry, typeId, dictionaryService.getClass(CMISMapping.RELATIONSHIP_QNAME));
registry.registerTypeDefinition(objectTypeDef);
// register all other relationships
for (QName classQName : classQNames) for (QName classQName : classQNames)
{ {
if (!cmisMapping.isValidCmisRelationship(classQName)) if (!cmisMapping.isValidCmisRelationship(classQName))
@@ -103,9 +108,8 @@ public class CMISStrictDictionaryService extends CMISAbstractDictionaryService
// create appropriate kind of type definition // create appropriate kind of type definition
AssociationDefinition assocDef = dictionaryService.getAssociation(classQName); AssociationDefinition assocDef = dictionaryService.getAssociation(classQName);
String typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_RELATIONSHIP, classQName); typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_RELATIONSHIP, classQName);
RelationshipTypeDefintionWrapper objectTypeDef = new RelationshipTypeDefintionWrapper(cmisMapping, typeId, objectTypeDef = new RelationshipTypeDefintionWrapper(cmisMapping, typeId, assocDef);
assocDef);
registry.registerTypeDefinition(objectTypeDef); registry.registerTypeDefinition(objectTypeDef);
} }

View File

@@ -642,14 +642,6 @@ public class CMISMapping implements InitializingBean
{ {
return false; return false;
} }
if (!isValidCmisDocumentOrFolder(getCmisType(associationDefinition.getSourceClass().getName())))
{
return false;
}
if (!isValidCmisDocumentOrFolder(getCmisType(associationDefinition.getTargetClass().getName())))
{
return false;
}
return true; return true;
} }

View File

@@ -21,6 +21,7 @@ package org.alfresco.opencmis.mapping;
import java.io.Serializable; import java.io.Serializable;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
/** /**
@@ -40,15 +41,15 @@ public class NodeRefProperty extends AbstractVersioningProperty
super(serviceRegistry, NodeRefPropertyId); super(serviceRegistry, NodeRefPropertyId);
} }
/* @Override
* (non-Javadoc)
*
* @see
* org.alfresco.cmis.mapping.AbstractProperty#getValue(org.alfresco.service
* .cmr.repository.NodeRef)
*/
public Serializable getValue(NodeRef nodeRef) public Serializable getValue(NodeRef nodeRef)
{ {
return getLiveNodeRef(nodeRef); return getLiveNodeRef(nodeRef);
} }
@Override
public Serializable getValue(AssociationRef assocRef)
{
return "" + assocRef.getId();
}
} }