REPO-1354: Get Rendition info - implement the API

- implemented get rendition info by id method

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@131302 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Raluca Munteanu
2016-10-11 10:32:47 +00:00
parent 7fe14f340a
commit 7ca76a9101
4 changed files with 94 additions and 27 deletions

View File

@@ -386,6 +386,48 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
}
}
private Parameters getParamsWithCreatedStatus()
{
String filterStatusCreated = "(" + Renditions.PARAM_STATUS + "='" + Rendition.RenditionStatus.CREATED + "')";
Query whereQuery = getWhereClause(filterStatusCreated);
Params.RecognizedParams recParams = new Params.RecognizedParams(null, null, null, null, null, null, whereQuery, null, false);
Parameters params = Params.valueOf(recParams, null, null, null);
return params;
}
@Override
public Rendition getRendition(String sharedId, String renditionId)
{
checkEnabled();
checkValidShareId(sharedId);
try
{
Pair<String, NodeRef> pair = quickShareService.getTenantNodeRefFromSharedId(sharedId);
String networkTenantDomain = pair.getFirst();
final NodeRef nodeRef = pair.getSecond();
return TenantUtil.runAsSystemTenant(() ->
{
String nodeId = nodeRef.getId();
Parameters params = getParamsWithCreatedStatus();
return renditions.getRendition(nodeId, renditionId, params);
}, networkTenantDomain);
}
catch (InvalidSharedIdException ex)
{
logger.warn("Unable to find: " + sharedId);
throw new EntityNotFoundException(sharedId);
}
catch (InvalidNodeRefException inre)
{
logger.warn("Unable to find: " + sharedId + " [" + inre.getNodeRef() + "]");
throw new EntityNotFoundException(sharedId);
}
}
@Override
public CollectionWithPagingInfo<Rendition> getRenditions(String sharedId)
{
@@ -399,15 +441,10 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
String networkTenantDomain = pair.getFirst();
final NodeRef nodeRef = pair.getSecond();
return TenantUtil.runAsSystemTenant(() -> {
return TenantUtil.runAsSystemTenant(() ->
{
String nodeId = nodeRef.getId();
// hmm ... can we simplify ?
String filterStatusCreated = "(" + Renditions.PARAM_STATUS + "='" + Rendition.RenditionStatus.CREATED + "')";
Query whereQuery = getWhereClause(filterStatusCreated);
Params.RecognizedParams recParams = new Params.RecognizedParams(null, null, null, null, null, null, whereQuery, null, false);
Parameters params = Params.valueOf(recParams, null, null, null);
Parameters params = getParamsWithCreatedStatus();
return renditions.getRenditions(nodeId, params);
}, networkTenantDomain);