public interface ContentManager
Content manager which interacts with the ContentProvider
s to get, update and delete content based on its ContentScope
.
Modifier and Type | Method and Description |
---|---|
ContentReference |
addContent(ContentInfo contentInfo,
org.springframework.core.io.Resource resource,
long inputStreamLength)
Add content with the specified
ContentInfo and the content itself as InputStream . |
int |
deleteContent(ContentReference contentReference)
Deletes all versions of the specified
ContentReference such that the passed in ContentReference cannot be used anymore to retrieve content. |
void |
deleteContent(ContentReference contentReference,
String version)
Deletes a specific version of the specified
ContentReference such that the passed in ContentReference cannot be used anymore to retrieve content with that
version. |
void |
deleteContent(String contentSourceId)
Deletes the content that is associated to the supplied ContentSourceId.
|
org.springframework.core.io.Resource |
getContent(ContentReference contentReference)
Returns the latest version of the content.
|
org.springframework.core.io.Resource |
getContent(ContentReference contentReference,
String version)
Returns the specified version of the content.
|
byte[] |
getContentAsBytes(ContentReference contentReference)
Returns the latest version of the content as a byte array.
|
byte[] |
getContentAsBytes(ContentReference contentReference,
String version)
Returns the specified version of the content as a byte array.
|
Optional<ContentMetadata> |
getContentMetadata(ContentReference contentReference)
Returns the metadata of the latest version of the content.
|
Optional<ContentMetadata> |
getContentMetadata(ContentReference contentReference,
String version)
Returns the metadata of the supplied version of the content.
|
Optional<ContentReference> |
getContentReference(String contentReferenceId)
Gets the content reference associated to the supplied ContentReferenceId.
|
List<ContentReference> |
getContentReferences(String contentSourceId)
Gets a list of all the content references associated to the supplied ContentSourceId.
|
List<String> |
getContentVersions(ContentReference contentReference)
Returns a list with all the versions of the content of the specified
ContentReference . |
ContentProvider |
getDefaultContentProvider()
Returns the default
ContentProvider configured for the content manager instance. |
void |
setContentSourceId(ContentReference contentReference,
String contentSourceId)
Sets the ContentSourceId for a selected
ContentReference . |
ContentReference |
updateContent(ContentReference contentReference,
org.springframework.core.io.Resource resource,
long inputStreamLength,
ContentMetadata contentMetadata)
This method behaves exactly like calling
updateContent(ContentReference, Resource, long, ContentMetadata, boolean) with the last parameter set to false. |
ContentReference |
updateContent(ContentReference contentReference,
org.springframework.core.io.Resource resource,
long inputStreamLength,
ContentMetadata contentMetadata,
boolean overwrite)
Updates the the content and the metadata of the specified
ContentReference with the specified InputStream and ContentMetadata , with the option to
overwrite te existing version. |
void |
updateContentMetadata(ContentReference contentReference,
ContentMetadata contentMetadata)
Updates the content metadata.
|
ContentReference addContent(ContentInfo contentInfo, org.springframework.core.io.Resource resource, long inputStreamLength)
Add content with the specified ContentInfo
and the content itself as InputStream
. The provided InputStream
will always be closed. This method
triggers the ContentListener.contentAdded(ContentEvent)
method of the registered content listeners.
contentInfo
- the content inforesource
- the content as input streaminputStreamLength
- the length of the input streamContentException
- if there is an error with the specified input stream or the content could not be addedContentProviderNotFoundException
- if the content provider with the content provider id of the content info is not foundIllegalArgumentException
- if the specified content info, the input stream or its length is not valid. Also, if the provided content metadata object size field is not
a non-zero positive numberorg.springframework.core.io.Resource getContent(ContentReference contentReference)
Returns the latest version of the content. The version of the specified ContentReference
is not taken into account.
contentReference
- the content reference of the content to be returnedContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundContentPreProcessingException
- if the content is still in processingIllegalArgumentException
- if the content reference is not validbyte[] getContentAsBytes(ContentReference contentReference)
Returns the latest version of the content as a byte array.
Note
|
Whenever possible you should use the stream-based content access methods as they will allow large content to be processed without requiring that the whole content be loaded into memory at the same time. |
contentReference
- the content reference of the content to be returnedContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundContentPreProcessingException
- if the content is still in processingIllegalArgumentException
- if the content reference is not validorg.springframework.core.io.Resource getContent(ContentReference contentReference, String version)
Returns the specified version of the content. The version of the specified ContentReference
is not taken into account.
contentReference
- the content reference of the content to be returnedversion
- the version of the content to be returnedContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content or the specified version of it is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference or the version is not validbyte[] getContentAsBytes(ContentReference contentReference, String version)
Returns the specified version of the content as a byte array.
Note
|
Whenever possible you should use the stream-based content access methods as they will allow large content to be processed without requiring that the whole content be loaded into memory at the same time. |
contentReference
- the content reference of the content to be returnedContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundContentPreProcessingException
- if the content is still in processingIllegalArgumentException
- if the content reference is not validOptional<ContentMetadata> getContentMetadata(ContentReference contentReference)
Returns the metadata of the latest version of the content. The version of the specified ContentReference
is not taken into account.
contentReference
- the content reference of the content to be returnedOptional
content metadata object of the specified content reference.ContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content (and the content metadata) is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference is not validOptional<ContentMetadata> getContentMetadata(ContentReference contentReference, String version)
Returns the metadata of the supplied version of the content. The version of the specified ContentReference
is not taken into account.
contentReference
- the content reference of the content to be returnedversion
- the versionContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content (and the content metadata) is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference or the version are not validList<String> getContentVersions(ContentReference contentReference)
Returns a list with all the versions of the content of the specified ContentReference
. The first entry of the list holds the first version and the last entry the
last one.
contentReference
- the content reference of the content versions to be returnedContentNotFoundException
- if the content is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference is not validList<ContentReference> getContentReferences(String contentSourceId)
Gets a list of all the content references associated to the supplied ContentSourceId. In case of a multi-versioned content reference, the last version is retrieved.
contentSourceId
- the content source idContentException
- if there is an error while retrieving the contentIllegalArgumentException
- if the content source id is null or undefinedOptional<ContentReference> getContentReference(String contentReferenceId)
Gets the content reference associated to the supplied ContentReferenceId. In case of a multi-versioned content reference, the last version is retrieved.
contentReferenceId
- the content reference idContentException
- if there is an error while retrieving the contentContentProvider getDefaultContentProvider()
Returns the default ContentProvider
configured for the content manager instance.
ContentReference updateContent(ContentReference contentReference, org.springframework.core.io.Resource resource, long inputStreamLength, ContentMetadata contentMetadata)
This method behaves exactly like calling updateContent(ContentReference, Resource, long, ContentMetadata, boolean)
with the last parameter set to false.
contentReference
- the content reference to be updatedresource
- the updated content as input streaminputStreamLength
- the length of the input streamcontentMetadata
- the optional content metadataContentException
- if there is an error with the specified input stream or the content could not be addedContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference, the input stream or its length is not valid. Also, if the provided content metadata object size field is not a
non-zero positive numberContentReference updateContent(ContentReference contentReference, org.springframework.core.io.Resource resource, long inputStreamLength, ContentMetadata contentMetadata, boolean overwrite)
Updates the the content and the metadata of the specified ContentReference
with the specified InputStream
and ContentMetadata
, with the option to
overwrite te existing version. A new ContentReference
will be returned with the new version set if the overwrite flag is set to false. The same ContentReference will
be returned if the overwrite flag is set to true. The source id of the specified content reference must not be changed. The provided InputStream
will always be
closed. This method triggers the ContentListener.contentUpdated(ContentEvent)
method of the registered content listeners.
contentReference
- the content reference to be updatedresource
- the updated content as input streaminputStreamLength
- the length of the input streamcontentMetadata
- the optional content metadataoverwrite
- true if the content that is about to be updated shall be overwritten, otherwise falseContentException
- if there is an error with the specified input stream or the content could not be addedContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference, the input stream or its length is not validvoid updateContentMetadata(ContentReference contentReference, ContentMetadata contentMetadata)
Updates the content metadata. This method triggers the ContentListener.contentUpdated(ContentEvent)
method of the registered content listeners.
contentReference
- the content referencecontentMetadata
- the content metadataContentException
- if there is an error updating the content metadataContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference is not valid or if the provided content metadata object size field is not a non-zero positive numbervoid setContentSourceId(ContentReference contentReference, String contentSourceId)
Sets the ContentSourceId for a selected ContentReference
. All the versions of the content reference are updated. This method triggers the ContentListener.contentUpdated(ContentEvent)
method of the registered content listeners.
contentReference
- the content referencecontentSourceId
- the content source idContentException
- if there is an error updating the content source idContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference or the content source id are not validint deleteContent(ContentReference contentReference)
Deletes all versions of the specified ContentReference
such that the passed in ContentReference
cannot be used anymore to retrieve content. This method
triggers the ContentListener.contentDeleted(ContentEvent, Optional)
method of the registered content listeners.
contentReference
- the content reference to be deletedContentException
- if there is an error deleting the contentContentNotFoundException
- if the content is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference is not validvoid deleteContent(ContentReference contentReference, String version)
Deletes a specific version of the specified ContentReference
such that the passed in ContentReference
cannot be used anymore to retrieve content with that
version. This method triggers the ContentListener.contentDeleted(ContentEvent, Optional)
method of the registered content listeners.
contentReference
- the content reference to be deletedversion
- the version of the content to be deletedContentException
- if there is an error deleting the contentContentNotFoundException
- if the content or the specified version of it is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference or the version is not validvoid deleteContent(String contentSourceId)
Deletes the content that is associated to the supplied ContentSourceId. All the configured content providers are called to delete the content. This method triggers
the ContentListener.contentDeleted(ContentEvent, Optional)
method of the registered content listeners.
contentSourceId
- the content source idContentException
- if there is an error deleting the contentIllegalArgumentException
- if the {ContentSourceId is nullCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.