Interface FileResource
- All Superinterfaces:
AuthenticatedResource
Resource for loading and manipulating Files in GCN
- Author:
- norbert
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopyFile
(FileCopyRequest request) Create a copy of the given file.create
(FileCreateRequest request) Create a new file with the binary data loaded from a URLcreate
(org.glassfish.jersey.media.multipart.MultiPart multiPart) Create a new file handling multipart form-data.createSimple
(javax.servlet.http.HttpServletRequest request, int folderId, int nodeId, String customBodyPartKeyName, String fileName, String description, boolean overwrite) Create a new file handling simple post datacreateSimpleMultiPartFallback
(org.glassfish.jersey.media.multipart.MultiPart multiPart, javax.servlet.http.HttpServletRequest request, String folderId, String nodeId, String customBodyPartName, String qqFileUploaderFileName, String description, boolean overwrite) Create a new file handling simple post dataDelete the file denoted by iddeleteFromWastebin
(IdSetRequest request, long waitMs) Remove the given files from the wastebindeleteFromWastebin
(String id, long waitMs) Remove the file denoted by the given id from the wastebin.getFileUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> fileId, Integer nodeId, boolean returnFiles) Get the files using one of the given filesgetFolderUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> fileId, Integer nodeId, boolean returnFolders) Get the folders using one of the given files.getImageUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> fileId, Integer nodeId, boolean returnImages) Get the images using one of the given filesgetPageUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> fileId, Integer nodeId, boolean returnPages, PageModelParameterBean pageModel) Get the pages using one of the given filesgetPrivileges
(Integer id) Get the privileges of the current user on the given filegetTemplateUsageInfo
(Integer skipCount, Integer maxItems, String sortBy, String sortOrder, List<Integer> fileId, Integer nodeId, boolean returnTemplates) Get the templates using one of the given filesgetTotalUsageInfo
(List<Integer> fileId, Integer nodeId) Get the total usage information for the given files.list
(InFolderParameterBean inFolder, FileListParameterBean fileListParams, FilterParameterBean filterParams, SortParameterBean sortingParams, PagingParameterBean pagingParams, EditableParameterBean editableParams, WastebinParameterBean wastebinParams) Get a list of files 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 files specified in the givenrequest
.Load the file (without data)javax.ws.rs.core.Response
loadContent
(String id, Integer nodeId) Load the file with given idmove
(MultiObjectMoveRequest request) Move multiple files to another foldermove
(String id, ObjectMoveRequest request) Mpve the given file to another folderrestoreFromWastebin
(IdSetRequest request, long waitMs) Restore the given files from the wastebinrestoreFromWastebin
(String id, long waitMs) Restore the given file from the wastebinsave
(Integer id, FileSaveRequest request) Save the given fileSave the posted content into the given fileMethods inherited from interface com.gentics.contentnode.rest.resource.AuthenticatedResource
setSessionId
-
Field Details
-
QQFILE_FILENAME_PARAMETER_NAME
GET parameter name for qqfile's filename- See Also:
-
META_DATA_FOLDERID_KEY
- See Also:
-
META_DATA_DESCRIPTION_KEY
- See Also:
-
META_DATA_FILE_NAME_KEY
- See Also:
-
META_DATA_NODE_ID_KEY
- See Also:
-
META_DATA_OVERWRITE_KEY
- See Also:
-
META_DATA_BODY_PART_KEY_CUSTOM_PARAMETER_NAME
- See Also:
-
-
Method Details
-
list
@GET FileListResponse 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 files 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 files
-
loadContent
@GET @Path("/content/load/{id}") javax.ws.rs.core.Response loadContent(@PathParam("id") String id, @QueryParam("nodeId") Integer nodeId) Load the file with given id- Parameters:
id
- file id. This can either be the localid or a globalidnodeId
- id of the node (channel) for which the image shall be loaded (when multichannelling is used).- Returns:
- response containing file binary data
-
load
@GET @Path("/load/{id}") FileLoadResponse 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 file (without data)- Parameters:
id
- id of the fileupdate
- true when the file is fetched for updating. Currently, files cannot be locked in the backend, but it is still recommended to set this parameter to true when the file 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 file status in it- Returns:
- response containing the file
-
load
@POST @Path("/load") MultiFileLoadResponse load(MultiObjectLoadRequest request, @QueryParam("fillWithNulls") @DefaultValue("false") boolean fillWithNulls) Load a list of files specified in the givenrequest
. File ids for which no files exist, or the user does not have the necessary permissions, are silently ignored.- Parameters:
request
- The request with he list of file 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 files, for which the user has enough permissions.
-
createSimpleMultiPartFallback
@POST @Path("/createSimple") @Consumes("multipart/form-data") @Produces("application/json") FileUploadResponse createSimpleMultiPartFallback(org.glassfish.jersey.media.multipart.MultiPart multiPart, @Context javax.servlet.http.HttpServletRequest request, @QueryParam("folderId") String folderId, @QueryParam("nodeId") String nodeId, @QueryParam("databodypart") String customBodyPartName, @QueryParam("qqfile") String qqFileUploaderFileName, @QueryParam("description") String description, @QueryParam("overwrite") @DefaultValue("false") boolean overwrite) Create a new file handling simple post data- Parameters:
multiPart
- multipart/form-data request datarequest
- request with data for the file to be createdfolderId
- Folder ID where to save the file incustomBodyPartName
- Custom name for the file data body partqqFileUploaderFileName
- Meta data filenamedescription
- File descriptionoverwrite
- Whether a file with the same name would be overwritten- Returns:
- response containing the file meta data
-
createSimple
@POST @Path("/createSimple") @Produces("application/json") FileUploadResponse createSimple(@Context javax.servlet.http.HttpServletRequest request, @QueryParam("folderId") int folderId, @QueryParam("nodeId") @DefaultValue("0") int nodeId, @QueryParam("databodypart") String customBodyPartKeyName, @QueryParam("qqfile") String fileName, @QueryParam("description") String description, @QueryParam("overwrite") @DefaultValue("false") boolean overwrite) Create a new file handling simple post data- Parameters:
request
- request with data for the file to be createdfolderId
- Folder ID where to save the file innodeId
- Node IDcustomBodyPartKeyName
-fileName
- File namedescription
- File descriptionoverwrite
- Whether a file with the same name would be overwritten- Returns:
- response containing the file meta data
-
create
@POST @Path("/create") @Consumes("multipart/form-data") @Produces("application/json") FileUploadResponse create(org.glassfish.jersey.media.multipart.MultiPart multiPart) Create a new file handling multipart form-data. The data and meta data is encoded within separate body parts.- Parameters:
multiPart
- request with data for the file to be created- Returns:
- response containing the file meta data
-
create
@POST @Path("/create") @Consumes("application/json") @Produces("application/json") FileUploadResponse create(FileCreateRequest request) Create a new file with the binary data loaded from a URL- Parameters:
request
- request- Returns:
- response containing the file meta data
-
copyFile
Create a copy of the given file.- Parameters:
request
-- Returns:
-
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}") @Produces("application/json") GenericResponse save(@PathParam("id") Integer id, FileSaveRequest request) Save the given file- Parameters:
request
- request with the file to be saved- Returns:
- generic response
-
save
@POST @Path("/save/{id}") @Consumes("multipart/form-data") @Produces("application/json") GenericResponse save(@PathParam("id") Integer id, org.glassfish.jersey.media.multipart.MultiPart multiPart) Save the posted content into the given file- Parameters:
id
- id of the filemultiPart
- request with data for the file to be created- Returns:
- generic response
-
delete
@POST @Path("/delete/{id}") GenericResponse delete(@PathParam("id") String id, @QueryParam("nodeId") Integer nodeId, @QueryParam("noSync") Boolean noCrSync) Delete the file denoted by id- Parameters:
id
- id of the File to deletenodeId
- id of the node (channel) of the filenoCrSync
- don't synchronize the deletion with the content repo- Returns:
- response object
-
deleteFromWastebin
@POST @Path("/wastebin/delete/{id}") GenericResponse deleteFromWastebin(@PathParam("id") String id, @QueryParam("wait") @DefaultValue("0") long waitMs) Remove the file denoted by the given id from the wastebin.- Parameters:
id
- id of the file 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 files from the wastebin- Parameters:
request
- request containing the file 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 file from the wastebin- Parameters:
id
- id of the file 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 files from the wastebin- Parameters:
request
- request containing the file 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 file- Parameters:
id
- id of the file- Returns:
- privileges response
-
getTotalUsageInfo
@GET @Path("/usage/total") TotalUsageResponse getTotalUsageInfo(@QueryParam("id") List<Integer> fileId, @QueryParam("nodeId") Integer nodeId) Get the total usage information for the given files.- Parameters:
nodeId
- id of the nodenodeId
- id of the node- Returns:
- response
-
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> fileId, @QueryParam("nodeId") Integer nodeId, @QueryParam("folders") @DefaultValue("true") boolean returnFolders) Get the folders using one of the given files.- 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".fileId
- list of file 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> fileId, @QueryParam("nodeId") Integer nodeId, @QueryParam("pages") @DefaultValue("true") boolean returnPages, @BeanParam PageModelParameterBean pageModel) Get the pages using one of the given files- 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".fileId
- list of file 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> fileId, @QueryParam("nodeId") Integer nodeId, @QueryParam("templates") @DefaultValue("true") boolean returnTemplates) Get the templates using one of the given files- 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".fileId
- list of file 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> fileId, @QueryParam("nodeId") Integer nodeId, @QueryParam("files") @DefaultValue("true") boolean returnImages) Get the images using one of the given files- 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".fileId
- list of file ids, for which the usage shall be fetchednodeId
- id of the nodereturnImages
- true (default) if the files 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> fileId, @QueryParam("nodeId") Integer nodeId, @QueryParam("files") @DefaultValue("true") boolean returnFiles) Get the files using one of the given files- 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".fileId
- list of file 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
-