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

126493 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      122640 gjames: RA-211: Renamed ResponseCallBack to WithResponse (because its not a callback)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126837 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 11:44:37 +00:00
parent a6cf35a715
commit 5e3016c92c
14 changed files with 24 additions and 43 deletions

View File

@@ -152,7 +152,7 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
{
final String entityCollectionName = ResourceInspector.findEntityCollectionNameName(resource.getMetaData());
final ResourceOperation operation = resource.getMetaData().getOperation(getHttpMethod());
final ResponseCallBack callBack = new ResponseCallBack(operation.getSuccessStatus(),DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
final WithResponse callBack = new WithResponse(operation.getSuccessStatus(),DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
Object toReturn = transactionService.getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionHelper.RetryingTransactionCallback<Object>()
{
@@ -217,7 +217,7 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
setContentInfoOnResponse(res,contentInfo);
}
protected void setResponse(final WebScriptResponse res, ResponseCallBack withResponse)
protected void setResponse(final WebScriptResponse res, WithResponse withResponse)
{
setResponse(res, withResponse.getStatus(), withResponse.getCache(), withResponse.getContentInfo(), withResponse.getHeaders());
}

View File

@@ -114,7 +114,7 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
* @return anObject the result of the execute
*/
@Override
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse)
public Object executeAction(ResourceWithMetadata resource, Params params, WithResponse withResponse)
{
switch (resource.getMetaData().getType())
{
@@ -168,7 +168,7 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
public Void execute(final ResourceWithMetadata resource, final Params params, final WebScriptResponse res, boolean isReadOnly)
{
final ResourceOperation operation = resource.getMetaData().getOperation(HttpMethod.DELETE);
final ResponseCallBack callBack = new ResponseCallBack(operation.getSuccessStatus(),DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
final WithResponse callBack = new WithResponse(operation.getSuccessStatus(),DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
transactionService.getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionCallback<Void>()
{

View File

@@ -25,11 +25,8 @@
*/
package org.alfresco.rest.framework.webscripts;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.rest.framework.core.ResourceInspector;
import org.alfresco.rest.framework.core.ResourceLocator;
import org.alfresco.rest.framework.core.ResourceMetadata;
import org.alfresco.rest.framework.core.ResourceOperation;
import org.alfresco.rest.framework.core.ResourceWithMetadata;
import org.alfresco.rest.framework.core.exceptions.DeletedResourceException;
import org.alfresco.rest.framework.core.exceptions.UnsupportedResourceOperationException;
@@ -40,17 +37,13 @@ import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAct
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.content.ContentInfo;
import org.alfresco.rest.framework.resource.content.NodeBinaryResource;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Params;
import org.alfresco.rest.framework.resource.parameters.Params.RecognizedParams;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
import org.springframework.http.HttpMethod;
/**
@@ -124,7 +117,7 @@ public class ResourceWebScriptGet extends AbstractResourceWebScript implements P
* @return anObject the result of the execute
*/
@Override
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse) throws Throwable
public Object executeAction(ResourceWithMetadata resource, Params params, WithResponse withResponse) throws Throwable
{
switch (resource.getMetaData().getType())

View File

@@ -637,7 +637,7 @@ public class ResourceWebScriptHelper
paramFilter = filters.get(resourceKey);
}
final Params executionParams = Params.valueOf(paramFilter, uniqueEntityId, params.getRequest());
final ResponseCallBack callBack = new ResponseCallBack(Status.STATUS_OK,ApiWebScript.DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
final WithResponse callBack = new WithResponse(Status.STATUS_OK,ApiWebScript.DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
//Read only because this only occurs for GET requests
Object result = executor.executeAction(resource, executionParams, callBack);
return processAdditionsToTheResponse(null, api, null, executionParams, result);

View File

@@ -28,9 +28,7 @@ package org.alfresco.rest.framework.webscripts;
import java.util.Arrays;
import java.util.List;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.rest.framework.core.OperationResourceMetaData;
import org.alfresco.rest.framework.core.ResourceInspector;
import org.alfresco.rest.framework.core.ResourceInspectorUtil;
import org.alfresco.rest.framework.core.ResourceLocator;
import org.alfresco.rest.framework.core.ResourceMetadata;
@@ -48,10 +46,8 @@ import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Params;
import org.alfresco.rest.framework.resource.parameters.Params.RecognizedParams;
import org.apache.commons.lang.StringUtils;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptRequestImpl;
import org.springframework.extensions.webscripts.WebScriptResponse;
import org.springframework.extensions.webscripts.servlet.FormData;
import org.springframework.http.HttpMethod;
@@ -217,7 +213,7 @@ public class ResourceWebScriptPost extends AbstractResourceWebScript implements
* @return anObject the result of the execute
*/
@Override
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse) throws Throwable
public Object executeAction(ResourceWithMetadata resource, Params params, WithResponse withResponse) throws Throwable
{
final Object resObj = resource.getResource();

View File

@@ -30,8 +30,6 @@ import java.io.InputStream;
import java.util.Locale;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.rest.framework.core.ResourceInspector;
import org.alfresco.rest.framework.core.ResourceLocator;
import org.alfresco.rest.framework.core.ResourceMetadata;
import org.alfresco.rest.framework.core.ResourceOperation;
@@ -43,16 +41,13 @@ import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAct
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.BasicContentInfo;
import org.alfresco.rest.framework.resource.content.BinaryResource;
import org.alfresco.rest.framework.resource.content.ContentInfoImpl;
import org.alfresco.rest.framework.resource.parameters.Params;
import org.alfresco.rest.framework.resource.parameters.Params.RecognizedParams;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
import org.springframework.extensions.webscripts.WrappingWebScriptRequest;
import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest;
import org.springframework.http.HttpMethod;
@@ -186,7 +181,7 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
* @return anObject the result of the execute
*/
@Override
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse) throws Throwable
public Object executeAction(ResourceWithMetadata resource, Params params, WithResponse withResponse) throws Throwable
{
switch (resource.getMetaData().getType())
{

View File

@@ -13,14 +13,14 @@ import java.util.Map;
*
* @author Gethin James
*/
public class ResponseCallBack
public class WithResponse
{
private ContentInfo contentInfo;
private int status;
private Map<String, String> headers;
private Cache cache;
public ResponseCallBack(int status, ContentInfo contentInfo, Cache cache)
public WithResponse(int status, ContentInfo contentInfo, Cache cache)
{
this.contentInfo = contentInfo;
this.status = status;