diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java index e87c7a21b2..935dcc151c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java @@ -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, diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/RMEvents.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/RMEvents.java new file mode 100644 index 0000000000..bf1d724f65 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/RMEvents.java @@ -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; + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java index abaf11debd..122ab88bef 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java @@ -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(); diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java index 62c0ba697f..2e91ee2928 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java @@ -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 *
* 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)); } /**