public class ContentManagerHelper extends Object implements com.edorasware.commons.core.util.service.Service
ContentManager
. The methods provide a simplified way of accessing the functionality
of the ContentManager
.Constructor and Description |
---|
ContentManagerHelper(com.edorasware.commons.core.content.ContentManager contentManager,
com.edorasware.commons.core.any.AnyWorkObjectService anyWorkObjectService,
com.edorasware.commons.core.identity.CurrentUserService currentUserService,
com.edorasware.commons.core.time.TimeProvider timeProvider,
com.edorasware.commons.core.content.ContentDetector contentDetector,
boolean enableVersioning)
Instantiates a new Content manager helper.
|
Modifier and Type | Method and Description |
---|---|
com.edorasware.commons.core.content.ContentMetadata |
getContentMetadata(com.edorasware.commons.core.entity.WorkObjectId workObjectId)
Gets content metadata.
|
com.google.common.base.Optional<com.edorasware.commons.core.content.ContentReference> |
getContentReference(String id)
Gets content reference by any work object id as String.
|
com.google.common.base.Optional<com.edorasware.commons.core.content.ContentReference> |
getContentReference(com.edorasware.commons.core.entity.WorkObject<?,?,?> workObject)
Gets content reference.
|
com.google.common.base.Optional<com.edorasware.commons.core.content.ContentReference> |
getContentReference(com.edorasware.commons.core.entity.WorkObjectId workObjectId)
Gets content reference.
|
void |
init() |
com.edorasware.commons.core.content.ContentReference |
saveWorkObjectContent(com.edorasware.commons.core.entity.WorkObjectId workObjectId,
InputStream inputStream,
String name,
com.google.common.net.MediaType contentType,
Long size,
com.google.common.base.Optional<Date> lastModifiedDate,
com.google.common.base.Optional<Date> uploadDate)
Save work object content content reference.
|
public ContentManagerHelper(com.edorasware.commons.core.content.ContentManager contentManager, com.edorasware.commons.core.any.AnyWorkObjectService anyWorkObjectService, com.edorasware.commons.core.identity.CurrentUserService currentUserService, com.edorasware.commons.core.time.TimeProvider timeProvider, com.edorasware.commons.core.content.ContentDetector contentDetector, boolean enableVersioning)
contentManager
- the content manageranyWorkObjectService
- the any work object servicecurrentUserService
- the current user servicecontentDetector
- the content detectorenableVersioning
- true if the existing content will not be replaced by the new one on updatepublic com.edorasware.commons.core.content.ContentMetadata getContentMetadata(com.edorasware.commons.core.entity.WorkObjectId workObjectId)
workObjectId
- the work object idcom.edorasware.commons.core.content.ContentException
- if no content reference is found for the WorkObjectId
IllegalArgumentException
- if the WorkObjectId
is nullpublic com.edorasware.commons.core.content.ContentReference saveWorkObjectContent(com.edorasware.commons.core.entity.WorkObjectId workObjectId, InputStream inputStream, String name, com.google.common.net.MediaType contentType, Long size, com.google.common.base.Optional<Date> lastModifiedDate, com.google.common.base.Optional<Date> uploadDate)
workObjectId
- the work object idinputStream
- the input streamname
- the namecontentType
- the content typesize
- the sizelastModifiedDate
- the last modified datecom.edorasware.commons.core.entity.EntityNotFoundException
- if no work object is found for the WorkObjectId
public com.google.common.base.Optional<com.edorasware.commons.core.content.ContentReference> getContentReference(String id)
id
- the idIllegalArgumentException
- if the id is null or emptypublic com.google.common.base.Optional<com.edorasware.commons.core.content.ContentReference> getContentReference(com.edorasware.commons.core.entity.WorkObjectId workObjectId)
workObjectId
- the work object idWorkObjectId
or Optional.absent()
if either the work object or the content reference are not foundIllegalArgumentException
- if the WorkObjectId
is nullpublic com.google.common.base.Optional<com.edorasware.commons.core.content.ContentReference> getContentReference(com.edorasware.commons.core.entity.WorkObject<?,?,?> workObject)
workObject
- the work objectIllegalArgumentException
- if the WorkObject
is nullpublic void init()
init
in interface com.edorasware.commons.core.util.service.Service
Copyright © 2010 - 2017 edorasware ag. All Rights Reserved.