Class AbstractAdminResource
- java.lang.Object
-
- org.silverpeas.core.web.rs.RESTWebService
-
- org.silverpeas.core.webapi.admin.AbstractAdminResource
-
- All Implemented Interfaces:
ProtectedWebResource
,WebAuthenticationValidation
,WebAuthorizationValidation
,SilverpeasWebResource
- Direct Known Subclasses:
ComponentResource
,ComponentsResource
,SpaceResource
public abstract class AbstractAdminResource extends RESTWebService
Centralizations of admin resource processings- 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 Modifier and Type Field Description protected OrganizationController
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 AbstractAdminResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T,E extends AbstractTypeEntity>
Collection<E>asWebEntities(Stream<T> data)
Converts the given list of data into their corresponding web entities.protected <T,E extends AbstractTypeEntity>
Collection<E>asWebEntities(Stream<T> data, boolean forceGettingFavorite)
Converts the given list of data into their corresponding web entities.protected AbstractTypeEntity
asWebEntity(Object object)
Converts the component into its corresponding web entity.protected ComponentEntity
asWebEntity(ComponentInstLight component)
Converts the component into its corresponding web entity.protected SpaceEntity
asWebEntity(SpaceInstLight space, boolean forceGettingFavorite)
Converts the space into its corresponding web entity.protected SpaceAppearanceEntity
asWebEntity(SpaceInstLight space, String look, String wallpaper, String css)
Converts the space appearance into its corresponding web entity.protected <T,E extends AbstractTypeEntity>
Collection<E>asWebPersonalEntities(Collection<T> data)
Converts the given list of data into their corresponding web entities.protected PersonalComponentEntity
asWebPersonalEntity(SilverpeasComponent component)
Converts the personal component into its corresponding web entity.protected PersonalComponentEntity
asWebPersonalEntity(SilverpeasComponentInstance component)
Converts the personal component into its corresponding web entity.protected PersonalToolEntity
asWebPersonalEntity(AbstractTool tool)
Converts the tool into its corresponding web entity.protected Stream<ComponentInstLight>
filterAuthorizedComponents(Collection<ComponentInstLight> componentInstances)
Filters the given collection ofComponentInstLight
instance according to user rights.protected AdminPersonalWebDelegate
getAdminPersonalDelegate()
protected LookWebDelegate
getLookDelegate()
protected boolean
isUserAuthorizedToAccessLookContext()
Indicates if the requester user is authorized to access the given spaceprotected ComponentInstLight
loadComponent(String componentId)
Loading data centralization of a component instance.protected Stream<ComponentInstLight>
loadComponents(String... componentIds)
Loading data centralization of components.protected SpaceInstLight
loadSpace(String spaceId)
Loading data centralization of a space.protected Stream<SpaceInstLight>
loadSpaces(String... spaceIds)
Loading data centralization of spaces.void
validateUserAuthorization(UserPrivilegeValidation validation)
Validates the authorization of the user to request this web service.protected void
verifyUserAuthorizedToAccessLookContext()
Verifies the requester user is authorized to access the given spaceprotected void
verifyUserAuthorizedToAccessSpace(String spaceId)
Verifies the requester user is authorized to access the given space.-
Methods inherited from class org.silverpeas.core.web.rs.RESTWebService
createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getResourceBasePath, 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.SilverpeasWebResource
getComponentId
-
Methods inherited from interface org.silverpeas.core.web.rs.WebAuthenticationValidation
validateUserAuthentication
-
-
-
-
Field Detail
-
orgaController
@Inject protected OrganizationController orgaController
-
-
Method Detail
-
loadSpace
protected SpaceInstLight loadSpace(String spaceId)
Loading data centralization of a space.When calling this method to load space data, it is considered that
verifyUserAuthorizedToAccessSpace(String)
method has been called in order to verify user right access about the space.- Parameters:
spaceId
- the space identifier.- Returns:
- the space instance light representation.
-
loadSpaces
protected Stream<SpaceInstLight> loadSpaces(String... spaceIds)
Loading data centralization of spaces.When calling this method, the caller is loading massively space data. In a such context, the loading data are verified concerning the user authorizations.
- Parameters:
spaceIds
- the space identifiers.- Returns:
- stream of
SpaceInstLight
instance.
-
loadComponent
protected ComponentInstLight loadComponent(String componentId)
Loading data centralization of a component instance.When calling this method to load component instance data, it is considered that
validateUserAuthorization(UserPrivilegeValidation)
method has been called in order to verify user right access about the component instance (cf.Authorized
class annotation).- Parameters:
componentId
- the component instance identifier- Returns:
- an instance of
ComponentInstLight
if any, null otherwise.
-
loadComponents
protected Stream<ComponentInstLight> loadComponents(String... componentIds)
Loading data centralization of components.When calling this method, the caller is loading massively component data. In a such context, the loading data are verified concerning the user authorizations.
- Parameters:
componentIds
- the component instance identifiers.- Returns:
- stream of
ComponentInstLight
instance.
-
filterAuthorizedComponents
protected Stream<ComponentInstLight> filterAuthorizedComponents(Collection<ComponentInstLight> componentInstances)
Filters the given collection ofComponentInstLight
instance according to user rights.- Parameters:
componentInstances
- component instances to filter.- Returns:
- a filtered stream of
ComponentInstLight
instance.
-
asWebEntities
protected <T,E extends AbstractTypeEntity> Collection<E> asWebEntities(Stream<T> data)
Converts the given list of data into their corresponding web entities.- Parameters:
data
- data to convert.- Returns:
- an array with the corresponding web entities.
-
asWebEntities
protected <T,E extends AbstractTypeEntity> Collection<E> asWebEntities(Stream<T> data, boolean forceGettingFavorite)
Converts the given list of data into their corresponding web entities.- Parameters:
data
- data to convert.forceGettingFavorite
- forcing the user favorite space search even if the favorite feature is disabled- Returns:
- an array with the corresponding web entities.
-
asWebPersonalEntities
protected <T,E extends AbstractTypeEntity> Collection<E> asWebPersonalEntities(Collection<T> data)
Converts the given list of data into their corresponding web entities.- Parameters:
data
- data to convert.- Returns:
- an array with the corresponding web entities.
-
asWebEntity
protected SpaceEntity asWebEntity(SpaceInstLight space, boolean forceGettingFavorite)
Converts the space into its corresponding web entity.- Parameters:
space
- the space to convert.forceGettingFavorite
- forcing the user favorite space search even if the favorite- Returns:
- the corresponding space entity.
-
asWebEntity
protected SpaceAppearanceEntity asWebEntity(SpaceInstLight space, String look, String wallpaper, String css)
Converts the space appearance into its corresponding web entity.- Parameters:
space
- the aimed space appearance to convert.look
- the look associated to the given space.wallpaper
- the wallpaper associated to the given space.- Returns:
- the corresponding space appearance entity.
-
asWebEntity
protected ComponentEntity asWebEntity(ComponentInstLight component)
Converts the component into its corresponding web entity.- Parameters:
component
- the component to convert.- Returns:
- the corresponding component entity.
-
asWebPersonalEntity
protected PersonalComponentEntity asWebPersonalEntity(SilverpeasComponent component)
Converts the personal component into its corresponding web entity.- Parameters:
component
- the personal component to convert.- Returns:
- the corresponding personal component entity.
-
asWebPersonalEntity
protected PersonalComponentEntity asWebPersonalEntity(SilverpeasComponentInstance component)
Converts the personal component into its corresponding web entity.- Parameters:
component
- the personal component to convert.- Returns:
- the corresponding personal component entity.
-
asWebPersonalEntity
protected PersonalToolEntity asWebPersonalEntity(AbstractTool tool)
Converts the tool into its corresponding web entity.- Parameters:
tool
- the tool to convert.- Returns:
- the corresponding tool entity.
-
asWebEntity
protected AbstractTypeEntity asWebEntity(Object object)
Converts the component into its corresponding web entity.- Parameters:
object
- any object instance.- Returns:
- the corresponding component entity.
-
getAdminPersonalDelegate
protected AdminPersonalWebDelegate getAdminPersonalDelegate()
- Returns:
- the commin admin personal services
-
verifyUserAuthorizedToAccessSpace
protected void verifyUserAuthorizedToAccessSpace(String spaceId)
Verifies the requester user is authorized to access the given space.- Parameters:
spaceId
- the space identifier
-
validateUserAuthorization
public void validateUserAuthorization(UserPrivilegeValidation validation)
Description copied from interface:ProtectedWebResource
Validates the authorization of the user to request this web service. For doing, the user must have the rights to access the component instance that manages this web resource. If no such component instance exists, a Not Found HTTP error is thrown (status code 404). Otherwise the validation is delegated to the validation service by passing it the required information.This method should be invoked for web service requiring an authorized access. For doing, the authentication of the user must be first valdiated. Otherwise, the annotation Authorized can be also used instead at class level for both authentication and authorization.
- Parameters:
validation
- the validation instance to use.- See Also:
UserPrivilegeValidator
-
verifyUserAuthorizedToAccessLookContext
protected void verifyUserAuthorizedToAccessLookContext()
Verifies the requester user is authorized to access the given space
-
isUserAuthorizedToAccessLookContext
protected boolean isUserAuthorizedToAccessLookContext()
Indicates if the requester user is authorized to access the given space
-
getLookDelegate
protected LookWebDelegate getLookDelegate()
- Returns:
- the common look services for Web Services
-
-