* Marked the "site" and "unloadedonly" parameters on the GET DataSet URI as optional

* Fixed the code for the getting the data set if a site name is not provided

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@41645 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2012-09-17 08:53:33 +00:00
parent 15bcee05c8
commit 94db43b6bd
2 changed files with 13 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
<webscript> <webscript>
<shortname>Get data sets</shortname> <shortname>Get data sets</shortname>
<description>WebScript to get the list of available RM test data</description> <description>WebScript to get the list of available RM test data</description>
<url>/api/rma/datasets?site={site}&amp;unloadedonly={unloadedonly}</url> <url>/api/rma/datasets?site={site?}&amp;unloadedonly={unloadedonly?}</url>
<format default="json">argument</format> <format default="json">argument</format>
<authentication>admin</authentication> <authentication>admin</authentication>
<transaction>required</transaction> <transaction>required</transaction>

View File

@@ -19,6 +19,12 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
public class DataSetsGet extends DeclarativeWebScript public class DataSetsGet extends DeclarativeWebScript
{ {
/** Constant for the site name parameter */
private static final String ARG_SITE_NAME = "site";
/** Constant for the unloadedonly parameter */
private static final String ARG_UNLOADED_ONLY = "unloadedonly";
/** Data set service */ /** Data set service */
private DataSetService dataSetService; private DataSetService dataSetService;
@@ -54,11 +60,15 @@ public class DataSetsGet extends DeclarativeWebScript
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{ {
// Get the site name from the URL and find out the file plan // Get the site name from the URL and find out the file plan
String siteName = req.getParameter("site"); String siteName = req.getParameter(ARG_SITE_NAME);
if (StringUtils.isBlank(siteName))
{
siteName = RmSiteType.DEFAULT_SITE_NAME;
}
NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
// Check if only unloaded data sets should be returned - default value is false // Check if only unloaded data sets should be returned - default value is false
String unloadedOnlyParam = req.getParameter("unloadedonly"); String unloadedOnlyParam = req.getParameter(ARG_UNLOADED_ONLY);
boolean unloadedOnly = false; boolean unloadedOnly = false;
if (StringUtils.isNotBlank(unloadedOnlyParam)) if (StringUtils.isNotBlank(unloadedOnlyParam))
{ {