Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

75520: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (5.0/Cloud)
      75206: Merged DEV to V4.2-BUG-FIX (4.2.3)
         74383 : MNT-11726 : CMIS change log isn't returning valid cmis:objectId values for deleted objects
            - Use context safe objectId generation in CMISChangeLogDataExtractor. Test for the fix
         74484 : MNT-11726 : CMIS change log isn't returning valid cmis:objectId values for deleted objects
            - Test implemented in CMISTest
            - Changed CMISConnector.isFolder(NodeRef) logic. Can cause NPE if NodeRef is not FOLDER or FILE
         75113 : MNT-11726 : CMIS change log isn't returning valid cmis:objectId values for deleted objects
            - alfresco-audit-cmis.xml moved to Repository project


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77482 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-22 12:52:57 +00:00
parent 238a2a02c1
commit 27e2d25a8b
5 changed files with 207 additions and 18 deletions

View File

@@ -1170,9 +1170,14 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
* be the assocRef guid.
*/
public String constructObjectId(AssociationRef assocRef, String versionLabel)
{
return constructObjectId(assocRef, versionLabel, isPublicApi());
}
public String constructObjectId(AssociationRef assocRef, String versionLabel, boolean dropStoreRef)
{
StringBuilder sb = new StringBuilder(CMISConnector.ASSOC_ID_PREFIX);
if(isPublicApi())
if(dropStoreRef)
{
// always return the guid
sb.append(assocRef.getId());
@@ -1204,9 +1209,14 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
* be the node guid.
*/
public String constructObjectId(String incomingNodeId, String versionLabel)
{
return constructObjectId(incomingNodeId, versionLabel, isPublicApi());
}
public String constructObjectId(String incomingNodeId, String versionLabel, boolean dropStoreRef)
{
StringBuilder sb = new StringBuilder();
if(isPublicApi())
if(dropStoreRef)
{
// always return the guid
sb.append(getGuid(incomingNodeId));
@@ -1264,9 +1274,14 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
* be the incomingNodeRef guid.
*/
public String constructObjectId(NodeRef incomingNodeRef, String versionLabel)
{
return constructObjectId(incomingNodeRef, versionLabel, isPublicApi());
}
public String constructObjectId(NodeRef incomingNodeRef, String versionLabel, boolean dropStoreRef)
{
StringBuilder sb = new StringBuilder();
sb.append(isPublicApi() ? incomingNodeRef.getId() : incomingNodeRef.toString());
sb.append(dropStoreRef ? incomingNodeRef.getId() : incomingNodeRef.toString());
if(versionLabel != null)
{
sb.append(CMISConnector.ID_SEPERATOR);
@@ -1278,29 +1293,39 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
/**
* Compiles a CMIS object if for a live node.
*/
public String createObjectId(NodeRef currentVersionNodeRef)
public String createObjectId(NodeRef nodeRef)
{
QName typeQName = nodeService.getType(currentVersionNodeRef);
return createObjectId(nodeRef, isPublicApi());
}
public String createObjectId(NodeRef nodeRef, boolean dropStoreRef)
{
QName typeQName = nodeService.getType(nodeRef);
TypeDefinitionWrapper type = getOpenCMISDictionaryService().findNodeType(typeQName);
if(type instanceof ItemTypeDefinitionWrapper)
{
return constructObjectId(currentVersionNodeRef, null);
return constructObjectId(nodeRef, null);
}
if(type instanceof FolderTypeDefintionWrapper)
{
return constructObjectId(currentVersionNodeRef, null);
return constructObjectId(nodeRef, null, dropStoreRef);
}
Serializable versionLabel = getNodeService()
.getProperty(currentVersionNodeRef, ContentModel.PROP_VERSION_LABEL);
.getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL);
if (versionLabel == null)
{
versionLabel = CMISConnector.UNVERSIONED_VERSION_LABEL;
}
return constructObjectId(currentVersionNodeRef, (String)versionLabel);
return constructObjectId(nodeRef, (String)versionLabel, dropStoreRef);
}
private boolean isFolder(NodeRef nodeRef)
{
return getType(nodeRef) instanceof FolderTypeDefintionWrapper;
}
/**