Class AbstractResource

java.lang.Object
org.eclipse.persistence.jpa.rs.resources.common.AbstractResource
Direct Known Subclasses:
AbstractEntityResource, AbstractPersistenceResource, AbstractPersistenceUnitResource, AbstractQueryResource, AbstractSingleResultQueryResource, MetadataResource

public abstract class AbstractResource extends Object
Base class for all resources.
Author:
gonural
  • Field Details

  • Constructor Details

    • AbstractResource

      public AbstractResource()
  • Method Details

    • setPersistenceFactory

      public void setPersistenceFactory(PersistenceContextFactory factory)
      Sets the persistence factory.
      Parameters:
      factory - the new persistence factory
    • getPersistenceFactory

      public PersistenceContextFactory getPersistenceFactory()
      Gets the persistence factory.
      Returns:
      the persistence factory
    • getPersistenceFactory

      public PersistenceContextFactory getPersistenceFactory(ClassLoader loader)
      Gets the persistence factory.
      Returns:
      the persistence factory
    • buildPersistenceContextFactory

      protected PersistenceContextFactory buildPersistenceContextFactory(ClassLoader loader)
      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 info
      segment - the segment
      Returns:
      the matrix parameters
      See Also:
    • getQueryParameters

      public static Map<String,Object> 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 QueryParameters
      Parameters:
      info - the info
      Returns:
      the query parameters
      See Also:
    • isValidVersion

      protected static boolean isValidVersion(String version)
      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 unit
      baseURI - the base uri
      version - the version
      initializationProperties - 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 params
      queryParams - 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 metadata
      mediaType - the media type
      Returns:
      the string
      Throws:
      jakarta.xml.bind.JAXBException - the jAXB exception
    • setRequestUniqueId

      protected void setRequestUniqueId()