mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126520 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 122978 jvonka: RA-766: Update REST fwk - implement "include" query param (used by nodes & shared-links) and deprecate "select" (still used by tasks & cmm). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126864 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -197,10 +197,10 @@ public interface Nodes
|
|||||||
String PARAM_AUTO_RENAME = "autoRename";
|
String PARAM_AUTO_RENAME = "autoRename";
|
||||||
String PARAM_PERMANENT = "permanent";
|
String PARAM_PERMANENT = "permanent";
|
||||||
|
|
||||||
String PARAM_SELECT_PROPERTIES = "properties";
|
String PARAM_INCLUDE_PROPERTIES = "properties";
|
||||||
String PARAM_SELECT_PATH = "path";
|
String PARAM_INCLUDE_PATH = "path";
|
||||||
String PARAM_SELECT_ASPECTNAMES = "aspectNames";
|
String PARAM_INCLUDE_ASPECTNAMES = "aspectNames";
|
||||||
String PARAM_SELECT_ISLINK = "isLink";
|
String PARAM_INCLUDE_ISLINK = "isLink";
|
||||||
|
|
||||||
String PARAM_ISFOLDER = "isFolder";
|
String PARAM_ISFOLDER = "isFolder";
|
||||||
String PARAM_ISFILE = "isFile";
|
String PARAM_ISFILE = "isFile";
|
||||||
|
@@ -655,14 +655,14 @@ public class NodesImpl implements Nodes
|
|||||||
|
|
||||||
private Node getFolderOrDocumentFullInfo(NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, Parameters parameters)
|
private Node getFolderOrDocumentFullInfo(NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, Parameters parameters)
|
||||||
{
|
{
|
||||||
List<String> selectParam = new ArrayList<>();
|
List<String> includeParam = new ArrayList<>();
|
||||||
selectParam.addAll(parameters.getSelectedProperties());
|
includeParam.addAll(parameters.getInclude());
|
||||||
|
|
||||||
// Add basic info for single get (above & beyond minimal that is used for listing collections)
|
// Add basic info for single get (above & beyond minimal that is used for listing collections)
|
||||||
selectParam.add(PARAM_SELECT_ASPECTNAMES);
|
includeParam.add(PARAM_INCLUDE_ASPECTNAMES);
|
||||||
selectParam.add(PARAM_SELECT_PROPERTIES);
|
includeParam.add(PARAM_INCLUDE_PROPERTIES);
|
||||||
|
|
||||||
return getFolderOrDocument(nodeRef, parentNodeRef, nodeTypeQName, selectParam, null);
|
return getFolderOrDocument(nodeRef, parentNodeRef, nodeTypeQName, includeParam, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List<String> selectParam, Map<String,UserInfo> mapUserInfo)
|
private Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List<String> selectParam, Map<String,UserInfo> mapUserInfo)
|
||||||
@@ -673,7 +673,7 @@ public class NodesImpl implements Nodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
PathInfo pathInfo = null;
|
PathInfo pathInfo = null;
|
||||||
if (selectParam.contains(PARAM_SELECT_PATH))
|
if (selectParam.contains(PARAM_INCLUDE_PATH))
|
||||||
{
|
{
|
||||||
pathInfo = lookupPathInfo(nodeRef);
|
pathInfo = lookupPathInfo(nodeRef);
|
||||||
}
|
}
|
||||||
@@ -719,12 +719,12 @@ public class NodesImpl implements Nodes
|
|||||||
node.setProperties(mapFromNodeProperties(properties, selectParam, mapUserInfo));
|
node.setProperties(mapFromNodeProperties(properties, selectParam, mapUserInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectParam.contains(PARAM_SELECT_ASPECTNAMES))
|
if (selectParam.contains(PARAM_INCLUDE_ASPECTNAMES))
|
||||||
{
|
{
|
||||||
node.setAspectNames(mapFromNodeAspects(nodeService.getAspects(nodeRef)));
|
node.setAspectNames(mapFromNodeAspects(nodeService.getAspects(nodeRef)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectParam.contains(PARAM_SELECT_ISLINK))
|
if (selectParam.contains(PARAM_INCLUDE_ISLINK))
|
||||||
{
|
{
|
||||||
boolean isLink = isSubClass(nodeTypeQName, ContentModel.TYPE_LINK);
|
boolean isLink = isSubClass(nodeTypeQName, ContentModel.TYPE_LINK);
|
||||||
node.setIsLink(isLink);
|
node.setIsLink(isLink);
|
||||||
@@ -852,7 +852,7 @@ public class NodesImpl implements Nodes
|
|||||||
{
|
{
|
||||||
List<QName> selectedProperties;
|
List<QName> selectedProperties;
|
||||||
|
|
||||||
if ((selectParam.size() == 0) || selectParam.contains(PARAM_SELECT_PROPERTIES))
|
if ((selectParam.size() == 0) || selectParam.contains(PARAM_INCLUDE_PROPERTIES))
|
||||||
{
|
{
|
||||||
// return all properties
|
// return all properties
|
||||||
selectedProperties = new ArrayList<>(nodeProps.size());
|
selectedProperties = new ArrayList<>(nodeProps.size());
|
||||||
@@ -929,7 +929,7 @@ public class NodesImpl implements Nodes
|
|||||||
throw new InvalidArgumentException("NodeId of folder is expected: " + parentNodeRef.getId());
|
throw new InvalidArgumentException("NodeId of folder is expected: " + parentNodeRef.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> selectParam = parameters.getSelectedProperties();
|
final List<String> includeParam = parameters.getInclude();
|
||||||
|
|
||||||
boolean includeFolders = true;
|
boolean includeFolders = true;
|
||||||
boolean includeFiles = true;
|
boolean includeFiles = true;
|
||||||
@@ -1038,7 +1038,7 @@ public class NodesImpl implements Nodes
|
|||||||
FileInfo fInfo = page.get(index);
|
FileInfo fInfo = page.get(index);
|
||||||
|
|
||||||
// minimal info by default (unless "select"ed otherwise)
|
// minimal info by default (unless "select"ed otherwise)
|
||||||
return getFolderOrDocument(fInfo.getNodeRef(), parentNodeRef, fInfo.getType(), selectParam, mapUserInfo);
|
return getFolderOrDocument(fInfo.getNodeRef(), parentNodeRef, fInfo.getType(), includeParam, mapUserInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1051,7 +1051,7 @@ public class NodesImpl implements Nodes
|
|||||||
Node sourceEntity = null;
|
Node sourceEntity = null;
|
||||||
if (parameters.includeSource())
|
if (parameters.includeSource())
|
||||||
{
|
{
|
||||||
sourceEntity = getFolderOrDocument(parentNodeRef, null, null, selectParam, mapUserInfo);
|
sourceEntity = getFolderOrDocument(parentNodeRef, null, null, includeParam, mapUserInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1913,7 +1913,7 @@ public class NodesImpl implements Nodes
|
|||||||
*/
|
*/
|
||||||
protected List<QName> createQNames(List<String> qnameStrList)
|
protected List<QName> createQNames(List<String> qnameStrList)
|
||||||
{
|
{
|
||||||
String PREFIX = PARAM_SELECT_PROPERTIES+"/";
|
String PREFIX = PARAM_INCLUDE_PROPERTIES +"/";
|
||||||
|
|
||||||
List<QName> result = new ArrayList<>(qnameStrList.size());
|
List<QName> result = new ArrayList<>(qnameStrList.size());
|
||||||
for (String str : qnameStrList)
|
for (String str : qnameStrList)
|
||||||
|
@@ -78,9 +78,7 @@ import org.apache.commons.logging.Log;
|
|||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
import org.springframework.extensions.webscripts.WebScriptException;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -184,7 +182,7 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
|||||||
{
|
{
|
||||||
public QuickShareLink doWork() throws Exception
|
public QuickShareLink doWork() throws Exception
|
||||||
{
|
{
|
||||||
return getQuickShareInfo(sharedId, noAuth, parameters.getSelectedProperties());
|
return getQuickShareInfo(sharedId, noAuth, parameters.getInclude());
|
||||||
}
|
}
|
||||||
}, networkTenantDomain);
|
}, networkTenantDomain);
|
||||||
}
|
}
|
||||||
@@ -309,7 +307,7 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
|||||||
|
|
||||||
boolean noAuth = (AuthenticationUtil.getRunAsUser() == null);
|
boolean noAuth = (AuthenticationUtil.getRunAsUser() == null);
|
||||||
|
|
||||||
List<String> selectParam = parameters.getSelectedProperties();
|
List<String> includeParam = parameters.getInclude();
|
||||||
|
|
||||||
for (QuickShareLink qs : nodeIds)
|
for (QuickShareLink qs : nodeIds)
|
||||||
{
|
{
|
||||||
@@ -336,7 +334,7 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
QuickShareDTO qsDto = quickShareService.shareContent(nodeRef);
|
QuickShareDTO qsDto = quickShareService.shareContent(nodeRef);
|
||||||
result.add(getQuickShareInfo(qsDto.getId(), noAuth, selectParam));
|
result.add(getQuickShareInfo(qsDto.getId(), noAuth, includeParam));
|
||||||
}
|
}
|
||||||
catch (InvalidNodeRefException inre)
|
catch (InvalidNodeRefException inre)
|
||||||
{
|
{
|
||||||
@@ -444,12 +442,12 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
|||||||
|
|
||||||
List<QuickShareLink> qsLinks = new ArrayList<>(results.length());
|
List<QuickShareLink> qsLinks = new ArrayList<>(results.length());
|
||||||
|
|
||||||
List<String> selectParam = parameters.getSelectedProperties();
|
List<String> includeParam = parameters.getInclude();
|
||||||
|
|
||||||
for (ResultSetRow row : results)
|
for (ResultSetRow row : results)
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = row.getNodeRef();
|
NodeRef nodeRef = row.getNodeRef();
|
||||||
qsLinks.add(getQuickShareInfo(nodeRef, false, selectParam));
|
qsLinks.add(getQuickShareInfo(nodeRef, false, includeParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
results.close();
|
results.close();
|
||||||
|
@@ -32,7 +32,6 @@ import org.alfresco.rest.framework.jacksonextensions.BeanPropertiesFilter;
|
|||||||
import org.alfresco.rest.framework.resource.content.BasicContentInfo;
|
import org.alfresco.rest.framework.resource.content.BasicContentInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.where.Query;
|
import org.alfresco.rest.framework.resource.parameters.where.Query;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
|
||||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +48,7 @@ public interface Parameters
|
|||||||
* @param parameterName String
|
* @param parameterName String
|
||||||
* @return String The Parameter value
|
* @return String The Parameter value
|
||||||
*/
|
*/
|
||||||
public String getParameter(String parameterName);
|
String getParameter(String parameterName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a single request parameter passed in by the user.
|
* Gets a single request parameter passed in by the user.
|
||||||
@@ -61,7 +60,7 @@ public interface Parameters
|
|||||||
* @return The Parameter value
|
* @return The Parameter value
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public T getParameter(String parameterName, Class<T> clazz) throws InvalidArgumentException;
|
T getParameter(String parameterName, Class<T> clazz) throws InvalidArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a representation of the Paging of collections of resources, with skip count and max items.
|
* Returns a representation of the Paging of collections of resources, with skip count and max items.
|
||||||
@@ -69,21 +68,21 @@ public interface Parameters
|
|||||||
* Specified by the "skipCount" and "maxItems" request parameters.
|
* Specified by the "skipCount" and "maxItems" request parameters.
|
||||||
* @return Paging Paging information
|
* @return Paging Paging information
|
||||||
*/
|
*/
|
||||||
public Paging getPaging();
|
Paging getPaging();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a List of {@link SortColumn} for sorting properties.
|
* Returns a List of {@link SortColumn} for sorting properties.
|
||||||
* Specified by the "orderBy" request parameter.
|
* Specified by the "orderBy" request parameter.
|
||||||
* @return List of {@link SortColumn}
|
* @return List of {@link SortColumn}
|
||||||
*/
|
*/
|
||||||
public List<SortColumn> getSorting();
|
List<SortColumn> getSorting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link BeanPropertiesFilter} for filtering out properties.
|
* Returns a {@link BeanPropertiesFilter} for filtering out properties.
|
||||||
* Specified by the "properties" request parameter.
|
* Specified by the "properties" request parameter.
|
||||||
* @return BeanPropertiesFilter {@link BeanPropertiesFilter}
|
* @return BeanPropertiesFilter {@link BeanPropertiesFilter}
|
||||||
*/
|
*/
|
||||||
public BeanPropertiesFilter getFilter();
|
BeanPropertiesFilter getFilter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the specified property was requested.
|
* Indicates if the specified property was requested.
|
||||||
@@ -91,13 +90,13 @@ public interface Parameters
|
|||||||
* Specified as part of the url request.
|
* Specified as part of the url request.
|
||||||
* @return true if the propertyName was specified as part of the url request
|
* @return true if the propertyName was specified as part of the url request
|
||||||
*/
|
*/
|
||||||
public boolean hasBinaryProperty(String propertyName);
|
boolean hasBinaryProperty(String propertyName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of the property that was requested.
|
* Gets the name of the property that was requested.
|
||||||
* @return String the propertyName
|
* @return String the propertyName
|
||||||
*/
|
*/
|
||||||
public String getBinaryProperty();
|
String getBinaryProperty();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the source entity should be includes in the request.
|
* Indicates if the source entity should be includes in the request.
|
||||||
@@ -112,24 +111,32 @@ public interface Parameters
|
|||||||
* Specified by the "WHERE" request parameter.
|
* Specified by the "WHERE" request parameter.
|
||||||
* @return Query {@link Query}
|
* @return Query {@link Query}
|
||||||
*/
|
*/
|
||||||
public Query getQuery();
|
Query getQuery();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of property names passed in the request using the json pointer syntax
|
* A list of property names passed in the request using the json pointer syntax
|
||||||
* Specified by the "SELECT" request parameter.
|
* Specified by the "SELECT" request parameter.
|
||||||
* @return List<String> the propertyNames
|
* @return List<String> the propertyNames
|
||||||
*/
|
*/
|
||||||
public List<String> getSelectedProperties();
|
@Deprecated
|
||||||
|
List<String> getSelectedProperties();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of property names passed in the request using the json pointer syntax
|
||||||
|
* Specified by the "INCLUDE" request parameter.
|
||||||
|
* @return List<String> the propertyNames
|
||||||
|
*/
|
||||||
|
List<String> getInclude();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the basic information about content, typically taken from a HTTPServletRequest.
|
* Gets the basic information about content, typically taken from a HTTPServletRequest.
|
||||||
* @return BasicContentInfo the content info
|
* @return BasicContentInfo the content info
|
||||||
*/
|
*/
|
||||||
public BasicContentInfo getContentInfo();
|
BasicContentInfo getContentInfo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets access to the entire webscript request.
|
* Gets access to the entire webscript request.
|
||||||
* @return WebScriptRequest
|
* @return WebScriptRequest
|
||||||
*/
|
*/
|
||||||
public WebScriptRequest getRequest();
|
WebScriptRequest getRequest();
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ public class Params implements Parameters
|
|||||||
private final WebScriptRequest request;
|
private final WebScriptRequest request;
|
||||||
|
|
||||||
//Constants
|
//Constants
|
||||||
private static final RecognizedParams NULL_PARAMS = new RecognizedParams(null, null, null, null, null, null, null, false);
|
private static final RecognizedParams NULL_PARAMS = new RecognizedParams(null, null, null, null, null, null, null, null, false);
|
||||||
private static final BasicContentInfo DEFAULT_CONTENT_INFO = new ContentInfoImpl(MimetypeMap.MIMETYPE_BINARY, "UTF-8", -1, null);
|
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, WebScriptRequest request)
|
protected Params(String entityId, String relationshipId, Object passedIn, InputStream stream, String addressedProperty, RecognizedParams recognizedParams, BasicContentInfo contentInfo, WebScriptRequest request)
|
||||||
@@ -76,7 +76,7 @@ public class Params implements Parameters
|
|||||||
|
|
||||||
public static Params valueOf(BeanPropertiesFilter paramFilter, String entityId, WebScriptRequest request)
|
public static Params valueOf(BeanPropertiesFilter paramFilter, String entityId, WebScriptRequest request)
|
||||||
{
|
{
|
||||||
return new Params(entityId, null, null, null, null, new RecognizedParams(null, null, paramFilter, null, null, null, null, false), null, request);
|
return new Params(entityId, null, null, null, null, new RecognizedParams(null, null, paramFilter, null, null, null, null, null, false), null, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Params valueOf(String entityId, String relationshipId, WebScriptRequest request)
|
public static Params valueOf(String entityId, String relationshipId, WebScriptRequest request)
|
||||||
@@ -170,6 +170,8 @@ public class Params implements Parameters
|
|||||||
builder.append(this.recognizedParams.query);
|
builder.append(this.recognizedParams.query);
|
||||||
builder.append(", sorting=");
|
builder.append(", sorting=");
|
||||||
builder.append(this.recognizedParams.sorting);
|
builder.append(this.recognizedParams.sorting);
|
||||||
|
builder.append(", include=");
|
||||||
|
builder.append(this.recognizedParams.include);
|
||||||
builder.append(", select=");
|
builder.append(", select=");
|
||||||
builder.append(this.recognizedParams.select);
|
builder.append(this.recognizedParams.select);
|
||||||
builder.append(", filter=");
|
builder.append(", filter=");
|
||||||
@@ -237,6 +239,12 @@ public class Params implements Parameters
|
|||||||
return recognizedParams.select;
|
return recognizedParams.select;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getInclude()
|
||||||
|
{
|
||||||
|
return recognizedParams.include;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BasicContentInfo getContentInfo()
|
public BasicContentInfo getContentInfo()
|
||||||
{
|
{
|
||||||
@@ -259,21 +267,30 @@ public class Params implements Parameters
|
|||||||
private final Map<String, BeanPropertiesFilter> relationshipFilter;
|
private final Map<String, BeanPropertiesFilter> relationshipFilter;
|
||||||
private final Map<String, String[]> requestParameters;
|
private final Map<String, String[]> requestParameters;
|
||||||
private final Query query;
|
private final Query query;
|
||||||
private final List<String> select;
|
|
||||||
|
private final List<String> include;
|
||||||
|
@Deprecated
|
||||||
|
private final List<String> select; // see include
|
||||||
|
|
||||||
private final List<SortColumn> sorting;
|
private final List<SortColumn> sorting;
|
||||||
private final boolean includeSource;
|
private final boolean includeSource;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public RecognizedParams(Map<String, String[]> requestParameters, Paging paging, BeanPropertiesFilter filter, Map<String, BeanPropertiesFilter> relationshipFilter, List<String> select,
|
public RecognizedParams(Map<String, String[]> requestParameters, Paging paging, BeanPropertiesFilter filter,
|
||||||
|
Map<String, BeanPropertiesFilter> relationshipFilter, List<String> include, List<String> select,
|
||||||
Query query, List<SortColumn> sorting, boolean includeSource)
|
Query query, List<SortColumn> sorting, boolean includeSource)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.requestParameters = requestParameters;
|
this.requestParameters = requestParameters;
|
||||||
this.paging = paging==null?Paging.DEFAULT:paging;
|
this.paging = paging==null?Paging.DEFAULT:paging;
|
||||||
this.filter = filter==null?BeanPropertiesFilter.ALLOW_ALL:filter;
|
this.filter = filter==null?BeanPropertiesFilter.ALLOW_ALL:filter;
|
||||||
this.query = query==null?QueryImpl.EMPTY:query;
|
this.query = query==null?QueryImpl.EMPTY:query;
|
||||||
this.relationshipFilter = (Map<String, BeanPropertiesFilter>) (relationshipFilter==null?Collections.emptyMap():relationshipFilter);
|
this.relationshipFilter = (Map<String, BeanPropertiesFilter>) (relationshipFilter==null?Collections.emptyMap():relationshipFilter);
|
||||||
|
|
||||||
|
this.include = (List<String>) (include==null?Collections.emptyList():include);
|
||||||
this.select = (List<String>) (select==null?Collections.emptyList():select);
|
this.select = (List<String>) (select==null?Collections.emptyList():select);
|
||||||
|
|
||||||
this.sorting = (List<SortColumn>) (sorting==null?Collections.emptyList():sorting);
|
this.sorting = (List<SortColumn>) (sorting==null?Collections.emptyList():sorting);
|
||||||
this.includeSource = includeSource;
|
this.includeSource = includeSource;
|
||||||
}
|
}
|
||||||
|
@@ -90,7 +90,6 @@ import org.springframework.http.HttpMethod;
|
|||||||
*/
|
*/
|
||||||
public class ResourceWebScriptHelper
|
public class ResourceWebScriptHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
private static Log logger = LogFactory.getLog(ResourceWebScriptHelper.class);
|
private static Log logger = LogFactory.getLog(ResourceWebScriptHelper.class);
|
||||||
public static final String PARAM_RELATIONS = "relations";
|
public static final String PARAM_RELATIONS = "relations";
|
||||||
|
|
||||||
@@ -103,7 +102,10 @@ public class ResourceWebScriptHelper
|
|||||||
public static final String PARAM_PAGING_MAX = "maxItems";
|
public static final String PARAM_PAGING_MAX = "maxItems";
|
||||||
public static final String PARAM_ORDERBY = "orderBy";
|
public static final String PARAM_ORDERBY = "orderBy";
|
||||||
public static final String PARAM_WHERE = "where";
|
public static final String PARAM_WHERE = "where";
|
||||||
|
|
||||||
public static final String PARAM_SELECT = "select";
|
public static final String PARAM_SELECT = "select";
|
||||||
|
|
||||||
|
public static final String PARAM_INCLUDE = "include";
|
||||||
public static final String PARAM_INCLUDE_SOURCE_ENTITY = "includeSource";
|
public static final String PARAM_INCLUDE_SOURCE_ENTITY = "includeSource";
|
||||||
|
|
||||||
public static final List<String> KNOWN_PARAMS = Arrays.asList(
|
public static final List<String> KNOWN_PARAMS = Arrays.asList(
|
||||||
@@ -239,15 +241,32 @@ public class ResourceWebScriptHelper
|
|||||||
* @return List<String> bean property names potentially using JSON Pointer syntax
|
* @return List<String> bean property names potentially using JSON Pointer syntax
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@Deprecated
|
||||||
public static List<String> getSelectClause(String selectParam) throws InvalidArgumentException
|
public static List<String> getSelectClause(String selectParam) throws InvalidArgumentException
|
||||||
{
|
{
|
||||||
if (selectParam == null) return Collections.emptyList();
|
return getClause(selectParam, "SELECT");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes the "include" parameter and turns it into a List<String> property names
|
||||||
|
* @param includeParam String
|
||||||
|
* @return List<String> bean property names potentially using JSON Pointer syntax
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static List<String> getIncludeClause(String includeParam) throws InvalidArgumentException
|
||||||
|
{
|
||||||
|
return getClause(includeParam, "INCLUDE");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> getClause(String param, String paramName)
|
||||||
|
{
|
||||||
|
if (param == null) return Collections.emptyList();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CommonTree selectedPropsTree = WhereCompiler.compileSelectClause(selectParam);
|
CommonTree selectedPropsTree = WhereCompiler.compileSelectClause(param);
|
||||||
if (selectedPropsTree instanceof CommonErrorNode)
|
if (selectedPropsTree instanceof CommonErrorNode)
|
||||||
{
|
{
|
||||||
logger.debug("Error parsing the SELECT clause "+selectedPropsTree);
|
logger.debug("Error parsing the "+paramName+" clause "+selectedPropsTree);
|
||||||
throw new InvalidSelectException(selectedPropsTree);
|
throw new InvalidSelectException(selectedPropsTree);
|
||||||
}
|
}
|
||||||
if (selectedPropsTree.getChildCount() == 0 && !selectedPropsTree.getText().isEmpty())
|
if (selectedPropsTree.getChildCount() == 0 && !selectedPropsTree.getText().isEmpty())
|
||||||
@@ -263,13 +282,19 @@ public class ResourceWebScriptHelper
|
|||||||
}
|
}
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
} catch (RewriteCardinalityException re) { //Catch any error so it doesn't get thrown up the stack
|
|
||||||
logger.debug("Unhandled Error parsing the SELECT clause: "+re);
|
|
||||||
} catch (RecognitionException e) {
|
|
||||||
logger.debug("Error parsing the SELECT clause: "+selectParam);
|
|
||||||
}
|
}
|
||||||
|
catch (RewriteCardinalityException re)
|
||||||
|
{
|
||||||
|
//Catch any error so it doesn't get thrown up the stack
|
||||||
|
logger.debug("Unhandled Error parsing the "+paramName+" clause: "+re);
|
||||||
|
}
|
||||||
|
catch (RecognitionException e)
|
||||||
|
{
|
||||||
|
logger.debug("Error parsing the \"+paramName+\" clause: "+param);
|
||||||
|
}
|
||||||
|
|
||||||
//Default to throw out an invalid query
|
//Default to throw out an invalid query
|
||||||
throw new InvalidSelectException(selectParam);
|
throw new InvalidSelectException(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -603,7 +628,7 @@ public class ResourceWebScriptHelper
|
|||||||
* the ExecutionResult object.
|
* the ExecutionResult object.
|
||||||
*
|
*
|
||||||
* @param api Api
|
* @param api Api
|
||||||
* @param filters Map<String, BeanPropertiesFilter>
|
* @param params Params
|
||||||
* @param relatedResources Map<String, ResourceWithMetadata>
|
* @param relatedResources Map<String, ResourceWithMetadata>
|
||||||
* @param uniqueEntityId String
|
* @param uniqueEntityId String
|
||||||
* @return Map
|
* @return Map
|
||||||
@@ -629,7 +654,7 @@ public class ResourceWebScriptHelper
|
|||||||
* the ExecutionResult object.
|
* the ExecutionResult object.
|
||||||
*
|
*
|
||||||
* @param api Api
|
* @param api Api
|
||||||
* @param filters Map<String, BeanPropertiesFilter>
|
* @param params Params
|
||||||
* @param uniqueEntityId String
|
* @param uniqueEntityId String
|
||||||
* @param resourceKey String
|
* @param resourceKey String
|
||||||
* @param resource ResourceWithMetadata
|
* @param resource ResourceWithMetadata
|
||||||
@@ -722,7 +747,8 @@ public class ResourceWebScriptHelper
|
|||||||
Map<String, String[]> requestParams = getRequestParameters(req);
|
Map<String, String[]> requestParams = getRequestParameters(req);
|
||||||
boolean includeSource = Boolean.valueOf(req.getParameter(ResourceWebScriptHelper.PARAM_INCLUDE_SOURCE_ENTITY));
|
boolean includeSource = Boolean.valueOf(req.getParameter(ResourceWebScriptHelper.PARAM_INCLUDE_SOURCE_ENTITY));
|
||||||
|
|
||||||
List<String> theSelect = getSelectClause(req.getParameter(ResourceWebScriptHelper.PARAM_SELECT));
|
List<String> includedFields = getIncludeClause(req.getParameter(ResourceWebScriptHelper.PARAM_INCLUDE));
|
||||||
|
List<String> selectFields = getSelectClause(req.getParameter(ResourceWebScriptHelper.PARAM_SELECT));
|
||||||
|
|
||||||
String fields = req.getParameter(ResourceWebScriptHelper.PARAM_FILTER_FIELDS);
|
String fields = req.getParameter(ResourceWebScriptHelper.PARAM_FILTER_FIELDS);
|
||||||
String properties = req.getParameter(ResourceWebScriptHelper.PARAM_FILTER_PROPERTIES);
|
String properties = req.getParameter(ResourceWebScriptHelper.PARAM_FILTER_PROPERTIES);
|
||||||
@@ -735,9 +761,9 @@ public class ResourceWebScriptHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BeanPropertiesFilter filter = getFilter((fields != null ? fields : properties), theSelect);
|
BeanPropertiesFilter filter = getFilter((fields != null ? fields : properties), includedFields);
|
||||||
|
|
||||||
return new RecognizedParams(requestParams, paging, filter, relationFilter, theSelect, whereQuery, sorting, includeSource);
|
return new RecognizedParams(requestParams, paging, filter, relationFilter, includedFields, selectFields, whereQuery, sorting, includeSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -366,7 +366,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
assertNotNull(node.getContent().getEncoding());
|
assertNotNull(node.getContent().getEncoding());
|
||||||
assertTrue(node.getContent().getSizeInBytes() > 0);
|
assertTrue(node.getContent().getSizeInBytes() > 0);
|
||||||
|
|
||||||
// request without select
|
// request without "include"
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
response = getAll(myChildrenUrl, user1, paging, params, 200);
|
response = getAll(myChildrenUrl, user1, paging, params, 200);
|
||||||
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);
|
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);
|
||||||
@@ -378,9 +378,9 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
assertNull("There shouldn't be a 'aspectNames' object in the response.", n.getAspectNames());
|
assertNull("There shouldn't be a 'aspectNames' object in the response.", n.getAspectNames());
|
||||||
}
|
}
|
||||||
|
|
||||||
// request with select - example 1
|
// request with include - example 1
|
||||||
params = new HashMap<>();
|
params = new HashMap<>();
|
||||||
params.put("select", "isLink");
|
params.put("include", "isLink");
|
||||||
response = getAll(myChildrenUrl, user1, paging, params, 200);
|
response = getAll(myChildrenUrl, user1, paging, params, 200);
|
||||||
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);
|
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);
|
||||||
for (Node n : nodes)
|
for (Node n : nodes)
|
||||||
@@ -388,9 +388,9 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
assertNotNull("There should be a 'isLink' object in the response.", n.getIsLink());
|
assertNotNull("There should be a 'isLink' object in the response.", n.getIsLink());
|
||||||
}
|
}
|
||||||
|
|
||||||
// request with select - example 2
|
// request with include - example 2
|
||||||
params = new HashMap<>();
|
params = new HashMap<>();
|
||||||
params.put("select", "aspectNames,properties, path,isLink");
|
params.put("include", "aspectNames,properties, path,isLink");
|
||||||
response = getAll(myChildrenUrl, user1, paging, params, 200);
|
response = getAll(myChildrenUrl, user1, paging, params, 200);
|
||||||
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);
|
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);
|
||||||
for (Node n : nodes)
|
for (Node n : nodes)
|
||||||
@@ -401,9 +401,9 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
assertNotNull("There should be a 'aspectNames' object in the response.", n.getAspectNames());
|
assertNotNull("There should be a 'aspectNames' object in the response.", n.getAspectNames());
|
||||||
}
|
}
|
||||||
|
|
||||||
// request specific property via select
|
// request specific property via include
|
||||||
params = new HashMap<>();
|
params = new HashMap<>();
|
||||||
params.put("select", "cm:lastThumbnailModification");
|
params.put("include", "cm:lastThumbnailModification");
|
||||||
params.put("orderBy", "isFolder DESC,modifiedAt DESC");
|
params.put("orderBy", "isFolder DESC,modifiedAt DESC");
|
||||||
response = getAll(myChildrenUrl, user1, paging, params, 200);
|
response = getAll(myChildrenUrl, user1, paging, params, 200);
|
||||||
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);
|
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);
|
||||||
@@ -522,7 +522,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
/**
|
/**
|
||||||
* Tests get node with path information.
|
* Tests get node with path information.
|
||||||
* <p>GET:</p>
|
* <p>GET:</p>
|
||||||
* {@literal <host>:<port>/alfresco/api/<networkId>/public/alfresco/versions/1/nodes/<nodeId>?select=path}
|
* {@literal <host>:<port>/alfresco/api/<networkId>/public/alfresco/versions/1/nodes/<nodeId>?include=path}
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPathElements_DocLib() throws Exception
|
public void testGetPathElements_DocLib() throws Exception
|
||||||
@@ -559,8 +559,8 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
// Grant userTwoN1 permission for folderC
|
// Grant userTwoN1 permission for folderC
|
||||||
permissionService.setPermission(folderC_Ref, userTwoN1.getId(), PermissionService.CONSUMER, true);
|
permissionService.setPermission(folderC_Ref, userTwoN1.getId(), PermissionService.CONSUMER, true);
|
||||||
|
|
||||||
//...nodes/nodeId?select=path
|
//...nodes/nodeId?include=path
|
||||||
Map<String, String> params = Collections.singletonMap("select", "path");
|
Map<String, String> params = Collections.singletonMap("include", "path");
|
||||||
HttpResponse response = getSingle(NodesEntityResource.class, userOneN1.getId(), content1_Id, params, 200);
|
HttpResponse response = getSingle(NodesEntityResource.class, userOneN1.getId(), content1_Id, params, 200);
|
||||||
Document node = jacksonUtil.parseEntry(response.getJsonResponse(), Document.class);
|
Document node = jacksonUtil.parseEntry(response.getJsonResponse(), Document.class);
|
||||||
PathInfo path = node.getPath();
|
PathInfo path = node.getPath();
|
||||||
@@ -673,8 +673,8 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
d1.expected(documentResp);
|
d1.expected(documentResp);
|
||||||
|
|
||||||
// get node info + path
|
// get node info + path
|
||||||
//...nodes/nodeId?select=path
|
//...nodes/nodeId?include=path
|
||||||
Map<String, String> params = Collections.singletonMap("select", "path");
|
Map<String, String> params = Collections.singletonMap("include", "path");
|
||||||
response = getSingle(NodesEntityResource.class, user1, content1Id, params, 200);
|
response = getSingle(NodesEntityResource.class, user1, content1Id, params, 200);
|
||||||
documentResp = jacksonUtil.parseEntry(response.getJsonResponse(), Document.class);
|
documentResp = jacksonUtil.parseEntry(response.getJsonResponse(), Document.class);
|
||||||
|
|
||||||
@@ -760,7 +760,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
assertEquals(user1, node.getName());
|
assertEquals(user1, node.getName());
|
||||||
assertTrue(node.getIsFolder());
|
assertTrue(node.getIsFolder());
|
||||||
assertFalse(node.getIsFile());
|
assertFalse(node.getIsFile());
|
||||||
assertNull(node.getPath()); // note: path can be optionally "select"'ed - see separate test
|
assertNull(node.getPath()); // note: path can be optionally "include"'ed - see separate test
|
||||||
|
|
||||||
response = getSingle(NodesEntityResource.class, user1, Nodes.PATH_SHARED, null, 200);
|
response = getSingle(NodesEntityResource.class, user1, Nodes.PATH_SHARED, null, 200);
|
||||||
node = jacksonUtil.parseEntry(response.getJsonResponse(), Node.class);
|
node = jacksonUtil.parseEntry(response.getJsonResponse(), Node.class);
|
||||||
@@ -814,7 +814,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
// Default encoding
|
// Default encoding
|
||||||
assertEquals("UTF-8", contentInfo.getEncoding());
|
assertEquals("UTF-8", contentInfo.getEncoding());
|
||||||
// Check there is no path info returned.
|
// Check there is no path info returned.
|
||||||
// The path info should only be returned when it is requested via a select statement.
|
// The path info should only be returned when it is requested via a include statement.
|
||||||
assertNull(document.getPath());
|
assertNull(document.getPath());
|
||||||
|
|
||||||
// Retrieve the uploaded file
|
// Retrieve the uploaded file
|
||||||
@@ -850,7 +850,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
assertEquals("quick-1.pdf", document.getName());
|
assertEquals("quick-1.pdf", document.getName());
|
||||||
|
|
||||||
// upload the same file again, and request the path info to be present in the response
|
// upload the same file again, and request the path info to be present in the response
|
||||||
response = post(getChildrenUrl(Nodes.PATH_MY), user1, reqBody.getBody(), "?select=path", reqBody.getContentType(), 201);
|
response = post(getChildrenUrl(Nodes.PATH_MY), user1, reqBody.getBody(), "?include=path", reqBody.getContentType(), 201);
|
||||||
document = jacksonUtil.parseEntry(response.getJsonResponse(), Document.class);
|
document = jacksonUtil.parseEntry(response.getJsonResponse(), Document.class);
|
||||||
// Check the upload response
|
// Check the upload response
|
||||||
assertEquals("quick-2.pdf", document.getName());
|
assertEquals("quick-2.pdf", document.getName());
|
||||||
@@ -2151,7 +2151,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
File pdfFile = getResourceFile("quick.pdf");
|
File pdfFile = getResourceFile("quick.pdf");
|
||||||
payload = new BinaryPayload(pdfFile, MimetypeMap.MIMETYPE_PDF, "ISO-8859-1");
|
payload = new BinaryPayload(pdfFile, MimetypeMap.MIMETYPE_PDF, "ISO-8859-1");
|
||||||
|
|
||||||
response = putBinary(url + "?select=path", user1, payload, null, null, 200);
|
response = putBinary(url + "?include=path", user1, payload, null, null, 200);
|
||||||
docResp = jacksonUtil.parseEntry(response.getJsonResponse(), Document.class);
|
docResp = jacksonUtil.parseEntry(response.getJsonResponse(), Document.class);
|
||||||
assertEquals(docName, docResp.getName());
|
assertEquals(docName, docResp.getName());
|
||||||
assertNotNull(docResp.getContent());
|
assertNotNull(docResp.getContent());
|
||||||
|
@@ -183,7 +183,7 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
|
|||||||
|
|
||||||
|
|
||||||
// auth access to get shared link info - as user1
|
// auth access to get shared link info - as user1
|
||||||
Map<String, String> params = Collections.singletonMap("select", "allowableOperations");
|
Map<String, String> params = Collections.singletonMap("include", "allowableOperations");
|
||||||
response = getSingle(QuickShareLinkEntityResource.class, user1, sharedId, params, 200);
|
response = getSingle(QuickShareLinkEntityResource.class, user1, sharedId, params, 200);
|
||||||
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
|
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
|
|||||||
assertNull(resp.getAllowableOperations());
|
assertNull(resp.getAllowableOperations());
|
||||||
|
|
||||||
// auth access to get shared link info - as user2
|
// auth access to get shared link info - as user2
|
||||||
params = Collections.singletonMap("select", "allowableOperations");
|
params = Collections.singletonMap("include", "allowableOperations");
|
||||||
response = getSingle(QuickShareLinkEntityResource.class, user2, sharedId, params, 200);
|
response = getSingle(QuickShareLinkEntityResource.class, user2, sharedId, params, 200);
|
||||||
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
|
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
|
||||||
|
|
||||||
@@ -211,21 +211,21 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
|
|||||||
assertEquals(1, resp.getAllowableOperations().size());
|
assertEquals(1, resp.getAllowableOperations().size());
|
||||||
assertEquals("delete", resp.getAllowableOperations().get(0));
|
assertEquals("delete", resp.getAllowableOperations().get(0));
|
||||||
|
|
||||||
// allowable operations not selected
|
// allowable operations not included
|
||||||
response = getSingle(QuickShareLinkEntityResource.class, user2, sharedId, null, 200);
|
response = getSingle(QuickShareLinkEntityResource.class, user2, sharedId, null, 200);
|
||||||
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
|
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
|
||||||
assertNull(resp.getAllowableOperations());
|
assertNull(resp.getAllowableOperations());
|
||||||
|
|
||||||
|
|
||||||
// unauth access to get shared link info
|
// unauth access to get shared link info
|
||||||
params = Collections.singletonMap("select", "allowableOperations"); // note: this will be ignore for unauth access
|
params = Collections.singletonMap("include", "allowableOperations"); // note: this will be ignore for unauth access
|
||||||
response = getSingle(QuickShareLinkEntityResource.class, null, sharedId, params, 200);
|
response = getSingle(QuickShareLinkEntityResource.class, null, sharedId, params, 200);
|
||||||
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
|
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
|
||||||
|
|
||||||
assertEquals(sharedId, resp.getId());
|
assertEquals(sharedId, resp.getId());
|
||||||
assertEquals(docName1, resp.getName());
|
assertEquals(docName1, resp.getName());
|
||||||
assertNull(resp.getNodeId()); // nodeId not returned
|
assertNull(resp.getNodeId()); // nodeId not returned
|
||||||
assertNull(resp.getAllowableOperations()); // select is ignored
|
assertNull(resp.getAllowableOperations()); // include is ignored
|
||||||
|
|
||||||
assertNull(resp.getModifiedByUser().getId()); // userId not returned
|
assertNull(resp.getModifiedByUser().getId()); // userId not returned
|
||||||
assertEquals(user1+" "+user1, resp.getModifiedByUser().getDisplayName());
|
assertEquals(user1+" "+user1, resp.getModifiedByUser().getDisplayName());
|
||||||
|
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2016 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
package org.alfresco.rest.framework.tests.core;
|
package org.alfresco.rest.framework.tests.core;
|
||||||
|
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
@@ -51,7 +69,7 @@ public abstract class AbstractContextTest
|
|||||||
JacksonHelper jsonHelper;
|
JacksonHelper jsonHelper;
|
||||||
|
|
||||||
static Params NOT_USED = Params.valueOf("notUsed", null, mock(WebScriptRequest.class));
|
static Params NOT_USED = Params.valueOf("notUsed", null, mock(WebScriptRequest.class));
|
||||||
static final Params.RecognizedParams NULL_PARAMS = new Params.RecognizedParams(null, null, null, null, null, null, null, false);
|
static final Params.RecognizedParams NULL_PARAMS = new Params.RecognizedParams(null, null, null, null, null, null, null, null, false);
|
||||||
static final WithResponse callBack = new WithResponse(Status.STATUS_OK, ApiWebScript.DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
|
static final WithResponse callBack = new WithResponse(Status.STATUS_OK, ApiWebScript.DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
|
||||||
static Api api = Api.valueOf("alfrescomock", "private", "1");
|
static Api api = Api.valueOf("alfrescomock", "private", "1");
|
||||||
|
|
||||||
|
@@ -50,22 +50,22 @@ public class ParamsExtender extends Params
|
|||||||
|
|
||||||
public static Params valueOf(Map<String, BeanPropertiesFilter> rFilter, String entityId)
|
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, false));
|
return new ParamsExtender(entityId, null, null, null, null, new Params.RecognizedParams(null, null, null, rFilter, null, null, null, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Params valueOf(boolean includeSource, String entityId)
|
public static Params valueOf(boolean includeSource, String entityId)
|
||||||
{
|
{
|
||||||
return new ParamsExtender(entityId, null, null, null, null, new Params.RecognizedParams(null, null, null, null, null, null, null, includeSource));
|
return new ParamsExtender(entityId, null, null, null, null, new Params.RecognizedParams(null, null, null, null, null, null, null, null, includeSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Params valueOf(Paging paging, String entityId)
|
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, false));
|
return new ParamsExtender(entityId, null, null, null, null, new Params.RecognizedParams(null, paging, null, null, null, null, null, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Params valueOf(Map<String, String[]> params)
|
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, false));
|
return new ParamsExtender(null, null, null, null, null, new Params.RecognizedParams(params, null, null, null, null, null, null, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -171,16 +171,28 @@ public class ResourceWebScriptHelperTests
|
|||||||
assertTrue(theSort.get(0).asc);
|
assertTrue(theSort.get(0).asc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getIncludeClauseTest()
|
||||||
|
{
|
||||||
|
getClauseTest("include");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSelectClauseTest()
|
public void getSelectClauseTest()
|
||||||
{
|
{
|
||||||
List<String> theSelect = ResourceWebScriptHelper.getSelectClause(null);
|
getClauseTest("select");
|
||||||
assertNotNull(theSelect);
|
}
|
||||||
assertFalse("Null passed in so nothing in the Select.",theSelect.size() > 0);
|
|
||||||
|
// at the moment select and include are parsed the same way, hence common/shared test
|
||||||
|
private void getClauseTest(String paramName)
|
||||||
|
{
|
||||||
|
List<String> theClause = getClause(paramName, null);
|
||||||
|
assertNotNull(theClause);
|
||||||
|
assertFalse("Null passed in so nothing in the "+paramName, theClause.size() > 0);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause(",,,");
|
theClause = getClause(paramName, ",,,");
|
||||||
fail("Should throw an InvalidSelectException");
|
fail("Should throw an InvalidSelectException");
|
||||||
}
|
}
|
||||||
catch (InvalidSelectException error)
|
catch (InvalidSelectException error)
|
||||||
@@ -190,7 +202,7 @@ public class ResourceWebScriptHelperTests
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("(,,,");
|
theClause = getClause(paramName, "(,,,");
|
||||||
fail("Should throw an InvalidSelectException");
|
fail("Should throw an InvalidSelectException");
|
||||||
}
|
}
|
||||||
catch (InvalidSelectException error)
|
catch (InvalidSelectException error)
|
||||||
@@ -200,7 +212,7 @@ public class ResourceWebScriptHelperTests
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("(,,,)");
|
theClause = getClause(paramName, "(,,,)");
|
||||||
fail("Should throw an InvalidSelectException");
|
fail("Should throw an InvalidSelectException");
|
||||||
}
|
}
|
||||||
catch (InvalidSelectException error)
|
catch (InvalidSelectException error)
|
||||||
@@ -210,7 +222,7 @@ public class ResourceWebScriptHelperTests
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("x/,z");
|
theClause = getClause(paramName, "x/,z");
|
||||||
fail("Should throw an InvalidSelectException");
|
fail("Should throw an InvalidSelectException");
|
||||||
}
|
}
|
||||||
catch (InvalidArgumentException error)
|
catch (InvalidArgumentException error)
|
||||||
@@ -220,7 +232,7 @@ public class ResourceWebScriptHelperTests
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/x'n,/z");
|
theClause = getClause(paramName, "/x'n,/z");
|
||||||
fail("Should throw an InvalidSelectException");
|
fail("Should throw an InvalidSelectException");
|
||||||
}
|
}
|
||||||
catch (InvalidArgumentException error)
|
catch (InvalidArgumentException error)
|
||||||
@@ -230,7 +242,7 @@ public class ResourceWebScriptHelperTests
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/foo/0");
|
theClause = getClause(paramName, "/foo/0");
|
||||||
fail("Should throw an InvalidSelectException. Legal identifiers must start with a letter not zero");
|
fail("Should throw an InvalidSelectException. Legal identifiers must start with a letter not zero");
|
||||||
}
|
}
|
||||||
catch (InvalidArgumentException error)
|
catch (InvalidArgumentException error)
|
||||||
@@ -240,7 +252,7 @@ public class ResourceWebScriptHelperTests
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/");
|
theClause = getClause(paramName, "/");
|
||||||
fail("Should throw an InvalidSelectException. No identifier specified.");
|
fail("Should throw an InvalidSelectException. No identifier specified.");
|
||||||
}
|
}
|
||||||
catch (InvalidArgumentException error)
|
catch (InvalidArgumentException error)
|
||||||
@@ -248,56 +260,71 @@ public class ResourceWebScriptHelperTests
|
|||||||
//this is correct
|
//this is correct
|
||||||
}
|
}
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("king/kong");
|
theClause = getClause(paramName, "king/kong");
|
||||||
assertTrue("has a valid select",theSelect.size() == 1);
|
assertTrue("has a valid "+paramName, theClause.size() == 1);
|
||||||
assertEquals("king/kong",theSelect.get(0));
|
assertEquals("king/kong",theClause.get(0));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("x,y");
|
theClause = getClause(paramName, "x,y");
|
||||||
assertTrue("has a valid select",theSelect.size() == 2);
|
assertTrue("has a valid "+paramName, theClause.size() == 2);
|
||||||
assertEquals("x",theSelect.get(0));
|
assertEquals("x",theClause.get(0));
|
||||||
assertEquals("y",theSelect.get(1));
|
assertEquals("y",theClause.get(1));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("x,/z");
|
theClause = getClause(paramName, "x,/z");
|
||||||
assertTrue("has a valid select",theSelect.size() == 2);
|
assertTrue("has a valid "+paramName, theClause.size() == 2);
|
||||||
assertEquals("x",theSelect.get(0));
|
assertEquals("x",theClause.get(0));
|
||||||
assertEquals("/z",theSelect.get(1));
|
assertEquals("/z",theClause.get(1));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/b");
|
theClause = getClause(paramName, "/b");
|
||||||
assertTrue("has a valid select",theSelect.size() == 1);
|
assertTrue("has a valid "+paramName, theClause.size() == 1);
|
||||||
assertEquals("/b",theSelect.get(0));
|
assertEquals("/b",theClause.get(0));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/be,/he");
|
theClause = getClause(paramName, "/be,/he");
|
||||||
assertTrue("has a valid select",theSelect.size() == 2);
|
assertTrue("has a valid "+paramName, theClause.size() == 2);
|
||||||
assertEquals("/be",theSelect.get(0));
|
assertEquals("/be",theClause.get(0));
|
||||||
assertEquals("/he",theSelect.get(1));
|
assertEquals("/he",theClause.get(1));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/king/kong");
|
theClause = getClause(paramName, "/king/kong");
|
||||||
assertTrue("has a valid select",theSelect.size() == 1);
|
assertTrue("has a valid "+paramName, theClause.size() == 1);
|
||||||
assertEquals("/king/kong",theSelect.get(0));
|
assertEquals("/king/kong",theClause.get(0));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/name,/person/age");
|
theClause = getClause(paramName, "/name,/person/age");
|
||||||
assertTrue("has a valid select",theSelect.size() == 2);
|
assertTrue("has a valid "+paramName, theClause.size() == 2);
|
||||||
assertEquals("/name",theSelect.get(0));
|
assertEquals("/name",theClause.get(0));
|
||||||
assertEquals("/person/age",theSelect.get(1));
|
assertEquals("/person/age",theClause.get(1));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/foo");
|
theClause = getClause(paramName, "/foo");
|
||||||
assertTrue("has a valid select",theSelect.size() == 1);
|
assertTrue("has a valid select",theClause.size() == 1);
|
||||||
assertEquals("/foo",theSelect.get(0));
|
assertEquals("/foo",theClause.get(0));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/foo/anArray/x");
|
theClause = getClause(paramName, "/foo/anArray/x");
|
||||||
assertTrue("has a valid select",theSelect.size() == 1);
|
assertTrue("has a valid "+paramName, theClause.size() == 1);
|
||||||
assertEquals("/foo/anArray/x",theSelect.get(0));
|
assertEquals("/foo/anArray/x",theClause.get(0));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/foo/anArray/x,/person/age,/eggs/bacon/sausage,/p");
|
theClause = getClause(paramName, "/foo/anArray/x,/person/age,/eggs/bacon/sausage,/p");
|
||||||
assertTrue("has a valid select",theSelect.size() == 4);
|
assertTrue("has a valid "+paramName, theClause.size() == 4);
|
||||||
assertEquals("/foo/anArray/x",theSelect.get(0));
|
assertEquals("/foo/anArray/x",theClause.get(0));
|
||||||
assertEquals("/person/age",theSelect.get(1));
|
assertEquals("/person/age",theClause.get(1));
|
||||||
assertEquals("/eggs/bacon/sausage",theSelect.get(2));
|
assertEquals("/eggs/bacon/sausage",theClause.get(2));
|
||||||
assertEquals("/p",theSelect.get(3));
|
assertEquals("/p",theClause.get(3));
|
||||||
|
|
||||||
theSelect = ResourceWebScriptHelper.getSelectClause("/foo/_bar ");
|
theClause = getClause(paramName, "/foo/_bar ");
|
||||||
assertTrue("has a valid select",theSelect.size() == 1);
|
assertTrue("has a valid "+paramName, theClause.size() == 1);
|
||||||
assertEquals("/foo/_bar",theSelect.get(0));
|
assertEquals("/foo/_bar",theClause.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getClause(String paramName, String paramValue)
|
||||||
|
{
|
||||||
|
if (paramName.equalsIgnoreCase("include"))
|
||||||
|
{
|
||||||
|
return ResourceWebScriptHelper.getIncludeClause(paramValue);
|
||||||
|
}
|
||||||
|
else if (paramName.equalsIgnoreCase("select"))
|
||||||
|
{
|
||||||
|
return ResourceWebScriptHelper.getSelectClause(paramValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
fail("Unexpected clause: "+paramName);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -28,39 +28,26 @@ package org.alfresco.rest.framework.tests.core;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
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.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
import static org.mockito.Matchers.any;
|
|
||||||
import static org.mockito.Matchers.anyBoolean;
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
|
||||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder;
|
import org.alfresco.rest.api.tests.util.MultiPartBuilder;
|
||||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder.FileData;
|
import org.alfresco.rest.api.tests.util.MultiPartBuilder.FileData;
|
||||||
import org.alfresco.rest.api.tests.util.MultiPartBuilder.MultiPartRequest;
|
import org.alfresco.rest.api.tests.util.MultiPartBuilder.MultiPartRequest;
|
||||||
import org.alfresco.rest.framework.Api;
|
import org.alfresco.rest.framework.Api;
|
||||||
import org.alfresco.rest.framework.core.ResourceDictionaryBuilder;
|
|
||||||
import org.alfresco.rest.framework.core.ResourceLookupDictionary;
|
|
||||||
import org.alfresco.rest.framework.core.ResourceWithMetadata;
|
import org.alfresco.rest.framework.core.ResourceWithMetadata;
|
||||||
import org.alfresco.rest.framework.core.exceptions.UnsupportedResourceOperationException;
|
import org.alfresco.rest.framework.core.exceptions.UnsupportedResourceOperationException;
|
||||||
import org.alfresco.rest.framework.jacksonextensions.BeanPropertiesFilter;
|
import org.alfresco.rest.framework.jacksonextensions.BeanPropertiesFilter;
|
||||||
import org.alfresco.rest.framework.jacksonextensions.ExecutionResult;
|
import org.alfresco.rest.framework.jacksonextensions.ExecutionResult;
|
||||||
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper;
|
|
||||||
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper.Writer;
|
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper.Writer;
|
||||||
import org.alfresco.rest.framework.resource.EntityResource;
|
|
||||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction.Read;
|
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction.Read;
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction.ReadById;
|
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction.ReadById;
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartResourceAction;
|
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.content.BinaryProperty;
|
import org.alfresco.rest.framework.resource.content.BinaryProperty;
|
||||||
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
|
||||||
import org.alfresco.rest.framework.resource.content.ContentInfo;
|
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||||
@@ -73,7 +60,6 @@ import org.alfresco.rest.framework.tests.api.mocks3.SlimGoat;
|
|||||||
import org.alfresco.rest.framework.webscripts.AbstractResourceWebScript;
|
import org.alfresco.rest.framework.webscripts.AbstractResourceWebScript;
|
||||||
import org.alfresco.rest.framework.webscripts.ResourceWebScriptHelper;
|
import org.alfresco.rest.framework.webscripts.ResourceWebScriptHelper;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.TempFileProvider;
|
import org.alfresco.util.TempFileProvider;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -85,21 +71,12 @@ import org.codehaus.jackson.schema.JsonSchema;
|
|||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONTokener;
|
import org.json.JSONTokener;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
|
||||||
import org.mockito.stubbing.Answer;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.extensions.webscripts.Format;
|
import org.springframework.extensions.webscripts.Format;
|
||||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
|
||||||
import org.springframework.extensions.webscripts.WebScriptResponse;
|
import org.springframework.extensions.webscripts.WebScriptResponse;
|
||||||
import org.springframework.extensions.webscripts.servlet.FormData;
|
import org.springframework.extensions.webscripts.servlet.FormData;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.mock.web.MockHttpServletRequest;
|
import org.springframework.mock.web.MockHttpServletRequest;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -474,9 +451,9 @@ public class SerializeTests extends AbstractContextTest
|
|||||||
assertEquals("The name should be 'Dolly'", "Dolly", entry.getString("name"));
|
assertEquals("The name should be 'Dolly'", "Dolly", entry.getString("name"));
|
||||||
assertTrue("The age should be 3", entry.getInt("age") == 3);
|
assertTrue("The age should be 3", entry.getInt("age") == 3);
|
||||||
|
|
||||||
// unit test filter with select taking precendence
|
// unit test filter with "include" taking precendence over "fields" filter
|
||||||
List<String> theSelect = ResourceWebScriptHelper.getSelectClause("name");
|
List<String> theInclude = ResourceWebScriptHelper.getIncludeClause("name");
|
||||||
theFilter = ResourceWebScriptHelper.getFilter("age", theSelect);
|
theFilter = ResourceWebScriptHelper.getFilter("age", theInclude);
|
||||||
res = new ExecutionResult(new Sheep("bob"),theFilter);
|
res = new ExecutionResult(new Sheep("bob"),theFilter);
|
||||||
out = writeResponse(res);
|
out = writeResponse(res);
|
||||||
jsonRsp = new JSONObject(new JSONTokener(out));
|
jsonRsp = new JSONObject(new JSONTokener(out));
|
||||||
|
@@ -223,7 +223,7 @@ public class ProcessesImplTest extends TestCase
|
|||||||
private CollectionWithPagingInfo<ProcessInfo> queryActiveProcessesAndAssertResult(int skipCount, int maxItems)
|
private CollectionWithPagingInfo<ProcessInfo> queryActiveProcessesAndAssertResult(int skipCount, int maxItems)
|
||||||
{
|
{
|
||||||
Query query = ResourceWebScriptHelper.getWhereClause(QUERY_STATUS_ACTIVE);
|
Query query = ResourceWebScriptHelper.getWhereClause(QUERY_STATUS_ACTIVE);
|
||||||
Parameters parameters = Params.valueOf(new RecognizedParams(null, Paging.valueOf(skipCount, maxItems), null, null, null, query, null, false), null, null, null);
|
Parameters parameters = Params.valueOf(new RecognizedParams(null, Paging.valueOf(skipCount, maxItems), null, null, null, null, query, null, false), null, null, null);
|
||||||
|
|
||||||
CollectionWithPagingInfo<ProcessInfo> result = processes.getProcesses(parameters);
|
CollectionWithPagingInfo<ProcessInfo> result = processes.getProcesses(parameters);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user