Class CommunityWebResource
- java.lang.Object
-
- org.silverpeas.core.web.rs.RESTWebService
-
- org.silverpeas.components.community.web.CommunityWebResource
-
- All Implemented Interfaces:
org.silverpeas.core.web.rs.ProtectedWebResource
,org.silverpeas.core.web.rs.WebAuthenticationValidation
,org.silverpeas.core.web.rs.WebAuthorizationValidation
,org.silverpeas.core.web.SilverpeasWebResource
- Direct Known Subclasses:
CommunityMembershipResource
,CommunityOfUsersResource
@Authorized public abstract class CommunityWebResource extends org.silverpeas.core.web.rs.RESTWebService
Base class of all the resources in the community application exposed through the Web. It is expected the web resource to be spawn for each incoming request; the life-cycle of each web resource instance is within the one of the request.- Author:
- mmoquillon
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
CommunityWebResource.WebFunction<R>
-
Field Summary
Fields Modifier and Type Field Description protected static org.silverpeas.core.admin.PaginationPage
NO_PAGINATION
protected static String
RESOURCE_NAME
-
Constructor Summary
Constructors Constructor Description CommunityWebResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.silverpeas.components.community.web.CommunityWebResourceURIBuilder
getCommunityUriBuilder()
Gets the builder of URIs of the web resources managed by the community application.protected String
getResourceBasePath()
Gets the relative base path at which are all exposed the resources in the community application.protected Collection<org.silverpeas.core.admin.user.model.SilverpeasRole>
getUserRoles()
Gets the roles the user requesting currently this web resource plays in the community of users.protected CommunityWebManager
getWebManager()
Gets the Web Manager to use to fulfill the incoming request.protected void
initURIBuilder()
protected <T> T
process(CommunityWebResource.WebFunction<T> function)
Processes the specified web function behalf the community of users concerned by the incoming request.-
Methods inherited from class org.silverpeas.core.web.rs.RESTWebService
createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getSilverpeasContext, getUri, getUser, getUserPreferences, identifiedBy, identifiedBy, initContext, initWebResourceUri, isUserDefined, process
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
RESOURCE_NAME
protected static final String RESOURCE_NAME
- See Also:
- Constant Field Values
-
NO_PAGINATION
protected static final org.silverpeas.core.admin.PaginationPage NO_PAGINATION
-
-
Method Detail
-
initURIBuilder
@PostConstruct protected void initURIBuilder()
-
getResourceBasePath
protected String getResourceBasePath()
Gets the relative base path at which are all exposed the resources in the community application.- Specified by:
getResourceBasePath
in classorg.silverpeas.core.web.rs.RESTWebService
- Returns:
- the base path of the resource relative to the URI at which are all exposed the REST-based web services in Silverpeas.
-
getUserRoles
protected Collection<org.silverpeas.core.admin.user.model.SilverpeasRole> getUserRoles()
Gets the roles the user requesting currently this web resource plays in the community of users.- Overrides:
getUserRoles
in classorg.silverpeas.core.web.rs.RESTWebService
- Returns:
- a collection of roles the current user plays.
-
getWebManager
protected CommunityWebManager getWebManager()
Gets the Web Manager to use to fulfill the incoming request. The web manager centralizes all the behaviour provided in the website, both by the Web GUI and the REST web resources.- Returns:
- a community web manager.
-
process
protected <T> T process(CommunityWebResource.WebFunction<T> function)
Processes the specified web function behalf the community of users concerned by the incoming request.- Type Parameters:
T
- the concrete type of the answer.- Parameters:
function
- the web function to apply.- Returns:
- the answer of the web function.
-
getCommunityUriBuilder
protected org.silverpeas.components.community.web.CommunityWebResourceURIBuilder getCommunityUriBuilder()
Gets the builder of URIs of the web resources managed by the community application.- Returns:
- a builder of URIS to identify the web resources handled in a community application instance.
-
-