Class HoldsAPI


  • @Component
    public class HoldsAPI
    extends BaseAPI
    Methods to make API requests using v0 API for generalized holds
    Since:
    3.2
    Author:
    Rodica Sutu
    • Constructor Detail

      • HoldsAPI

        public HoldsAPI()
    • Method Detail

      • createHold

        public org.apache.http.HttpResponse createHold​(String user,
                                                       String password,
                                                       String holdName,
                                                       String reason,
                                                       String description)
        Util method to create a hold
        Parameters:
        user - the user creating the hold
        password - the user's password
        holdName - the hold name
        reason - hold reason
        description - hold description
        Returns:
        The HTTP response.
      • createHold

        public org.apache.http.HttpResponse createHold​(String user,
                                                       String password,
                                                       String holdName,
                                                       String reason,
                                                       String description,
                                                       int expectedStatusCode)
        Util method to create a hold
        Parameters:
        user - the user creating the hold
        password - the user's password
        holdName - the hold name
        reason - hold reason
        description - hold description
        expectedStatusCode - The expected return status code.
        Returns:
        The HTTP response or throws AssertionError if the returned status code is not as expected.
      • createHoldAndGetNodeRef

        public String createHoldAndGetNodeRef​(String user,
                                              String password,
                                              String holdName,
                                              String reason,
                                              String description)
        Create a hold and get the node ref of the hold from the response body
        Parameters:
        user - the user creating the hold
        password - the user's password
        holdName - the hold name to be created
        reason - reason of the hold to be created
        description - hold description
        Returns:
        node ref of the hold created
      • deleteHold

        public org.apache.http.HttpResponse deleteHold​(org.alfresco.utility.model.UserModel user,
                                                       String holdNodeRef)
        Deletes hold using RM Actions API and expect action to be successful
        Parameters:
        user - the user who does the request
        holdNodeRef - the hold node ref
        Returns:
        The HTTP Response or throws AssertionError if the request is not successful.
      • deleteHold

        public org.apache.http.HttpResponse deleteHold​(String username,
                                                       String password,
                                                       String holdNodeRef,
                                                       int expectedStatusCode)
        Deletes hold using RM Actions API and expect a specific status code
        Parameters:
        username - user's username
        password - its password
        holdNodeRef - the hold node ref
        Returns:
        The HTTP Response or throws AssertionError if the returned status code is not as expected.
      • deleteHold

        public void deleteHold​(String username,
                               String password,
                               String holdName)
        Deletes hold using cmis
        Parameters:
        username - user's username
        password - its password
        holdName - the hold name
        Throws:
        AssertionError - if the deletion was unsuccessful.
      • addItemToHold

        public org.apache.http.HttpResponse addItemToHold​(String user,
                                                          String password,
                                                          String itemNodeRef,
                                                          String holdName)
        Adds item(content/record/record folder) to the hold
        Parameters:
        user - the user who adds the item to the hold
        password - the user's password
        itemNodeRef - the nodeRef of the item to be added to hold
        holdName - the hold name
        Returns:
        The HTTP response
      • addItemsToHolds

        public org.apache.http.HttpResponse addItemsToHolds​(String user,
                                                            String password,
                                                            List<String> itemNodeRefs,
                                                            List<String> holdNames)
        Adds a list of items (content/record/record folder) to a list of holds
        Parameters:
        user - the user who adds the items to the holds
        password - the user's password
        itemNodeRefs - the list of items nodeRefs to be added to holds
        holdNames - the list of holds
        Returns:
        The HTTP response
      • addItemsToHolds

        public org.apache.http.HttpResponse addItemsToHolds​(String user,
                                                            String password,
                                                            int expectedStatus,
                                                            List<String> itemNodeRefs,
                                                            List<String> holdNodeRefs)
        Adds a list of items (content/record/record folder) to a list of holds
        Parameters:
        user - the user who adds the items to the holds
        password - the user's password
        itemNodeRefs - the list of items nodeRefs to be added to holds
        holdNodeRefs - the list of holds
        Returns:
        The HTTP response
      • addToHoldAndGetMessage

        public String addToHoldAndGetMessage​(String user,
                                             String password,
                                             int expectedStatus,
                                             String itemNodeRef,
                                             String holdNodeRef)
        Util method to add item(content/record/record folder) to the hold and get the error message
        Parameters:
        user - the user who adds the item to the hold
        password - the user's password
        itemNodeRef - the nodeRef of the item to be added to hold
        holdNodeRef - the hold node ref
        Returns:
        The error message
      • removeItemFromHold

        public org.apache.http.HttpResponse removeItemFromHold​(String user,
                                                               String password,
                                                               String itemNodeRef,
                                                               String holdName)
        Remove item(content/record/record folder) from hold
        Parameters:
        user - the user who removes the item from the hold
        password - the user's password
        itemNodeRef - the nodeRef of the item to be removed from hold
        holdName - the hold name
        Returns:
        The HTTP response
      • removeItemsFromHolds

        public org.apache.http.HttpResponse removeItemsFromHolds​(String user,
                                                                 String password,
                                                                 List<String> itemNodeRefs,
                                                                 List<String> holdNames)
        Remove a list of items (content/record/record folder) from a list of holds
        Parameters:
        user - the user who removes the item from the hold
        password - the user's password
        itemNodeRefs - the list of items nodeRefs to be removed from hold
        holdNames - the list of hold names
        Returns:
        The HTTP response
      • removeItemsFromHolds

        public org.apache.http.HttpResponse removeItemsFromHolds​(String user,
                                                                 String password,
                                                                 int expectedStatus,
                                                                 List<String> itemNodeRefs,
                                                                 List<String> holdNodeRefs)
        Remove a list of items (content/record/record folder) from a list of holds
        Parameters:
        user - the user who removes the item from the hold
        password - the user's password
        expectedStatus - https status code expected
        itemNodeRefs - the list of items nodeRefs to be removed from hold
        holdNodeRefs - the list of hold node refs
        Returns:
        The HTTP response
      • removeFromHoldAndGetMessage

        public String removeFromHoldAndGetMessage​(String user,
                                                  String password,
                                                  int expectedStatus,
                                                  String itemNodeRef,
                                                  String holdNodeRef)
        Util method to remove item(content/record/record folder) from hold and get the error message
        Parameters:
        user - the user who removes the item from hold
        password - the user's password
        itemNodeRef - the nodeRef of the item to be removed from hold
        holdNodeRef - the hold node ref
        Returns:
        The error message
      • getHolds

        public List<HoldEntry> getHolds​(String user,
                                        String password,
                                        String itemNodeRef,
                                        Boolean includedInHold,
                                        Boolean fileOnly)
        Get the list of the available holds which have the item node reference if includedInHold parameter is true, otherwise a list of hold node references will be retrieved which do not include the given node reference.
        Parameters:
        user - The username of the user to use.
        password - The password of the user.
        itemNodeRef - The item node reference
        includedInHold - True to retrieve the holds which have the item node reference
        fileOnly - True if only files should be return
        Returns:
        return a list of hold entries