Class AnyCasesManager
java.lang.Object
eu.c6.gibraltar.api.common.AbstractManager
eu.c6.gibraltar.api.managers.cases.AnyCasesManager
The Class AnyContentsManager to manage cases.
-
Field Summary
Fields inherited from class eu.c6.gibraltar.api.common.AbstractManager
APPLICATION_XLS, APPLICATION_XLS_TYPE, APPLICATION_XLSX, APPLICATION_XLSX_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionAnyCasesManager(AnySession anySession) Instantiates a new Any contents manager. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddAttachment(String objectId, String metadata, File file) Adds an attachment to a data objectaddContent(String objectId, String metadata, String contentId) Adds an content to a case.addContentVersion(String objectId, String metadata, String contentRootId, String version) Adds a specific content version to a case.booleanapplyMetadataComposer(String objectId, String composer) Apply metadata composer to a data object.Create a data object with specified metadatabooleanDelete data object.booleandeleteAttachment(String objectId, String metadata, String attachmentId) Delete data object attachment.booleandeleteWithCheckReference(String objectId) Delete data object safely.booleandeleteWithoutCheckReference(String objectId) Delete case without check references.getAttachments(String objectId, String metadata) Gets the data object attachments.getContents(String objectId, String metadata) Gets the data object contents.getLifecycleNextStates(String objectId, String lifecycle) Changes case lifecycle state.Get the dump of data object.getObjects(List<String> objectIds) Get the dump of data objects.booleanlifecycleChangeState(String objectId, String lifecycle, String targetState) Get case lifecycle next states.booleanPost an event intercepted by the lifecycle to trigger a state change if such event is listened.booleanremoveAllContents(String objectId, String metadata) Remove all contents related to a data object.booleanremoveContent(String objectId, String metadata, String relationId) Remove a content from a data object.search(IApiFullTextSearchRequest request) Search for data objects.booleansetDataObjectMetadata(String objectId, String metadata, String dataObjectId) Set data object reference to another data object.booleansetDataObjectMetadataList(String objectId, String metadata, String mode, List<String> dataObjectIds) Sets multiple references to others data objects.booleansetMetadata(String objectId, String metadata, String value) Sets a single value metadata.booleanSets a multiple values metadata.booleanUpdate data object with specified metadata.viewAttachment(String objectId, String metadata, String attachmentId) Download format of data object attachment.
-
Constructor Details
-
AnyCasesManager
Instantiates a new Any contents manager.- Parameters:
anySession- the Any user session
-
-
Method Details
-
create
Create a data object with specified metadata- Parameters:
objectType- the data object type you want to createmetadata- 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
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
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
Search for data objects.- Parameters:
request- used for search terms and location- Returns:
ScrollResultcontaining 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
Gets the data object attachments.- Parameters:
metadata- the attachments metadata nameobjectId- 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
Adds an attachment to a data object- Parameters:
objectId- the case identifiermetadata- the attachments metadata namefile- 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 identifiermetadata- the attachments metadata nameattachmentid- 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 identifiermetadata- the attachments metadata nameattachmentId- the attachment identifier- Returns:
- the input stream response
- Throws:
Exception- the exception if download is not correct or failed
-
addContent
Adds an content to a case.- Parameters:
objectId- the case identifiermetadata- the contents metadata namecontentId- 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 identifiermetadata- the contents metadata namecontentRootId- target content root identifierversion- 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
Remove a content from a data object.- Parameters:
objectId- the case identifiermetadata- the contents metadata namerelationId- 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
Remove all contents related to a data object.- Parameters:
objectId- the case identifiermetadata- 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
Gets the data object contents.- Parameters:
objectId- the data object identifiermetadata- 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 identifiermetadata- 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 identifiermetadata- 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 identifiermetadata- 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
Sets a single value metadata.- Parameters:
objectId- the data object identifiermetadata- 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
Post an event intercepted by the lifecycle to trigger a state change if such event is listened.- Parameters:
objectId- the data object identifierevent- 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
Apply metadata composer to a data object.- Parameters:
objectId- the data object identifiercomposer- 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 identifierlifecycle- (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
Changes case lifecycle state.- Parameters:
objectId- the data object identifierlifecycle- (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
Update data object with specified metadata.- Parameters:
objectId- the data object identifiermetadata- 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
Delete data object.- Parameters:
objectId- the data object identifiercheckReferenced- 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
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
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
-