mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126455 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 122167 gjames: RA-823 adding "source" into the collection output git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126800 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -55,6 +55,7 @@ import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||
import org.alfresco.rest.framework.jacksonextensions.BeanPropertiesFilter;
|
||||
import org.alfresco.rest.framework.jacksonextensions.ExecutionResult;
|
||||
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper;
|
||||
import org.alfresco.rest.framework.resource.SerializablePagedCollection;
|
||||
import org.alfresco.rest.framework.resource.actions.ActionExecutor;
|
||||
import org.alfresco.rest.framework.resource.actions.ActionExecutor.ExecutionCallback;
|
||||
import org.alfresco.rest.framework.resource.content.ContentInfo;
|
||||
@@ -482,22 +483,19 @@ public class ResourceWebScriptHelper
|
||||
{
|
||||
PropertyCheck.mandatory(this, null, params);
|
||||
if (objectToWrap == null ) return null;
|
||||
if (objectToWrap instanceof CollectionWithPagingInfo<?>)
|
||||
if (objectToWrap instanceof SerializablePagedCollection<?>)
|
||||
{
|
||||
CollectionWithPagingInfo<?> collectionToWrap = (CollectionWithPagingInfo<?>) objectToWrap;
|
||||
SerializablePagedCollection<?> collectionToWrap = (SerializablePagedCollection<?>) objectToWrap;
|
||||
Object sourceEntity = executeIncludedSource(api,entityCollectionName,params.getEntityId(),params.includeSource());
|
||||
Collection<Object> resultCollection = new ArrayList(collectionToWrap.getCollection().size());
|
||||
if (!collectionToWrap.getCollection().isEmpty())
|
||||
{
|
||||
Collection<Object> resultCollection = new ArrayList(collectionToWrap.getCollection().size());
|
||||
for (Object obj : collectionToWrap.getCollection())
|
||||
{
|
||||
resultCollection.add(processAdditionsToTheResponse(api,entityCollectionName,params,obj));
|
||||
}
|
||||
return CollectionWithPagingInfo.asPaged(collectionToWrap.getPaging(), resultCollection, collectionToWrap.hasMoreItems(), collectionToWrap.getTotalItems());
|
||||
}
|
||||
else
|
||||
{ //It is empty so just return it for rendering.
|
||||
return objectToWrap;
|
||||
}
|
||||
return CollectionWithPagingInfo.asPaged(collectionToWrap.getPaging(), resultCollection, collectionToWrap.hasMoreItems(), collectionToWrap.getTotalItems(), sourceEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -529,6 +527,20 @@ public class ResourceWebScriptHelper
|
||||
}
|
||||
}
|
||||
|
||||
private Object executeIncludedSource(Api api, String entityCollectionName, String uniqueEntityId, boolean includeSource)
|
||||
{
|
||||
if (includeSource)
|
||||
{
|
||||
ResourceWithMetadata res = locator.locateEntityResource(api, entityCollectionName, HttpMethod.GET);
|
||||
if (res != null)
|
||||
{
|
||||
Object result = executeRelatedResource(api, null, uniqueEntityId, null, res);
|
||||
if (result!=null && result instanceof ExecutionResult) return ((ExecutionResult) result).getRoot();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loops through the embedded Resources and executes them. The results are added to list of embedded results used by
|
||||
* the ExecutionResult object.
|
||||
|
Reference in New Issue
Block a user