Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)

122164 gjames: RA-823 adding "includeSource" param


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126452 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 10:57:28 +00:00
parent 2795628608
commit 3b6cad99e6
5 changed files with 23 additions and 10 deletions

View File

@@ -33,7 +33,7 @@ public class Params implements Parameters
private final Status status;
//Constants
private static final RecognizedParams NULL_PARAMS = new RecognizedParams(null, null, null, null, null, null, null);
private static final RecognizedParams NULL_PARAMS = new RecognizedParams(null, null, null, null, null, null, null, false);
private static final BasicContentInfo DEFAULT_CONTENT_INFO = new ContentInfoImpl(MimetypeMap.MIMETYPE_BINARY, "UTF-8", -1, null);
protected Params(String entityId, String relationshipId, Object passedIn, InputStream stream, String addressedProperty, RecognizedParams recognizedParams, BasicContentInfo contentInfo)
@@ -51,7 +51,7 @@ public class Params implements Parameters
public static Params valueOf(BeanPropertiesFilter paramFilter, String entityId)
{
return new Params(entityId, null, null, null, null, new RecognizedParams(null, null, paramFilter, null, null, null, null), null);
return new Params(entityId, null, null, null, null, new RecognizedParams(null, null, paramFilter, null, null, null, null, false), null);
}
public static Params valueOf(String entityId, String relationshipId)
@@ -104,6 +104,11 @@ public class Params implements Parameters
return this.recognizedParams.filter;
}
public boolean includeSource()
{
return this.recognizedParams.includeSource;
}
public Map<String, BeanPropertiesFilter> getRelationsFilter()
{
return this.recognizedParams.relationshipFilter;
@@ -139,6 +144,8 @@ public class Params implements Parameters
builder.append(this.recognizedParams.filter);
builder.append(", relationshipFilter=");
builder.append(this.recognizedParams.relationshipFilter);
builder.append(", includeSource=");
builder.append(this.recognizedParams.includeSource);
builder.append(", addressedProperty=");
builder.append(this.addressedProperty);
builder.append("]");
@@ -222,10 +229,11 @@ public class Params implements Parameters
private final Query query;
private final List<String> select;
private final List<SortColumn> sorting;
private final boolean includeSource;
@SuppressWarnings("unchecked")
public RecognizedParams(Map<String, String[]> requestParameters, Paging paging, BeanPropertiesFilter filter, Map<String, BeanPropertiesFilter> relationshipFilter, List<String> select,
Query query, List<SortColumn> sorting)
Query query, List<SortColumn> sorting, boolean includeSource)
{
super();
this.requestParameters = requestParameters;
@@ -235,6 +243,7 @@ public class Params implements Parameters
this.relationshipFilter = (Map<String, BeanPropertiesFilter>) (relationshipFilter==null?Collections.emptyMap():relationshipFilter);
this.select = (List<String>) (select==null?Collections.emptyList():select);
this.sorting = (List<SortColumn>) (sorting==null?Collections.emptyList():sorting);
this.includeSource = includeSource;
}
}

View File

@@ -90,7 +90,8 @@ public class ResourceWebScriptHelper
public static final String PARAM_ORDERBY = "orderBy";
public static final String PARAM_WHERE = "where";
public static final String PARAM_SELECT = "select";
public static final List<String> KNOWN_PARAMS = Arrays.asList(PARAM_RELATIONS,PARAM_FILTER_PROPS,PARAM_PAGING_SKIP,PARAM_PAGING_MAX, PARAM_ORDERBY, PARAM_WHERE, PARAM_SELECT);
public static final String PARAM_INCLUDE_SOURCE_ENTITY = "includeSource";
public static final List<String> KNOWN_PARAMS = Arrays.asList(PARAM_RELATIONS,PARAM_FILTER_PROPS,PARAM_PAGING_SKIP,PARAM_PAGING_MAX, PARAM_ORDERBY, PARAM_WHERE, PARAM_SELECT, PARAM_INCLUDE_SOURCE_ENTITY);
private ResourceLocator locator;
@@ -687,11 +688,12 @@ public class ResourceWebScriptHelper
Map<String, BeanPropertiesFilter> relationFilter = getRelationFilter(req.getParameter(ResourceWebScriptHelper.PARAM_RELATIONS));
Query whereQuery = getWhereClause(req.getParameter(ResourceWebScriptHelper.PARAM_WHERE));
Map<String, String[]> requestParams = getRequestParameters(req);
boolean includeSource = Boolean.valueOf(req.getParameter(ResourceWebScriptHelper.PARAM_INCLUDE_SOURCE_ENTITY));
List<String> theSelect = getSelectClause(req.getParameter(ResourceWebScriptHelper.PARAM_SELECT));
BeanPropertiesFilter filter = getFilter(req.getParameter(ResourceWebScriptHelper.PARAM_FILTER_PROPS), theSelect);
return new RecognizedParams(requestParams, paging, filter, relationFilter, theSelect, whereQuery, sorting);
return new RecognizedParams(requestParams, paging, filter, relationFilter, theSelect, whereQuery, sorting, includeSource);
}
/**

View File

@@ -22,17 +22,17 @@ public class ParamsExtender extends Params
public static Params valueOf(Map<String, BeanPropertiesFilter> rFilter, String entityId)
{
return new ParamsExtender(entityId, null, null, null, null, new Params.RecognizedParams(null, null, null, rFilter, null, null, null));
return new ParamsExtender(entityId, null, null, null, null, new Params.RecognizedParams(null, null, null, rFilter, null, null, null, false));
}
public static Params valueOf(Paging paging, String entityId)
{
return new ParamsExtender(entityId, null, null, null, null, new Params.RecognizedParams(null, paging, null, null, null, null, null));
return new ParamsExtender(entityId, null, null, null, null, new Params.RecognizedParams(null, paging, null, null, null, null, null, false));
}
public static Params valueOf(Map<String, String[]> params)
{
return new ParamsExtender(null, null, null, null, null, new Params.RecognizedParams(params, null, null, null, null, null, null));
return new ParamsExtender(null, null, null, null, null, new Params.RecognizedParams(params, null, null, null, null, null, null, false));
}
}

View File

@@ -85,12 +85,14 @@ public class ParamsExtractorTests
params = extractor.extractParams(mockEntity(), request);
assertNotNull(params);
assertNotNull(params.getRelationsFilter());
assertFalse(params.includeSource());
templateVars.put(ResourceLocator.RELATIONSHIP_ID, "45678");
params = extractor.extractParams(mockRelationship(), request);
assertNotNull(params);
assertEquals("1234", params.getEntityId());
assertEquals("45678", params.getRelationshipId());
assertFalse(params.includeSource());
testExtractAddressedParams(templateVars, request, extractor);
}

View File

@@ -216,7 +216,7 @@ public class ProcessesImplTest extends TestCase
private CollectionWithPagingInfo<ProcessInfo> queryActiveProcessesAndAssertResult(int skipCount, int maxItems)
{
Query query = ResourceWebScriptHelper.getWhereClause(QUERY_STATUS_ACTIVE);
Parameters parameters = Params.valueOf(new RecognizedParams(null, Paging.valueOf(skipCount, maxItems), null, null, null, query, null), null, null);
Parameters parameters = Params.valueOf(new RecognizedParams(null, Paging.valueOf(skipCount, maxItems), null, null, null, query, null, false), null, null);
CollectionWithPagingInfo<ProcessInfo> result = processes.getProcesses(parameters);