Package org.cyclos.impl.system
Class BaseImageServiceImpl<I extends Image,A extends com.querydsl.core.types.EntityPath<I>,NP>
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.system.BaseImageServiceImpl<I,A,NP>
-
- All Implemented Interfaces:
BaseImageServiceLocal<I,NP>,Service,BaseImageService<NP>
- Direct Known Subclasses:
BaseCategorizedImageServiceImpl,ConfigurationImageServiceImpl,CustomFieldValueImageServiceImpl,TempImageServiceImpl,ThemeImageServiceImpl,VoucherTemplateImageServiceImpl
public abstract class BaseImageServiceImpl<I extends Image,A extends com.querydsl.core.types.EntityPath<I>,NP> extends BaseServiceImpl implements BaseImageServiceLocal<I,NP>
implementation forImageService
-
-
Field Summary
Fields Modifier and Type Field Description protected A$protected ImageHandlerimageHandlerprotected Class<I>imageTypeprotected ImageNaturenatureprotected StoredFileHandlerstoredFileHandler-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description BaseImageServiceImpl(ImageNature nature, Class<I> imageType, A alias)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Ifind(Long id)Finds an image by idIfindByKey(String key)ImageNaturegetImageNature()Should return the nature of images handled by this serviceprotected booleanisKeepOriginalContent()Subclasses may return true to skipping the resizing to a maximum dimension in configurationabstract InewImage(NP param)Returns a new image for the given parametersprotected voidonAfterRemove(I image)May be overridden in order to take actions after remove an imageprotected voidonAfterSave(I image)May be overridden in order to take action after save an imageprotected voidonBeforeRemove(I image)May be overridden in order to take actions before remove an imageSerializableInputStreamreadContent(Long id)Reads the contents for the image with the given id, with the specified sizeSerializableInputStreamreadContentByKey(String key)Reads the contents for the image with the given key, with the specified sizevoidremove(Long id)Removes the given imagevoidremoveAll(Collection<Long> ids)Removes all the given imageImageVOsave(NP param, String name, SerializableInputStream content, String contentType)Saves the given image for the given parameter (which depends on each image type), returning the descriptorvoidsaveName(Long id, String name)Saves the name of the given imageprotected voidsetDataAndPersist(I image, SerializableInputStream in, String contentType)Sets image data and content on the given image, reading the image content from the givenInputStream(expecting the given content type)protected voidsetImageName(String name, I image)protected voidvalidateMaxImages(NP param)May be overridden in order to validate maximum images upload limit-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings, registerNetworkMappings
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Field Detail
-
nature
protected final ImageNature nature
-
imageHandler
@Autowired protected ImageHandler imageHandler
-
storedFileHandler
@Autowired protected StoredFileHandler storedFileHandler
-
-
Constructor Detail
-
BaseImageServiceImpl
public BaseImageServiceImpl(ImageNature nature, Class<I> imageType, A alias)
-
-
Method Detail
-
find
public I find(Long id)
Description copied from interface:BaseImageServiceLocalFinds an image by id
-
getImageNature
public ImageNature getImageNature()
Description copied from interface:BaseImageServiceLocalShould return the nature of images handled by this service- Specified by:
getImageNaturein interfaceBaseImageServiceLocal<I extends Image,A extends com.querydsl.core.types.EntityPath<I>>
-
readContent
public SerializableInputStream readContent(Long id)
Description copied from interface:BaseImageServiceLocalReads the contents for the image with the given id, with the specified size- Specified by:
readContentin interfaceBaseImageServiceLocal<I extends Image,A extends com.querydsl.core.types.EntityPath<I>>
-
readContentByKey
public SerializableInputStream readContentByKey(String key)
Description copied from interface:BaseImageServiceLocalReads the contents for the image with the given key, with the specified size- Specified by:
readContentByKeyin interfaceBaseImageServiceLocal<I extends Image,A extends com.querydsl.core.types.EntityPath<I>>
-
remove
public final void remove(Long id)
Description copied from interface:BaseImageServiceRemoves the given image- Specified by:
removein interfaceBaseImageService<I extends Image>
-
removeAll
public void removeAll(Collection<Long> ids) throws FrameworkException
Description copied from interface:BaseImageServiceRemoves all the given image- Specified by:
removeAllin interfaceBaseImageService<I extends Image>- Throws:
FrameworkException
-
save
public ImageVO save(NP param, String name, SerializableInputStream content, String contentType) throws FrameworkException
Description copied from interface:BaseImageServiceSaves the given image for the given parameter (which depends on each image type), returning the descriptor- Specified by:
savein interfaceBaseImageService<I extends Image>- Throws:
FrameworkException
-
saveName
public void saveName(Long id, String name) throws FrameworkException
Description copied from interface:BaseImageServiceSaves the name of the given image- Specified by:
saveNamein interfaceBaseImageService<I extends Image>- Throws:
FrameworkException
-
isKeepOriginalContent
protected final boolean isKeepOriginalContent()
Subclasses may return true to skipping the resizing to a maximum dimension in configuration
-
onAfterRemove
protected void onAfterRemove(I image)
May be overridden in order to take actions after remove an image
-
onAfterSave
protected void onAfterSave(I image)
May be overridden in order to take action after save an image
-
onBeforeRemove
protected void onBeforeRemove(I image)
May be overridden in order to take actions before remove an image
-
setDataAndPersist
protected void setDataAndPersist(I image, SerializableInputStream in, String contentType)
Sets image data and content on the given image, reading the image content from the givenInputStream(expecting the given content type)
-
validateMaxImages
protected void validateMaxImages(NP param) throws MaxItemsException
May be overridden in order to validate maximum images upload limit- Throws:
MaxItemsException
-
-