public class DefaultConfigurableContentManager extends Object implements ConfigurableContentManager
Default ConfigurableContentManager implementation. This implementation uses the CurrentTenantService to set the scope of the operations of the content provider.
| Modifier and Type | Field and Description | 
|---|---|
static String | 
PRE_PROCESS_ORIGINAL_FILE_NAME  | 
static String | 
PRE_PROCESS_PROCESSED_FILE_NAME  | 
| Constructor and Description | 
|---|
DefaultConfigurableContentManager(List<ContentProvider> contentProviders,
                                 CurrentTenantService currentTenantService,
                                 CurrentUserService currentUserService,
                                 org.springframework.transaction.PlatformTransactionManager transactionManager)
Constructor for the  
ConfigurableContentManager. | 
| Modifier and Type | Method and Description | 
|---|---|
ContentReference | 
addContent(ContentInfo contentInfo,
          InputStream inputStream,
          int inputStreamLength)
Add content with the specified  
ContentInfo and the content itself as InputStream. | 
void | 
addContentProvider(ContentProvider contentProvider)
Add a  
ContentProvider to the content manager. | 
void | 
deleteContent()
Deletes all the content of the content manager. 
 | 
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. 
 | 
InputStream | 
getContent(ContentReference contentReference)
Returns the latest version of the content. 
 | 
InputStream | 
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. 
 | 
List<ContentProvider> | 
getContentProviders()
Returns the  
ContentProviders. | 
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 | 
processContent(ContentScope contentScope,
              ContentProcessor contentProcessor)
Process all content with the given content processor 
 | 
void | 
setContentListeners(List<ContentListener> contentListeners)
Set the  
ContentListeners for the content manager. | 
void | 
setContentPreProcessingConfiguration(ContentPreProcessingConfiguration contentPreProcessingConfiguration)
Set the  
ContentPreProcessingConfiguration which is required if you want to pre process the content added or updated in a separate job. | 
void | 
setContentSourceId(ContentReference contentReference,
                  String contentSourceId)
Sets the ContentSourceId for a selected  
ContentReference. | 
ContentReference | 
updateContent(ContentReference contentReference,
             InputStream inputStream,
             int inputStreamLength,
             ContentMetadata contentMetadata)
This method behaves exactly like calling  
ContentManager.updateContent(ContentReference, InputStream, int, ContentMetadata, boolean) with the last parameter set to false. | 
ContentReference | 
updateContent(ContentReference contentReference,
             InputStream inputStream,
             int inputStreamLength,
             ContentMetadata contentMetadata,
             boolean overwriteVersion)
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. 
 | 
public static final String PRE_PROCESS_ORIGINAL_FILE_NAME
public static final String PRE_PROCESS_PROCESSED_FILE_NAME
public DefaultConfigurableContentManager(List<ContentProvider> contentProviders, CurrentTenantService currentTenantService, CurrentUserService currentUserService, org.springframework.transaction.PlatformTransactionManager transactionManager)
Constructor for the ConfigurableContentManager. It requires a list of content providers and the current tenant service. The first element of the list of content
providers is considered to be the default one.
contentProviders - A list of content providers that can be used with this content manager.currentTenantService - the current tenant service that will be used to establish the content scope of the content manager instancecurrentUserService - the current user service used to get the current user for the content pre processing jobstransactionManager - the transaction managerIllegalArgumentException - if the current tenant service is null or if the supplied list of content providers is null, if it contains null values or if it not contains
at least a valid content provider@Transactional public ContentReference addContent(ContentInfo contentInfo, InputStream inputStream, int inputStreamLength)
ContentManagerAdd 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.
addContent in interface ContentManagercontentInfo - the content infoinputStream - the content as input streaminputStreamLength - the length of the input stream@Transactional(readOnly=true) public InputStream getContent(ContentReference contentReference)
ContentManagerReturns the latest version of the content. The version of the specified ContentReference is not taken into account.
getContent in interface ContentManagercontentReference - the content reference of the content to be returned@Transactional(readOnly=true) public byte[] getContentAsBytes(ContentReference contentReference)
ContentManagerReturns 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.  | 
getContentAsBytes in interface ContentManagercontentReference - the content reference of the content to be returned@Transactional(readOnly=true) public InputStream getContent(ContentReference contentReference, String version)
ContentManagerReturns the specified version of the content. The version of the specified ContentReference is not taken into account.
getContent in interface ContentManagercontentReference - the content reference of the content to be returnedversion - the version of the content to be returned@Transactional(readOnly=true) public byte[] getContentAsBytes(ContentReference contentReference, String version)
ContentManagerReturns 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.  | 
getContentAsBytes in interface ContentManagercontentReference - the content reference of the content to be returned@Cacheable(value="edorasGear-contentMetadataByContentReferenceId",
           condition="#contentReference != null",
           key="#contentReference.getId()")
public Optional<ContentMetadata> getContentMetadata(ContentReference contentReference)
ContentManagerReturns the metadata of the latest version of the content. The version of the specified ContentReference is not taken into account.
getContentMetadata in interface ContentManagercontentReference - the content reference of the content to be returnedOptional content metadata object of the specified content reference.public Optional<ContentMetadata> getContentMetadata(ContentReference contentReference, String version)
ContentManagerReturns the metadata of the supplied version of the content. The version of the specified ContentReference is not taken into account.
getContentMetadata in interface ContentManagercontentReference - the content reference of the content to be returnedversion - the version@Transactional(readOnly=true)
 @Cacheable(value="edorasGear-contentVersionsByContentReferenceId",
           condition="#contentReference != null",
           key="#contentReference.getId()")
public List<String> getContentVersions(ContentReference contentReference)
ContentManagerReturns 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.
getContentVersions in interface ContentManagercontentReference - the content reference of the content versions to be returned@Transactional(readOnly=true)
 @Cacheable(value="edorasGear-contentReferencesByContentSourceId",
           condition="#contentSourceId != null",
           key="#contentSourceId")
public List<ContentReference> getContentReferences(String contentSourceId)
ContentManagerGets 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.
getContentReferences in interface ContentManagercontentSourceId - the content source id@Transactional(readOnly=true) public Optional<ContentReference> getContentReference(String contentReferenceId)
ContentManagerGets the content reference associated to the supplied ContentReferenceId. In case of a multi-versioned content reference, the last version is retrieved.
getContentReference in interface ContentManagercontentReferenceId - the content reference id@Transactional
 @CacheEvict(cacheNames={"edorasGear-contentMetadataByContentReferenceId","edorasGear-contentVersionsByContentReferenceId"},key="#contentReference.getId()") @CacheEvict(value="edorasOne-previewedDocuments",key="#contentReference")
public ContentReference updateContent(ContentReference contentReference,
                                                                                                                                                                                                                                                                                            InputStream inputStream,
                                                                                                                                                                                                                                                                                            int inputStreamLength,
                                                                                                                                                                                                                                                                                            ContentMetadata contentMetadata)
ContentManagerThis method behaves exactly like calling ContentManager.updateContent(ContentReference, InputStream, int, ContentMetadata, boolean) with the last parameter set to false.
updateContent in interface ContentManagercontentReference - the content reference to be updatedinputStream - the updated content as input streaminputStreamLength - the length of the input streamcontentMetadata - the optional content metadata@Transactional
 @CacheEvict(cacheNames={"edorasGear-contentMetadataByContentReferenceId","edorasGear-contentVersionsByContentReferenceId"},key="#contentReference.getId()") @CacheEvict(value="edorasOne-previewedDocuments",key="#contentReference")
public ContentReference updateContent(ContentReference contentReference,
                                                                                                                                                                                                                                                                                            InputStream inputStream,
                                                                                                                                                                                                                                                                                            int inputStreamLength,
                                                                                                                                                                                                                                                                                            ContentMetadata contentMetadata,
                                                                                                                                                                                                                                                                                            boolean overwriteVersion)
ContentManagerUpdates 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.
updateContent in interface ContentManagercontentReference - the content reference to be updatedinputStream - the updated content as input streaminputStreamLength - the length of the input streamcontentMetadata - the optional content metadataoverwriteVersion - true if the content that is about to be updated shall be overwritten, otherwise false@CacheEvict(value="edorasGear-contentMetadataByContentReferenceId",key="#contentReference.getId()") @CacheEvict(value="edorasOne-previewedDocuments",key="#contentReference") public void updateContentMetadata(ContentReference contentReference, ContentMetadata contentMetadata)
ContentManagerUpdates the content metadata. This method triggers the ContentListener.contentUpdated(ContentEvent) method of the registered content listeners.
updateContentMetadata in interface ContentManagercontentReference - the content referencecontentMetadata - the content metadata@CacheEvict(value="edorasGear-contentReferencesByContentSourceId",
            key="#contentSourceId")
public void setContentSourceId(ContentReference contentReference,
                                                                                                                                      String contentSourceId)
ContentManagerSets 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.
setContentSourceId in interface ContentManagercontentReference - the content referencecontentSourceId - the content source id@CacheEvict(cacheNames={"edorasGear-contentMetadataByContentReferenceId","edorasGear-contentVersionsByContentReferenceId","edorasGear-contentReferencesByContentSourceId","edorasOne-previewedDocuments"},
            allEntries=true)
public void deleteContent()
ConfigurableContentManagerDeletes all the content of the content manager. CAUTION: Double check what you are doing before calling this method. All the configured content providers are called to
delete the content. This method is intended only for maintenance purposes. No ContentListener will be called upon a full content deletion.
deleteContent in interface ConfigurableContentManager@Transactional
 @CacheEvict(cacheNames={"edorasGear-contentMetadataByContentReferenceId","edorasGear-contentVersionsByContentReferenceId"},key="#contentReference.getId()") @CacheEvict(value="edorasOne-previewedDocuments",key="#contentReference") @CacheEvict(value="edorasGear-contentReferencesByContentSourceId",allEntries=true)
public int deleteContent(ContentReference contentReference)
ContentManagerDeletes 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.
deleteContent in interface ContentManagercontentReference - the content reference to be deleted@Transactional
 @CacheEvict(cacheNames={"edorasGear-contentMetadataByContentReferenceId","edorasGear-contentVersionsByContentReferenceId"},key="#contentReference.getId()") @CacheEvict(value="edorasOne-previewedDocuments",key="#contentReference") @CacheEvict(value="edorasGear-contentReferencesByContentSourceId",allEntries=true)
public void deleteContent(ContentReference contentReference,
                                                                                                                                                                                                                                                                                                                                                                   String version)
ContentManagerDeletes 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.
deleteContent in interface ContentManagercontentReference - the content reference to be deletedversion - the version of the content to be deleted@CacheEvict(cacheNames={"edorasGear-contentMetadataByContentReferenceId","edorasGear-contentVersionsByContentReferenceId","edorasOne-previewedDocuments"},allEntries=true) @CacheEvict(value="edorasGear-contentReferencesByContentSourceId",key="#contentSourceId")
public void deleteContent(String contentSourceId)
ContentManagerDeletes 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.
deleteContent in interface ContentManagercontentSourceId - the content source idpublic void addContentProvider(ContentProvider contentProvider)
ConfigurableContentManagerAdd a ContentProvider to the content manager.
addContentProvider in interface ConfigurableContentManagercontentProvider - the content provider to be added@Autowired(required=false) public void setContentListeners(List<ContentListener> contentListeners)
ConfigurableContentManagerSet the ContentListeners for the content manager.
setContentListeners in interface ConfigurableContentManagercontentListeners - the list of content listeners to be addedpublic void setContentPreProcessingConfiguration(ContentPreProcessingConfiguration contentPreProcessingConfiguration)
ConfigurableContentManagerSet the ContentPreProcessingConfiguration which is required if you want to pre process the content added or updated in a separate job.
setContentPreProcessingConfiguration in interface ConfigurableContentManagercontentPreProcessingConfiguration - the content pre processing configurationpublic List<ContentProvider> getContentProviders()
ConfigurableContentManagerReturns the ContentProviders.
getContentProviders in interface ConfigurableContentManagerpublic ContentProvider getDefaultContentProvider()
ContentManagerReturns the default ContentProvider configured for the content manager instance.
getDefaultContentProvider in interface ContentManagerpublic void processContent(ContentScope contentScope, ContentProcessor contentProcessor)
ConfigurableContentManagerProcess all content with the given content processor
processContent in interface ConfigurableContentManagercontentScope - contentScope for which content will be processedcontentProcessor - content processor which will be applied on all contentCopyright © 2010 - 2018 edorasware ag. All Rights Reserved.