mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
REPO-1564: Retrieve content/rendition for node in trashcan (#28)
* REPO-1564: Retrieve content/rendition for node in trashcan - Implemented endpoints for downloading archived node and rendition content, getting renditions and rendition by id for an archived node.
This commit is contained in:
@@ -25,14 +25,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api;
|
package org.alfresco.rest.api;
|
||||||
|
|
||||||
import org.alfresco.repo.node.archive.RestoreNodeReport;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.rest.api.model.Node;
|
import org.alfresco.rest.api.model.Node;
|
||||||
|
import org.alfresco.rest.api.model.Rendition;
|
||||||
import org.alfresco.rest.api.model.UserInfo;
|
import org.alfresco.rest.api.model.UserInfo;
|
||||||
|
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||||
|
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles trashcan / deleted nodes
|
* Handles trashcan / deleted nodes
|
||||||
@@ -70,4 +71,29 @@ public interface DeletedNodes
|
|||||||
* @param archivedId
|
* @param archivedId
|
||||||
*/
|
*/
|
||||||
void purgeArchivedNode(String archivedId);
|
void purgeArchivedNode(String archivedId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download file content (or rendition content) via archived node.
|
||||||
|
*
|
||||||
|
* @param archivedId
|
||||||
|
* @param renditionId
|
||||||
|
* - optional
|
||||||
|
* @param parameters
|
||||||
|
* {@link Parameters}
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BinaryResource getContent(String archivedId, String renditionId, Parameters parameters);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param archivedId
|
||||||
|
* @param renditionId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Rendition getRendition(String archivedId, String renditionId, Parameters parameters);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param archivedId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CollectionWithPagingInfo<Rendition> getRenditions(String archivedId, Parameters parameters);
|
||||||
}
|
}
|
||||||
|
@@ -44,51 +44,41 @@ public interface Renditions
|
|||||||
/**
|
/**
|
||||||
* Lists all available renditions includes those that have been created and those that are yet to be created.
|
* Lists all available renditions includes those that have been created and those that are yet to be created.
|
||||||
*
|
*
|
||||||
* @param nodeId the source node id
|
* @param nodeRef
|
||||||
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
||||||
* @return the rendition results
|
* @return the rendition results
|
||||||
*/
|
*/
|
||||||
CollectionWithPagingInfo<Rendition> getRenditions(String nodeId, Parameters parameters);
|
CollectionWithPagingInfo<Rendition> getRenditions(NodeRef nodeRef, Parameters parameters);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets information about a rendition of a node in the repository.
|
* Gets information about a rendition of a node in the repository.
|
||||||
* If there is no rendition, then returns the available/registered rendition.
|
* If there is no rendition, then returns the available/registered rendition.
|
||||||
*
|
*
|
||||||
* @param nodeId the source node id
|
* @param nodeRef
|
||||||
* @param renditionId the rendition id
|
* @param renditionId the rendition id
|
||||||
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
||||||
* @return the {@link Rendition} object
|
* @return the {@link Rendition} object
|
||||||
*/
|
*/
|
||||||
Rendition getRendition(String nodeId, String renditionId, Parameters parameters);
|
Rendition getRendition(NodeRef nodeRef, String renditionId, Parameters parameters);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a rendition for the given node asynchronously.
|
* Creates a rendition for the given node asynchronously.
|
||||||
*
|
*
|
||||||
* @param nodeId the source node id
|
* @param nodeRef
|
||||||
* @param rendition the {@link Rendition} request
|
* @param rendition the {@link Rendition} request
|
||||||
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
||||||
*/
|
*/
|
||||||
void createRendition(String nodeId, Rendition rendition, Parameters parameters);
|
void createRendition(NodeRef nodeRef, Rendition rendition, Parameters parameters);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a rendition for the given node - either async r sync
|
* Creates a rendition for the given node - either async r sync
|
||||||
*
|
*
|
||||||
* @param nodeId
|
* @param nodeRef
|
||||||
* @param rendition
|
* @param rendition
|
||||||
* @param executeAsync
|
* @param executeAsync
|
||||||
* @param parameters
|
* @param parameters
|
||||||
*/
|
*/
|
||||||
void createRendition(String nodeId, Rendition rendition, boolean executeAsync, Parameters parameters);
|
void createRendition(NodeRef nodeRef, Rendition rendition, boolean executeAsync, Parameters parameters);
|
||||||
|
|
||||||
/**
|
|
||||||
* Downloads rendition.
|
|
||||||
*
|
|
||||||
* @param nodeId the source node id
|
|
||||||
* @param renditionId the rendition id
|
|
||||||
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
|
||||||
* @return the rendition stream
|
|
||||||
*/
|
|
||||||
BinaryResource getContent(String nodeId, String renditionId, Parameters parameters);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads rendition.
|
* Downloads rendition.
|
||||||
@@ -99,5 +89,15 @@ public interface Renditions
|
|||||||
* @return the rendition stream
|
* @return the rendition stream
|
||||||
*/
|
*/
|
||||||
BinaryResource getContent(NodeRef sourceNodeRef, String renditionId, Parameters parameters);
|
BinaryResource getContent(NodeRef sourceNodeRef, String renditionId, Parameters parameters);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads rendition.
|
||||||
|
*
|
||||||
|
* @param sourceNodeRef the source nodeRef
|
||||||
|
* @param renditionId the rendition id
|
||||||
|
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
||||||
|
* @return the rendition stream
|
||||||
|
*/
|
||||||
|
BinaryResource getContentNoValidation(NodeRef sourceNodeRef, String renditionId, Parameters parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,6 +25,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.impl;
|
package org.alfresco.rest.api.impl;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
@@ -34,39 +41,38 @@ import org.alfresco.repo.node.archive.RestoreNodeReport;
|
|||||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.rest.api.DeletedNodes;
|
import org.alfresco.rest.api.DeletedNodes;
|
||||||
import org.alfresco.rest.api.Nodes;
|
import org.alfresco.rest.api.Nodes;
|
||||||
|
import org.alfresco.rest.api.Renditions;
|
||||||
import org.alfresco.rest.api.model.Node;
|
import org.alfresco.rest.api.model.Node;
|
||||||
|
import org.alfresco.rest.api.model.Rendition;
|
||||||
import org.alfresco.rest.api.model.UserInfo;
|
import org.alfresco.rest.api.model.UserInfo;
|
||||||
import org.alfresco.rest.framework.core.exceptions.ApiException;
|
import org.alfresco.rest.framework.core.exceptions.ApiException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException;
|
import org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.NotFoundException;
|
import org.alfresco.rest.framework.core.exceptions.NotFoundException;
|
||||||
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||||
|
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
|
import org.alfresco.rest.framework.tools.RecognizedParamsExtractor;
|
||||||
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles trashcan / deleted nodes
|
* Handles trashcan / deleted nodes
|
||||||
*
|
*
|
||||||
* @author Gethin James
|
* @author Gethin James
|
||||||
*/
|
*/
|
||||||
public class DeletedNodesImpl implements DeletedNodes
|
public class DeletedNodesImpl implements DeletedNodes, RecognizedParamsExtractor
|
||||||
{
|
{
|
||||||
private NodeArchiveService nodeArchiveService;
|
private NodeArchiveService nodeArchiveService;
|
||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
private Nodes nodes;
|
private Nodes nodes;
|
||||||
|
private Renditions renditions;
|
||||||
|
|
||||||
public void setNodeArchiveService(NodeArchiveService nodeArchiveService)
|
public void setNodeArchiveService(NodeArchiveService nodeArchiveService)
|
||||||
{
|
{
|
||||||
@@ -88,6 +94,11 @@ public class DeletedNodesImpl implements DeletedNodes
|
|||||||
this.nodes = nodes;
|
this.nodes = nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRenditions(Renditions renditions)
|
||||||
|
{
|
||||||
|
this.renditions = renditions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets archived information on the Node
|
* Sets archived information on the Node
|
||||||
* @param aNode
|
* @param aNode
|
||||||
@@ -189,4 +200,35 @@ public class DeletedNodesImpl implements DeletedNodes
|
|||||||
NodeRef validatedNodeRef = nodes.validateNode(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, archivedId);
|
NodeRef validatedNodeRef = nodes.validateNode(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, archivedId);
|
||||||
nodeArchiveService.purgeArchivedNode(validatedNodeRef);
|
nodeArchiveService.purgeArchivedNode(validatedNodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BinaryResource getContent(String archivedId, String renditionId, Parameters parameters)
|
||||||
|
{
|
||||||
|
// First check if the archived node is valid
|
||||||
|
NodeRef validatedNodeRef = nodes.validateNode(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, archivedId);
|
||||||
|
|
||||||
|
if (renditionId != null)
|
||||||
|
{
|
||||||
|
return renditions.getContent(validatedNodeRef, renditionId, parameters);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nodes.getContent(validatedNodeRef, parameters, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rendition getRendition(String archivedId, String renditionId, Parameters parameters)
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, archivedId);
|
||||||
|
Rendition rendition = renditions.getRendition(nodeRef, renditionId, parameters);
|
||||||
|
return rendition;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CollectionWithPagingInfo<Rendition> getRenditions(String archivedId, Parameters parameters)
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, archivedId);
|
||||||
|
return renditions.getRenditions(nodeRef, parameters);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -325,7 +325,7 @@ public class PeopleImpl implements People
|
|||||||
NodeRef personNode = personService.getPerson(personId);
|
NodeRef personNode = personService.getPerson(personId);
|
||||||
NodeRef avatarNodeRef = getAvatarOriginal(personNode);
|
NodeRef avatarNodeRef = getAvatarOriginal(personNode);
|
||||||
|
|
||||||
return renditions.getContent(avatarNodeRef, "avatar", parameters);
|
return renditions.getContentNoValidation(avatarNodeRef, "avatar", parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -369,7 +369,7 @@ public class PeopleImpl implements People
|
|||||||
// create thumbnail synchronously
|
// create thumbnail synchronously
|
||||||
Rendition avatarR = new Rendition();
|
Rendition avatarR = new Rendition();
|
||||||
avatarR.setId("avatar");
|
avatarR.setId("avatar");
|
||||||
renditions.createRendition(avatarOriginalNodeId, avatarR, false, parameters);
|
renditions.createRendition(avatar, avatarR, false, parameters);
|
||||||
|
|
||||||
List<String> include = Arrays.asList(
|
List<String> include = Arrays.asList(
|
||||||
PARAM_INCLUDE_ASPECTNAMES,
|
PARAM_INCLUDE_ASPECTNAMES,
|
||||||
|
@@ -410,9 +410,8 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
|
|||||||
|
|
||||||
return TenantUtil.runAsSystemTenant(() ->
|
return TenantUtil.runAsSystemTenant(() ->
|
||||||
{
|
{
|
||||||
String nodeId = nodeRef.getId();
|
|
||||||
Parameters params = getParamsWithCreatedStatus();
|
Parameters params = getParamsWithCreatedStatus();
|
||||||
return renditions.getRendition(nodeId, renditionId, params);
|
return renditions.getRendition(nodeRef, renditionId, params);
|
||||||
|
|
||||||
}, networkTenantDomain);
|
}, networkTenantDomain);
|
||||||
}
|
}
|
||||||
@@ -443,9 +442,8 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
|
|||||||
|
|
||||||
return TenantUtil.runAsSystemTenant(() ->
|
return TenantUtil.runAsSystemTenant(() ->
|
||||||
{
|
{
|
||||||
String nodeId = nodeRef.getId();
|
|
||||||
Parameters params = getParamsWithCreatedStatus();
|
Parameters params = getParamsWithCreatedStatus();
|
||||||
return renditions.getRenditions(nodeId, params);
|
return renditions.getRenditions(nodeRef, params);
|
||||||
|
|
||||||
}, networkTenantDomain);
|
}, networkTenantDomain);
|
||||||
}
|
}
|
||||||
|
@@ -64,6 +64,7 @@ import org.alfresco.service.cmr.repository.ContentData;
|
|||||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -153,10 +154,10 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CollectionWithPagingInfo<Rendition> getRenditions(String nodeId, Parameters parameters)
|
public CollectionWithPagingInfo<Rendition> getRenditions(NodeRef nodeRef, Parameters parameters)
|
||||||
{
|
{
|
||||||
final NodeRef nodeRef = validateSourceNode(nodeId);
|
final NodeRef validatedNodeRef = validateNode(nodeRef.getStoreRef(), nodeRef.getId());
|
||||||
String contentMimeType = getMimeType(nodeRef);
|
String contentMimeType = getMimeType(validatedNodeRef);
|
||||||
|
|
||||||
Query query = parameters.getQuery();
|
Query query = parameters.getQuery();
|
||||||
boolean includeCreated = true;
|
boolean includeCreated = true;
|
||||||
@@ -179,7 +180,7 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ChildAssociationRef> nodeRefRenditions = renditionService.getRenditions(nodeRef);
|
List<ChildAssociationRef> nodeRefRenditions = renditionService.getRenditions(validatedNodeRef);
|
||||||
if (!nodeRefRenditions.isEmpty())
|
if (!nodeRefRenditions.isEmpty())
|
||||||
{
|
{
|
||||||
for (ChildAssociationRef childAssociationRef : nodeRefRenditions)
|
for (ChildAssociationRef childAssociationRef : nodeRefRenditions)
|
||||||
@@ -208,10 +209,10 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rendition getRendition(String nodeId, String renditionId, Parameters parameters)
|
public Rendition getRendition(NodeRef nodeRef, String renditionId, Parameters parameters)
|
||||||
{
|
{
|
||||||
final NodeRef nodeRef = validateSourceNode(nodeId);
|
final NodeRef validatedNodeRef = validateNode(nodeRef.getStoreRef(), nodeRef.getId());
|
||||||
NodeRef renditionNodeRef = getRenditionByName(nodeRef, renditionId, parameters);
|
NodeRef renditionNodeRef = getRenditionByName(validatedNodeRef, renditionId, parameters);
|
||||||
boolean includeNotCreated = true;
|
boolean includeNotCreated = true;
|
||||||
String status = getStatus(parameters);
|
String status = getStatus(parameters);
|
||||||
if (status != null)
|
if (status != null)
|
||||||
@@ -229,7 +230,7 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String contentMimeType = getMimeType(nodeRef);
|
String contentMimeType = getMimeType(validatedNodeRef);
|
||||||
// List all available thumbnail definitions for the source node
|
// List all available thumbnail definitions for the source node
|
||||||
List<ThumbnailDefinition> thumbnailDefinitions = thumbnailService.getThumbnailRegistry().getThumbnailDefinitions(contentMimeType, -1);
|
List<ThumbnailDefinition> thumbnailDefinitions = thumbnailService.getThumbnailRegistry().getThumbnailDefinitions(contentMimeType, -1);
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
@@ -259,13 +260,13 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createRendition(String nodeId, Rendition rendition, Parameters parameters)
|
public void createRendition(NodeRef nodeRef, Rendition rendition, Parameters parameters)
|
||||||
{
|
{
|
||||||
createRendition(nodeId, rendition, true, parameters);
|
createRendition(nodeRef, rendition, true, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createRendition(String nodeId, Rendition rendition, boolean executeAsync, Parameters parameters)
|
public void createRendition(NodeRef nodeRef, Rendition rendition, boolean executeAsync, Parameters parameters)
|
||||||
{
|
{
|
||||||
// If thumbnail generation has been configured off, then don't bother.
|
// If thumbnail generation has been configured off, then don't bother.
|
||||||
if (!thumbnailService.getThumbnailsEnabled())
|
if (!thumbnailService.getThumbnailsEnabled())
|
||||||
@@ -273,7 +274,7 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
|||||||
throw new DisabledServiceException("Thumbnail generation has been disabled.");
|
throw new DisabledServiceException("Thumbnail generation has been disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
final NodeRef sourceNodeRef = validateSourceNode(nodeId);
|
final NodeRef sourceNodeRef = validateNode(nodeRef.getStoreRef(), nodeRef.getId());
|
||||||
final NodeRef renditionNodeRef = getRenditionByName(sourceNodeRef, rendition.getId(), parameters);
|
final NodeRef renditionNodeRef = getRenditionByName(sourceNodeRef, rendition.getId(), parameters);
|
||||||
if (renditionNodeRef != null)
|
if (renditionNodeRef != null)
|
||||||
{
|
{
|
||||||
@@ -304,14 +305,14 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BinaryResource getContent(String nodeId, String renditionId, Parameters parameters)
|
public BinaryResource getContent(NodeRef nodeRef, String renditionId, Parameters parameters)
|
||||||
{
|
{
|
||||||
final NodeRef sourceNodeRef = validateSourceNode(nodeId);
|
final NodeRef validatedNodeRef = validateNode(nodeRef.getStoreRef(), nodeRef.getId());
|
||||||
return getContent(sourceNodeRef, renditionId, parameters);
|
return getContentNoValidation(validatedNodeRef, renditionId, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BinaryResource getContent(NodeRef sourceNodeRef, String renditionId, Parameters parameters)
|
public BinaryResource getContentNoValidation(NodeRef sourceNodeRef, String renditionId, Parameters parameters)
|
||||||
{
|
{
|
||||||
NodeRef renditionNodeRef = getRenditionByName(sourceNodeRef, renditionId, parameters);
|
NodeRef renditionNodeRef = getRenditionByName(sourceNodeRef, renditionId, parameters);
|
||||||
|
|
||||||
@@ -458,14 +459,25 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
|||||||
return apiRendition;
|
return apiRendition;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NodeRef validateSourceNode(String nodeId)
|
public NodeRef validateNode(StoreRef storeRef, String nodeId)
|
||||||
|
{
|
||||||
|
if (nodeId == null)
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException("Missing nodeId");
|
||||||
|
}
|
||||||
|
|
||||||
|
final NodeRef nodeRef = nodes.validateNode(storeRef, nodeId);
|
||||||
|
// check if the node represents a file
|
||||||
|
isContentFile(nodeRef);
|
||||||
|
return nodeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void isContentFile(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
final NodeRef nodeRef = nodes.validateNode(nodeId);
|
|
||||||
if (!nodes.isSubClass(nodeRef, ContentModel.PROP_CONTENT, false))
|
if (!nodes.isSubClass(nodeRef, ContentModel.PROP_CONTENT, false))
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException("Node id '" + nodeId + "' does not represent a file.");
|
throw new InvalidArgumentException("Node id '" + nodeRef.getId() + "' does not represent a file.");
|
||||||
}
|
}
|
||||||
return nodeRef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMimeTypeDisplayName(String mimeType)
|
private String getMimeTypeDisplayName(String mimeType)
|
||||||
|
@@ -37,6 +37,8 @@ import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResou
|
|||||||
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.util.PropertyCheck;
|
import org.alfresco.util.PropertyCheck;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
@@ -72,19 +74,22 @@ public class NodeRenditionsRelation implements RelationshipResourceAction.Read<R
|
|||||||
@Override
|
@Override
|
||||||
public CollectionWithPagingInfo<Rendition> readAll(String nodeId, Parameters parameters)
|
public CollectionWithPagingInfo<Rendition> readAll(String nodeId, Parameters parameters)
|
||||||
{
|
{
|
||||||
return renditions.getRenditions(nodeId, parameters);
|
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||||
|
return renditions.getRenditions(nodeRef, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rendition readById(String nodeId, String renditionId, Parameters parameters)
|
public Rendition readById(String nodeId, String renditionId, Parameters parameters)
|
||||||
{
|
{
|
||||||
return renditions.getRendition(nodeId, renditionId, parameters);
|
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||||
|
return renditions.getRendition(nodeRef, renditionId, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WebApiDescription(title = "Create rendition", successStatus = Status.STATUS_ACCEPTED)
|
@WebApiDescription(title = "Create rendition", successStatus = Status.STATUS_ACCEPTED)
|
||||||
@Override
|
@Override
|
||||||
public List<Rendition> create(String nodeId, List<Rendition> entity, Parameters parameters)
|
public List<Rendition> create(String nodeId, List<Rendition> entity, Parameters parameters)
|
||||||
{
|
{
|
||||||
|
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||||
// Temporary - pending future improvements to thumbnail service to minimise chance of
|
// Temporary - pending future improvements to thumbnail service to minimise chance of
|
||||||
// missing/failed thumbnails (when requested/generated 'concurrently')
|
// missing/failed thumbnails (when requested/generated 'concurrently')
|
||||||
if (entity.size() > 1)
|
if (entity.size() > 1)
|
||||||
@@ -94,7 +99,7 @@ public class NodeRenditionsRelation implements RelationshipResourceAction.Read<R
|
|||||||
|
|
||||||
for (Rendition rendition : entity)
|
for (Rendition rendition : entity)
|
||||||
{
|
{
|
||||||
renditions.createRendition(nodeId, rendition, parameters);
|
renditions.createRendition(nodeRef, rendition, parameters);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -104,6 +109,7 @@ public class NodeRenditionsRelation implements RelationshipResourceAction.Read<R
|
|||||||
@Override
|
@Override
|
||||||
public BinaryResource readProperty(String nodeId, String renditionId, Parameters parameters)
|
public BinaryResource readProperty(String nodeId, String renditionId, Parameters parameters)
|
||||||
{
|
{
|
||||||
return renditions.getContent(nodeId, renditionId, parameters);
|
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
|
||||||
|
return renditions.getContent(nodeRef, renditionId, parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,31 +26,21 @@
|
|||||||
|
|
||||||
package org.alfresco.rest.api.trashcan;
|
package org.alfresco.rest.api.trashcan;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.alfresco.query.PagingRequest;
|
|
||||||
import org.alfresco.query.PagingResults;
|
|
||||||
import org.alfresco.repo.node.archive.ArchivedNodesCannedQueryBuilder;
|
|
||||||
import org.alfresco.repo.node.archive.NodeArchiveService;
|
|
||||||
import org.alfresco.rest.api.DeletedNodes;
|
import org.alfresco.rest.api.DeletedNodes;
|
||||||
import org.alfresco.rest.api.Nodes;
|
|
||||||
import org.alfresco.rest.api.impl.Util;
|
|
||||||
import org.alfresco.rest.api.model.Node;
|
import org.alfresco.rest.api.model.Node;
|
||||||
import org.alfresco.rest.api.model.NodeTarget;
|
import org.alfresco.rest.framework.BinaryProperties;
|
||||||
import org.alfresco.rest.framework.Operation;
|
import org.alfresco.rest.framework.Operation;
|
||||||
import org.alfresco.rest.framework.WebApiDescription;
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||||
import org.alfresco.rest.framework.resource.EntityResource;
|
import org.alfresco.rest.framework.resource.EntityResource;
|
||||||
|
import org.alfresco.rest.framework.resource.actions.interfaces.BinaryResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||||
|
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
import org.alfresco.rest.framework.webscripts.WithResponse;
|
import org.alfresco.rest.framework.webscripts.WithResponse;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of an Entity Resource for handling archived content
|
* An implementation of an Entity Resource for handling archived content
|
||||||
@@ -59,7 +49,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@EntityResource(name="deleted-nodes", title = "Deleted Nodes")
|
@EntityResource(name="deleted-nodes", title = "Deleted Nodes")
|
||||||
public class TrashcanEntityResource implements
|
public class TrashcanEntityResource implements
|
||||||
EntityResourceAction.ReadById<Node>, EntityResourceAction.Read<Node>, EntityResourceAction.Delete
|
EntityResourceAction.ReadById<Node>, EntityResourceAction.Read<Node>, EntityResourceAction.Delete, BinaryResourceAction.Read
|
||||||
{
|
{
|
||||||
private DeletedNodes deletedNodes;
|
private DeletedNodes deletedNodes;
|
||||||
|
|
||||||
@@ -87,6 +77,14 @@ public class TrashcanEntityResource implements
|
|||||||
return deletedNodes.restoreArchivedNode(nodeId);
|
return deletedNodes.restoreArchivedNode(nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@WebApiDescription(title = "Download content", description = "Download content")
|
||||||
|
@BinaryProperties({ "content" })
|
||||||
|
public BinaryResource readProperty(String nodeId, Parameters parameters)
|
||||||
|
{
|
||||||
|
return deletedNodes.getContent(nodeId, null, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String nodeId, Parameters parameters)
|
public void delete(String nodeId, Parameters parameters)
|
||||||
{
|
{
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Remote API
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.rest.api.trashcan;
|
||||||
|
|
||||||
|
import org.alfresco.rest.api.DeletedNodes;
|
||||||
|
import org.alfresco.rest.api.model.Rendition;
|
||||||
|
import org.alfresco.rest.framework.BinaryProperties;
|
||||||
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
|
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||||
|
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||||
|
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||||
|
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||||
|
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceBinaryAction;
|
||||||
|
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||||
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
@RelationshipResource(name = "renditions", entityResource = TrashcanEntityResource.class, title = "Node renditions via archived node")
|
||||||
|
public class TrashcanRenditionsRelation
|
||||||
|
implements RelationshipResourceAction.Read<Rendition>, RelationshipResourceAction.ReadById<Rendition>, RelationshipResourceBinaryAction.Read, InitializingBean
|
||||||
|
{
|
||||||
|
|
||||||
|
private DeletedNodes deletedNodes;
|
||||||
|
|
||||||
|
public void setDeletedNodes(DeletedNodes deletedNodes)
|
||||||
|
{
|
||||||
|
this.deletedNodes = deletedNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@WebApiDescription(title = "List renditions", description = "List available (created) renditions")
|
||||||
|
@Override
|
||||||
|
public CollectionWithPagingInfo<Rendition> readAll(String nodeId, Parameters parameters)
|
||||||
|
{
|
||||||
|
return deletedNodes.getRenditions(nodeId, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WebApiDescription(title = "Retrieve rendition information", description = "Retrieve (created) rendition information")
|
||||||
|
@Override
|
||||||
|
public Rendition readById(String nodeId, String renditionId, Parameters parameters)
|
||||||
|
{
|
||||||
|
return deletedNodes.getRendition(nodeId, renditionId, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WebApiDescription(title = "Download archived node rendition", description = "Download rendition for an archived node")
|
||||||
|
@BinaryProperties({ "content" })
|
||||||
|
@Override
|
||||||
|
public BinaryResource readProperty(String nodeId, String renditionId, Parameters parameters)
|
||||||
|
{
|
||||||
|
return deletedNodes.getContent(nodeId, renditionId, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatory("deletedNodes", this.deletedNodes);
|
||||||
|
}
|
||||||
|
}
|
@@ -584,6 +584,7 @@
|
|||||||
<property name="nodeService" ref="NodeService" />
|
<property name="nodeService" ref="NodeService" />
|
||||||
<property name="nodeArchiveService" ref="nodeArchiveService"/>
|
<property name="nodeArchiveService" ref="nodeArchiveService"/>
|
||||||
<property name="personService" ref="PersonService" />
|
<property name="personService" ref="PersonService" />
|
||||||
|
<property name="renditions" ref="Renditions" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="DeletedNodes" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="DeletedNodes" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
@@ -1361,6 +1362,10 @@
|
|||||||
<property name="quickShareLinks" ref="QuickShareLinks"/>
|
<property name="quickShareLinks" ref="QuickShareLinks"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean class="org.alfresco.rest.api.trashcan.TrashcanRenditionsRelation">
|
||||||
|
<property name="deletedNodes" ref="DeletedNodes"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- Authentications REST API -->
|
<!-- Authentications REST API -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
@@ -25,27 +25,43 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest;
|
package org.alfresco.rest;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
|
import org.alfresco.rest.AbstractSingleNetworkSiteTest;
|
||||||
import org.alfresco.rest.api.Nodes;
|
import org.alfresco.rest.api.Nodes;
|
||||||
import org.alfresco.rest.api.tests.client.HttpResponse;
|
import org.alfresco.rest.api.tests.client.HttpResponse;
|
||||||
import org.alfresco.rest.api.tests.client.PublicApiClient;
|
import org.alfresco.rest.api.tests.client.PublicApiClient;
|
||||||
|
import org.alfresco.rest.api.tests.client.data.ContentInfo;
|
||||||
import org.alfresco.rest.api.tests.client.data.Document;
|
import org.alfresco.rest.api.tests.client.data.Document;
|
||||||
import org.alfresco.rest.api.tests.client.data.Folder;
|
import org.alfresco.rest.api.tests.client.data.Folder;
|
||||||
import org.alfresco.rest.api.tests.client.data.Node;
|
import org.alfresco.rest.api.tests.client.data.Node;
|
||||||
import org.alfresco.rest.api.tests.client.data.PathInfo;
|
import org.alfresco.rest.api.tests.client.data.PathInfo;
|
||||||
|
import org.alfresco.rest.api.tests.client.data.Rendition;
|
||||||
|
import org.alfresco.rest.api.tests.util.MultiPartBuilder;
|
||||||
import org.alfresco.rest.api.tests.util.RestApiUtil;
|
import org.alfresco.rest.api.tests.util.RestApiUtil;
|
||||||
|
import org.alfresco.rest.api.trashcan.TrashcanEntityResource;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
|
|
||||||
import java.util.Collections;
|
import com.google.common.collect.Ordering;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* V1 REST API tests for managing the user's Trashcan (ie. "deleted nodes")
|
* V1 REST API tests for managing the user's Trashcan (ie. "deleted nodes")
|
||||||
@@ -58,6 +74,9 @@ public class DeletedNodesTest extends AbstractSingleNetworkSiteTest
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected static final String URL_DELETED_NODES = "deleted-nodes";
|
protected static final String URL_DELETED_NODES = "deleted-nodes";
|
||||||
|
private static final String URL_RENDITIONS = "renditions";
|
||||||
|
|
||||||
|
private final static long DELAY_IN_MS = 500;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup() throws Exception
|
public void setup() throws Exception
|
||||||
@@ -263,6 +282,355 @@ public class DeletedNodesTest extends AbstractSingleNetworkSiteTest
|
|||||||
getSingle(URL_DELETED_NODES, createdFolder.getId(), 404);
|
getSingle(URL_DELETED_NODES, createdFolder.getId(), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests download of file/content.
|
||||||
|
* <p>GET:</p>
|
||||||
|
* {@literal <host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/<nodeId>/content}
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDownloadFileContent() throws Exception
|
||||||
|
{
|
||||||
|
setRequestContext(user1);
|
||||||
|
|
||||||
|
// Use existing test file
|
||||||
|
String fileName = "quick-1.txt";
|
||||||
|
File file = getResourceFile(fileName);
|
||||||
|
|
||||||
|
MultiPartBuilder multiPartBuilder = MultiPartBuilder.create().setFileData(new MultiPartBuilder.FileData(fileName, file));
|
||||||
|
MultiPartBuilder.MultiPartRequest reqBody = multiPartBuilder.build();
|
||||||
|
|
||||||
|
// Upload text content
|
||||||
|
HttpResponse response = post(getNodeChildrenUrl(Nodes.PATH_MY), reqBody.getBody(), null, reqBody.getContentType(), 201);
|
||||||
|
Document document = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||||
|
|
||||||
|
String contentNodeId = document.getId();
|
||||||
|
|
||||||
|
// Check the upload response
|
||||||
|
assertEquals(fileName, document.getName());
|
||||||
|
ContentInfo contentInfo = document.getContent();
|
||||||
|
assertNotNull(contentInfo);
|
||||||
|
assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, contentInfo.getMimeType());
|
||||||
|
|
||||||
|
// move the node to Trashcan
|
||||||
|
deleteNode(document.getId());
|
||||||
|
|
||||||
|
// Download text content - by default with Content-Disposition header
|
||||||
|
response = getSingle(TrashcanEntityResource.class, contentNodeId + "/content", null, 200);
|
||||||
|
|
||||||
|
String textContent = response.getResponse();
|
||||||
|
assertEquals("The quick brown fox jumps over the lazy dog", textContent);
|
||||||
|
Map<String, String> responseHeaders = response.getHeaders();
|
||||||
|
assertNotNull(responseHeaders);
|
||||||
|
assertEquals("attachment; filename=\"quick-1.txt\"; filename*=UTF-8''quick-1.txt", responseHeaders.get("Content-Disposition"));
|
||||||
|
String cacheControl = responseHeaders.get("Cache-Control");
|
||||||
|
assertNotNull(cacheControl);
|
||||||
|
assertTrue(cacheControl.contains("must-revalidate"));
|
||||||
|
assertTrue(cacheControl.contains("max-age=0"));
|
||||||
|
assertNotNull(responseHeaders.get("Expires"));
|
||||||
|
String lastModifiedHeader = responseHeaders.get(LAST_MODIFIED_HEADER);
|
||||||
|
assertNotNull(lastModifiedHeader);
|
||||||
|
Map<String, String> headers = Collections.singletonMap(IF_MODIFIED_SINCE_HEADER, lastModifiedHeader);
|
||||||
|
// Test 304 response
|
||||||
|
getSingle(URL_DELETED_NODES + "/" + contentNodeId + "/content", null, null, headers, 304);
|
||||||
|
|
||||||
|
// Use existing pdf test file
|
||||||
|
fileName = "quick.pdf";
|
||||||
|
file = getResourceFile(fileName);
|
||||||
|
byte[] originalBytes = Files.readAllBytes(Paths.get(file.getAbsolutePath()));
|
||||||
|
|
||||||
|
multiPartBuilder = MultiPartBuilder.create().setFileData(new MultiPartBuilder.FileData(fileName, file));
|
||||||
|
reqBody = multiPartBuilder.build();
|
||||||
|
|
||||||
|
// Upload binary content
|
||||||
|
response = post(getNodeChildrenUrl(Nodes.PATH_MY), reqBody.getBody(), null, reqBody.getContentType(), 201);
|
||||||
|
document = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||||
|
|
||||||
|
// move the node to Trashcan
|
||||||
|
deleteNode(document.getId());
|
||||||
|
contentNodeId = document.getId();
|
||||||
|
|
||||||
|
// Check the upload response
|
||||||
|
assertEquals(fileName, document.getName());
|
||||||
|
contentInfo = document.getContent();
|
||||||
|
assertNotNull(contentInfo);
|
||||||
|
assertEquals(MimetypeMap.MIMETYPE_PDF, contentInfo.getMimeType());
|
||||||
|
|
||||||
|
// Download binary content (as bytes) - without Content-Disposition
|
||||||
|
// header (attachment=false)
|
||||||
|
Map<String, String> params = new LinkedHashMap<>();
|
||||||
|
params.put("attachment", "false");
|
||||||
|
|
||||||
|
response = getSingle(TrashcanEntityResource.class, contentNodeId + "/content", params, 200);
|
||||||
|
byte[] bytes = response.getResponseAsBytes();
|
||||||
|
assertArrayEquals(originalBytes, bytes);
|
||||||
|
|
||||||
|
responseHeaders = response.getHeaders();
|
||||||
|
assertNotNull(responseHeaders);
|
||||||
|
assertNull(responseHeaders.get("Content-Disposition"));
|
||||||
|
assertNotNull(responseHeaders.get("Cache-Control"));
|
||||||
|
assertNotNull(responseHeaders.get("Expires"));
|
||||||
|
lastModifiedHeader = responseHeaders.get(LAST_MODIFIED_HEADER);
|
||||||
|
assertNotNull(lastModifiedHeader);
|
||||||
|
headers = Collections.singletonMap(IF_MODIFIED_SINCE_HEADER, lastModifiedHeader);
|
||||||
|
// Test 304 response
|
||||||
|
getSingle(URL_DELETED_NODES + "/" + contentNodeId + "/content", null, null, headers, 304);
|
||||||
|
|
||||||
|
// -ve - nodeId in the path parameter does not exist
|
||||||
|
getSingle(TrashcanEntityResource.class, UUID.randomUUID().toString() + "/content", params, 404);
|
||||||
|
|
||||||
|
// -ve test - Authentication failed
|
||||||
|
setRequestContext(null);
|
||||||
|
getSingle(TrashcanEntityResource.class, contentNodeId + "/content", params, 401);
|
||||||
|
|
||||||
|
// -ve - Current user does not have permission for nodeId
|
||||||
|
setRequestContext(user2);
|
||||||
|
getSingle(TrashcanEntityResource.class, contentNodeId + "/content", params, 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test retrieve renditions for deleted nodes
|
||||||
|
* <p>post:</p>
|
||||||
|
* {@literal <host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/<nodeId>/renditions}
|
||||||
|
* {@literal <host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/<nodeId>/rendition/<renditionId>}
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testListRenditions() throws Exception
|
||||||
|
{
|
||||||
|
setRequestContext(user1);
|
||||||
|
|
||||||
|
Date now = new Date();
|
||||||
|
String folder1 = "folder" + now.getTime() + "_1";
|
||||||
|
Folder createdFolder = createFolder(tDocLibNodeId, folder1, null);
|
||||||
|
assertNotNull(createdFolder);
|
||||||
|
String f1Id = createdFolder.getId();
|
||||||
|
|
||||||
|
// Create multipart request
|
||||||
|
String fileName = "quick.pdf";
|
||||||
|
File file = getResourceFile(fileName);
|
||||||
|
MultiPartBuilder multiPartBuilder = MultiPartBuilder.create().setFileData(new MultiPartBuilder.FileData(fileName, file));
|
||||||
|
MultiPartBuilder.MultiPartRequest reqBody = multiPartBuilder.build();
|
||||||
|
|
||||||
|
// Upload quick.pdf file into the folder previously created
|
||||||
|
HttpResponse response = post(getNodeChildrenUrl(f1Id), reqBody.getBody(), null, reqBody.getContentType(), 201);
|
||||||
|
Document document = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||||
|
String contentNodeId = document.getId();
|
||||||
|
|
||||||
|
// create doclib rendition and move node to trashcan
|
||||||
|
createAndGetRendition(contentNodeId, "doclib");
|
||||||
|
deleteNode(contentNodeId);
|
||||||
|
|
||||||
|
// List all renditions and check for results
|
||||||
|
PublicApiClient.Paging paging = getPaging(0, 50);
|
||||||
|
response = getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, 200);
|
||||||
|
List<Rendition> renditions = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Rendition.class);
|
||||||
|
assertTrue(renditions.size() >= 3);
|
||||||
|
|
||||||
|
// +ve test - get previously created 'doclib' rendition
|
||||||
|
response = getSingle(getDeletedNodeRenditionsUrl(contentNodeId), "doclib", 200);
|
||||||
|
Rendition doclibRendition = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Rendition.class);
|
||||||
|
|
||||||
|
assertNotNull(doclibRendition);
|
||||||
|
assertEquals(Rendition.RenditionStatus.CREATED, doclibRendition.getStatus());
|
||||||
|
ContentInfo contentInfo = doclibRendition.getContent();
|
||||||
|
assertNotNull(contentInfo);
|
||||||
|
assertEquals(MimetypeMap.MIMETYPE_IMAGE_PNG, contentInfo.getMimeType());
|
||||||
|
assertEquals("PNG Image", contentInfo.getMimeTypeName());
|
||||||
|
assertNotNull(contentInfo.getEncoding());
|
||||||
|
assertTrue(contentInfo.getSizeInBytes() > 0);
|
||||||
|
|
||||||
|
// +ve test - Add a filter on rendition 'status' and list only 'NOT_CREATED' renditions
|
||||||
|
Map<String, String> params = new HashMap<>(1);
|
||||||
|
params.put("where", "(status='NOT_CREATED')");
|
||||||
|
response = getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, params, 200);
|
||||||
|
renditions = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Rendition.class);
|
||||||
|
assertTrue(renditions.size() >= 2);
|
||||||
|
|
||||||
|
// +ve test - Add a filter on rendition 'status' and list only the CREATED renditions
|
||||||
|
params.put("where", "(status='CREATED')");
|
||||||
|
response = getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, params, 200);
|
||||||
|
renditions = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Rendition.class);
|
||||||
|
assertEquals("Only 'doclib' rendition should be returned.", 1, renditions.size());
|
||||||
|
|
||||||
|
// SkipCount=0,MaxItems=2
|
||||||
|
paging = getPaging(0, 2);
|
||||||
|
// List all available renditions
|
||||||
|
response = getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, 200);
|
||||||
|
renditions = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Rendition.class);
|
||||||
|
assertEquals(2, renditions.size());
|
||||||
|
PublicApiClient.ExpectedPaging expectedPaging = RestApiUtil.parsePaging(response.getJsonResponse());
|
||||||
|
assertEquals(2, expectedPaging.getCount().intValue());
|
||||||
|
assertEquals(0, expectedPaging.getSkipCount().intValue());
|
||||||
|
assertEquals(2, expectedPaging.getMaxItems().intValue());
|
||||||
|
assertTrue(expectedPaging.getTotalItems() >= 3);
|
||||||
|
assertTrue(expectedPaging.getHasMoreItems());
|
||||||
|
|
||||||
|
// SkipCount=1,MaxItems=3
|
||||||
|
paging = getPaging(1, 3);
|
||||||
|
// List all available renditions
|
||||||
|
response = getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, 200);
|
||||||
|
renditions = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Rendition.class);
|
||||||
|
assertEquals(2, renditions.size());
|
||||||
|
expectedPaging = RestApiUtil.parsePaging(response.getJsonResponse());
|
||||||
|
assertEquals(2, expectedPaging.getCount().intValue());
|
||||||
|
assertEquals(1, expectedPaging.getSkipCount().intValue());
|
||||||
|
assertEquals(3, expectedPaging.getMaxItems().intValue());
|
||||||
|
assertTrue(expectedPaging.getTotalItems() >= 3);
|
||||||
|
|
||||||
|
// +ve test - Test returned renditions are ordered (natural sort order)
|
||||||
|
response = getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, params, 200);
|
||||||
|
renditions = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Rendition.class);
|
||||||
|
assertTrue(Ordering.natural().isOrdered(renditions));
|
||||||
|
// Check again to make sure the ordering wasn't coincidental
|
||||||
|
response = getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, params, 200);
|
||||||
|
renditions = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Rendition.class);
|
||||||
|
assertTrue(Ordering.natural().isOrdered(renditions));
|
||||||
|
|
||||||
|
// -ve - nodeId in the path parameter does not exist
|
||||||
|
getAll(getDeletedNodeRenditionsUrl(UUID.randomUUID().toString()), paging, params, 404);
|
||||||
|
|
||||||
|
// -ve test - Create an empty text file
|
||||||
|
Document emptyDoc = createEmptyTextFile(f1Id, "d1.txt");
|
||||||
|
getAll(getDeletedNodeRenditionsUrl(emptyDoc.getId()), paging, params, 404);
|
||||||
|
|
||||||
|
// -ve - nodeId in the path parameter does not represent a file
|
||||||
|
deleteNode(f1Id);
|
||||||
|
getAll(getDeletedNodeRenditionsUrl(f1Id), paging, params, 400);
|
||||||
|
|
||||||
|
// -ve - Invalid status value
|
||||||
|
params.put("where", "(status='WRONG')");
|
||||||
|
getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, params, 400);
|
||||||
|
|
||||||
|
// -ve - Invalid filter (only 'status' is supported)
|
||||||
|
params.put("where", "(id='doclib')");
|
||||||
|
getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, params, 400);
|
||||||
|
|
||||||
|
// -ve test - Authentication failed
|
||||||
|
setRequestContext(null);
|
||||||
|
getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, params, 401);
|
||||||
|
|
||||||
|
// -ve - Current user does not have permission for nodeId
|
||||||
|
setRequestContext(user2);
|
||||||
|
getAll(getDeletedNodeRenditionsUrl(contentNodeId), paging, params, 403);
|
||||||
|
|
||||||
|
// Test get single node rendition
|
||||||
|
setRequestContext(user1);
|
||||||
|
// -ve - nodeId in the path parameter does not exist
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(UUID.randomUUID().toString()), "doclib", 404);
|
||||||
|
|
||||||
|
// -ve - renditionId in the path parameter is not registered/available
|
||||||
|
getSingle(getNodeRenditionsUrl(contentNodeId), ("renditionId" + System.currentTimeMillis()), 404);
|
||||||
|
|
||||||
|
// -ve - nodeId in the path parameter does not represent a file
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(f1Id), "doclib", 400);
|
||||||
|
|
||||||
|
// -ve test - Authentication failed
|
||||||
|
setRequestContext(null);
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(contentNodeId), "doclib", 401);
|
||||||
|
|
||||||
|
// -ve - Current user does not have permission for nodeId
|
||||||
|
setRequestContext(user2);
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(contentNodeId), "doclib", 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests download rendition.
|
||||||
|
* <p>GET:</p>
|
||||||
|
* {@literal <host>:<port>/alfresco/api/<networkId>/public/alfresco/versions/1/deleted-nodes/<nodeId>/renditions/<renditionId>/content}
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDownloadRendition() throws Exception
|
||||||
|
{
|
||||||
|
setRequestContext(user1);
|
||||||
|
|
||||||
|
// Create a folder within the site document's library
|
||||||
|
Date now = new Date();
|
||||||
|
String folder1 = "folder" + now.getTime() + "_1";
|
||||||
|
Folder createdFolder = createFolder(tDocLibNodeId, folder1, null);
|
||||||
|
assertNotNull(createdFolder);
|
||||||
|
String f1Id = createdFolder.getId();
|
||||||
|
|
||||||
|
// Create multipart request using an existing file
|
||||||
|
String fileName = "quick.pdf";
|
||||||
|
File file = getResourceFile(fileName);
|
||||||
|
MultiPartBuilder multiPartBuilder = MultiPartBuilder.create().setFileData(new MultiPartBuilder.FileData(fileName, file));
|
||||||
|
MultiPartBuilder.MultiPartRequest reqBody = multiPartBuilder.build();
|
||||||
|
|
||||||
|
// Upload quick.pdf file into 'folder'
|
||||||
|
HttpResponse response = post(getNodeChildrenUrl(f1Id), reqBody.getBody(), null, reqBody.getContentType(), 201);
|
||||||
|
Document document = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||||
|
String contentNodeId = document.getId();
|
||||||
|
|
||||||
|
Rendition rendition = createAndGetRendition(contentNodeId, "doclib");
|
||||||
|
assertNotNull(rendition);
|
||||||
|
assertEquals(Rendition.RenditionStatus.CREATED, rendition.getStatus());
|
||||||
|
deleteNode(contentNodeId);
|
||||||
|
|
||||||
|
// Download rendition - by default with Content-Disposition header
|
||||||
|
response = getSingle(getDeletedNodeRenditionsUrl(contentNodeId), "doclib/content", 200);
|
||||||
|
assertNotNull(response.getResponseAsBytes());
|
||||||
|
Map<String, String> responseHeaders = response.getHeaders();
|
||||||
|
assertNotNull(responseHeaders);
|
||||||
|
String contentDisposition = responseHeaders.get("Content-Disposition");
|
||||||
|
assertNotNull(contentDisposition);
|
||||||
|
assertTrue(contentDisposition.contains("filename=\"doclib\""));
|
||||||
|
String contentType = responseHeaders.get("Content-Type");
|
||||||
|
assertNotNull(contentType);
|
||||||
|
assertTrue(contentType.startsWith(MimetypeMap.MIMETYPE_IMAGE_PNG));
|
||||||
|
|
||||||
|
// Download rendition - without Content-Disposition header
|
||||||
|
// (attachment=false)
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params = Collections.singletonMap("attachment", "false");
|
||||||
|
response = getSingle(getDeletedNodeRenditionsUrl(contentNodeId), "doclib/content", params, 200);
|
||||||
|
assertNotNull(response.getResponseAsBytes());
|
||||||
|
responseHeaders = response.getHeaders();
|
||||||
|
assertNotNull(responseHeaders);
|
||||||
|
assertNull(responseHeaders.get("Content-Disposition"));
|
||||||
|
contentType = responseHeaders.get("Content-Type");
|
||||||
|
assertNotNull(contentType);
|
||||||
|
assertTrue(contentType.startsWith(MimetypeMap.MIMETYPE_IMAGE_PNG));
|
||||||
|
|
||||||
|
// Download rendition - with Content-Disposition header
|
||||||
|
// (attachment=true) same as default
|
||||||
|
params = Collections.singletonMap("attachment", "true");
|
||||||
|
response = getSingle(getDeletedNodeRenditionsUrl(contentNodeId), "doclib/content", params, 200);
|
||||||
|
assertNotNull(response.getResponseAsBytes());
|
||||||
|
responseHeaders = response.getHeaders();
|
||||||
|
assertNotNull(responseHeaders);
|
||||||
|
String cacheControl = responseHeaders.get("Cache-Control");
|
||||||
|
assertNotNull(cacheControl);
|
||||||
|
assertFalse(cacheControl.contains("must-revalidate"));
|
||||||
|
assertTrue(cacheControl.contains("max-age=31536000"));
|
||||||
|
contentDisposition = responseHeaders.get("Content-Disposition");
|
||||||
|
assertNotNull(contentDisposition);
|
||||||
|
assertTrue(contentDisposition.contains("filename=\"doclib\""));
|
||||||
|
contentType = responseHeaders.get("Content-Type");
|
||||||
|
assertNotNull(contentType);
|
||||||
|
assertTrue(contentType.startsWith(MimetypeMap.MIMETYPE_IMAGE_PNG));
|
||||||
|
|
||||||
|
// Test 304 response - doclib rendition (attachment=true)
|
||||||
|
String lastModifiedHeader = responseHeaders.get(LAST_MODIFIED_HEADER);
|
||||||
|
assertNotNull(lastModifiedHeader);
|
||||||
|
Map<String, String> headers = Collections.singletonMap(IF_MODIFIED_SINCE_HEADER, lastModifiedHeader);
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(contentNodeId), "doclib/content", params, headers, 304);
|
||||||
|
|
||||||
|
// -ve tests
|
||||||
|
// nodeId in the path parameter does not represent a file
|
||||||
|
deleteNode(f1Id);
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(f1Id), "doclib/content", 400);
|
||||||
|
|
||||||
|
// nodeId in the path parameter does not exist
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(UUID.randomUUID().toString()), "doclib/content", 404);
|
||||||
|
|
||||||
|
// renditionId in the path parameter is not registered/available
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(contentNodeId), ("renditionId" + System.currentTimeMillis() + "/content"), 404);
|
||||||
|
|
||||||
|
// The rendition does not exist, a placeholder is not available and the
|
||||||
|
// placeholder parameter has a value of "true"
|
||||||
|
params = Collections.singletonMap("placeholder", "true");
|
||||||
|
getSingle(getDeletedNodeRenditionsUrl(contentNodeId), ("renditionId" + System.currentTimeMillis() + "/content"), params, 404);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the deleted nodes are in the correct order.
|
* Checks the deleted nodes are in the correct order.
|
||||||
*/
|
*/
|
||||||
@@ -291,4 +659,9 @@ public class DeletedNodesTest extends AbstractSingleNetworkSiteTest
|
|||||||
assertNull("We don't show the parent id for a deleted node",aNode.getParentId());
|
assertNull("We don't show the parent id for a deleted node",aNode.getParentId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDeletedNodeRenditionsUrl(String nodeId)
|
||||||
|
{
|
||||||
|
return URL_DELETED_NODES + "/" + nodeId + "/" + URL_RENDITIONS;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.tests;
|
package org.alfresco.rest.api.tests;
|
||||||
|
|
||||||
|
|
||||||
import org.alfresco.rest.DeletedNodesTest;
|
import org.alfresco.rest.DeletedNodesTest;
|
||||||
import org.alfresco.rest.api.search.BasicSearchApiIntegrationTest;
|
import org.alfresco.rest.api.search.BasicSearchApiIntegrationTest;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@@ -53,6 +53,7 @@ import org.alfresco.service.cmr.repository.ContentService;
|
|||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||||
@@ -2114,7 +2115,7 @@ public class TestPeople extends AbstractBaseApiTest
|
|||||||
Rendition avatarR = new Rendition();
|
Rendition avatarR = new Rendition();
|
||||||
avatarR.setId("avatar");
|
avatarR.setId("avatar");
|
||||||
Renditions renditions = applicationContext.getBean("Renditions", Renditions.class);
|
Renditions renditions = applicationContext.getBean("Renditions", Renditions.class);
|
||||||
renditions.createRendition(avatarRef.getId(), avatarR, false, null);
|
renditions.createRendition(avatarRef, avatarR, false, null);
|
||||||
|
|
||||||
return avatarRef;
|
return avatarRef;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user