Package org.silverpeas.core.webapi.admin
Class SpaceResource
- java.lang.Object
-
- org.silverpeas.core.web.rs.RESTWebService
-
- org.silverpeas.core.webapi.admin.AbstractAdminResource
-
- org.silverpeas.core.webapi.admin.SpaceResource
-
- All Implemented Interfaces:
ProtectedWebResource
,WebAuthenticationValidation
,WebAuthorizationValidation
,SilverpeasWebResource
@WebService @Path("spaces") @Authenticated public class SpaceResource extends AbstractAdminResource
A REST Web resource giving space data.- Author:
- Yohann Chastagnier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.silverpeas.core.web.rs.RESTWebService
RESTWebService.WebProcess<R>, RESTWebService.WebTreatment<R>
-
-
Field Summary
-
Fields inherited from class org.silverpeas.core.webapi.admin.AbstractAdminResource
orgaController
-
Fields inherited from class org.silverpeas.core.web.rs.RESTWebService
RESPONSE_HEADER_ARRAYSIZE
-
Fields inherited from interface org.silverpeas.core.web.SilverpeasWebResource
BASE_PATH
-
-
Constructor Summary
Constructors Constructor Description SpaceResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PersonalComponentEntity
discardComponent(String componentName)
Removes from the user's personal space the instantiation of the requested component.SpaceEntity
get(String spaceId, boolean forceGettingFavorite)
Gets the JSON representation of the given existing space.Collection<SpaceEntity>
getAll(boolean forceGettingFavorite)
Gets the JSON representation of root spaces.SpaceAppearanceEntity
getAppearance(String spaceId)
Gets the JSON representation of the given existing space.String
getComponentId()
Gets the identifier of the component instance to which the requested resource belongs to.Collection<ComponentEntity>
getComponents(String spaceId)
Gets the JSON representation of components of the given existing space.javax.ws.rs.core.Response
getContent(String spaceId, boolean forceGettingFavorite)
Gets the JSON representation of content of the given existing space.javax.ws.rs.core.Response
getPersonals(boolean getNotUsedComponents, boolean getUsedComponents, boolean getUsedTools)
Gets the JSON representation of the content of user's personal space.protected String
getResourceBasePath()
Gets the base path of the web resource relative to the root path of all the web resources in Silverpeas as given bySilverpeasWebResource.getBasePath()
.Collection<SpaceEntity>
getSpaces(String spaceId, boolean forceGettingFavorite)
Gets the JSON representation of spaces of the given existing space.Map<SilverpeasRole,UsersAndGroupsRoleEntity>
getUsersAndGroupsRoles(String spaceId, String roles)
Gets users and groups roles indexed by role names.SpaceEntity
update(String spaceId, SpaceEntity spaceEntity)
Updates the space data from its JSON representation and returns it once updated.PersonalComponentEntity
useComponent(String componentName)
Instantiates the requested component in the user's personal space.-
Methods inherited from class org.silverpeas.core.webapi.admin.AbstractAdminResource
asWebEntities, asWebEntities, asWebEntity, asWebEntity, asWebEntity, asWebEntity, asWebPersonalEntities, asWebPersonalEntity, asWebPersonalEntity, asWebPersonalEntity, filterAuthorizedComponents, getAdminPersonalDelegate, getLookDelegate, isUserAuthorizedToAccessLookContext, loadComponent, loadComponents, loadSpace, loadSpaces, validateUserAuthorization, verifyUserAuthorizedToAccessLookContext, verifyUserAuthorizedToAccessSpace
-
Methods inherited from class org.silverpeas.core.web.rs.RESTWebService
createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getSilverpeasContext, getUri, getUser, getUserPreferences, getUserRoles, identifiedBy, identifiedBy, initContext, initWebResourceUri, isUserDefined, process
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.web.rs.WebAuthenticationValidation
validateUserAuthentication
-
-
-
-
Method Detail
-
getResourceBasePath
protected String getResourceBasePath()
Description copied from class:RESTWebService
Gets the base path of the web resource relative to the root path of all the web resources in Silverpeas as given bySilverpeasWebResource.getBasePath()
.- Specified by:
getResourceBasePath
in classRESTWebService
- Returns:
- the relative path that identifies this REST web service among all other REST web services.
-
getAll
@GET @Produces("application/json") public Collection<SpaceEntity> getAll(@QueryParam("forceGettingFavorite") boolean forceGettingFavorite)
Gets the JSON representation of root spaces. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
forceGettingFavorite
- forcing the user favorite space search even if the favorite feature is disabled.- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space.
-
get
@GET @Path("{spaceId}") @Produces("application/json") public SpaceEntity get(@PathParam("spaceId") String spaceId, @QueryParam("forceGettingFavorite") boolean forceGettingFavorite)
Gets the JSON representation of the given existing space. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the space, a 403 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
spaceId
- the id of space to process.forceGettingFavorite
- forcing the user favorite space search even if the favorite feature is disabled.- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space.
-
getUsersAndGroupsRoles
@GET @Path("{spaceId}/usersAndGroupsRoles") @Produces("application/json") public Map<SilverpeasRole,UsersAndGroupsRoleEntity> getUsersAndGroupsRoles(@PathParam("spaceId") String spaceId, @QueryParam("roles") String roles)
Gets users and groups roles indexed by role names. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the space, a 403 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
spaceId
- the id of space to process.roles
- aimed roles (each one separated by comma). If empty, all roles are returned.- Returns:
- the JSON response to the HTTP GET request.
-
update
@PUT @Path("{spaceId}") @Produces("application/json") @Consumes("application/json") public SpaceEntity update(@PathParam("spaceId") String spaceId, SpaceEntity spaceEntity)
Updates the space data from its JSON representation and returns it once updated. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the space, a 403 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
spaceId
- the id of space to process.spaceEntity
- space entity to update.- Returns:
- the response to the HTTP PUT request with the JSON representation of the updated space.
-
getSpaces
@GET @Path("{spaceId}/spaces") @Produces("application/json") public Collection<SpaceEntity> getSpaces(@PathParam("spaceId") String spaceId, @QueryParam("forceGettingFavorite") boolean forceGettingFavorite)
Gets the JSON representation of spaces of the given existing space. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the space, a 403 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
spaceId
- the id of space to process.forceGettingFavorite
- forcing the user favorite space search even if the favorite- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space.
-
getComponents
@GET @Path("{spaceId}/components") @Produces("application/json") public Collection<ComponentEntity> getComponents(@PathParam("spaceId") String spaceId)
Gets the JSON representation of components of the given existing space. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the space, a 403 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
spaceId
- the id of space to process.- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space.
-
getContent
@GET @Path("{spaceId}/content") @Produces("application/json") public javax.ws.rs.core.Response getContent(@PathParam("spaceId") String spaceId, @QueryParam("forceGettingFavorite") boolean forceGettingFavorite)
Gets the JSON representation of content of the given existing space. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the space, a 403 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
spaceId
- the id of space to process.- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space.
-
getAppearance
@GET @Path("{spaceId}/appearance") @Produces("application/json") public SpaceAppearanceEntity getAppearance(@PathParam("spaceId") String spaceId)
Gets the JSON representation of the given existing space. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the space, a 403 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
spaceId
- the id of space to process.- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space.
-
getPersonals
@GET @Path("personal") @Produces("application/json") public javax.ws.rs.core.Response getPersonals(@QueryParam("getNotUsedComponents") boolean getNotUsedComponents, @QueryParam("getUsedComponents") boolean getUsedComponents, @QueryParam("getUsedTools") boolean getUsedTools)
Gets the JSON representation of the content of user's personal space. When all query parameters are set at false then the service understands that it has to return all personal entities. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
getNotUsedComponents
- boolean indicating if the not used components are concernedgetUsedComponents
- boolean indicating if the used components are concernedgetUsedTools
- a boolean indicating if the used tools are concerned- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space
-
useComponent
@PUT @Path("personal/{componentName}") @Produces("application/json") public PersonalComponentEntity useComponent(@PathParam("componentName") String componentName)
Instantiates the requested component in the user's personal space. It returns the JSON representation of the instantiated component. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
componentName
- the name of component to add in the user's personal space- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space.
-
discardComponent
@DELETE @Path("personal/{componentName}") @Produces("application/json") public PersonalComponentEntity discardComponent(@PathParam("componentName") String componentName)
Removes from the user's personal space the instantiation of the requested component. It returns the JSON representation of WAComponent. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.- Parameters:
componentName
- the name of component to add in the user's personal space- Returns:
- the response to the HTTP GET request with the JSON representation of the asked space.
-
getComponentId
public String getComponentId()
Description copied from interface:SilverpeasWebResource
Gets the identifier of the component instance to which the requested resource belongs to.- Returns:
- the identifier of the Silverpeas component instance.
-
-