@Service(value="imageFileService") public class ImageFileService<E extends ImageFile,D extends ImageFileDao<E>> extends FileService<E,D>
ImageFile model.permissionCollectionServicedao, logger| Modifier | Constructor and Description |
|---|---|
|
ImageFileService()
Default constructor, which calls the type-constructor
|
protected |
ImageFileService(Class<E> entityClass)
Constructor that sets the concrete entity class for the service.
|
| Modifier and Type | Method and Description |
|---|---|
E |
saveImage(org.springframework.web.multipart.MultipartFile file,
boolean createThumbnail,
Integer thumbnailTargetSize)
Method persists a given Image as a bytearray in the database
|
static byte[] |
scaleImage(byte[] imageBytes,
String outputFormat,
Integer targetSize)
Scales an image by the given dimensions
|
void |
setDao(D dao)
We have to use
Qualifier to define the correct dao here. |
E |
uploadFile(org.springframework.web.multipart.MultipartFile file)
Method persists a given MultipartFile as a bytearray in the database
|
addAndSaveGroupPermissions, addAndSaveUserPermissions, findAllUserGroupPermissionsOfUserGroup, findAllUserPermissionsOfUser, getPermissionCollectionService, removeAndSaveGroupPermissions, removeAndSaveUserPermissions, setPermissionCollectionServicedelete, findAll, findAllRestricted, findAllWhereFieldEquals, findAllWithCollectionContaining, findById, findBySimpleFilter, loadById, saveOrUpdate, updatePartialWithJsonNodegetDao, getEntityClasspublic ImageFileService()
public static byte[] scaleImage(byte[] imageBytes,
String outputFormat,
Integer targetSize)
throws Exception
outputFormat - targetSize - width/height in px (square)Exception@Autowired @Qualifier(value="imageFileDao") public void setDao(D dao)
Qualifier to define the correct dao here.
Otherwise, spring can not decide which dao has to be autowired here
as there are multiple candidates.setDao in class FileService<E extends ImageFile,D extends ImageFileDao<E>>dao - the dao to set@PreAuthorize(value="isAuthenticated()") public E uploadFile(org.springframework.web.multipart.MultipartFile file) throws Exception
FileServiceuploadFile in class FileService<E extends ImageFile,D extends ImageFileDao<E>>file - Exception@PreAuthorize(value="isAuthenticated()") public E saveImage(org.springframework.web.multipart.MultipartFile file, boolean createThumbnail, Integer thumbnailTargetSize) throws Exception
file - createThumbnail - thumbnailTargetSize - ExceptionCopyright © 2020 terrestris GmbH & Co. KG. All rights reserved.