Merged HEAD (5.2) to 5.2.N (5.2.1)

126503 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      122758 gjames: RA-211: Added new interface for WithResponse. Revert>Java7


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126847 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 11:46:04 +00:00
parent 62144d05b0
commit 754269a751
4 changed files with 208 additions and 14 deletions

View File

@@ -33,6 +33,7 @@ import org.alfresco.rest.framework.resource.content.BinaryResource;
import org.alfresco.rest.framework.resource.content.FileBinaryResource;
import org.alfresco.rest.framework.resource.content.NodeBinaryResource;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.rest.framework.webscripts.WithResponse;
/**
* Permissible actions for binary resources of an Entity Resource
@@ -60,8 +61,24 @@ public interface BinaryResourceAction
*/
public BinaryResource readProperty (String entityId, Parameters parameters) throws EntityNotFoundException;
}
/**
* HTTP GET - Retrieve a binary resource
*/
public static interface ReadWithResponse extends ResourceAction
{
/**
* Retrieves a binary property by returning a BinaryResource object. The specific property is specified in the {@link Parameters} object.
* See {@link Parameters#hasBinaryProperty(String)} or {@link Parameters#getBinaryProperty()}
* @param entityId unique id
* @param parameters {@link Parameters}
* @return BinaryResource - Either {@link FileBinaryResource} or {@link NodeBinaryResource}
* @throws EntityNotFoundException
*/
public BinaryResource readProperty (String entityId, Parameters parameters, WithResponse withResponse) throws EntityNotFoundException;
}
/**
* HTTP DELETE - Deletes a binary resource
*/
public static interface Delete extends ResourceAction
@@ -75,8 +92,23 @@ public interface BinaryResourceAction
*/
public void deleteProperty (String entityId, Parameters parameters);
}
/**
* HTTP DELETE - Deletes a binary resource
*/
public static interface DeleteWithResponse extends ResourceAction
{
/**
* Deletes a binary property. The specific property is specified in the {@link Parameters} object.
* See {@link Parameters#hasBinaryProperty(String)} or {@link Parameters#getBinaryProperty()}
* @param entityId unique id
* @param parameters {@link Parameters}
*/
public void deleteProperty (String entityId, Parameters parameters, WithResponse withResponse);
}
/**
* HTTP PUT - Updates a binary resource if it exists, error if not
*/
public static interface Update<E> extends ResourceAction
@@ -93,4 +125,20 @@ public interface BinaryResourceAction
public E updateProperty (String entityId, BasicContentInfo contentInfo, InputStream stream, Parameters params);
}
/**
* HTTP PUT - Updates a binary resource if it exists, error if not
*/
public static interface UpdateWithResponse<E> extends ResourceAction
{
/**
* Updates a binary property. The specific property is specified in the {@link Parameters} object.
* See {@link Parameters#hasBinaryProperty(String)} or {@link Parameters#getBinaryProperty()}
* @param entityId unique id
* @param stream An inputstream
* @param contentInfo Basic information about the content stream
* @param params {@link Parameters}
*/
public E updateProperty (String entityId, BasicContentInfo contentInfo, InputStream stream, Parameters params, WithResponse withResponse);
}
}

View File

@@ -30,6 +30,7 @@ import java.util.List;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.rest.framework.webscripts.WithResponse;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.Status;
@@ -50,7 +51,15 @@ public interface EntityResourceAction
{
public List<E> create (List<E> entity, Parameters parameters);
}
/**
* HTTP POST - Create a new entity
*/
public static interface CreateWithResponse<E> extends ResourceAction
{
public List<E> create (List<E> entity, Parameters parameters, WithResponse withResponse);
}
/**
* HTTP GET - Retrieve list of entities
*/
@@ -66,17 +75,39 @@ public interface EntityResourceAction
*/
public CollectionWithPagingInfo<E> readAll (Parameters params);
}
/**
* HTTP GET - Retrieve list of entities
*/
public static interface ReadWithResponse<E> extends ResourceAction
{
/**
* Reads all the entries from the collection.
*
* Paging information is provided.
* @param params - will never be null and will have the PAGING default values
* @return CollectionWithPagingInfo<E>
*/
public CollectionWithPagingInfo<E> readAll (Parameters params, WithResponse withResponse);
}
/**
* HTTP GET - Retrieve an entity by its unique id
*/
public static interface ReadById<E> extends ResourceAction
{
public E readById (String id, Parameters parameters) throws EntityNotFoundException;
// public E readById (String id, Parameters parameters, Status status, Cache cache) throws EntityNotFoundException;
}
/**
* HTTP GET - Retrieve an entity by its unique id
*/
public static interface ReadByIdWithResponse<E> extends ResourceAction
{
public E readById (String id, Parameters parameters, WithResponse withResponse) throws EntityNotFoundException;
}
/**
* HTTP PUT - Update entity if it exists, error if not
*/
@@ -84,7 +115,15 @@ public interface EntityResourceAction
{
public E update (String id, E entity, Parameters parameters);
}
/**
* HTTP PUT - Update entity if it exists, error if not
*/
public static interface UpdateWithResponse<E> extends ResourceAction
{
public E update (String id, E entity, Parameters parameters, WithResponse withResponse);
}
/**
* HTTP DELETE - Deletes an entity
*/
@@ -92,4 +131,12 @@ public interface EntityResourceAction
{
public void delete (String id, Parameters parameters);
}
/**
* HTTP DELETE - Deletes an entity
*/
public static interface DeleteWithResponse extends ResourceAction
{
public void delete (String id, Parameters parameters, WithResponse withResponse);
}
}

View File

@@ -30,6 +30,7 @@ import java.util.List;
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.rest.framework.webscripts.WithResponse;
/**
* Permissible actions for an Relationship Resources
@@ -55,7 +56,23 @@ public interface RelationshipResourceAction
*/
public CollectionWithPagingInfo<E> readAll (String entityResourceId, Parameters params);
}
/**
* HTTP GET - Retrieve list of related entities by its related entityResource Id
*/
public static interface ReadWithResponse<E> extends ResourceAction
{
/**
* Reads all the relationship entities from the collection using the related entityResourceId.
*
* Paging information is provided.
* @param entityResourceId Entity resource context for this relationship
* @param params - will never be null and will have the PAGING default values
* @return CollectionWithPagingInfo<E>
*/
public CollectionWithPagingInfo<E> readAll (String entityResourceId, Parameters params, WithResponse withResponse);
}
/**
* HTTP GET - Retrieve a relation by its unique id & entity context
*/
@@ -63,7 +80,15 @@ public interface RelationshipResourceAction
{
public E readById (String entityResourceId, String id, Parameters parameters) throws RelationshipResourceNotFoundException;
}
/**
* HTTP GET - Retrieve a relation by its unique id & entity context
*/
public static interface ReadByIdWithResponse<E> extends ResourceAction
{
public E readById (String entityResourceId, String id, Parameters parameters, WithResponse withResponse) throws RelationshipResourceNotFoundException;
}
/**
* HTTP PUT - Update entity (by its related entityResource Id) if it exists, error if not
*/
@@ -71,7 +96,15 @@ public interface RelationshipResourceAction
{
public E update (String entityResourceId, E entity, Parameters parameters);
}
/**
* HTTP PUT - Update entity (by its related entityResource Id) if it exists, error if not
*/
public static interface UpdateWithResponse<E> extends ResourceAction
{
public E update (String entityResourceId, E entity, Parameters parameters, WithResponse withResponse);
}
/**
* HTTP POST - Create one or more new entity
*/
@@ -79,7 +112,15 @@ public interface RelationshipResourceAction
{
public List<E> create (String entityResourceId, List<E> entity, Parameters parameters);
}
/**
* HTTP POST - Create one or more new entity
*/
public static interface CreateWithResponse<E> extends ResourceAction
{
public List<E> create (String entityResourceId, List<E> entity, Parameters parameters, WithResponse withResponse);
}
/**
* HTTP DELETE - Deletes a relation by its unique id & entity context
*/
@@ -88,4 +129,11 @@ public interface RelationshipResourceAction
public void delete (String entityResourceId, String id, Parameters parameters);
}
/**
* HTTP DELETE - Deletes a relation by its unique id & entity context
*/
public static interface DeleteWithResponse extends ResourceAction
{
public void delete (String entityResourceId, String id, Parameters parameters, WithResponse withResponse);
}
}

View File

@@ -6,6 +6,7 @@ import org.alfresco.rest.framework.resource.content.BinaryResource;
import org.alfresco.rest.framework.resource.content.FileBinaryResource;
import org.alfresco.rest.framework.resource.content.NodeBinaryResource;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.rest.framework.webscripts.WithResponse;
import java.io.InputStream;
@@ -36,7 +37,24 @@ public interface RelationshipResourceBinaryAction
*/
public BinaryResource readProperty(String entityId, String entityResourceId, Parameters parameters) throws EntityNotFoundException;
}
/**
* HTTP GET - Retrieve a binary resource
*/
public static interface ReadWithResponse extends ResourceAction
{
/**
* Retrieves a binary property by returning a BinaryResource object. The specific property is specified in the {@link Parameters} object.
* See {@link Parameters#hasBinaryProperty(String)} or {@link Parameters#getBinaryProperty()}
* @param entityId unique id
* @param entityResourceId Entity resource context for this relationship
* @param parameters {@link Parameters}
* @return BinaryResource - Either {@link FileBinaryResource} or {@link NodeBinaryResource}
* @throws EntityNotFoundException
*/
public BinaryResource readProperty(String entityId, String entityResourceId, Parameters parameters, WithResponse withResponse) throws EntityNotFoundException;
}
/**
* HTTP DELETE - Deletes a binary resource
*/
@@ -52,7 +70,22 @@ public interface RelationshipResourceBinaryAction
*/
public void deleteProperty(String entityId, String entityResourceId, Parameters parameters);
}
/**
* HTTP DELETE - Deletes a binary resource
*/
public static interface DeleteWithResponse extends ResourceAction
{
/**
* Deletes a binary property. The specific property is specified in the {@link Parameters} object.
* See {@link Parameters#hasBinaryProperty(String)} or {@link Parameters#getBinaryProperty()}
* @param entityId unique id
* @param entityResourceId Entity resource context for this relationship
* @param parameters {@link Parameters}
*/
public void deleteProperty(String entityId, String entityResourceId, Parameters parameters, WithResponse withResponse);
}
/**
* HTTP PUT - Updates a binary resource if it exists, error if not
*/
@@ -71,4 +104,22 @@ public interface RelationshipResourceBinaryAction
public E updateProperty(String entityId, String entityResourceId, BasicContentInfo contentInfo, InputStream stream, Parameters params);
}
/**
* HTTP PUT - Updates a binary resource if it exists, error if not
*/
public static interface UpdateWithResponse<E> extends ResourceAction
{
/**
* Updates a binary property. The specific property is specified in the {@link Parameters} object.
* See {@link Parameters#hasBinaryProperty(String)} or {@link Parameters#getBinaryProperty()}
* @param entityId unique id
* @param entityResourceId Entity resource context for this relationship
* @param stream An inputstream
* @param contentInfo Basic information about the content stream
* @param params {@link Parameters}
*/
public E updateProperty(String entityId, String entityResourceId, BasicContentInfo contentInfo,
InputStream stream, Parameters params, WithResponse withResponse);
}
}