public abstract class AbstractService extends Object
| Constructor and Description |
|---|
AbstractService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertCanAccess(AbstractAuthzEntity entity,
String requiredScope)
This method tests whether a particular entity may be accessed.
|
protected void |
assertCanAccessSubresource(AbstractAuthzEntity entity,
String requiredParentScope)
This method tests whether a particular subresource entity may be
accessed.
|
protected javax.ws.rs.core.Response |
executeQuery(Class<? extends AbstractEntity> klass,
org.hibernate.search.FullTextQuery query,
int offset,
int limit)
Execute a search query.
|
protected abstract String |
getAccessScope()
Return the scope required to access resources on this service.
|
protected Application |
getAdminApplication()
Retrieve the admin application database entry for the current running
test.
|
protected abstract String |
getAdminScope()
Return the scope required to access ALL resources on this services.
|
org.apache.commons.configuration.Configuration |
getConfig()
Get the configuration.
|
protected User |
getCurrentUser()
Retrieve the current user for this request.
|
org.hibernate.search.FullTextSession |
getFullTextSession()
Get the full text search session.
|
org.glassfish.jersey.internal.inject.InjectionManager |
getInjector()
Retrieve the injector for this context.
|
org.hibernate.search.SearchFactory |
getSearchFactory()
Retrieve the search factory.
|
javax.ws.rs.core.SecurityContext |
getSecurityContext()
Get the security context.
|
org.hibernate.Session |
getSession()
Get the session.
|
javax.ws.rs.core.UriInfo |
getUriInfo()
Get the URI info for the current request.
|
protected <K extends AbstractAuthzEntity> |
requireEntityInput(Class<K> requestedType,
K entity)
Provided a type and an entity, requires the existence of this entity.
|
protected <K extends AbstractAuthzEntity> |
resolveEntityInput(Class<K> requestedType,
BigInteger entityId)
Provided a type and an id, attempts to resolve a fresh entity from
the database session.
|
protected <K extends AbstractAuthzEntity> |
resolveEntityInput(Class<K> requestedType,
K entity)
Provided a type and an entity, attempts to resolve a fresh entity from
the database session.
|
protected <T extends AbstractAuthzEntity> |
resolveFilterEntity(Class<T> roleClass,
BigInteger entityId)
Attempt to resolve the provided ID into the requested entity type.
|
protected User |
resolveOwnershipFilter(BigInteger ownerId)
Determine the appropriate owner on which we should be filtering.
|
void |
setConfig(org.apache.commons.configuration.Configuration config)
Set the request configuration.
|
void |
setFullTextSession(org.hibernate.search.FullTextSession fullTextSession)
Set the full text search session.
|
void |
setInjector(org.glassfish.jersey.internal.inject.InjectionManager injector)
Set (via injection, usually) the injector for this resource.
|
void |
setSearchFactory(org.hibernate.search.SearchFactory searchFactory)
Set an instance of the search factory.
|
void |
setSecurityContext(javax.ws.rs.core.SecurityContext securityContext)
Set a new security context.
|
void |
setSession(org.hibernate.Session session)
Set the session.
|
void |
setUriInfo(javax.ws.rs.core.UriInfo uriInfo)
Set the URI info instance for the current request.
|
public final org.glassfish.jersey.internal.inject.InjectionManager getInjector()
public final void setInjector(org.glassfish.jersey.internal.inject.InjectionManager injector)
injector - The injector.public final javax.ws.rs.core.UriInfo getUriInfo()
public final void setUriInfo(javax.ws.rs.core.UriInfo uriInfo)
uriInfo - The new URIInfo instance.public final org.hibernate.Session getSession()
public final void setSession(org.hibernate.Session session)
session - The session.public final org.hibernate.search.SearchFactory getSearchFactory()
public final void setSearchFactory(org.hibernate.search.SearchFactory searchFactory)
searchFactory - The search factory.public final org.hibernate.search.FullTextSession getFullTextSession()
public final void setFullTextSession(org.hibernate.search.FullTextSession fullTextSession)
fullTextSession - The FTSession.public final org.apache.commons.configuration.Configuration getConfig()
public final void setConfig(org.apache.commons.configuration.Configuration config)
config - A request configuration.public final javax.ws.rs.core.SecurityContext getSecurityContext()
public final void setSecurityContext(javax.ws.rs.core.SecurityContext securityContext)
securityContext - A new security context.protected final User getCurrentUser()
protected abstract String getAdminScope()
protected abstract String getAccessScope()
protected final Application getAdminApplication()
protected final void assertCanAccess(AbstractAuthzEntity entity, String requiredScope)
entity - The entity to check.requiredScope - The scope required to access this
entity.protected final void assertCanAccessSubresource(AbstractAuthzEntity entity, String requiredParentScope)
entity - The entity to check.requiredParentScope - The scope required to access the parent
entity.protected final User resolveOwnershipFilter(BigInteger ownerId)
ownerId - The passed-in owner id, could be null.protected final <T extends AbstractAuthzEntity> T resolveFilterEntity(Class<T> roleClass, BigInteger entityId)
T - The return type.roleClass - The entity type to resolve.entityId - The ID to resolve.protected final javax.ws.rs.core.Response executeQuery(Class<? extends AbstractEntity> klass, org.hibernate.search.FullTextQuery query, int offset, int limit)
klass - The type to cast to.query - The fulltext query to execute.offset - The query offset.limit - The query limit.protected final <K extends AbstractAuthzEntity> K resolveEntityInput(Class<K> requestedType, K entity)
K - The type to return (same as type to resolve).requestedType - The type to resolve.entity - The entity.protected final <K extends AbstractAuthzEntity> K resolveEntityInput(Class<K> requestedType, BigInteger entityId)
K - The type to return (same as type to resolve).requestedType - The type to resolve.entityId - The entity id.protected final <K extends AbstractAuthzEntity> K requireEntityInput(Class<K> requestedType, K entity)
K - The type to return (same as type to resolve).requestedType - The type to resolve.entity - The entity.Copyright © 2018 krotscheck.net. All rights reserved.