Class RestFolderService
java.lang.Object
com.logicaldoc.webservice.AbstractService
com.logicaldoc.webservice.soap.endpoint.SoapFolderService
com.logicaldoc.webservice.rest.endpoint.RestFolderService
- All Implemented Interfaces:
FolderService
,FolderService
- Direct Known Subclasses:
RestFolderSwagger
@Path("/")
@Consumes("application/json")
@Produces("application/json")
public class RestFolderService
extends SoapFolderService
implements FolderService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Copies an existing folder with the given identifier.createAlias
(long parentId, long foldRef) Creates a new folder aliaslong
createFolder
(long parentId, String name) createPath
(long parentId, String path) createSimple
(String folderPath) createSimpleForm
(String folderPath) createSimpleJSON
(String jsonstr) void
delete
(long folderId) findByPath
(String path) Finds the folder at the specified pathgetAccessControlList
(long folderId) Retrieves the access control listGets the Default workspacegetFolder
(long folderId) getPath
(long folderId) getPathString
(long folderId) Gets the root folderboolean
Tests if the current user has a specific permission on a folderboolean
isReadable
(long folderId) Tests if a folder is readable.boolean
isWritable
(long folderId) Tests if a folder is writablelistChildren
(long folderId) Retrieves the list of all workspaces.void
move
(long folderId, long parentId) Moves an existing folder with the given identifier.void
Renames an existing folder.void
setAccessControlList
(long folderId, List<WSAccessControlEntry> acl) Sets the Access Control Listvoid
Updates an existing folder.Methods inherited from class com.logicaldoc.webservice.soap.endpoint.SoapFolderService
copy, create, createAlias, createFolder, createPath, delete, findByPath, getAccessControlList, getDefaultWorkspace, getFolder, getPath, getRootFolder, isGranted, isReadable, isWritable, list, listChildren, listWorkspaces, merge, move, rename, setAccessControlList, update
Methods inherited from class com.logicaldoc.webservice.AbstractService
convertDateToString, convertStringToDate, getCurrentMessage, isValidateSession, setCurrentMessage, setValidateSession
-
Constructor Details
-
RestFolderService
public RestFolderService()
-
-
Method Details
-
create
@POST @Path("/create") public WSFolder create(WSFolder folder) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
create
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
createSimpleForm
@POST @Path("/createSimpleForm") @Consumes("application/x-www-form-urlencoded") public WSFolder createSimpleForm(@FormParam("folderPath") String folderPath) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
createSimpleForm
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
createSimpleJSON
@POST @Path("/createSimpleJSON") @Consumes("application/json") public WSFolder createSimpleJSON(String jsonstr) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
createSimpleJSON
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
createSimple
@POST @Path("/createSimple") @Consumes({"text/plain","application/json"}) public WSFolder createSimple(String folderPath) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
createSimple
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
createPath
@POST @Path("/createPath") @Consumes("application/x-www-form-urlencoded") public WSFolder createPath(@FormParam("parentId") long parentId, @FormParam("path") String path) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
createPath
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
findByPath
@GET @Path("/findByPath") @Produces("application/json") public WSFolder findByPath(@QueryParam("path") String path) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException Description copied from interface:FolderService
Finds the folder at the specified path- Specified by:
findByPath
in interfaceFolderService
- Parameters:
path
- the path- Returns:
- the folder
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getRootFolder
@GET @Path("/getRootFolder") @Produces("application/json") public WSFolder getRootFolder() throws AuthenticationException, WebserviceException, PersistenceExceptionDescription copied from interface:FolderService
Gets the root folder- Specified by:
getRootFolder
in interfaceFolderService
- Returns:
- the root folder
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
createFolder
@POST @Path("/createFolder") @Consumes("application/x-www-form-urlencoded") @Produces({"text/plain","application/json","application/xml"}) public long createFolder(@FormParam("parentId") long parentId, @FormParam("name") String name) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
createFolder
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
getFolder
@GET @Path("/getFolder") @Produces({"application/json","application/xml"}) public WSFolder getFolder(@QueryParam("folderId") long folderId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
getFolder
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
delete
@DELETE @Path("/delete") public void delete(@QueryParam("folderId") long folderId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
delete
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
listChildren
@GET @Path("/listChildren") @Produces({"application/json","application/xml"}) public List<WSFolder> listChildren(@QueryParam("folderId") long folderId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
listChildren
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
list
@GET @Path("/list") @Produces({"application/json","application/xml"}) public List<WSFolder> list(@QueryParam("folderId") long folderId, @QueryParam("sort") String sort, @QueryParam("page") Integer page, @QueryParam("max") Integer max) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
list
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
getPath
@GET @Path("/getPath") public List<WSFolder> getPath(@QueryParam("folderId") long folderId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
getPath
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
getPathString
@GET @Path("/getPathString") public String getPathString(@QueryParam("folderId") long folderId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException - Specified by:
getPathString
in interfaceFolderService
- Throws:
AuthenticationException
PermissionException
WebserviceException
PersistenceException
-
update
@POST @Path("/update") public void update(WSFolder folder) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException Description copied from interface:FolderService
Updates an existing folder. To perform this you need the RENAME permission.- Specified by:
update
in interfaceFolderService
- Parameters:
folder
- The folders metadata(please compile the ID)- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
rename
@PUT @Path("/rename") public void rename(@QueryParam("folderId") long folderId, @QueryParam("name") String name) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException Description copied from interface:FolderService
Renames an existing folder.- Specified by:
rename
in interfaceFolderService
- Parameters:
folderId
- The folder idname
- The new folder name- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
move
@PUT @Path("/move") public void move(@QueryParam("folderId") long folderId, @QueryParam("parentId") long parentId) throws AuthenticationException, PersistenceException, WebserviceException, PermissionException Description copied from interface:FolderService
Moves an existing folder with the given identifier.- Specified by:
move
in interfaceFolderService
- Parameters:
folderId
- The folder idparentId
- The folder id of the new parent folder- Throws:
AuthenticationException
- Invalid credentialsPersistenceException
- Error in the databaseWebserviceException
- A generic error in the WebServicePermissionException
- The current user does not have enough permissions
-
createAlias
@POST @Path("/createAlias") @Consumes("application/x-www-form-urlencoded") public WSFolder createAlias(@FormParam("parentId") long parentId, @FormParam("foldRef") long foldRef) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException Description copied from interface:FolderService
Creates a new folder alias- Specified by:
createAlias
in interfaceFolderService
- Parameters:
parentId
- The parent folderfoldRef
- The referenced folder- Returns:
- The newly created alias
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getDefaultWorkspace
@GET @Path("/getDefaultWorkspace") public WSFolder getDefaultWorkspace() throws AuthenticationException, PermissionException, WebserviceException, PersistenceExceptionDescription copied from interface:FolderService
Gets the Default workspace- Specified by:
getDefaultWorkspace
in interfaceFolderService
- Returns:
- A value object containing the workspace's metadata
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
listWorkspaces
@GET @Path("/listWorkspaces") public List<WSFolder> listWorkspaces() throws AuthenticationException, WebserviceException, PersistenceExceptionDescription copied from interface:FolderService
Retrieves the list of all workspaces.- Specified by:
listWorkspaces
in interfaceFolderService
- Returns:
- the list of all workspaces
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
isReadable
@GET @Path("/isReadable") public boolean isReadable(@QueryParam("folderId") long folderId) throws AuthenticationException, WebserviceException, PersistenceException Description copied from interface:FolderService
Tests if a folder is readable.- Specified by:
isReadable
in interfaceFolderService
- Parameters:
folderId
- The folder id- Returns:
- True if the identifier denotes a readable folder, otherwise false.
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
isWritable
@GET @Path("/isWritable") public boolean isWritable(@QueryParam("folderId") long folderId) throws AuthenticationException, WebserviceException, PersistenceException Description copied from interface:FolderService
Tests if a folder is writable- Specified by:
isWritable
in interfaceFolderService
- Parameters:
folderId
- The folder id- Returns:
- True if the identifier denotes a writable folder, otherwise false
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
isGranted
@GET @Path("/isGranted") public boolean isGranted(@QueryParam("folderId") long folderId, @QueryParam("permission") String permission) throws AuthenticationException, WebserviceException, PersistenceException Description copied from interface:FolderService
Tests if the current user has a specific permission on a folder- Specified by:
isGranted
in interfaceFolderService
- Parameters:
folderId
- The folder idpermission
- The permission to check (eg: 'read', 'write', ...)- Returns:
- True if the identifier denotes a granted permission, otherwise false
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
copy
@POST @Path("/copy") @Consumes("application/x-www-form-urlencoded") public void copy(@FormParam("folderId") long folderId, @FormParam("targetId") long targetId, @FormParam("foldersOnly") int foldersOnly, @FormParam("securityOption") String securityOption) throws AuthenticationException, WebserviceException, PersistenceException, PermissionException Description copied from interface:FolderService
Copies an existing folder with the given identifier.- Specified by:
copy
in interfaceFolderService
- Parameters:
folderId
- The folder idtargetId
- The folder id of the target folderfoldersOnly
- If 1, only the folders will be copied and not the documentssecurityOption
- How to assign the security policies to the newly created folders:- null or none: empty security policies
- inherit: the new folder will point to the parent for the security policies
- replicate: the new folder will have a copy of the security policies of the source folder
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databasePermissionException
- The current user does not have enough permissions
-
setAccessControlList
@PUT @Path("/setAccessControlList") public void setAccessControlList(@QueryParam("folderId") long folderId, List<WSAccessControlEntry> acl) throws PersistenceException, PermissionException, AuthenticationException, WebserviceException Description copied from interface:FolderService
Sets the Access Control List- Specified by:
setAccessControlList
in interfaceFolderService
- Parameters:
folderId
- Folder idacl
- the complete Access Control List- Throws:
PersistenceException
- Error in the databasePermissionException
- The user does not have the required permissionAuthenticationException
- Invalid sessionWebserviceException
- Error in the webservice
-
getAccessControlList
@GET @Path("/getAccessControlList") public List<WSAccessControlEntry> getAccessControlList(@QueryParam("folderId") long folderId) throws AuthenticationException, WebserviceException, PersistenceException, PermissionException Description copied from interface:FolderService
Retrieves the access control list- Specified by:
getAccessControlList
in interfaceFolderService
- Parameters:
folderId
- Folder id- Returns:
- 'error' if error occurred, the right objects collection
- Throws:
AuthenticationException
- Invalid sessionWebserviceException
- Error in the webservicePersistenceException
- Error in the databasePermissionException
- The permission has not been granted
-