Class AbstractResource
java.lang.Object
org.eclipse.persistence.jpa.rs.resources.common.AbstractResource
- Direct Known Subclasses:
AbstractEntityResource
,AbstractPersistenceResource
,AbstractPersistenceUnitResource
,AbstractQueryResource
,AbstractSingleResultQueryResource
,MetadataResource
Base class for all resources.
- Author:
- gonural
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final jakarta.ws.rs.core.MediaType
protected PersistenceContextFactory
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected PersistenceContextFactory
Builds the persistence context factory.getMatrixParameters
(jakarta.ws.rs.core.UriInfo info, 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 MatrixParametersprotected PersistenceContext
getPersistenceContext
(String persistenceUnit, String entityType, URI baseURI, String version, Map<String, Object> initializationProperties) Gets the persistence context.Gets the persistence factory.getPersistenceFactory
(ClassLoader loader) Gets the persistence factory.getQueryParameters
(jakarta.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 QueryParametersprotected String
Gets the relationship partner.protected static boolean
isValidVersion
(String version) Checks if is valid version.protected String
marshallMetadata
(Object metadata, String mediaType) Marshall metadata.void
Sets the persistence factory.protected void
-
Field Details
-
SERVICE_VERSION_FORMAT
- See Also:
-
APPLICATION_SCHEMA_JSON
- See Also:
-
APPLICATION_SCHEMA_JSON_TYPE
public static final jakarta.ws.rs.core.MediaType APPLICATION_SCHEMA_JSON_TYPE -
factory
-
-
Constructor Details
-
AbstractResource
public AbstractResource()
-
-
Method Details
-
setPersistenceFactory
Sets the persistence factory.- Parameters:
factory
- the new persistence factory
-
getPersistenceFactory
Gets the persistence factory.- Returns:
- the persistence factory
-
getPersistenceFactory
Gets the persistence factory.- Returns:
- the persistence factory
-
buildPersistenceContextFactory
Builds the persistence context factory.- Parameters:
loader
- the loader- Returns:
- the persistence context factory
-
getMatrixParameters
protected static Map<String,String> getMatrixParameters(jakarta.ws.rs.core.UriInfo info, 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- Parameters:
info
- the infosegment
- the segment- Returns:
- the matrix parameters
- See Also:
-
getQueryParameters
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- Parameters:
info
- the info- Returns:
- the query parameters
- See Also:
-
isValidVersion
Checks if is valid version.- Parameters:
version
- the version- Returns:
- true, if is valid version
-
getPersistenceContext
protected PersistenceContext getPersistenceContext(String persistenceUnit, String entityType, URI baseURI, String version, Map<String, Object> initializationProperties) Gets the persistence context.- Parameters:
persistenceUnit
- the persistence unitbaseURI
- the base uriversion
- the versioninitializationProperties
- the initialization properties- Returns:
- the persistence context
-
getRelationshipPartner
protected String getRelationshipPartner(Map<String, String> matrixParams, Map<String, Object> queryParams) Gets the relationship partner.- Parameters:
matrixParams
- the matrix paramsqueryParams
- the query params- Returns:
- the relationship partner
-
marshallMetadata
protected String marshallMetadata(Object metadata, String mediaType) throws jakarta.xml.bind.JAXBException Marshall metadata.- Parameters:
metadata
- the metadatamediaType
- the media type- Returns:
- the string
- Throws:
jakarta.xml.bind.JAXBException
- the jAXB exception
-
setRequestUniqueId
protected void setRequestUniqueId()
-