Class RecordsAPI


  • public class RecordsAPI
    extends RMModelRequest
    Records REST API Wrapper
    Since:
    2.6
    Author:
    Rodica Sutu
    • Constructor Detail

      • RecordsAPI

        public RecordsAPI​(RMRestWrapper rmRestWrapper)
        Parameters:
        rmRestWrapper - RM REST Wrapper
    • Method Detail

      • getRecordContent

        public io.restassured.response.ResponseBody<?> getRecordContent​(String recordId)
        Get the content for the electronic record
        Parameters:
        recordId - The id of the electronic record
        Returns:
        ResponseBody representing content for the given record id
        Throws:
        RuntimeException - for the following cases:
        • recordId has no content
        • recordId is not a valid format, or is not a record
        • authentication fails
        • recordId does not exist
      • fileRecord

        public Record fileRecord​(RecordBodyFile recordBodyFile,
                                 String recordId)
        File the record recordId into file plan structure based on the location sent via the request body
        Parameters:
        recordBodyFile - The properties where to file the record
        recordId - The id of the record to file
        Returns:
        The Record with the given properties
        Throws:
        RuntimeException - for the following cases:
        • Invalid parameter: recordBodyFile is not a valid format,recordId is not a record
        • authentication fails
        • current user does not have permission to file to fileplanComponentId
        • recordId does not exist
        • targetParentId from recordBodyFile does not exist
        • model integrity exception: the action breaks system's integrity restrictions
      • fileRecord

        public Record fileRecord​(RecordBodyFile recordBodyFile,
                                 String recordId,
                                 String parameters)
        File the record recordId into file plan structure based on the location sent via the request body
        Parameters:
        recordBodyFile - The properties where to file the record
        recordId - The id of the record to file
        Returns:
        The Record with the given properties
        Throws:
        RuntimeException - for the following cases:
        • Invalid parameter: recordBodyFile is not a valid format,recordId is not a record
        • authentication fails
        • current user does not have permission to file to fileplanComponentId
        • recordId does not exist
        • targetParentId from recordBodyFile does not exist
        • model integrity exception: the action breaks system's integrity restrictions
      • completeRecord

        public Record completeRecord​(String recordId,
                                     String parameters)
        Complete the record recordId
        Parameters:
        recordId - The id of the record to complete
        Returns:
        The completed Record with the given properties
        Throws:
        RuntimeException - for the following cases:
        • Invalid parameter: recordId is not a record
        • authentication fails
        • current user does not have permission to complete recordId
        • recordId does not exist or is frozen
        • model integrity exception: the record is already completed
        • model integrity exception: the record has missing meta-data
      • deleteRecord

        public void deleteRecord​(String recordId)
        Deletes a record.
        Parameters:
        recordId - The identifier of a record
        Throws:
        RuntimeException - for the following cases:
        • recordId is not a valid format
        • authentication fails
        • current user does not have permission to delete recordId
        • recordId does not exist
        • recordId is locked and cannot be deleted
      • getRecord

        public Record getRecord​(String recordId,
                                String parameters)
        Gets a record.
        Parameters:
        recordId - The identifier of a record
        parameters - The URL parameters to add
        Returns:
        The Record for the given recordId
        Throws:
        RuntimeException - for the following cases:
        • recordId is not a valid format
        • authentication fails
        • current user does not have permission to read recordId
        • recordId does not exist
      • updateRecord

        public Record updateRecord​(Record recordModel,
                                   String recordId,
                                   String parameters)
        Updates a record.
        Parameters:
        recordModel - The record model which holds the information
        recordId - The identifier of a record
        parameters - The URL parameters to add
        Returns:
        The updated Record
        Throws:
        RuntimeException - for the following cases:
        • the update request is invalid or recordId is not a valid format or recordModel is invalid
        • authentication fails
        • current user does not have permission to update recordId
        • recordId does not exist
        • the updated name clashes with an existing record in the current parent folder
        • model integrity exception, including file name with invalid characters