mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed OpenCMIS server getObjectRelationships() operation
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29064 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -542,7 +542,8 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Too many sort properties in 'orderBy' - ignore those above max (max="+maxSortProps+",actual="+len+")");
|
||||
logger.debug("Too many sort properties in 'orderBy' - ignore those above max (max="
|
||||
+ maxSortProps + ",actual=" + len + ")");
|
||||
}
|
||||
len = maxSortProps;
|
||||
}
|
||||
@@ -552,7 +553,8 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
|
||||
if (sort.length > 0)
|
||||
{
|
||||
PropertyDefintionWrapper propDef = connector.getOpenCMISDictionaryService().findPropertyByQueryName(sort[0]);
|
||||
PropertyDefintionWrapper propDef = connector.getOpenCMISDictionaryService()
|
||||
.findPropertyByQueryName(sort[0]);
|
||||
if (propDef != null)
|
||||
{
|
||||
QName sortProp = propDef.getPropertyAccessor().getMappedProperty();
|
||||
@@ -560,16 +562,14 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
{
|
||||
boolean sortAsc = ((sort.length == 1) || (sortAsc = (sort[1].equalsIgnoreCase("asc"))));
|
||||
sortProps.add(new Pair<QName, Boolean>(sortProp, sortAsc));
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Ignore sort property '" + sort[0] + " - mapping not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -582,16 +582,26 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
|
||||
if (sortProps.size() < origLen)
|
||||
{
|
||||
logger.warn("Sort properties trimmed - either too many and/or not found: \n" +
|
||||
" orig: " + orderBy + "\n" +
|
||||
" final: " + sortProps);
|
||||
logger.warn("Sort properties trimmed - either too many and/or not found: \n" + " orig: " + orderBy
|
||||
+ "\n" + " final: " + sortProps);
|
||||
}
|
||||
}
|
||||
|
||||
PagingRequest pageRequest = new PagingRequest(skipCount.intValue(), maxItems.intValue(), null);
|
||||
pageRequest.setRequestTotalCountMax(skipCount.intValue() + 1000); // TODO make this optional/configurable - affects whether numItems may be returned
|
||||
pageRequest.setRequestTotalCountMax(skipCount.intValue() + 1000); // TODO
|
||||
// make
|
||||
// this
|
||||
// optional/configurable
|
||||
// -
|
||||
// affects
|
||||
// whether
|
||||
// numItems
|
||||
// may
|
||||
// be
|
||||
// returned
|
||||
|
||||
PagingResults<FileInfo> pageOfNodeInfos = connector.getFileFolderService().list(folderNodeRef, true, true, null, sortProps, pageRequest);
|
||||
PagingResults<FileInfo> pageOfNodeInfos = connector.getFileFolderService().list(folderNodeRef, true, true,
|
||||
null, sortProps, pageRequest);
|
||||
List<FileInfo> childrenList = pageOfNodeInfos.getPage();
|
||||
|
||||
if (max > 0)
|
||||
@@ -604,8 +614,8 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
try
|
||||
{
|
||||
// create a child CMIS object
|
||||
ObjectData object = connector.createCMISObject(child, filter,
|
||||
includeAllowableActions, includeRelationships, renditionFilter, false, false);
|
||||
ObjectData object = connector.createCMISObject(child, filter, includeAllowableActions,
|
||||
includeRelationships, renditionFilter, false, false);
|
||||
|
||||
if (context.isObjectInfoRequired())
|
||||
{
|
||||
@@ -648,7 +658,8 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("getChildren: "+childrenList.size()+" in "+(System.currentTimeMillis()-start)+" msecs");
|
||||
logger.debug("getChildren: " + childrenList.size() + " in " + (System.currentTimeMillis() - start)
|
||||
+ " msecs");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -2301,6 +2312,27 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
throw new CmisInvalidArgumentException("Object is a relationship!");
|
||||
}
|
||||
|
||||
// check if the relationship base type is requested
|
||||
if (BaseTypeId.CMIS_RELATIONSHIP.value().equals(typeId))
|
||||
{
|
||||
boolean isrt = (includeSubRelationshipTypes == null ? false : includeSubRelationshipTypes.booleanValue());
|
||||
if (isrt)
|
||||
{
|
||||
// all relationships are a direct subtype of the base type in
|
||||
// Alfresco -> remove filter
|
||||
typeId = null;
|
||||
} else
|
||||
{
|
||||
// there are no relationships of the base type in ALfresco ->
|
||||
// return empty list
|
||||
ObjectListImpl result = new ObjectListImpl();
|
||||
result.setHasMoreItems(false);
|
||||
result.setNumItems(BigInteger.ZERO);
|
||||
result.setObjects(new ArrayList<ObjectData>());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
NodeRef nodeRef = connector.getNodeRefIfCurrent("Object", objectId);
|
||||
return connector.getObjectRelationships(nodeRef, relationshipDirection, typeId, filter,
|
||||
includeAllowableActions, maxItems, skipCount);
|
||||
|
@@ -1903,7 +1903,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((typeId != null) && !assocRef.getId().equals(typeId))
|
||||
if ((typeId != null) && !assocTypeDef.getTypeId().equals(typeId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user