diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java index 2888a70adf..ca51c60200 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java @@ -345,4 +345,30 @@ public class RecordsAPI extends BaseAPI return new Pair<>(false, String.valueOf(response.getJSONObject("status").getInt("code"))); } + /** + * Hide in place record + * + * @param user the user + * @param password the user's password + * @param nodeId the in place record node id + * @return true if the action was successful + */ + public boolean hideRecord(String user, String password, String nodeId) + { + String docNodeRef = getNodeRefSpacesStore() + nodeId; + + try + { + JSONObject requestParams = new JSONObject(); + requestParams.put("actionedUponNode", docNodeRef); + requestParams.put("actionDefinitionName", "hide-record"); + + return doPostJsonRequest(user, password, requestParams, ACTIONS_API); + } catch (JSONException error) + { + LOGGER.error("Unable to extract response parameter", error); + } + return false; + } + } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index 43178fdb4d..de96716f21 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -53,6 +53,7 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import javafx.util.Pair; import org.alfresco.dataprep.ContentService; import org.alfresco.rest.RestTest; import org.alfresco.rest.core.RestAPIFactory; @@ -71,6 +72,7 @@ import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; +import org.alfresco.rest.rm.community.util.ParameterCheck; import org.alfresco.rest.search.RestRequestQueryModel; import org.alfresco.rest.search.SearchNodeModel; import org.alfresco.rest.search.SearchRequest; @@ -80,6 +82,7 @@ import org.alfresco.utility.model.ContentModel; import org.alfresco.utility.model.FolderModel; import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.UserModel; +import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.testng.annotations.BeforeClass; @@ -615,6 +618,22 @@ public class BaseRMRestTest extends RestTest } return names; } + + /** + * Helper method to get the error response code and message from the provided setClassificationResponse + * + * @param setClassificationResponse + * @return a pair of representing the code and message from the response + */ + public Pair parseErrorResponse(JSONObject setClassificationResponse) + { + ParameterCheck.mandatoryObject("setClassificationResponse", setClassificationResponse); + + String message = setClassificationResponse.getString("message"); + String code = setClassificationResponse.getJSONObject("status").get("code").toString(); + + return new Pair<>(Integer.valueOf(code), message); + } /** * Helper method to return site document library content model