mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged HEAD (5.1) to 5.1.N (5.1.1)
118887 jvonka: ACE-198 / ACE-202 / ACE-4734: Perf improvements for CMIS (getChildren et al)\n Merge BRANCHES/DEV/HEAD_ACE198_2 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@119389 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -140,6 +140,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
*
|
||||
* @author florian.mueller
|
||||
* @author Derek Hulley
|
||||
* @author janv
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public class AlfrescoCmisServiceImpl extends AbstractCmisService implements AlfrescoCmisService
|
||||
@@ -159,8 +161,8 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
||||
public AlfrescoCmisServiceImpl(CMISConnector connector)
|
||||
{
|
||||
this.connector = connector;
|
||||
nodeInfoMap = new HashMap<String, CMISNodeInfo>();
|
||||
objectInfoMap = new HashMap<String, ObjectInfo>();
|
||||
nodeInfoMap = new HashMap<>();
|
||||
objectInfoMap = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,12 +189,17 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
||||
|
||||
protected CMISNodeInfoImpl createNodeInfo(NodeRef nodeRef)
|
||||
{
|
||||
return createNodeInfo(nodeRef, null);
|
||||
return createNodeInfo(nodeRef, null, true);
|
||||
}
|
||||
|
||||
protected CMISNodeInfoImpl createNodeInfo(NodeRef nodeRef, VersionHistory versionHistory)
|
||||
protected CMISNodeInfoImpl createNodeInfo(NodeRef nodeRef, VersionHistory versionHistory, boolean checkExists)
|
||||
{
|
||||
CMISNodeInfoImpl result = connector.createNodeInfo(nodeRef, versionHistory);
|
||||
return createNodeInfo(nodeRef, null, null, versionHistory, checkExists);
|
||||
}
|
||||
|
||||
protected CMISNodeInfoImpl createNodeInfo(NodeRef nodeRef, QName nodeType, Map<QName,Serializable> nodeProps, VersionHistory versionHistory, boolean checkExists)
|
||||
{
|
||||
CMISNodeInfoImpl result = connector.createNodeInfo(nodeRef, nodeType, nodeProps, versionHistory, checkExists);
|
||||
nodeInfoMap.put(result.getObjectId(), result);
|
||||
|
||||
return result;
|
||||
@@ -494,20 +501,19 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
||||
}
|
||||
|
||||
// create a child CMIS object
|
||||
CMISNodeInfo ni = createNodeInfo(child.getNodeRef());
|
||||
CMISNodeInfo ni = createNodeInfo(child.getNodeRef(), child.getType(), child.getProperties(), null, false); // note: checkExists=false (don't need to check again)
|
||||
|
||||
if (getObjectInfo(repositoryId, ni.getObjectId(), includeRelationships)==null)
|
||||
// ignore invalid children
|
||||
// Skip non-cmis objects
|
||||
if (ni.getObjectVariant() == CMISObjectVariant.INVALID_ID
|
||||
|| ni.getObjectVariant() == CMISObjectVariant.NOT_EXISTING
|
||||
|| ni.getObjectVariant() == CMISObjectVariant.NOT_A_CMIS_OBJECT
|
||||
|| ni.getObjectVariant() == CMISObjectVariant.PERMISSION_DENIED)
|
||||
{
|
||||
// ignore invalid children
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CMISObjectVariant.NOT_A_CMIS_OBJECT.equals(ni.getObjectVariant()))
|
||||
{
|
||||
continue; //Skip non-cmis objects
|
||||
}
|
||||
|
||||
ObjectData object = connector.createCMISObject(ni, child, filter, includeAllowableActions,
|
||||
ObjectData object = connector.createCMISObject(ni, filter, includeAllowableActions,
|
||||
includeRelationships, renditionFilter, false, false/*, getContext().getCmisVersion()*/);
|
||||
|
||||
boolean isObjectInfoRequired = getContext().isObjectInfoRequired();
|
||||
@@ -731,7 +737,7 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
||||
|
||||
// create a child CMIS object
|
||||
ObjectInFolderDataImpl object = new ObjectInFolderDataImpl();
|
||||
CMISNodeInfo ni = createNodeInfo(child.getChildRef());
|
||||
CMISNodeInfo ni = createNodeInfo(child.getChildRef(), null, false); // note: checkExists=false (don't need to check again)
|
||||
object.setObject(connector.createCMISObject(
|
||||
ni, filter, includeAllowableActions, includeRelationships,
|
||||
renditionFilter, false, false));
|
||||
@@ -2050,10 +2056,9 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
||||
throw new CmisObjectNotFoundException("Object not found: " + path);
|
||||
}
|
||||
|
||||
CMISNodeInfo info = createNodeInfo(fileInfo.getNodeRef());
|
||||
CMISNodeInfo info = createNodeInfo(fileInfo.getNodeRef(), fileInfo.getType(), fileInfo.getProperties(), null, false);
|
||||
|
||||
object = connector.createCMISObject(
|
||||
info, fileInfo, filter, includeAllowableActions,
|
||||
object = connector.createCMISObject(info, filter, includeAllowableActions,
|
||||
includeRelationships, renditionFilter, includePolicyIds, includeAcl);
|
||||
|
||||
isObjectInfoRequired = getContext().isObjectInfoRequired();
|
||||
@@ -2357,7 +2362,7 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
||||
// convert the version history
|
||||
for (Version version : versionHistory.getAllVersions())
|
||||
{
|
||||
CMISNodeInfo versionInfo = createNodeInfo(version.getFrozenStateNodeRef(), versionHistory);
|
||||
CMISNodeInfo versionInfo = createNodeInfo(version.getFrozenStateNodeRef(), versionHistory, true); // TODO do we need to check existence ?
|
||||
// MNT-9557 fix. Replace head version with current node info
|
||||
if (versionHistory.getHeadVersion().equals(version))
|
||||
{
|
||||
@@ -2412,7 +2417,7 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(objectId).append("-").append(versionSeriesId);
|
||||
|
||||
|
||||
logGetObjectCall("getObjectOfLatestVersion", start, sb.toString(), filter, includeAllowableActions, includeRelationships,
|
||||
renditionFilter, includePolicyIds, includeAcl, isObjectInfoRequired, extension);
|
||||
|
||||
|
@@ -65,7 +65,6 @@ import org.alfresco.opencmis.dictionary.FolderTypeDefintionWrapper;
|
||||
import org.alfresco.opencmis.dictionary.ItemTypeDefinitionWrapper;
|
||||
import org.alfresco.opencmis.dictionary.PropertyDefinitionWrapper;
|
||||
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper;
|
||||
import org.alfresco.opencmis.mapping.DirectProperty;
|
||||
import org.alfresco.opencmis.search.CMISQueryOptions;
|
||||
import org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode;
|
||||
import org.alfresco.opencmis.search.CMISQueryService;
|
||||
@@ -1188,15 +1187,15 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
*/
|
||||
public CMISNodeInfoImpl createNodeInfo(NodeRef nodeRef)
|
||||
{
|
||||
return createNodeInfo(nodeRef, null);
|
||||
return createNodeInfo(nodeRef, null, null, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an object info object.
|
||||
*/
|
||||
public CMISNodeInfoImpl createNodeInfo(NodeRef nodeRef, VersionHistory versionHistory)
|
||||
public CMISNodeInfoImpl createNodeInfo(NodeRef nodeRef, QName nodeType, Map<QName,Serializable> nodeProps, VersionHistory versionHistory, boolean checkExists)
|
||||
{
|
||||
return new CMISNodeInfoImpl(this, nodeRef, versionHistory);
|
||||
return new CMISNodeInfoImpl(this, nodeRef, nodeType, nodeProps, versionHistory, checkExists);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1395,7 +1394,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
try
|
||||
{
|
||||
QName typeQName = nodeService.getType(nodeRef);
|
||||
return getType(typeQName);
|
||||
return getOpenCMISDictionaryService().findNodeType(typeQName);
|
||||
}
|
||||
catch(InvalidNodeRefException inre)
|
||||
{
|
||||
@@ -1403,11 +1402,6 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
}
|
||||
}
|
||||
|
||||
private TypeDefinitionWrapper getType(QName typeQName)
|
||||
{
|
||||
return getOpenCMISDictionaryService().findNodeType(typeQName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type definition of an association or <code>null</code> if no
|
||||
* type definition could be found.
|
||||
@@ -1520,21 +1514,6 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
/**
|
||||
* Creates the CMIS object for a node.
|
||||
*/
|
||||
public ObjectData createCMISObject(CMISNodeInfo info, FileInfo node, String filter,
|
||||
boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
|
||||
boolean includePolicyIds, boolean includeAcl)
|
||||
{
|
||||
if (info.getType() == null)
|
||||
{
|
||||
throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
|
||||
}
|
||||
|
||||
Properties nodeProps = getNodeProperties(info, node, filter, info.getType());
|
||||
|
||||
return createCMISObjectImpl(info, nodeProps, filter, includeAllowableActions, includeRelationships,
|
||||
renditionFilter, includePolicyIds, includeAcl);
|
||||
}
|
||||
|
||||
public ObjectData createCMISObject(CMISNodeInfo info, String filter, boolean includeAllowableActions,
|
||||
IncludeRelationships includeRelationships, String renditionFilter, boolean includePolicyIds,
|
||||
boolean includeAcl)
|
||||
@@ -1544,8 +1523,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
|
||||
}
|
||||
|
||||
Properties nodeProps = (info.isRelationship() ? getAssocProperties(info, filter) : getNodeProperties(info,
|
||||
filter));
|
||||
Properties nodeProps = (info.isRelationship() ? getAssocProperties(info, filter) : getNodeProperties(info, filter));
|
||||
|
||||
return createCMISObjectImpl(info, nodeProps, filter, includeAllowableActions, includeRelationships,
|
||||
renditionFilter, includePolicyIds, includeAcl);
|
||||
@@ -1630,6 +1608,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
// add aspects
|
||||
List<CmisExtensionElement> extensions = getAspectExtensions(info, filter, result.getProperties()
|
||||
.getProperties().keySet());
|
||||
|
||||
if (!extensions.isEmpty())
|
||||
{
|
||||
result.getProperties().setExtensions(
|
||||
@@ -1889,12 +1868,12 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
|
||||
private void addAspectProperties(CMISNodeInfo info, String filter, PropertiesImpl result)
|
||||
{
|
||||
if(getRequestCmisVersion().equals(CmisVersion.CMIS_1_1))
|
||||
if (getRequestCmisVersion().equals(CmisVersion.CMIS_1_1))
|
||||
{
|
||||
Set<String> propertyIds = new HashSet<String>();
|
||||
Set<String> propertyIds = new HashSet<>();
|
||||
Set<String> filterSet = splitFilter(filter);
|
||||
|
||||
Set<QName> aspects = nodeService.getAspects(info.getNodeRef());
|
||||
|
||||
Set<QName> aspects = info.getNodeAspects();
|
||||
for (QName aspect : aspects)
|
||||
{
|
||||
TypeDefinitionWrapper aspectType = getOpenCMISDictionaryService().findNodeType(aspect);
|
||||
@@ -1902,7 +1881,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
for (PropertyDefinitionWrapper propDef : aspectType.getProperties())
|
||||
{
|
||||
if (propertyIds.contains(propDef.getPropertyId()))
|
||||
@@ -1910,16 +1889,16 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
// skip properties that have already been added
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ((filterSet != null) && (!filterSet.contains(propDef.getPropertyDefinition().getQueryName())))
|
||||
{
|
||||
// skip properties that are not in the filter
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Serializable value = propDef.getPropertyAccessor().getValue(info);
|
||||
result.addProperty(getProperty(propDef.getPropertyDefinition().getPropertyType(), propDef, value));
|
||||
|
||||
|
||||
// mark property as 'added'
|
||||
propertyIds.add(propDef.getPropertyId());
|
||||
}
|
||||
@@ -1954,46 +1933,6 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
return result;
|
||||
}
|
||||
|
||||
public Properties getNodeProperties(CMISNodeInfo info, FileInfo node, String filter, TypeDefinitionWrapper type)
|
||||
{
|
||||
PropertiesImpl result = new PropertiesImpl();
|
||||
|
||||
Set<String> filterSet = splitFilter(filter);
|
||||
|
||||
Map<QName, Serializable> nodeProps = node.getProperties();
|
||||
|
||||
for (PropertyDefinitionWrapper propDef : type.getProperties())
|
||||
{
|
||||
if (!propDef.getPropertyId().equals(PropertyIds.OBJECT_ID))
|
||||
{
|
||||
// don't filter the object id
|
||||
if ((filterSet != null) && (!filterSet.contains(propDef.getPropertyDefinition().getQueryName())))
|
||||
{
|
||||
// skip properties that are not in the filter
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Serializable value = null;
|
||||
|
||||
CMISPropertyAccessor accessor = propDef.getPropertyAccessor();
|
||||
if (accessor instanceof DirectProperty)
|
||||
{
|
||||
value = nodeProps.get(accessor.getMappedProperty());
|
||||
}
|
||||
else
|
||||
{
|
||||
value = propDef.getPropertyAccessor().getValue(info);
|
||||
}
|
||||
|
||||
result.addProperty(getProperty(propDef.getPropertyDefinition().getPropertyType(), propDef, value));
|
||||
}
|
||||
|
||||
addAspectProperties(info, filter, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Properties getAssocProperties(CMISNodeInfo info, String filter)
|
||||
{
|
||||
PropertiesImpl result = new PropertiesImpl();
|
||||
@@ -2022,15 +1961,14 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
/**
|
||||
* Builds aspect extension.
|
||||
*/
|
||||
public List<CmisExtensionElement> getAspectExtensions(CMISNodeInfo info, String filter,
|
||||
Set<String> alreadySetProperties)
|
||||
public List<CmisExtensionElement> getAspectExtensions(CMISNodeInfo info, String filter, Set<String> alreadySetProperties)
|
||||
{
|
||||
List<CmisExtensionElement> extensions = new ArrayList<CmisExtensionElement>();
|
||||
Set<String> propertyIds = new HashSet<String>(alreadySetProperties);
|
||||
List<CmisExtensionElement> propertyExtensionList = new ArrayList<CmisExtensionElement>();
|
||||
Set<String> filterSet = splitFilter(filter);
|
||||
|
||||
Set<QName> aspects = nodeService.getAspects(info.getNodeRef());
|
||||
Set<QName> aspects = info.getNodeAspects();
|
||||
for (QName aspect : aspects)
|
||||
{
|
||||
TypeDefinitionWrapper aspectType = getOpenCMISDictionaryService().findNodeType(aspect);
|
||||
@@ -2038,7 +1976,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect);
|
||||
Map<QName, org.alfresco.service.cmr.dictionary.PropertyDefinition> aspectProperties = aspectDefinition.getProperties();
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -25,6 +25,7 @@ import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
@@ -36,7 +37,9 @@ import org.alfresco.opencmis.dictionary.RelationshipTypeDefintionWrapper;
|
||||
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.repo.version.Version2Model;
|
||||
import org.alfresco.repo.version.VersionBaseModel;
|
||||
import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.repo.version.common.VersionUtil;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -56,7 +59,7 @@ import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedExce
|
||||
* CMIS representation of a node.
|
||||
*
|
||||
* Tries to avoid getting the node's version history where possible (because it's not very performant).
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
{
|
||||
@@ -82,6 +85,9 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
private Map<String, Serializable> properties;
|
||||
private List<CMISNodeInfo> parents;
|
||||
|
||||
private Map<QName,Serializable> nodeProps; // for nodeRef
|
||||
private Set<QName> nodeAspects; // for nodeRef
|
||||
|
||||
public CMISNodeInfoImpl()
|
||||
{
|
||||
}
|
||||
@@ -94,13 +100,20 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
analyseObjectId();
|
||||
}
|
||||
|
||||
public CMISNodeInfoImpl(CMISConnector connector, NodeRef nodeRef, VersionHistory versionHistory)
|
||||
public CMISNodeInfoImpl(CMISConnector connector, NodeRef nodeRef, QName nodeType, Map<QName,Serializable> nodeProps, VersionHistory versionHistory, boolean checkExists)
|
||||
{
|
||||
this.connector = connector;
|
||||
this.nodeRef = nodeRef;
|
||||
this.versionHistory = versionHistory;
|
||||
|
||||
analyseNodeRef();
|
||||
if (nodeType != null)
|
||||
{
|
||||
determineType(nodeType);
|
||||
}
|
||||
|
||||
this.nodeProps = nodeProps;
|
||||
|
||||
analyseNodeRef(checkExists);
|
||||
}
|
||||
|
||||
public CMISNodeInfoImpl(CMISConnector connector, NodeRef nodeRef)
|
||||
@@ -108,7 +121,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
this.connector = connector;
|
||||
this.nodeRef = nodeRef;
|
||||
|
||||
analyseNodeRef();
|
||||
analyseNodeRef(true);
|
||||
}
|
||||
|
||||
public CMISNodeInfoImpl(CMISConnector connector, AssociationRef associationRef)
|
||||
@@ -134,13 +147,14 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
objectId = connector.constructObjectId(nodeRef, CMISConnector.UNVERSIONED_VERSION_LABEL);
|
||||
versionLabel = CMISConnector.UNVERSIONED_VERSION_LABEL;
|
||||
currentObjectId = objectId;
|
||||
hasPWC = connector.getCheckOutCheckInService().isCheckedOut(nodeRef);
|
||||
hasPWC = isNodeCheckedOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
versionLabel = (String)getNodeProps().get(ContentModel.PROP_VERSION_LABEL);
|
||||
|
||||
Version headVersion = versionHistory.getHeadVersion();
|
||||
|
||||
versionLabel = (String) connector.getNodeService().getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL);
|
||||
objectId = connector.constructObjectId(headVersion.getVersionedNodeRef(), versionLabel);
|
||||
currentObjectId = connector.constructObjectId(headVersion.getVersionedNodeRef(), headVersion.getVersionLabel());
|
||||
currentNodeId = headVersion.getVersionedNodeRef().toString();
|
||||
@@ -151,9 +165,9 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
}
|
||||
}
|
||||
|
||||
protected void analyseCurrentVersion(NodeRef nodeRef)
|
||||
protected void analyseCurrentVersion()
|
||||
{
|
||||
if(connector.getVersionService().isVersioned(nodeRef))
|
||||
if (isNodeVersioned(nodeRef))
|
||||
{
|
||||
versionLabel = (String) connector.getNodeService().getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL);
|
||||
if(versionLabel == null)
|
||||
@@ -164,21 +178,21 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
currentObjectId = objectId;
|
||||
currentNodeId = nodeRef.toString();
|
||||
objecVariant = CMISObjectVariant.CURRENT_VERSION;
|
||||
hasPWC = connector.getCheckOutCheckInService().isCheckedOut(nodeRef);
|
||||
hasPWC = isNodeCheckedOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
setUnversioned(nodeRef);
|
||||
setUnversioned();
|
||||
}
|
||||
}
|
||||
|
||||
protected void setUnversioned(NodeRef nodeRef)
|
||||
protected void setUnversioned()
|
||||
{
|
||||
objecVariant = CMISObjectVariant.CURRENT_VERSION;
|
||||
objectId = connector.constructObjectId(nodeRef, CMISConnector.UNVERSIONED_VERSION_LABEL);
|
||||
versionLabel = CMISConnector.UNVERSIONED_VERSION_LABEL;
|
||||
currentObjectId = objectId;
|
||||
hasPWC = connector.getCheckOutCheckInService().isCheckedOut(nodeRef);
|
||||
hasPWC = isNodeCheckedOut();
|
||||
}
|
||||
|
||||
protected void analyseObjectId()
|
||||
@@ -252,7 +266,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
}
|
||||
|
||||
// check PWC
|
||||
if (connector.getCheckOutCheckInService().isWorkingCopy(nodeRef))
|
||||
if (isNodeWorkingCopy())
|
||||
{
|
||||
NodeRef checkedOut = connector.getCheckOutCheckInService().getCheckedOut(nodeRef);
|
||||
if(connector.filter(nodeRef))
|
||||
@@ -318,7 +332,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
|
||||
objectId = connector.constructObjectId(objectId, versionLabel);
|
||||
currentObjectId = objectId;
|
||||
hasPWC = connector.getCheckOutCheckInService().isCheckedOut(nodeRef);
|
||||
hasPWC = isNodeCheckedOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -352,7 +366,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
}
|
||||
|
||||
// check version
|
||||
if(!connector.getVersionService().isVersioned(nodeRef))
|
||||
if(! isNodeVersioned(nodeRef))
|
||||
{
|
||||
// the node isn't versioned
|
||||
if(connector.filter(nodeRef))
|
||||
@@ -428,7 +442,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
}
|
||||
}
|
||||
|
||||
protected void analyseNodeRef()
|
||||
protected void analyseNodeRef(boolean checkExists)
|
||||
{
|
||||
objectId = null;
|
||||
currentNodeId = nodeRef.toString();
|
||||
@@ -437,7 +451,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
hasPWC = false;
|
||||
|
||||
// check for existence
|
||||
if (!connector.getNodeService().exists(nodeRef))
|
||||
if (checkExists && (!connector.getNodeService().exists(nodeRef)))
|
||||
{
|
||||
objecVariant = CMISObjectVariant.NOT_EXISTING;
|
||||
return;
|
||||
@@ -470,7 +484,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
}
|
||||
|
||||
// check PWC
|
||||
if (connector.getCheckOutCheckInService().isWorkingCopy(nodeRef))
|
||||
if (isNodeWorkingCopy())
|
||||
{
|
||||
NodeRef checkedOut = connector.getCheckOutCheckInService().getCheckedOut(nodeRef);
|
||||
if (checkedOut == null)
|
||||
@@ -491,15 +505,44 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
}
|
||||
|
||||
// check version
|
||||
if(connector.getVersionService().isAVersion(nodeRef))
|
||||
if (isNodeAVersion(nodeRef))
|
||||
{
|
||||
analyseVersionNode();
|
||||
}
|
||||
else
|
||||
{
|
||||
analyseCurrentVersion(nodeRef);
|
||||
analyseCurrentVersion();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isNodeWorkingCopy()
|
||||
{
|
||||
return getNodeAspects().contains(ContentModel.ASPECT_WORKING_COPY);
|
||||
}
|
||||
|
||||
private boolean isNodeCheckedOut()
|
||||
{
|
||||
return getNodeAspects().contains(ContentModel.ASPECT_CHECKED_OUT);
|
||||
}
|
||||
|
||||
private boolean isNodeAVersion(NodeRef nodeRef)
|
||||
{
|
||||
if(nodeRef.getStoreRef().getProtocol().equals(VersionBaseModel.STORE_PROTOCOL))
|
||||
{
|
||||
NodeRef realNodeRef = VersionUtil.convertNodeRef(nodeRef);
|
||||
return connector.getVersionService().isAVersion(realNodeRef);
|
||||
}
|
||||
return getNodeAspects().contains(Version2Model.ASPECT_VERSION);
|
||||
}
|
||||
|
||||
private boolean isNodeVersioned(NodeRef nodeRef)
|
||||
{
|
||||
if(nodeRef.getStoreRef().getProtocol().equals(VersionBaseModel.STORE_PROTOCOL))
|
||||
{
|
||||
NodeRef realNodeRef = VersionUtil.convertNodeRef(nodeRef);
|
||||
return connector.getVersionService().isVersioned(realNodeRef);
|
||||
}
|
||||
return getNodeAspects().contains(ContentModel.ASPECT_VERSIONABLE);
|
||||
}
|
||||
|
||||
protected void analyseAssociationRef()
|
||||
@@ -520,7 +563,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
objectId = CMISConnector.ASSOC_ID_PREFIX + associationRef.getId();
|
||||
}
|
||||
|
||||
private void determineType()
|
||||
private void determineType(QName nodeType)
|
||||
{
|
||||
type = null;
|
||||
|
||||
@@ -531,7 +574,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
|
||||
if (nodeRef != null)
|
||||
{
|
||||
QName typeQName = connector.getNodeService().getType(nodeRef);
|
||||
QName typeQName = (nodeType != null ? nodeType : connector.getNodeService().getType(nodeRef));
|
||||
type = connector.getOpenCMISDictionaryService().findNodeType(typeQName);
|
||||
} else if (associationRef != null)
|
||||
{
|
||||
@@ -694,7 +737,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
determineType();
|
||||
determineType(null);
|
||||
}
|
||||
|
||||
return type;
|
||||
@@ -744,7 +787,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
name = associationRef.toString();
|
||||
} else
|
||||
{
|
||||
Object nameObj = connector.getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
Object nameObj = getNodeProps().get(ContentModel.PROP_NAME);
|
||||
name = (nameObj instanceof String ? (String) nameObj : "");
|
||||
}
|
||||
}
|
||||
@@ -840,7 +883,7 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
// MNT-12680 we should return always creation date of original node
|
||||
if (isDocument() || isFolder())
|
||||
{
|
||||
return connector.getNodeService().getProperty(nodeRef, ContentModel.PROP_CREATED);
|
||||
return getNodeProps().get(ContentModel.PROP_CREATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -854,14 +897,14 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
{
|
||||
if (isCurrentVersion() || isPWC())
|
||||
{
|
||||
return connector.getNodeService().getProperty(nodeRef, ContentModel.PROP_MODIFIED);
|
||||
return getNodeProps().get(ContentModel.PROP_MODIFIED);
|
||||
} else
|
||||
{
|
||||
return getVersion().getVersionProperty(ContentModel.PROP_MODIFIED.getLocalName());
|
||||
}
|
||||
} else if (isFolder() || isItem())
|
||||
{
|
||||
return connector.getNodeService().getProperty(nodeRef, ContentModel.PROP_MODIFIED);
|
||||
return getNodeProps().get(ContentModel.PROP_MODIFIED);
|
||||
} else
|
||||
{
|
||||
return DUMMY_DATE;
|
||||
@@ -1061,4 +1104,22 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
|
||||
return parents;
|
||||
}
|
||||
|
||||
public Map<QName, Serializable> getNodeProps()
|
||||
{
|
||||
if ((nodeProps == null) && (nodeRef != null))
|
||||
{
|
||||
nodeProps = connector.getNodeService().getProperties(nodeRef);
|
||||
}
|
||||
return nodeProps;
|
||||
}
|
||||
|
||||
public Set<QName> getNodeAspects()
|
||||
{
|
||||
if ((nodeAspects == null) && (nodeRef != null))
|
||||
{
|
||||
nodeAspects = connector.getNodeService().getAspects(nodeRef);
|
||||
}
|
||||
return nodeAspects;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -39,7 +39,7 @@ import org.alfresco.service.namespace.QName;
|
||||
*/
|
||||
public abstract class AbstractProperty implements CMISPropertyAccessor
|
||||
{
|
||||
private static final String CONTENT_PROPERTY = "::content";
|
||||
public static final String CONTENT_PROPERTY = "::content";
|
||||
|
||||
private ServiceRegistry serviceRegistry;
|
||||
protected CMISConnector connector;
|
||||
@@ -146,8 +146,8 @@ public abstract class AbstractProperty implements CMISPropertyAccessor
|
||||
{
|
||||
ContentData contentData = null;
|
||||
|
||||
Serializable value = getServiceRegistry().getNodeService().getProperty(nodeInfo.getNodeRef(),
|
||||
ContentModel.PROP_CONTENT);
|
||||
Serializable value = nodeInfo.getNodeProps().get(ContentModel.PROP_CONTENT);
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, value);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -50,9 +50,7 @@ public class DescriptionProperty extends AbstractProperty
|
||||
{
|
||||
if (nodeInfo.getNodeRef() != null)
|
||||
{
|
||||
return getServiceRegistry().getNodeService().getProperty(
|
||||
nodeInfo.getNodeRef(),
|
||||
ContentModel.PROP_DESCRIPTION);
|
||||
return nodeInfo.getNodeProps().get(ContentModel.PROP_DESCRIPTION);
|
||||
}
|
||||
else if (nodeInfo.getAssociationRef() != null)
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -22,6 +22,7 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.CMISNodeInfoImpl;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -61,9 +62,9 @@ public class DirectProperty extends AbstractProperty
|
||||
|
||||
if (nodeInfo.getNodeRef() != null)
|
||||
{
|
||||
Serializable result = nodeInfo.getNodeProps().get(alfrescoName);
|
||||
|
||||
/* MNT-10548 fix */
|
||||
Serializable result = getServiceRegistry().getNodeService().getProperty(nodeInfo.getNodeRef(), alfrescoName);
|
||||
|
||||
if (result instanceof List)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -41,7 +59,7 @@ public class SecondaryTypesProperty extends AbstractProperty
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<QName> aspects = connector.getNodeService().getAspects(nodeRef);
|
||||
Set<QName> aspects = nodeInfo.getNodeAspects();
|
||||
ArrayList<String> results = new ArrayList<String>(aspects.size());
|
||||
for (QName aspect : aspects)
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -53,8 +53,7 @@ public class VersionSeriesCheckedOutByProperty extends AbstractProperty
|
||||
|
||||
if (nodeInfo.isPWC())
|
||||
{
|
||||
return getServiceRegistry().getNodeService().getProperty(nodeInfo.getNodeRef(),
|
||||
ContentModel.PROP_WORKING_COPY_OWNER);
|
||||
return nodeInfo.getNodeProps().get(ContentModel.PROP_WORKING_COPY_OWNER);
|
||||
} else
|
||||
{
|
||||
return getServiceRegistry().getNodeService().getProperty(nodeInfo.getCurrentNodeNodeRef(),
|
||||
|
Reference in New Issue
Block a user