public abstract class AbstractResource
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLICATION_SCHEMA_JSON |
static javax.ws.rs.core.MediaType |
APPLICATION_SCHEMA_JSON_TYPE |
protected PersistenceContextFactory |
factory |
static java.lang.String |
SERVICE_VERSION_FORMAT |
Constructor and Description |
---|
AbstractResource() |
Modifier and Type | Method and Description |
---|---|
protected PersistenceContextFactory |
buildPersistenceContextFactory(java.lang.ClassLoader loader)
Builds the persistence context factory.
|
protected static java.util.Map<java.lang.String,java.lang.String> |
getMatrixParameters(javax.ws.rs.core.UriInfo info,
java.lang.String segment)
Get a map of the matrix parameters associated with the URI path segment of the current request
In JPA-RS, things that user sets (such as parameters of named queries, etc.) are treated as matrix parameters
List of valid matrix parameters for JPA-RS is defined in MatrixParameters
|
protected PersistenceContext |
getPersistenceContext(java.lang.String persistenceUnit,
java.lang.String entityType,
java.net.URI baseURI,
java.lang.String version,
java.util.Map<java.lang.String,java.lang.Object> initializationProperties)
Gets the persistence context.
|
PersistenceContextFactory |
getPersistenceFactory()
Gets the persistence factory.
|
PersistenceContextFactory |
getPersistenceFactory(java.lang.ClassLoader loader)
Gets the persistence factory.
|
static java.util.Map<java.lang.String,java.lang.Object> |
getQueryParameters(javax.ws.rs.core.UriInfo info)
Get the URI query parameters of the current request
In JPA-RS, predefined attributes (such as eclipselink query hints) are treated as query parameters
List of valid query parameters for JPA-RS is defined in QueryParameters
|
protected java.lang.String |
getRelationshipPartner(java.util.Map<java.lang.String,java.lang.String> matrixParams,
java.util.Map<java.lang.String,java.lang.Object> queryParams)
Gets the relationship partner.
|
protected static boolean |
isValidVersion(java.lang.String version)
Checks if is valid version.
|
protected java.lang.String |
marshallMetadata(java.lang.Object metadata,
java.lang.String mediaType)
Marshall metadata.
|
void |
setPersistenceFactory(PersistenceContextFactory factory)
Sets the persistence factory.
|
protected void |
setRequestUniqueId() |
public static final java.lang.String SERVICE_VERSION_FORMAT
public static final java.lang.String APPLICATION_SCHEMA_JSON
public static final javax.ws.rs.core.MediaType APPLICATION_SCHEMA_JSON_TYPE
protected PersistenceContextFactory factory
public void setPersistenceFactory(PersistenceContextFactory factory)
factory
- the new persistence factorypublic PersistenceContextFactory getPersistenceFactory()
public PersistenceContextFactory getPersistenceFactory(java.lang.ClassLoader loader)
protected PersistenceContextFactory buildPersistenceContextFactory(java.lang.ClassLoader loader)
loader
- the loaderprotected static java.util.Map<java.lang.String,java.lang.String> getMatrixParameters(javax.ws.rs.core.UriInfo info, java.lang.String segment)
info
- the infosegment
- the segmentMatrixParameters
public static java.util.Map<java.lang.String,java.lang.Object> getQueryParameters(javax.ws.rs.core.UriInfo info)
info
- the infoQueryParameters
protected static boolean isValidVersion(java.lang.String version)
version
- the versionprotected PersistenceContext getPersistenceContext(java.lang.String persistenceUnit, java.lang.String entityType, java.net.URI baseURI, java.lang.String version, java.util.Map<java.lang.String,java.lang.Object> initializationProperties)
persistenceUnit
- the persistence unitbaseURI
- the base uriversion
- the versioninitializationProperties
- the initialization propertiesprotected java.lang.String getRelationshipPartner(java.util.Map<java.lang.String,java.lang.String> matrixParams, java.util.Map<java.lang.String,java.lang.Object> queryParams)
matrixParams
- the matrix paramsqueryParams
- the query paramsprotected java.lang.String marshallMetadata(java.lang.Object metadata, java.lang.String mediaType) throws JAXBException
metadata
- the metadatamediaType
- the media typeJAXBException
- the jAXB exceptionprotected void setRequestUniqueId()