org.silverpeas.admin.web
Class SpaceResource

java.lang.Object
  extended by com.silverpeas.web.RESTWebService
      extended by org.silverpeas.admin.web.AbstractAdminResource
          extended by org.silverpeas.admin.web.SpaceResource

@Service
@RequestScoped
@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 com.silverpeas.web.RESTWebService
RESTWebService.WebProcess<RETURN_VALUE>, RESTWebService.WebTreatment<RETURN_VALUE>
 
Field Summary
 
Fields inherited from class com.silverpeas.web.RESTWebService
RESPONSE_HEADER_ARRAYSIZE, REST_WEB_SERVICES_URI_BASE
 
Constructor Summary
SpaceResource()
           
 
Method Summary
 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.
 Collection<AbstractTypeEntity> getContent(String spaceId, boolean forceGettingFavorite)
          Gets the JSON representation of content of the given existing space.
 Collection<AbstractPersonnalEntity> getPersonals(boolean getNotUsedComponents, boolean getUsedComponents, boolean getUsedTools)
          Gets the JSON representation of the content of user's personal space.
 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.admin.web.AbstractAdminResource
asWebEntities, asWebEntities, asWebEntity, asWebEntity, asWebEntity, asWebEntity, asWebPersonalEntities, asWebPersonalEntity, asWebPersonalEntity, asWebPersonalEntity, getAdminPersonalDelegate, getAdminServices, getLookDelegate, isUserAuthorizedToAccessLookContext, loadComponent, loadComponents, loadSpace, loadSpaces, verifyUserAuthorizedToAccessLookContext, verifyUserAuthorizedToAccessSpace
 
Methods inherited from class com.silverpeas.web.RESTWebService
getBundle, getBundleLocation, getGreaterUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getUriInfo, getUserDetail, getUserPreferences, getUserRoles, process, validateUserAuthentication, validateUserAuthorization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpaceResource

public SpaceResource()
Method Detail

getAll

public Collection<SpaceEntity> getAll(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 authentified, 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

public SpaceEntity get(String spaceId,
                       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 authentified, 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

public Map<SilverpeasRole,UsersAndGroupsRoleEntity> getUsersAndGroupsRoles(String spaceId,
                                                                           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 authentified, 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

public SpaceEntity update(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 authentified, 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

public Collection<SpaceEntity> getSpaces(String spaceId,
                                         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 authentified, 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

public Collection<ComponentEntity> getComponents(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 authentified, 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

public Collection<AbstractTypeEntity> getContent(String spaceId,
                                                 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 authentified, 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

public SpaceAppearanceEntity getAppearance(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 authentified, 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

public Collection<AbstractPersonnalEntity> getPersonals(boolean getNotUsedComponents,
                                                        boolean getUsedComponents,
                                                        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 authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Parameters:
getNotUsedComponents -
getUsedComponents -
getUsedTools -
Returns:
the response to the HTTP GET request with the JSON representation of the asked space.

useComponent

public PersonalComponentEntity useComponent(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 authentified, 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

public PersonalComponentEntity discardComponent(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 authentified, 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 class: RESTWebService
Gets the identifier of the component instance to which the requested resource belongs to.

Specified by:
getComponentId in class RESTWebService
Returns:
the identifier of the Silverpeas component instance.


Copyright © 2016 Silverpeas. All Rights Reserved.