Class AnyCasesManager

java.lang.Object
eu.c6.gibraltar.api.common.AbstractManager
eu.c6.gibraltar.api.managers.cases.AnyCasesManager

public class AnyCasesManager extends AbstractManager
The Class AnyContentsManager to manage cases.
  • Constructor Details

    • AnyCasesManager

      public AnyCasesManager(AnySession anySession)
      Instantiates a new Any contents manager.
      Parameters:
      anySession - the Any user session
  • Method Details

    • create

      public String create(String objectType, Map<String,Object> metadata) throws Exception
      Create a data object with specified metadata
      Parameters:
      objectType - the data object type you want to create
      metadata - the metadata of new data object. Map of keys/values corresponding to each metadata to set. The metadata name must match the pattern "<aspect>.<name>" (ex : mydataobject.subject)
      locationId - the location identifier to link manually the case. It can be a room identifier or a folder path. Set it to NULL if you do not want to link it.
      file - the file associated to your new content
      Returns:
      the identifier of the new data object
      Throws:
      Exception - the exception if you are not authorized to create the new data object or error occurred during creation
    • getObject

      public ICObject getObject(String objectId) throws Exception
      Get the dump of data object.
      Parameters:
      objectId - the data object identifier
      Returns:
      the dump of data object
      Throws:
      Exception - the exception if current user is not authorized to access to the case or case is not found
    • getObjects

      public Map<String,ICObject> getObjects(List<String> objectIds) throws Exception
      Get the dump of data objects.
      Parameters:
      objectIds - Data object IDs
      Returns:
      List of data objects dumps
      Throws:
      Exception - the exception if current user is not authorized to access to the data object or data object is not found
    • search

      public ScrollResult search(IApiFullTextSearchRequest request) throws Exception
      Search for data objects.
      Parameters:
      request - used for search terms and location
      Returns:
      ScrollResult containing the list of abstract contents (ScrollResult.getResults()) and total count of contents ( ScrollResult.getTotalCount()).
      Throws:
      Exception - the exception if the current user is not authorized to access to specified location
    • getAttachments

      public List<ICObject> getAttachments(String objectId, String metadata) throws Exception
      Gets the data object attachments.
      Parameters:
      metadata - the attachments metadata name
      objectId - the case identifier
      Returns:
      the attachments as list of CObject with :
      • attachmentId : String. Identifier of the attachment
      • contentType : String . case type
      • extension : String . Extension
      • mimeType : String . Mime type
      • size : Long . Size
      Throws:
      Exception - the exception if current user is not authorized to access to the case formats or case is not found
    • addAttachment

      public boolean addAttachment(String objectId, String metadata, File file) throws Exception
      Adds an attachment to a data object
      Parameters:
      objectId - the case identifier
      metadata - the attachments metadata name
      file - the attachment file
      Returns:
      true, if successful attached
      Throws:
      Exception - the exception if you are not authorized to manage attachments of this case, case is not found or constraints are not valid after update.
    • deleteAttachment

      public boolean deleteAttachment(String objectId, String metadata, String attachmentId) throws Exception
      Delete data object attachment.
      Parameters:
      objectId - the data object identifier
      metadata - the attachments metadata name
      attachmentid - the attachment identifier (use 'all' keyword instead of the ID to remove all attachments)
      Returns:
      true, if successfully deleted
      Throws:
      Exception - the exception if current user is not authorized to edit or delete attachments, attachment is not found, data object is not found
    • viewAttachment

      public InputStream viewAttachment(String objectId, String metadata, String attachmentId) throws Exception
      Download format of data object attachment.
      Parameters:
      objectId - the data object identifier
      metadata - the attachments metadata name
      attachmentId - the attachment identifier
      Returns:
      the input stream response
      Throws:
      Exception - the exception if download is not correct or failed
    • addContent

      public String addContent(String objectId, String metadata, String contentId) throws Exception
      Adds an content to a case.
      Parameters:
      objectId - the case identifier
      metadata - the contents metadata name
      contentId - target content identifier
      Returns:
      true, if successful attached
      Throws:
      Exception - the exception if you are not authorized to manage attachments of this case, case is not found or target content is not found
    • addContentVersion

      public String addContentVersion(String objectId, String metadata, String contentRootId, String version) throws Exception
      Adds a specific content version to a case.
      Parameters:
      objectId - the case identifier
      metadata - the contents metadata name
      contentRootId - target content root identifier
      version - target target content version
      Returns:
      true, if successfully linked
      Throws:
      Exception - the exception if you are not authorized to manage contents of this data object, data object is not found or target content is not found using root identifier
    • removeContent

      public boolean removeContent(String objectId, String metadata, String relationId) throws Exception
      Remove a content from a data object.
      Parameters:
      objectId - the case identifier
      metadata - the contents metadata name
      relationId - the internal relation link Identifier used by data object to reference content
      Returns:
      true, if successful attached
      Throws:
      Exception - the exception if you are not authorized to manage contents of this data object, data object is not found or relation is not found
    • removeAllContents

      public boolean removeAllContents(String objectId, String metadata) throws Exception
      Remove all contents related to a data object.
      Parameters:
      objectId - the case identifier
      metadata - the contents metadata name
      Returns:
      true, if successful attached
      Throws:
      Exception - the exception if you are not authorized to manage attachments of this data object, data object is not found or metadata is not valid
    • getContents

      public List<ICObject> getContents(String objectId, String metadata) throws Exception
      Gets the data object contents.
      Parameters:
      objectId - the data object identifier
      metadata - the contents metadata name
      Returns:
      the attachments as list of CObject with :
      • relationId : String. Identifier of the relation
      • targetRootId : String . Target content root identifier
      • targetVersions : List of String. Versions tag
      • creationDate : Date . Creation date of link between data object and content
      Throws:
      Exception - the exception if current user is not authorized to access to the data object or data object is not found
    • setDataObjectMetadataList

      public boolean setDataObjectMetadataList(String objectId, String metadata, String mode, List<String> dataObjectIds) throws Exception
      Sets multiple references to others data objects.
      Parameters:
      objectId - the data object identifier
      metadata - the data object reference metadata name to update. The metadata name must match the pattern "<aspect>.<name>" (ex : mydataobject.keywords)
      mode - the update mode. Possible values are :
      • insert : insert values before current values
      • append : append values after current values
      • truncate_set : replace current values
      values - the values to set
      Returns:
      true, if metadata is valid and successfully updated with all values.
      Throws:
      Exception - the exception if current user is not authorized to edit metadata of data object, data object is not found or values are not correct
    • setDataObjectMetadata

      public boolean setDataObjectMetadata(String objectId, String metadata, String dataObjectId) throws Exception
      Set data object reference to another data object.
      Parameters:
      objectId - the data object identifier
      metadata - the data object reference metadata name
      Returns:
      true, if successful attached
      Throws:
      Exception - the exception if you are not authorized to manage attachments of this case, case is not found or constraints are not valid after update.
    • setMetadataList

      public boolean setMetadataList(String contentId, String metadata, String mode, List<String> values) throws Exception
      Sets a multiple values metadata.
      Parameters:
      contentId - the data object identifier
      metadata - the metadata name to update. The metadata name must match the pattern "<aspect>.<name>" (ex : standard.keywords)
      mode - the update mode. Possible values are :
      • insert : insert values before current values
      • append : append values after current values
      • truncate_set : replace current values
      values - the values to set
      Returns:
      true, if metadata is valid and successfully updated with all values.
      Throws:
      Exception - the exception if current user is not authorized to edit metadata of data object, data object is not found or values are not correct
    • setMetadata

      public boolean setMetadata(String objectId, String metadata, String value) throws Exception
      Sets a single value metadata.
      Parameters:
      objectId - the data object identifier
      metadata - the metadata name to update. The metadata name must match the pattern "<aspect>.<name>" (ex : mydataobject.title)
      value - the value to set
      Returns:
      true, if metadata is valid and successfully updated
      Throws:
      Exception - the exception if current user is not authorized to edit metadata of data object, data object is not found or value is not correct
    • postEvent

      public boolean postEvent(String objectId, String event) throws Exception
      Post an event intercepted by the lifecycle to trigger a state change if such event is listened.
      Parameters:
      objectId - the data object identifier
      event - the event name triggered.
      Returns:
      true, if successfully intercepted and state change is done
      Throws:
      Exception - the exception if you are not authorized to change state of data object or data object is not found
    • applyMetadataComposer

      public boolean applyMetadataComposer(String objectId, String composer) throws Exception
      Apply metadata composer to a data object.
      Parameters:
      objectId - the data object identifier
      composer - the composer configuration name
      Returns:
      true, if successfully applied
      Throws:
      Exception - the exception if you are not authorized to edit this data object
    • lifecycleChangeState

      public boolean lifecycleChangeState(String objectId, String lifecycle, String targetState) throws Exception
      Get case lifecycle next states.
      Parameters:
      objectId - the data object identifier
      lifecycle - (Nullable) the lifecycle configuration name if you want to initialize or use a specific lifecycle. Set it to NULL if you want to use default lifecycle associated to the data object.
      targetState - the target state.
      Returns:
      true, if change state is successful. If target state is not a valid next state or change state conditions are not valid, the change state is not applied and return false.
      Throws:
      Exception - the exception if current user is not authorized to change state of data object or data object is not found
    • getLifecycleNextStates

      public List<String> getLifecycleNextStates(String objectId, String lifecycle) throws Exception
      Changes case lifecycle state.
      Parameters:
      objectId - the data object identifier
      lifecycle - (Nullable) the lifecycle configuration name if you want to initialize or use a specific lifecycle. Set it to NULL if you want to use default lifecycle associated to the case.
      targetState - the target state.
      Returns:
      true, if change state is successful. If target state is not a valid next state or change state conditions are not valid, the change state is not applied and return false.
      Throws:
      Exception - the exception if current user is not authorized to change state of data object or data object is not found
    • update

      public boolean update(String objectId, Map<String,Object> metadata) throws Exception
      Update data object with specified metadata.
      Parameters:
      objectId - the data object identifier
      metadata - the metadata of new case. Map of keys/values corresponding to each metadata to set. The metadata name must match the pattern "<aspect>.<name>" (ex : mydataobject.subject)
      Returns:
      true, if successfully updated
      Throws:
      Exception - the exception if you are not authorized to edit this data object properties or data object is not found.
    • delete

      public boolean delete(String objectId, boolean checkReferenced) throws Exception
      Delete data object.
      Parameters:
      objectId - the data object identifier
      checkReferenced - set to 'true' to avoid deletion if data object is referenced by another data object, 'false' will not verify
      Returns:
      true, if successfully deleted
      Throws:
      Exception - the exception if you are not authorized to delete this data object
    • deleteWithCheckReference

      public boolean deleteWithCheckReference(String objectId) throws Exception
      Delete data object safely.
      Parameters:
      objectId - the data object identifier
      Returns:
      true, if successfully deleted
      Throws:
      Exception - the exception if you are not authorized to delete this data object
    • deleteWithoutCheckReference

      public boolean deleteWithoutCheckReference(String objectId) throws Exception
      Delete case without check references.
      Parameters:
      objectId - the data object identifier
      Returns:
      true, if successfully deleted
      Throws:
      Exception - the exception if you are not authorized to delete this data object