From 3a3b743f1806907cdc5ab008ea2e980f1a292811 Mon Sep 17 00:00:00 2001 From: David Caruana Date: Wed, 10 Nov 2010 10:38:35 +0000 Subject: [PATCH] Merged BRANCHES/V3.4 to HEAD: 23345: Merged BRANCHES/DEV/DC33E to BRANCHES/V3.4: 23305: Resolve ALF-5324: SDK is missing alfresco-share-3.4.a.jar 23306: Resolve ALF-5321: Jar generated in SDK example "CustomAspect" is not correct. 23307: Resolve ALF-5294: Internal Target throws an exception when try to edit it 23308: Resolve ALF-5332: Exception in SDK CustomAspect 23309: Resolve ALF-5162: CMIS Web Services: getTypeDescendants() returns a flat list, not a tree 23326: Resolve ALF-5039: Change events for documents creation are not returned 23356: Fix to continuous.xml 23482: Resolve ALF-5438: Required flag is wrong for most CMIS spec defined property definitions 23488: Resolve ALF-5439: Updatability of cmis:contentStreamFileName must be read-only 23501: Resolve ALF-5440: Some property definitions don't have descriptions 23502: Resolve ALF-5534: Subtypes of F:cm:systemfolder should not be creatable CMIS fixes for cmis.alfresco.com. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@23532 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/model/cmisModel.xml | 32 +++++++++---------- .../changelog/CMISChangeLogDataExtractor.java | 14 ++++++-- .../CMISAbstractTypeDefinition.java | 2 +- .../CMISBasePropertyDefinition.java | 2 +- .../CMISDocumentTypeDefinition.java | 2 +- .../dictionary/CMISFolderTypeDefinition.java | 7 ++-- .../dictionary/CMISObjectTypeDefinition.java | 2 +- .../dictionary/CMISPolicyTypeDefinition.java | 2 +- .../CMISRelationshipTypeDefinition.java | 4 +-- .../CMISStrictDictionaryService.java | 4 ++- .../repo/transfer/TransferServiceImpl2.java | 4 +-- 11 files changed, 43 insertions(+), 32 deletions(-) diff --git a/config/alfresco/model/cmisModel.xml b/config/alfresco/model/cmisModel.xml index 60aa71916d..7a728d01bd 100644 --- a/config/alfresco/model/cmisModel.xml +++ b/config/alfresco/model/cmisModel.xml @@ -54,7 +54,7 @@ The unique object id (a node ref) cmis:id true - true + false false false @@ -65,7 +65,7 @@ Id of the object’s type cmis:id true - true + false false false @@ -76,7 +76,7 @@ Id of the base object type for the object cmis:id true - true + false false true @@ -87,7 +87,7 @@ The authority who created this object d:text true - true + false false false @@ -98,7 +98,7 @@ The object creation date d:datetime true - true + false false false @@ -109,7 +109,7 @@ The authority who last modified this object d:text true - true + false false false @@ -120,7 +120,7 @@ The date this object was last modified d:datetime true - true + false false false @@ -131,7 +131,7 @@ Change Token d:text true - true + false false @@ -147,7 +147,7 @@ Name d:text false - true + false false both @@ -175,7 +175,7 @@ Is this the latest version of the document? d:boolean true - true + false false @@ -202,7 +202,7 @@ The version label d:text true - true + false false @@ -211,7 +211,7 @@ The version series id cmis:id true - true + false false @@ -220,7 +220,7 @@ Is the version series checked out? d:boolean true - true + false false @@ -277,7 +277,7 @@ Content Stream Filename The content stream filename d:text - false + true false false @@ -306,7 +306,7 @@ The parent id of the folder cmis:id true - true + false false false @@ -317,7 +317,7 @@ The fully qualified path to this folder/description d:text true - true + false false diff --git a/source/java/org/alfresco/cmis/changelog/CMISChangeLogDataExtractor.java b/source/java/org/alfresco/cmis/changelog/CMISChangeLogDataExtractor.java index 983f7b0d31..fbd3a17acc 100644 --- a/source/java/org/alfresco/cmis/changelog/CMISChangeLogDataExtractor.java +++ b/source/java/org/alfresco/cmis/changelog/CMISChangeLogDataExtractor.java @@ -24,9 +24,11 @@ import java.util.HashMap; import org.alfresco.cmis.CMISDictionaryModel; import org.alfresco.cmis.CMISInvalidArgumentException; import org.alfresco.cmis.CMISServices; +import org.alfresco.cmis.CMISTypeDefinition; import org.alfresco.cmis.CMISTypeId; import org.alfresco.repo.audit.extractor.AbstractDataExtractor; import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -70,8 +72,12 @@ public class CMISChangeLogDataExtractor extends AbstractDataExtractor { try { - CMISTypeId typeId = cmisService.getTypeDefinition(nodeRef).getBaseType().getTypeId(); - return typeId.equals(CMISDictionaryModel.DOCUMENT_TYPE_ID) || typeId.equals(CMISDictionaryModel.FOLDER_TYPE_ID); + CMISTypeDefinition typeDef = cmisService.getTypeDefinition(nodeRef); + if (typeDef != null) + { + CMISTypeId typeId = typeDef.getBaseType().getTypeId(); + return typeId.equals(CMISDictionaryModel.DOCUMENT_TYPE_ID) || typeId.equals(CMISDictionaryModel.FOLDER_TYPE_ID); + } } catch (CMISInvalidArgumentException e) { @@ -91,6 +97,10 @@ public class CMISChangeLogDataExtractor extends AbstractDataExtractor private NodeRef getNodeRef(Serializable data) { NodeRef nodeRef = null; + if (data instanceof ChildAssociationRef) + { + nodeRef = ((ChildAssociationRef) data).getChildRef(); + } if (data instanceof FileInfo) { nodeRef = ((FileInfo) data).getNodeRef(); diff --git a/source/java/org/alfresco/cmis/dictionary/CMISAbstractTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISAbstractTypeDefinition.java index 147b51880d..14484b2612 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISAbstractTypeDefinition.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISAbstractTypeDefinition.java @@ -91,7 +91,7 @@ public abstract class CMISAbstractTypeDefinition implements CMISTypeDefinition, //if (parentTypeId == null) throw new IllegalStateException("parentTypeId not specified; objectTypeId=" + objectTypeId); if (parentTypeId != null && internalParentType == null) throw new IllegalStateException("parentType not specified; objectTypeId=" + objectTypeId + ",parentTypeId=" + parentTypeId); if (rootType == null) throw new IllegalStateException("rootType not specified; objectTypeId=" + objectTypeId); - //if (description == null) throw new IllegalStateException("description not specified; objectTypeId=" + objectTypeId); + if (description == null) throw new IllegalStateException("description not specified; objectTypeId=" + objectTypeId); if (creatable == null) throw new IllegalStateException("creatable not specified; objectTypeId=" + objectTypeId); if (queryable == null) throw new IllegalStateException("queryable not specified; objectTypeId=" + objectTypeId); if (fullTextIndexed == null) throw new IllegalStateException("fullTextIndexed not specified; objectTypeId=" + objectTypeId); diff --git a/source/java/org/alfresco/cmis/dictionary/CMISBasePropertyDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISBasePropertyDefinition.java index a1fa8f0e78..dc080973a4 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISBasePropertyDefinition.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISBasePropertyDefinition.java @@ -111,7 +111,7 @@ public class CMISBasePropertyDefinition implements CMISPropertyDefinition, Seria this.typeDef = typeDef; queryName = cmisMapping.buildPrefixEncodedString(propertyId.getQName()); displayName = (propDef.getTitle() != null) ? propDef.getTitle() : propertyId.getId(); - description = propDef.getDescription(); + description = propDef.getDescription() != null ? propDef.getDescription() : displayName; propertyType = cmisMapping.getDataType(propDef.getDataType()); cardinality = propDef.isMultiValued() ? CMISCardinalityEnum.MULTI_VALUED : CMISCardinalityEnum.SINGLE_VALUED; for (ConstraintDefinition constraintDef : propDef.getConstraints()) diff --git a/source/java/org/alfresco/cmis/dictionary/CMISDocumentTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISDocumentTypeDefinition.java index f9191c2fab..bce1e97282 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISDocumentTypeDefinition.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISDocumentTypeDefinition.java @@ -56,7 +56,7 @@ public class CMISDocumentTypeDefinition extends CMISAbstractTypeDefinition this.cmisClassDef = cmisClassDef; objectTypeId = typeId; displayName = (cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId.getId(); - description = cmisClassDef.getDescription(); + description = cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : displayName; QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName()); if (typeId == CMISDictionaryModel.DOCUMENT_TYPE_ID) diff --git a/source/java/org/alfresco/cmis/dictionary/CMISFolderTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISFolderTypeDefinition.java index e09000d546..57f3964de1 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISFolderTypeDefinition.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISFolderTypeDefinition.java @@ -42,7 +42,7 @@ public class CMISFolderTypeDefinition extends CMISAbstractTypeDefinition * @param typeId * @param cmisClassDef */ - public CMISFolderTypeDefinition(CMISMapping cmisMapping, CMISTypeId typeId, ClassDefinition cmisClassDef) + public CMISFolderTypeDefinition(CMISMapping cmisMapping, CMISTypeId typeId, ClassDefinition cmisClassDef, boolean isSystem) { isPublic = true; @@ -50,7 +50,7 @@ public class CMISFolderTypeDefinition extends CMISAbstractTypeDefinition this.cmisClassDef = cmisClassDef; objectTypeId = typeId; displayName = (cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId.getId(); - description = cmisClassDef.getDescription(); + description = cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : displayName; QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName()); if (typeId == CMISDictionaryModel.FOLDER_TYPE_ID) @@ -73,8 +73,7 @@ public class CMISFolderTypeDefinition extends CMISAbstractTypeDefinition actionEvaluators = cmisMapping.getActionEvaluators(objectTypeId.getScope()); // TODO: introduce abstract into core alfresco content metamodel - // NOTE: system folder cannot be created via FolderFileService - creatable = (typeId.getQName().equals(ContentModel.TYPE_SYSTEM_FOLDER) ? false : true); + creatable = !isSystem; queryable = true; fullTextIndexed = true; controllablePolicy = false; diff --git a/source/java/org/alfresco/cmis/dictionary/CMISObjectTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISObjectTypeDefinition.java index 1ab2342a55..0fe32d040d 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISObjectTypeDefinition.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISObjectTypeDefinition.java @@ -58,7 +58,7 @@ public class CMISObjectTypeDefinition extends CMISAbstractTypeDefinition { this.cmisClassDef = cmisClassDef; displayName = (cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId.getId(); - description = cmisClassDef.getDescription(); + description = cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : displayName; QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName()); if (parentQName != null) { diff --git a/source/java/org/alfresco/cmis/dictionary/CMISPolicyTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISPolicyTypeDefinition.java index 8ba96fe8b6..12dd170896 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISPolicyTypeDefinition.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISPolicyTypeDefinition.java @@ -71,7 +71,7 @@ public class CMISPolicyTypeDefinition extends CMISAbstractTypeDefinition objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName()); parentTypeId = CMISDictionaryModel.POLICY_TYPE_ID; } - description = cmisClassDef.getDescription(); + description = cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : displayName; actionEvaluators = cmisMapping.getActionEvaluators(objectTypeId.getScope()); diff --git a/source/java/org/alfresco/cmis/dictionary/CMISRelationshipTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISRelationshipTypeDefinition.java index 3d5088c584..c38eb13883 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISRelationshipTypeDefinition.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISRelationshipTypeDefinition.java @@ -89,7 +89,7 @@ public class CMISRelationshipTypeDefinition extends CMISAbstractTypeDefinition { parentTypeId = cmisMapping.getCmisTypeId(CMISScope.OBJECT, parentQName); } - description = cmisClassDef.getDescription(); + description = cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : displayName; } else { @@ -97,7 +97,7 @@ public class CMISRelationshipTypeDefinition extends CMISAbstractTypeDefinition displayName = (assocDef.getTitle() != null) ? assocDef.getTitle() : typeId.getId(); objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName()); parentTypeId = CMISDictionaryModel.RELATIONSHIP_TYPE_ID; - description = assocDef.getDescription(); + description = assocDef.getDescription() != null ? assocDef.getDescription() : displayName; CMISTypeId sourceTypeId = cmisMapping.getCmisTypeId(cmisMapping.getCmisType(assocDef.getSourceClass().getName())); if (sourceTypeId != null) diff --git a/source/java/org/alfresco/cmis/dictionary/CMISStrictDictionaryService.java b/source/java/org/alfresco/cmis/dictionary/CMISStrictDictionaryService.java index 6efe0725ac..96aca1a748 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISStrictDictionaryService.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISStrictDictionaryService.java @@ -22,6 +22,7 @@ import java.util.Collection; import org.alfresco.cmis.CMISScope; import org.alfresco.cmis.CMISTypeId; +import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.dictionary.ClassDefinition; import org.alfresco.service.namespace.QName; @@ -76,7 +77,8 @@ public class CMISStrictDictionaryService extends CMISAbstractDictionaryService } else if (typeId.getScope() == CMISScope.FOLDER) { - objectTypeDef = new CMISFolderTypeDefinition(cmisMapping, typeId, classDef); + boolean isSystem = dictionaryService.isSubClass(classDef.getName(), ContentModel.TYPE_SYSTEM_FOLDER); + objectTypeDef = new CMISFolderTypeDefinition(cmisMapping, typeId, classDef, isSystem); } else if (typeId.getScope() == CMISScope.RELATIONSHIP) { diff --git a/source/java/org/alfresco/repo/transfer/TransferServiceImpl2.java b/source/java/org/alfresco/repo/transfer/TransferServiceImpl2.java index eaf26632da..903ad07e2b 100644 --- a/source/java/org/alfresco/repo/transfer/TransferServiceImpl2.java +++ b/source/java/org/alfresco/repo/transfer/TransferServiceImpl2.java @@ -220,7 +220,7 @@ public class TransferServiceImpl2 implements TransferService2 properties.put(TransferModel.PROP_ENDPOINT_PROTOCOL, newTarget.getEndpointProtocol()); properties.put(TransferModel.PROP_ENDPOINT_PATH, newTarget.getEndpointPath()); properties.put(TransferModel.PROP_USERNAME, newTarget.getUsername()); - properties.put(TransferModel.PROP_PASSWORD, encrypt(newTarget.getPassword())); + properties.put(TransferModel.PROP_PASSWORD, new String(encrypt(newTarget.getPassword()))); // titled aspect properties.put(ContentModel.PROP_TITLE, newTarget.getTitle()); @@ -389,7 +389,7 @@ public class TransferServiceImpl2 implements TransferService2 properties.put(TransferModel.PROP_ENDPOINT_PROTOCOL, update.getEndpointProtocol()); properties.put(TransferModel.PROP_ENDPOINT_PATH, update.getEndpointPath()); properties.put(TransferModel.PROP_USERNAME, update.getUsername()); - properties.put(TransferModel.PROP_PASSWORD, encrypt(update.getPassword())); + properties.put(TransferModel.PROP_PASSWORD, new String(encrypt(update.getPassword()))); // titled aspect properties.put(ContentModel.PROP_TITLE, update.getTitle());