mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
code review changes
This commit is contained in:
@@ -690,35 +690,6 @@ public abstract class BaseAPI
|
||||
}
|
||||
}
|
||||
|
||||
public enum RM_EVENTS
|
||||
{
|
||||
ABOLISHED("abolished", "Abolished"),
|
||||
ALL_ALLOWANCES_GRANTED_ARE_TERMINATED("all_allowances_granted_are_terminated", "All Allowances Granted are Terminated"),
|
||||
CASE_CLOSED("case_closed", "Case Closed"),
|
||||
DECLASSIFICATION_REVIEW("declassification_review", "Declassification Review"),
|
||||
OBSOLETE("obsolete", "Obsolete"),
|
||||
NO_LONGER_NEEDED("no_longer_needed", "No Longer Needed"),
|
||||
STUDY_COMPLETE("study_complete", "Study Complete");
|
||||
String eventName;
|
||||
String eventDisplayLabel;
|
||||
|
||||
RM_EVENTS(String eventName, String eventDisplayLabel)
|
||||
{
|
||||
this.eventName = eventName;
|
||||
this.eventDisplayLabel = eventDisplayLabel;
|
||||
}
|
||||
|
||||
public String getEventName()
|
||||
{
|
||||
return eventName;
|
||||
}
|
||||
|
||||
public String getEventDisplayLabel()
|
||||
{
|
||||
return eventDisplayLabel;
|
||||
}
|
||||
}
|
||||
|
||||
public enum PermissionType
|
||||
{
|
||||
SET_READ,
|
||||
|
@@ -0,0 +1,23 @@
|
||||
package org.alfresco.rest.core.v0;
|
||||
|
||||
public enum RMEvents
|
||||
{
|
||||
ABOLISHED("abolished"),
|
||||
ALL_ALLOWANCES_GRANTED_ARE_TERMINATED("all_allowances_granted_are_terminated"),
|
||||
CASE_CLOSED("case_closed"),
|
||||
DECLASSIFICATION_REVIEW("declassification_review"),
|
||||
OBSOLETE("obsolete"),
|
||||
NO_LONGER_NEEDED("no_longer_needed"),
|
||||
STUDY_COMPLETE("study_complete");
|
||||
private String eventName;
|
||||
|
||||
RMEvents(String eventName)
|
||||
{
|
||||
this.eventName = eventName;
|
||||
}
|
||||
|
||||
public String getEventName()
|
||||
{
|
||||
return eventName;
|
||||
}
|
||||
}
|
@@ -35,6 +35,7 @@ import static org.testng.AssertJUnit.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
@@ -46,6 +47,7 @@ import org.alfresco.dataprep.AlfrescoHttpClientFactory;
|
||||
import org.alfresco.dataprep.ContentService;
|
||||
import org.alfresco.dataprep.UserService;
|
||||
import org.alfresco.rest.core.v0.BaseAPI;
|
||||
import org.alfresco.rest.core.v0.RMEvents;
|
||||
import org.apache.chemistry.opencmis.client.api.CmisObject;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.http.HttpResponse;
|
||||
@@ -354,19 +356,19 @@ public class RMRolesAndActionsAPI extends BaseAPI
|
||||
*
|
||||
* @param user the user executing the action
|
||||
* @param password the user's password
|
||||
* @param contentName the content name
|
||||
* @param nodeName the node name
|
||||
* @param event the event to be completed
|
||||
* @param date the date to be updated
|
||||
* @return The HTTP response.
|
||||
*/
|
||||
public HttpResponse completeEvent(String user, String password, String contentName, RM_EVENTS event, ZonedDateTime date)
|
||||
public HttpResponse completeEvent(String user, String password, String nodeName, RMEvents event, Instant date)
|
||||
{
|
||||
String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, contentName);
|
||||
String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, nodeName);
|
||||
JSONObject requestParams = new JSONObject();
|
||||
requestParams.put("name", RM_ACTIONS.COMPLETE_EVENT.getAction());
|
||||
requestParams.put("nodeRef", recNodeRef);
|
||||
date = (date != null) ? date : ZonedDateTime.now();
|
||||
String formattedDate = date.format(DateTimeFormatter.ISO_INSTANT);
|
||||
date = (date != null) ? date : Instant.now();
|
||||
String formattedDate = DateTimeFormatter.ISO_INSTANT.format(date);
|
||||
requestParams.put("params", new JSONObject()
|
||||
.put("eventName", event.getEventName())
|
||||
.put("eventCompletedBy", user)
|
||||
@@ -387,7 +389,7 @@ public class RMRolesAndActionsAPI extends BaseAPI
|
||||
* @param event the event to be undone
|
||||
* @return The HTTP response.
|
||||
*/
|
||||
public HttpResponse undoEvent(String user, String password, String contentName, RM_EVENTS event)
|
||||
public HttpResponse undoEvent(String user, String password, String contentName, RMEvents event)
|
||||
{
|
||||
String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, contentName);
|
||||
JSONObject requestParams = new JSONObject();
|
||||
|
@@ -66,8 +66,8 @@ public class SearchAPI extends BaseAPI
|
||||
/** RM document search filters */
|
||||
private static final String RM_DEFAULT_RECORD_FILTERS =
|
||||
"records/true,undeclared/true,vital/false,folders/false,categories/false,frozen/false,cutoff/false";
|
||||
/** RM all content search filters */
|
||||
private static final String RM_DEFAULT_CONTENT_FILTERS =
|
||||
/** RM all nodes search filters */
|
||||
private static final String RM_DEFAULT_NODES_FILTERS =
|
||||
"records/true,undeclared/true,vital/false,folders/true,categories/true,frozen/false,cutoff/false";
|
||||
|
||||
/**
|
||||
@@ -143,7 +143,7 @@ public class SearchAPI extends BaseAPI
|
||||
}
|
||||
|
||||
/**
|
||||
* Search as a user for content on site "rm" matching query, using SearchAPI.RM_DEFAULT_CONTENT_FILTERS and sorted
|
||||
* Search as a user for content on site "rm" matching query, using SearchAPI.RM_DEFAULT_NODES_FILTERS and sorted
|
||||
* by sortby
|
||||
* <br>
|
||||
* If more fine-grained control of search parameters is required, use rmSearch() directly.
|
||||
@@ -159,7 +159,7 @@ public class SearchAPI extends BaseAPI
|
||||
String query,
|
||||
String sortby)
|
||||
{
|
||||
return getItemNames(rmSearch(username, password, "rm", query, RM_DEFAULT_CONTENT_FILTERS, sortby));
|
||||
return getItemNames(rmSearch(username, password, "rm", query, RM_DEFAULT_NODES_FILTERS, sortby));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user