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 OrganizationControllerorgaController-
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 AbstractTypeEntityasWebEntity(Object object)Converts the component into its corresponding web entity.protected ComponentEntityasWebEntity(ComponentInstLight component)Converts the component into its corresponding web entity.protected SpaceEntityasWebEntity(SpaceInstLight space, boolean forceGettingFavorite)Converts the space into its corresponding web entity.protected SpaceAppearanceEntityasWebEntity(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 PersonalComponentEntityasWebPersonalEntity(SilverpeasComponent component)Converts the personal component into its corresponding web entity.protected PersonalComponentEntityasWebPersonalEntity(SilverpeasComponentInstance component)Converts the personal component into its corresponding web entity.protected PersonalToolEntityasWebPersonalEntity(AbstractTool tool)Converts the tool into its corresponding web entity.protected Stream<ComponentInstLight>filterAuthorizedComponents(Collection<ComponentInstLight> componentInstances)Filters the given collection ofComponentInstLightinstance according to user rights.protected AdminPersonalWebDelegategetAdminPersonalDelegate()protected LookWebDelegategetLookDelegate()protected booleanisUserAuthorizedToAccessLookContext()Indicates if the requester user is authorized to access the given spaceprotected ComponentInstLightloadComponent(String componentId)Loading data centralization of a component instance.protected Stream<ComponentInstLight>loadComponents(String... componentIds)Loading data centralization of components.protected SpaceInstLightloadSpace(String spaceId)Loading data centralization of a space.protected Stream<SpaceInstLight>loadSpaces(String... spaceIds)Loading data centralization of spaces.voidvalidateUserAuthorization(UserPrivilegeValidation validation)Validates the authorization of the user to request this web service.protected voidverifyUserAuthorizedToAccessLookContext()Verifies the requester user is authorized to access the given spaceprotected voidverifyUserAuthorizedToAccessSpace(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
SpaceInstLightinstance.
-
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.Authorizedclass annotation).- Parameters:
componentId- the component instance identifier- Returns:
- an instance of
ComponentInstLightif 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
ComponentInstLightinstance.
-
filterAuthorizedComponents
protected Stream<ComponentInstLight> filterAuthorizedComponents(Collection<ComponentInstLight> componentInstances)
Filters the given collection ofComponentInstLightinstance according to user rights.- Parameters:
componentInstances- component instances to filter.- Returns:
- a filtered stream of
ComponentInstLightinstance.
-
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:ProtectedWebResourceValidates 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
-
-