com.gentics.contentnode.rest.resource
Interface FileResource

All Superinterfaces:
AuthenticatedResource

public interface FileResource
extends AuthenticatedResource

Resource for loading and manipulating Files in GCN

Author:
norbert

Field Summary
static java.lang.String META_DATA_BODY_PART_KEY_CUSTOM_PARAMETER_NAME
           
static java.lang.String META_DATA_DESCRIPTION_KEY
           
static java.lang.String META_DATA_FILE_NAME_KEY
           
static java.lang.String META_DATA_FOLDERID_KEY
           
static java.lang.String META_DATA_NODE_ID_KEY
           
static java.lang.String QQFILE_FILENAME_PARAMETER_NAME
          GET parameter name for qqfile's filename
 
Method Summary
 FileUploadResponse copyFile(FileCopyRequest request)
          Create a copy of the given file.
 FileUploadResponse create(com.sun.jersey.multipart.MultiPart multiPart)
          Create a new file handling multipart form-data.
 FileUploadResponse createSimple(javax.servlet.http.HttpServletRequest request, int folderId, int nodeId, java.lang.String customBodyPartKeyName, java.lang.String fileName, java.lang.String description)
          Create a new file handling simple post data
 FileUploadResponse createSimpleMultiPartFallback(com.sun.jersey.multipart.MultiPart multiPart, javax.servlet.http.HttpServletRequest request, java.lang.String folderId, java.lang.String customBodyPartName, java.lang.String qqFileUploaderFileName, java.lang.String description)
          Create a new file handling simple post data
 GenericResponse delete(java.lang.Integer id, java.lang.Integer nodeId)
          Delete the file denoted by id
 FileUsageListResponse getFileUsageInfo(java.lang.Integer skipCount, java.lang.Integer maxItems, java.lang.String sortBy, java.lang.String sortOrder, java.util.List<java.lang.Integer> fileId, java.lang.Integer nodeId, boolean returnFiles)
          Get the files using one of the given files
 FolderUsageListResponse getFolderUsageInfo(java.lang.Integer skipCount, java.lang.Integer maxItems, java.lang.String sortBy, java.lang.String sortOrder, java.util.List<java.lang.Integer> fileId, java.lang.Integer nodeId, boolean returnFolders)
          Get the folders using one of the given files
 FileUsageListResponse getImageUsageInfo(java.lang.Integer skipCount, java.lang.Integer maxItems, java.lang.String sortBy, java.lang.String sortOrder, java.util.List<java.lang.Integer> fileId, java.lang.Integer nodeId, boolean returnImages)
          Get the images using one of the given files
 LocalizationInfo getLocalizationInfo(java.lang.Integer id, java.lang.Integer nodeId)
          Get localization info for a file for a given channel and all master channels
 LocalizationInfo getLocalizationInfo(java.util.List<java.lang.Integer> ids, java.lang.Integer nodeId)
          Get localization info for a list of files for a given channel and all master channels
 PageUsageListResponse getPageUsageInfo(java.lang.Integer skipCount, java.lang.Integer maxItems, java.lang.String sortBy, java.lang.String sortOrder, java.util.List<java.lang.Integer> fileId, java.lang.Integer nodeId, boolean returnPages, boolean template, boolean folder, boolean languageVariants)
          Get the pages using one of the given files
 PrivilegesResponse getPrivileges(java.lang.Integer id)
          Get the privileges of the current user on the given file
 TemplateUsageListResponse getTemplateUsageInfo(java.lang.Integer skipCount, java.lang.Integer maxItems, java.lang.String sortBy, java.lang.String sortOrder, java.util.List<java.lang.Integer> fileId, java.lang.Integer nodeId, boolean returnTemplates)
          Get the templates using one of the given files
 FileLoadResponse load(java.lang.String id, boolean update, java.lang.Integer nodeId)
          Load the file (without data)
 javax.ws.rs.core.Response loadContent(java.lang.String id)
          Load the file with given id
 GenericResponse localize(java.lang.Integer id, LocalizeRequest request)
          Localize the given file
 GenericResponse pushToMaster(java.lang.Integer id, PushToMasterRequest request)
          Push a file from a channel into a master
 GenericResponse pushToMaster(MultiPushToMasterRequest request)
          Push a list of pages from a channel into a master
 GenericResponse save(java.lang.Integer id, FileSaveRequest request)
          Save the given file
 GenericResponse save(java.lang.Integer id, com.sun.jersey.multipart.MultiPart multiPart)
          Save the posted content into the given file
 GenericResponse unlocalize(java.lang.Integer id, UnlocalizeRequest request)
          Unlocalize the given file
 GenericResponse unlocalize(MultiUnlocalizeRequest request)
          Unlocalize files in a channel
 
Methods inherited from interface com.gentics.contentnode.rest.resource.AuthenticatedResource
setSessionId
 

Field Detail

QQFILE_FILENAME_PARAMETER_NAME

static final java.lang.String QQFILE_FILENAME_PARAMETER_NAME
GET parameter name for qqfile's filename

See Also:
Constant Field Values

META_DATA_FOLDERID_KEY

static final java.lang.String META_DATA_FOLDERID_KEY
See Also:
Constant Field Values

META_DATA_DESCRIPTION_KEY

static final java.lang.String META_DATA_DESCRIPTION_KEY
See Also:
Constant Field Values

META_DATA_FILE_NAME_KEY

static final java.lang.String META_DATA_FILE_NAME_KEY
See Also:
Constant Field Values

META_DATA_NODE_ID_KEY

static final java.lang.String META_DATA_NODE_ID_KEY
See Also:
Constant Field Values

META_DATA_BODY_PART_KEY_CUSTOM_PARAMETER_NAME

static final java.lang.String META_DATA_BODY_PART_KEY_CUSTOM_PARAMETER_NAME
See Also:
Constant Field Values
Method Detail

loadContent

javax.ws.rs.core.Response loadContent(java.lang.String id)
Load the file with given id

Parameters:
id - file id. This can either be the localid or a globalid
Returns:
response containing file binary data

load

FileLoadResponse load(java.lang.String id,
                      boolean update,
                      java.lang.Integer nodeId)
Load the file (without data)

Parameters:
id - id of the file
update - 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.
nodeId - id of the node (channel) for which the image shall be loaded (when multichannelling is used).
Returns:
response containing the file

createSimpleMultiPartFallback

FileUploadResponse createSimpleMultiPartFallback(com.sun.jersey.multipart.MultiPart multiPart,
                                                 @Context
                                                 javax.servlet.http.HttpServletRequest request,
                                                 java.lang.String folderId,
                                                 java.lang.String customBodyPartName,
                                                 java.lang.String qqFileUploaderFileName,
                                                 java.lang.String description)
Create a new file handling simple post data

Parameters:
multiPart - multipart/form-data request data
request - request with data for the file to be created
folderId - Folder ID where to save the file in
nodeId - Node ID
customBodyPartKeyName -
fileName - File name
description - File description
Returns:
response containing the file meta data

createSimple

FileUploadResponse createSimple(@Context
                                javax.servlet.http.HttpServletRequest request,
                                int folderId,
                                int nodeId,
                                java.lang.String customBodyPartKeyName,
                                java.lang.String fileName,
                                java.lang.String description)
Create a new file handling simple post data

Parameters:
request - request with data for the file to be created
folderId - Folder ID where to save the file in
nodeId - Node ID
customBodyPartKeyName -
fileName - File name
description - File description
Returns:
response containing the file meta data

create

FileUploadResponse create(com.sun.jersey.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

copyFile

FileUploadResponse copyFile(FileCopyRequest request)
Create a copy of the given file.

Parameters:
request -
Returns:

save

GenericResponse save(java.lang.Integer id,
                     FileSaveRequest request)
Save the given file

Parameters:
request - request with the file to be saved
Returns:
generic response

save

GenericResponse save(java.lang.Integer id,
                     com.sun.jersey.multipart.MultiPart multiPart)
Save the posted content into the given file

Parameters:
id - id of the file
multiPart - request with data for the file to be created
Returns:
generic response

delete

GenericResponse delete(java.lang.Integer id,
                       java.lang.Integer nodeId)
Delete the file denoted by id

Parameters:
id - id of the File to delete
Returns:
response object

getPrivileges

PrivilegesResponse getPrivileges(java.lang.Integer id)
Get the privileges of the current user on the given file

Parameters:
id - id of the file
Returns:
privileges response

getFolderUsageInfo

FolderUsageListResponse getFolderUsageInfo(java.lang.Integer skipCount,
                                           java.lang.Integer maxItems,
                                           java.lang.String sortBy,
                                           java.lang.String sortOrder,
                                           java.util.List<java.lang.Integer> fileId,
                                           java.lang.Integer nodeId,
                                           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 items
maxItems - maximum number of items to be returned, set to -1 for returning all items
sortby - (optional) attribute to sort by. defaults to name
sortorder - (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 fetched
nodeId - id of the node
returnFolders - true (default) if the folders shall be returned, false for only returning the counts
Returns:
response

getPageUsageInfo

PageUsageListResponse getPageUsageInfo(java.lang.Integer skipCount,
                                       java.lang.Integer maxItems,
                                       java.lang.String sortBy,
                                       java.lang.String sortOrder,
                                       java.util.List<java.lang.Integer> fileId,
                                       java.lang.Integer nodeId,
                                       boolean returnPages,
                                       boolean template,
                                       boolean folder,
                                       boolean languageVariants)
Get the pages using one of the given files

Parameters:
skipCount - number of items to be skipped, set to 0 for skipping no items
maxItems - maximum number of items to be returned, set to -1 for returning all items
sortby - (optional) attribute to sort by. defaults to name
sortorder - (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 fetched
nodeId - id of the node
returnPages - true (default) if the pages shall be returned, false for only returning the counts
template - true for adding template info to the pages, default is false
folder - true for adding folder info to the pages, default is false
languageVariants - true for adding the language variants to the pages, default is false
Returns:
response

getTemplateUsageInfo

TemplateUsageListResponse getTemplateUsageInfo(java.lang.Integer skipCount,
                                               java.lang.Integer maxItems,
                                               java.lang.String sortBy,
                                               java.lang.String sortOrder,
                                               java.util.List<java.lang.Integer> fileId,
                                               java.lang.Integer nodeId,
                                               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 items
maxItems - maximum number of items to be returned, set to -1 for returning all items
sortby - (optional) attribute to sort by. defaults to name
sortorder - (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 fetched
nodeId - id of the node
returnTemplates - true (default) if the templates shall be returned, false for only returning the counts
Returns:
response

getImageUsageInfo

FileUsageListResponse getImageUsageInfo(java.lang.Integer skipCount,
                                        java.lang.Integer maxItems,
                                        java.lang.String sortBy,
                                        java.lang.String sortOrder,
                                        java.util.List<java.lang.Integer> fileId,
                                        java.lang.Integer nodeId,
                                        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 items
maxItems - maximum number of items to be returned, set to -1 for returning all items
sortby - (optional) attribute to sort by. defaults to name
sortorder - (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 fetched
nodeId - id of the node
returnImages - true (default) if the files shall be returned, false for only returning the counts
Returns:
response

getFileUsageInfo

FileUsageListResponse getFileUsageInfo(java.lang.Integer skipCount,
                                       java.lang.Integer maxItems,
                                       java.lang.String sortBy,
                                       java.lang.String sortOrder,
                                       java.util.List<java.lang.Integer> fileId,
                                       java.lang.Integer nodeId,
                                       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 items
maxItems - maximum number of items to be returned, set to -1 for returning all items
sortby - (optional) attribute to sort by. defaults to name
sortorder - (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 fetched
nodeId - id of the node
returnFiles - true (default) if the files shall be returned, false for only returning the counts
Returns:
response

pushToMaster

GenericResponse pushToMaster(java.lang.Integer id,
                             PushToMasterRequest request)
Push a file from a channel into a master

Parameters:
id - id of the file
request - request
Returns:
generic response

pushToMaster

GenericResponse pushToMaster(MultiPushToMasterRequest request)
Push a list of pages from a channel into a master

Parameters:
request - request
Returns:
generic response

unlocalize

GenericResponse unlocalize(java.lang.Integer id,
                           UnlocalizeRequest request)
Unlocalize the given file

Parameters:
id - id of the file to unlocalize
request - request
Returns:
generic response

unlocalize

GenericResponse unlocalize(MultiUnlocalizeRequest request)
Unlocalize files in a channel

Parameters:
request - request
Returns:
generic response

localize

GenericResponse localize(java.lang.Integer id,
                         LocalizeRequest request)
Localize the given file

Parameters:
id - id of the file to localize
request - request
Returns:
generic response

getLocalizationInfo

LocalizationInfo getLocalizationInfo(java.util.List<java.lang.Integer> ids,
                                     java.lang.Integer nodeId)
Get localization info for a list of files for a given channel and all master channels

Parameters:
ids - list of file ids
nodeId - id of the node to start with
Returns:
localization info

getLocalizationInfo

LocalizationInfo getLocalizationInfo(java.lang.Integer id,
                                     java.lang.Integer nodeId)
Get localization info for a file for a given channel and all master channels

Parameters:
id - id of the file
nodeId - id of the node to start with
Returns:
localization info


Copyright © 2014 Gentics Software GmbH. All Rights Reserved.