E - the entity classC - the comm classpublic abstract class AbstractResource<E extends org.eurekaclinical.standardapis.entity.Entity,C> extends Object
admin
role access to all objects through these two APIs even if they are not the
owner of the object, and even if they are not a member of a group with
access to the object.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractResource(org.eurekaclinical.standardapis.dao.Dao<E,Long> inDao)
Creates an instance of a resource that will use the given data access
object for database queries.
|
protected |
AbstractResource(org.eurekaclinical.standardapis.dao.Dao<E,Long> inDao,
boolean inRestricted)
Creates an instance of a resource that will use the given data access
object for database queries.
|
| Modifier and Type | Method and Description |
|---|---|
List<C> |
getAll(javax.servlet.http.HttpServletRequest req)
Gets all objects managed by this resource.
|
C |
getAny(Long inId,
javax.servlet.http.HttpServletRequest req)
Gets the object with the given unique identifier.
|
protected abstract boolean |
isAuthorizedEntity(E entity,
javax.servlet.http.HttpServletRequest req)
Returns whether the requesting user is authorized to access an entity.
|
boolean |
isRestricted()
Whether or not admin users have read-only access to all objects, even
if they are not the object's owner, and even if they are not a member
of a group that has access to the object.
|
protected abstract C |
toComm(E entity,
javax.servlet.http.HttpServletRequest req)
Converts a JPA entity to a Jersey POJO.
|
protected AbstractResource(org.eurekaclinical.standardapis.dao.Dao<E,Long> inDao)
inDao - the data access object. Cannot be null.protected AbstractResource(org.eurekaclinical.standardapis.dao.Dao<E,Long> inDao, boolean inRestricted)
inDao - the data access object. Cannot be null.inRestricted - false to grant users with the
admin role read-only access to objects that they are not
otherwise authorized to access through Eureka! Clinical's group and
owner permissions. Setting this parameter to true achieves
the same behavior as the one-argument constructor, which grants all
users access only to objects that they own or otherwise have access to
through being a member of a group.public boolean isRestricted()
false if admin users do have these extra
privileges, false if they do not. The default value is
true.public List<C> getAll(@Context javax.servlet.http.HttpServletRequest req)
admin role are authorized to use this API. Setting
the restricted field to false in the two-
argument constructor will change this behavior so that non-admin users
may also make this API call.req - the HTTP servlet request.org.eurekaclinical.standardapis.exception.HttpStatusException - if an error occurred, for example, the user
is not authorized to make this call.public C getAny(Long inId, @Context javax.servlet.http.HttpServletRequest req)
inId - the unique identifier. Cannot be null.req - the HTTP servlet request.null.org.eurekaclinical.standardapis.exception.HttpStatusException - if there is no object with the given
unique identifier, or if the user is not authorized to access the
object.protected abstract C toComm(E entity, javax.servlet.http.HttpServletRequest req)
entity - the entity. Cannot be null.req - the HTTP servlet request.null.protected abstract boolean isAuthorizedEntity(E entity, javax.servlet.http.HttpServletRequest req)
entity - the entity.req - the HTTP servlet request.true if the current user is authorized to access
the entity, false otherwise.Copyright © 2016–2018 Emory University. All rights reserved.