Class RMRolesAndActionsAPI

java.lang.Object
org.alfresco.rest.core.v0.BaseAPI
org.alfresco.rest.v0.RMRolesAndActionsAPI

@Component public class RMRolesAndActionsAPI extends BaseAPI
Methods to make API requests using v0 API on RM items (move, update and other actions) including adding users to RM roles
Since:
2.5
Author:
Oana Nechiforescu
  • Constructor Details

    • RMRolesAndActionsAPI

      public RMRolesAndActionsAPI()
  • Method Details

    • getConfiguredRoles

      public Set<String> getConfiguredRoles(String adminUser, String adminPassword)
      Get all the configured RM roles.
      Parameters:
      adminUser - The RM admin user.
      adminPassword - The password of the user.
      Returns:
      The RM roles in the system (Note that this will be the internal names, not the display labels).
    • getCapabilitiesForRole

      public Set<String> getCapabilitiesForRole(String adminUser, String adminPassword, String role)
      Get the capabilities for a given role.
      Parameters:
      adminUser - The RM admin user.
      adminPassword - The password of the user.
      role - The role to get capabilities for.
      Returns:
      The set of system names for the capabilities.
    • createRole

      public void createRole(String adminUser, String adminPassword, String roleName, String roleDisplayLabel, Set<String> capabilities)
      Create a new RM role.
      Parameters:
      adminUser - The username of the admin user.
      adminPassword - The password for the admin user.
      roleName - The name of the new role.
      roleDisplayLabel - A human-readable label for the role.
      capabilities - A list of capabilities for the role.
    • updateRole

      public void updateRole(String adminUser, String adminPassword, String roleName, String roleDisplayLabel, Set<String> capabilities)
      Update an existing RM role.
      Parameters:
      adminUser - The username of the admin user.
      adminPassword - The password for the admin user.
      roleName - The name of the new role.
      roleDisplayLabel - A human-readable label for the role.
      capabilities - A list of capabilities for the role.
    • deleteRole

      public void deleteRole(String adminUser, String adminPassword, String roleName)
      Delete a created RM role.
      Parameters:
      adminUser - The username of the admin user.
      adminPassword - The password for the admin user.
      roleName - The name of the role to be deleted.
    • createUserAndAssignToRole

      public void createUserAndAssignToRole(String adminUser, String adminPassword, String userName, String password, String role)
      create user and assign to records management role
    • assignRoleToUser

      public void assignRoleToUser(String adminUser, String adminPassword, String userName, String role)
      Assign a records management role to a user.
      Throws:
      AssertionError - if the assignation is unsuccessful.
    • moveTo

      public void moveTo(String user, String password, String contentPath, String destinationPath)
      Move action
      Parameters:
      user - the user to move the contentPath
      password - the user's password
      contentPath - path to the content to be moved
      destinationPath - destination path
      Throws:
      AssertionError - if the move was unsuccessful.
    • moveToAndExpectFailure

      public void moveToAndExpectFailure(String user, String password, String contentPath, String destinationPath)
      Move action
      Parameters:
      user - the user to move the contentPath
      password - the user's password
      contentPath - path to the content to be moved
      destinationPath - destination path
      Throws:
      AssertionError - if the move was unexpectedly successful.
    • executeAction

      public org.apache.http.HttpResponse executeAction(String user, String password, String contentName, BaseAPI.RM_ACTIONS action)
      Perform an action on the given content
      Parameters:
      user - the user executing the action
      password - the user's password
      contentName - the content name
      Returns:
      The HTTP response.
    • executeActionAndExpectResponseCode

      public org.apache.http.HttpResponse executeActionAndExpectResponseCode(String user, String password, String contentName, BaseAPI.RM_ACTIONS action, int status)
      Perform an action on the given content
      Parameters:
      user - the user executing the action
      password - the user's password
      contentName - the content name
      Returns:
      The HTTP response.
    • executeAction

      public org.apache.http.HttpResponse executeAction(String user, String password, String contentName, BaseAPI.RM_ACTIONS action, ZonedDateTime date)
      Perform an action on the given content
      Parameters:
      user - the user executing the action
      password - the user's password
      contentName - the content name
      Returns:
      The HTTP response.
    • executeAction

      public org.apache.http.HttpResponse executeAction(String user, String password, String contentName, BaseAPI.RM_ACTIONS action, ZonedDateTime date, int status)
      Perform an action on the record folder
      Parameters:
      user - the user executing the action
      password - the user's password
      contentName - the content name
      date - the date to be updated
      Returns:
      The HTTP response.
    • completeEvent

      public org.apache.http.HttpResponse completeEvent(String user, String password, String nodeName, RMEvents event, Instant date)
      Complete an event on the record/record folder
      Parameters:
      user - the user executing the action
      password - the user's password
      nodeName - the node name
      event - the event to be completed
      date - the date to be updated
      Returns:
      The HTTP response.
    • undoEvent

      public org.apache.http.HttpResponse undoEvent(String user, String password, String contentName, RMEvents event)
      Undo an event on the record/record folder
      Parameters:
      user - the user executing the action
      password - the user's password
      contentName - the content name
      event - the event to be undone
      Returns:
      The HTTP response.
    • deleteAllItemsInContainer

      public void deleteAllItemsInContainer(String username, String password, String siteId, String containerName)
      Deletes every item in the given container
      Parameters:
      username - the user's username
      password - its password
      siteId - the site id in which the container is located
      containerName - the container to look for items into
      Throws:
      AssertionError - if not all items could be deleted.
    • updateMetadata

      public org.apache.http.HttpResponse updateMetadata(String username, String password, String itemNodeRef, Map<BaseAPI.RMProperty,String> properties)
      Updates metadata, can be used on records, folders and categories
      Parameters:
      username - the user updating the item
      password - the user's password
      itemNodeRef - the item noderef
      Returns:
      The HTTP response.