Interface ImageResource
- All Superinterfaces:
AuthenticatedResource
Resource for loading and manipulating Images in GCN
- Author:
- norbert
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(ImageCreateRequest request) Create a new imageDelete the image denoted by iddeleteFromWastebin
(IdSetRequest request, long waitMs) Remove the given images from the wastebindeleteFromWastebin
(String id, long waitMs) Remove the image denoted by the given id from the wastebin.getFileUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> imageId, Integer nodeId, boolean returnFiles) Get the files using one of the given imagesgetFolderUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> imageId, Integer nodeId, boolean returnFolders) Get the folders using one of the given images.getImageUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> imageId, Integer nodeId, boolean returnImages) Get the images using one of the given imagesgetPageUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> imageId, Integer nodeId, boolean returnPages, PageModelParameterBean pageModel) Get the pages using one of the given imagesgetPrivileges
(Integer id) Get the privileges of the current user on the given imagegetTemplateUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> imageId, Integer nodeId, boolean returnTemplates) Get the templates using one of the given imagesgetTotalFileUsageInfo
(List<Integer> imageId, Integer nodeId) Get the total usage info for the given images.list
(InFolderParameterBean inFolder, FileListParameterBean fileListParams, FilterParameterBean filterParams, SortParameterBean sortingParams, PagingParameterBean pagingParams, EditableParameterBean editableParams, WastebinParameterBean wastebinParams) Get a list of images in the specified folder.
The result can be filtered byid
name
description
niceUrl
alternateUrls
and sorted byid
name
niceUrl
alternateUrls
fileSize
fileType
load
(MultiObjectLoadRequest request, boolean fillWithNulls) Load a list of images specified in the givenrequest
.Load the image with given idjavax.ws.rs.core.Response
loadContent
(Integer id) Get the content of the image with given idmove
(MultiObjectMoveRequest request) Move multiple files to another foldermove
(String id, ObjectMoveRequest request) Mpve the given file to another folderresize
(ImageResizeRequest imageResizeRequest) Rotate by 90° (optionally), crop (optionally) and resize an image (in this order).restoreFromWastebin
(IdSetRequest request, long waitMs) Restore the given images from the wastebinrestoreFromWastebin
(String id, long waitMs) Restore the given image from the wastebinrotate
(ImageRotateRequest request) Rotate an image by 90°save
(Integer id, ImageSaveRequest request) Save the given imagesaveContent
(InputStream fileContent) Save the posted content into the given imageMethods inherited from interface com.gentics.contentnode.rest.resource.AuthenticatedResource
setSessionId
-
Method Details
-
list
@GET ImageListResponse list(@BeanParam InFolderParameterBean inFolder, @BeanParam FileListParameterBean fileListParams, @BeanParam FilterParameterBean filterParams, @BeanParam SortParameterBean sortingParams, @BeanParam PagingParameterBean pagingParams, @BeanParam EditableParameterBean editableParams, @BeanParam WastebinParameterBean wastebinParams) Get a list of images in the specified folder.
The result can be filtered byid
name
description
niceUrl
alternateUrls
id
name
niceUrl
alternateUrls
fileSize
fileType
- Parameters:
inFolder
- Folder ID and recursive parametersfileListParams
- Further file parametersfilterParams
- Filter parameterssortingParams
- Sorting parameterspagingParams
- Paging parameterseditableParams
- Editable parameterswastebinParams
- Wastebin parameters- Returns:
- A list of images
-
load
@GET @Path("/load/{id}") ImageLoadResponse load(@PathParam("id") String id, @DefaultValue("false") @QueryParam("update") boolean update, @DefaultValue("false") @QueryParam("construct") boolean construct, @QueryParam("nodeId") Integer nodeId, @QueryParam("package") String stagingPackageName) Load the image with given id- Parameters:
id
- image id. This can either be a local or globalidupdate
- true when the image is fetched for updating. Currently, images cannot be locked in the backend, but it is still recommended to set this parameter to true when the image shall be modified.construct
- if true, the construct information will be added to tagsnodeId
- id of the node (channel) for which the image shall be loaded (when multichannelling is used).stagingPackageName
- name of a content staging package, to check the image status in it- Returns:
- response containing the image meta data
-
load
@POST @Path("/load") MultiImageLoadResponse load(MultiObjectLoadRequest request, @QueryParam("fillWithNulls") @DefaultValue("false") boolean fillWithNulls) Load a list of images specified in the givenrequest
. Image ids for which no images exist, or the user does not have the necessary permissions, are silently ignored.- Parameters:
request
- The request with he list of image ids to load.fillWithNulls
- flag to have items, which cannot be loaded returned as "null" objects in the response (instead of just omitting them)- Returns:
- The list of found images, for which the user has enough permissions.
-
resize
Rotate by 90° (optionally), crop (optionally) and resize an image (in this order).- Parameters:
imageResizeRequest
- resize request- Returns:
- response
-
rotate
Rotate an image by 90°- Parameters:
request
- rotate request- Returns:
- response
-
loadContent
Get the content of the image with given id- Parameters:
id
- image id to get- Returns:
- binary content of the image
-
create
Create a new image- Parameters:
request
- request with data for the image to be created- Returns:
- response containing the image meta data
-
move
@POST @Path("/move/{id}") GenericResponse move(@PathParam("id") String id, ObjectMoveRequest request) Mpve the given file to another folder- Parameters:
id
- file idrequest
- request- Returns:
- generic response
-
move
Move multiple files to another folder- Parameters:
request
- request- Returns:
- generic response
-
save
@POST @Path("/save/{id}") GenericResponse save(@PathParam("id") Integer id, ImageSaveRequest request) Save the given image- Parameters:
request
- request with the image to be saved- Returns:
- generic response
-
saveContent
Save the posted content into the given image- Parameters:
fileContent
- image content- Returns:
- generic response
-
delete
@POST @Path("/delete/{id}") GenericResponse delete(@PathParam("id") String id, @QueryParam("nodeId") Integer nodeId, @QueryParam("disableInstantDelete") Boolean disableInstantDelete) Delete the image denoted by id- Parameters:
id
- id of the image to deletenodeId
- id of the node (channel) of the imagedisableInstantDelete
- don't delete the item from the content repo immediately- Returns:
- response object
-
deleteFromWastebin
@POST @Path("/wastebin/delete/{id}") GenericResponse deleteFromWastebin(@PathParam("id") String id, @QueryParam("wait") @DefaultValue("0") long waitMs) Remove the image denoted by the given id from the wastebin.- Parameters:
id
- id of the image to remove from the wastebin. This can either be a local or global idwaitMs
- time in ms for the request to be done in foreground- Returns:
- response object
-
deleteFromWastebin
@POST @Path("/wastebin/delete") GenericResponse deleteFromWastebin(IdSetRequest request, @QueryParam("wait") @DefaultValue("0") long waitMs) Remove the given images from the wastebin- Parameters:
request
- request containing the image IDswaitMs
- time in ms for the request to be done in foreground- Returns:
- response object
-
restoreFromWastebin
@POST @Path("/wastebin/restore/{id}") GenericResponse restoreFromWastebin(@PathParam("id") String id, @QueryParam("wait") @DefaultValue("0") long waitMs) Restore the given image from the wastebin- Parameters:
id
- id of the image to restore from the wastebin. This can either be a local or global idwaitMs
- time in ms for the request to be done in foreground- Returns:
- response object
-
restoreFromWastebin
@POST @Path("/wastebin/restore") GenericResponse restoreFromWastebin(IdSetRequest request, @QueryParam("wait") @DefaultValue("0") long waitMs) Restore the given images from the wastebin- Parameters:
request
- request containing the image IDswaitMs
- time in ms for the request to be done in foreground- Returns:
- response object
-
getPrivileges
Get the privileges of the current user on the given image- Parameters:
id
- id of the image- Returns:
- privileges response
-
getTotalFileUsageInfo
@GET @Path("/usage/total") TotalUsageResponse getTotalFileUsageInfo(@QueryParam("id") List<Integer> imageId, @QueryParam("nodeId") Integer nodeId) Get the total usage info for the given images.- Parameters:
imageId
- list of image ids, for which the usage shall be fetchednodeId
- id of the node- Returns:
- Response which contains the total usage info
-
getFolderUsageInfo
@GET @Path("/usage/folder") FolderUsageListResponse getFolderUsageInfo(@QueryParam("skipCount") @DefaultValue("0") Integer skipCount, @QueryParam("maxItems") @DefaultValue("-1") Integer maxItems, @QueryParam("sortby") @DefaultValue("name") String sortBy, @QueryParam("sortorder") @DefaultValue("asc") String sortOrder, @QueryParam("id") List<Integer> imageId, @QueryParam("nodeId") Integer nodeId, @QueryParam("folders") @DefaultValue("true") boolean returnFolders) Get the folders using one of the given images.- Parameters:
skipCount
- number of items to be skipped, set to 0 for skipping no itemsmaxItems
- maximum number of items to be returned, set to -1 for returning all itemssortBy
- (optional) attribute to sort by. defaults to namesortOrder
- (optional) result sort order - may be "asc" for ascending or "desc" for descending other strings will be ignored. defaults to "asc".imageId
- list of image ids, for which the usage shall be fetchednodeId
- id of the nodereturnFolders
- true (default) if the folders shall be returned, false for only returning the counts- Returns:
- response
-
getPageUsageInfo
@GET @Path("/usage/page") PageUsageListResponse getPageUsageInfo(@QueryParam("skipCount") @DefaultValue("0") Integer skipCount, @QueryParam("maxItems") @DefaultValue("-1") Integer maxItems, @QueryParam("sortby") @DefaultValue("name") String sortBy, @QueryParam("sortorder") @DefaultValue("asc") String sortOrder, @QueryParam("id") List<Integer> imageId, @QueryParam("nodeId") Integer nodeId, @QueryParam("pages") @DefaultValue("true") boolean returnPages, @BeanParam PageModelParameterBean pageModel) Get the pages using one of the given images- Parameters:
skipCount
- number of items to be skipped, set to 0 for skipping no itemsmaxItems
- maximum number of items to be returned, set to -1 for returning all itemssortBy
- (optional) attribute to sort by. defaults to namesortOrder
- (optional) result sort order - may be "asc" for ascending or "desc" for descending other strings will be ignored. defaults to "asc".imageId
- list of image ids, for which the usage shall be fetchednodeId
- id of the nodereturnPages
- true (default) if the pages shall be returned, false for only returning the countspageModel
- page model parameters- Returns:
- response
-
getTemplateUsageInfo
@GET @Path("/usage/template") TemplateUsageListResponse getTemplateUsageInfo(@QueryParam("skipCount") @DefaultValue("0") Integer skipCount, @QueryParam("maxItems") @DefaultValue("-1") Integer maxItems, @QueryParam("sortby") @DefaultValue("name") String sortBy, @QueryParam("sortorder") @DefaultValue("asc") String sortOrder, @QueryParam("id") List<Integer> imageId, @QueryParam("nodeId") Integer nodeId, @QueryParam("templates") @DefaultValue("true") boolean returnTemplates) Get the templates using one of the given images- Parameters:
skipCount
- number of items to be skipped, set to 0 for skipping no itemsmaxItems
- maximum number of items to be returned, set to -1 for returning all itemssortBy
- (optional) attribute to sort by. defaults to namesortOrder
- (optional) result sort order - may be "asc" for ascending or "desc" for descending other strings will be ignored. defaults to "asc".imageId
- list of image ids, for which the usage shall be fetchednodeId
- id of the nodereturnTemplates
- true (default) if the templates shall be returned, false for only returning the counts- Returns:
- response
-
getImageUsageInfo
@GET @Path("/usage/image") FileUsageListResponse getImageUsageInfo(@QueryParam("skipCount") @DefaultValue("0") Integer skipCount, @QueryParam("maxItems") @DefaultValue("-1") Integer maxItems, @QueryParam("sortby") @DefaultValue("name") String sortBy, @QueryParam("sortorder") @DefaultValue("asc") String sortOrder, @QueryParam("id") List<Integer> imageId, @QueryParam("nodeId") Integer nodeId, @QueryParam("images") @DefaultValue("true") boolean returnImages) Get the images using one of the given images- Parameters:
skipCount
- number of items to be skipped, set to 0 for skipping no itemsmaxItems
- maximum number of items to be returned, set to -1 for returning all itemssortBy
- (optional) attribute to sort by. defaults to namesortOrder
- (optional) result sort order - may be "asc" for ascending or "desc" for descending other strings will be ignored. defaults to "asc".imageId
- list of image ids, for which the usage shall be fetchednodeId
- id of the nodereturnImages
- true (default) if the images shall be returned, false for only returning the counts- Returns:
- response
-
getFileUsageInfo
@GET @Path("/usage/file") FileUsageListResponse getFileUsageInfo(@QueryParam("skipCount") @DefaultValue("0") Integer skipCount, @QueryParam("maxItems") @DefaultValue("-1") Integer maxItems, @QueryParam("sortby") @DefaultValue("name") String sortBy, @QueryParam("sortorder") @DefaultValue("asc") String sortOrder, @QueryParam("id") List<Integer> imageId, @QueryParam("nodeId") Integer nodeId, @QueryParam("files") @DefaultValue("true") boolean returnFiles) Get the files using one of the given images- Parameters:
skipCount
- number of items to be skipped, set to 0 for skipping no itemsmaxItems
- maximum number of items to be returned, set to -1 for returning all itemssortBy
- (optional) attribute to sort by. defaults to namesortOrder
- (optional) result sort order - may be "asc" for ascending or "desc" for descending other strings will be ignored. defaults to "asc".imageId
- list of image ids, for which the usage shall be fetchednodeId
- id of the nodereturnFiles
- true (default) if the files shall be returned, false for only returning the counts- Returns:
- response
-