Package com.aquima.interactions.portal
Interface IContentManager
- All Known Implementing Classes:
ContentManagerDelegate
,DisposableContentManager
,FileSystemContentManager
,MemoryContentManager
public interface IContentManager
An interface that can be used to perform basic CRUD operations for content.
- Since:
- 9.3
- Author:
- m.mahabiersing
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(InputStream stream, String name, String contentType, Long processId, String caseId, CustomContentProperties properties, IUserData user, String... roles) Add new content to the repository.void
Delete content from the repositoryThis method returns the content manager's disposable content.boolean
This method checks if the current content manager has anyIDisposableContent
contents.boolean
isAuthorized
(GUID id, IUserData user) This method checks if the user has roles on this content with the given id.int
Reads up tolength
bytes of data from content into a byte array.readMetadata
(GUID id, IUserData user, boolean checkRoles) Reads only the meta data for a given content id.String[]
Reads the required roles for a given content id.void
Update existing content with new data, but keep the existing metadata.void
update
(GUID id, InputStream stream, String name, String contentType, Long processId, String caseId, CustomContentProperties properties, IUserData user) Update existing content with new data and metadata.void
Update existing content with new metadata, but keep the existing data.void
Update the existing content with new roles, but keep the existing data and metadata.
-
Method Details
-
create
GUID create(InputStream stream, String name, String contentType, Long processId, String caseId, CustomContentProperties properties, IUserData user, String... roles) Add new content to the repository.- Parameters:
stream
- The stream containing the data, may not benull
.name
- A name for the content, may not benull
.contentType
- The content type of the data, may benull
ifunknown
.processId
- The id of the process where this content is part of, may benull
.caseId
- The id of the case where this content is part of, may benull
.properties
- Custom properties that should be stored with the content, may not benull
.user
- The user who is considered the creator of the content, may not benull
.roles
- The list of authorized roles associated to this content, may not benull
.- Returns:
- Returns a GUID that uniquely identifies the content, never
null
. - Throws:
CreateContentException
- If creation failed for any reason.
-
readBytes
@CheckReturnValue(explanation="Spotbugs thinks that this method doesn\'t have a side effect. However, it can throw an exception.") int readBytes(GUID id, long position, byte[] buffer, int offset, int length, IUserData user) Reads up tolength
bytes of data from content into a byte array. The method blocks until some input is available. Although publicly available, this method primarily facilitates the implementation ofContentInputStream
. For reading content from anIContentManager
, usage ofContentInputStream
is recommended over direct usage of this method. If the user is not authorized it will throw an exception.- Parameters:
id
- The id of the content that should be read, may not benull
.position
- the start offset in the source content.buffer
- The buffer into which the data is read, (may not benull
.offset
- The start offset in the destination arraybuffer
.length
- The maximum number of bytes read.user
- The user that is reading the content, may not benull
.- Returns:
- The total number of bytes read into the buffer, or
-1
if there is no more data because the end of the content has been reached. - Throws:
ReadContentException
- If the data cannot be read for any reason.ContentAuthorizationException
- If user is not authorized to access the content.- See Also:
-
readMetadata
Reads only the meta data for a given content id.- Parameters:
id
- The id of the content for which meta data is requested, may not benull
.user
- The user that is reading the content, may not benull
.checkRoles
- Flag indicating if the roles check should be done or not.- Returns:
- Returns an
IContentMetadata
IContentMetadata object containing the requested meta data, nevernull
. - Throws:
ReadContentException
- If the meta data cannot be read for any reason.ContentAuthorizationException
- If user is not authorized to access the content.
-
readRoles
Reads the required roles for a given content id.- Parameters:
id
- The id of the content for which roles are requested, may not benull
.user
- The user that is reading the content, may not benull
.- Returns:
- Returns a list of required roles. Can be
null
. - Throws:
ReadContentException
- If the roles cannot be read for any reason.ContentAuthorizationException
- If user is not authorized to access the content.
-
update
Update the existing content with new roles, but keep the existing data and metadata.- Parameters:
id
- The id of the content which should be updated, may not benull
.newRoles
- The list of new roles. May not benull
, may beempty
.user
- The user that is updating the content, may not benull
.- Throws:
UpdateContentException
- If the roles can not be updated for any reason.ContentAuthorizationException
- If user is not authorized to access the content.
-
update
void update(GUID id, InputStream stream, String name, String contentType, Long processId, String caseId, CustomContentProperties properties, IUserData user) Update existing content with new data and metadata.- Parameters:
id
- The id of the content which should be updated, may not benull
.stream
- The InputStream containing the new data, may not benull
.contentType
- The content type of the new data, may benull
.processId
- The id of the case where this content is part of, may benull
.caseId
- The id of the case where this content is part of, may benull
.properties
- The new set of properties, this will completely overwrite the existing properties, may not benull
.user
- The user that is updating the content, may not benull
.- Throws:
UpdateContentException
- If the content can not be updated for any reason.ContentAuthorizationException
- If user is not authorized to access the content.
-
update
Update existing content with new data, but keep the existing metadata.- Parameters:
id
- The id of the content which should be updated, may not benull
.stream
- The InputStream containing the new data, may not benull
.contentType
- The content type of the new data, may benull
.user
- The user that is updating the content, may not benull
.- Throws:
UpdateContentException
- If the content can not be updated for any reason.ContentAuthorizationException
- If user is not authorized to access the content.
-
update
void update(GUID id, Long processId, String caseId, CustomContentProperties properties, IUserData user) Update existing content with new metadata, but keep the existing data.- Parameters:
id
- The id of the content which should be updated, may not benull
.processId
- The id of the process where this content is part of, may benull
.caseId
- The id of the case where this content is part of, may benull
.properties
- The new set of properties, this will completely overwrite the existing properties, may not benull
.user
- The user that is updating the content, may not benull
.- Throws:
UpdateContentException
- If the content can not be updated for any reason.ContentAuthorizationException
- If user is not authorized to access the content.
-
delete
Delete content from the repository- Parameters:
id
- The id of the content which should be deleted, may not benull
.user
- The user that is deleting the content, may not benull
.checkRoles
- Flag indicating if the roles check should be done or not.- Throws:
DeleteContentException
- If the content can not be deleted for any reason.ContentAuthorizationException
- If user is not authorized to access the content.
-
isAuthorized
This method checks if the user has roles on this content with the given id.- Parameters:
id
- The id of the content, nevernull
.user
- The details of the user that wants to access the content, nevernull
.- Returns:
- A flag indicating if the user has roles on the document or not.
-
hasDisposableContent
boolean hasDisposableContent()This method checks if the current content manager has anyIDisposableContent
contents.- Returns:
- A flag indicating whether the content manager has disposable content objects.
-
getDisposableContent
IDisposableContent getDisposableContent()This method returns the content manager's disposable content.
-