public class PersistenceContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_NAME |
static java.lang.String |
JPARS_CONTEXT |
static java.lang.String |
SESSION_VERSION_PROPERTY |
Constructor and Description |
---|
PersistenceContext(java.lang.String emfName,
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl emf,
java.net.URI defaultURI)
Instantiates a new persistence context.
|
PersistenceContext(java.lang.String emfName,
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl emf,
java.net.URI defaultURI,
ServiceVersion version)
Instantiates a new persistence context.
|
Modifier and Type | Method and Description |
---|---|
javax.persistence.Query |
buildQuery(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String name,
java.util.Map<?,?> parameters,
java.util.Map<java.lang.String,?> hints)
Builds the query.
|
void |
create(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.Object entity)
A part of the facade over the JPA API.
|
void |
delete(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String type,
java.lang.Object id)
A part of the facade over the JPA API
Delete the given entity in JPA and commit the changes
|
boolean |
doesExist(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.Object entity)
Does exist.
|
boolean |
equals(java.lang.Object other) |
void |
finalize()
Finalize.
|
java.lang.Object |
find(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String entityName,
java.lang.Object id)
A part of the facade over the JPA API
Find an entity with the given name and id in JPA
|
java.lang.Object |
find(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String entityName,
java.lang.Object id,
java.util.Map<java.lang.String,java.lang.Object> properties)
A part of the facade over the JPA API
Find an entity with the given name and id in JPA
|
java.lang.Object |
find(java.lang.String entityName,
java.lang.Object id)
A part of the facade over the JPA API
Find an entity with the given name and id in JPA
|
java.net.URI |
getBaseURI()
Gets the base uri.
|
java.lang.Class<?> |
getClass(java.lang.String entityName)
Look-up the given entity name in the EntityManagerFactory and return the class
is describes
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getClientSession(javax.persistence.EntityManager em)
Gets the client session.
|
CollectionWrapperBuilder |
getCollectionWrapperBuilder()
Getter for the collectionWrapperBuilder property with lazy initialization.
|
ClassDescriptor |
getDescriptor(java.lang.String entityName)
Lookup the descriptor for the given entity name.
|
ClassDescriptor |
getDescriptorForClass(java.lang.Class clazz)
Gets the descriptor for class.
|
javax.persistence.EntityManagerFactory |
getEmf()
Gets the emf.
|
JAXBContext |
getJAXBContext()
Gets the jAXB context.
|
ClassDescriptor |
getJAXBDescriptorForClass(java.lang.Class clazz)
Gets the jAXB descriptor for class.
|
java.lang.String |
getName()
Gets the name.
|
RestPageableQuery |
getPageableQuery(java.lang.String queryName)
Gets REST pageable query details by query name.
|
DatabaseSession |
getServerSession()
Gets the jpa server session.
|
ServiceVersion |
getServiceVersion()
Gets JPARS version.
|
SessionLog |
getSessionLog() |
FeatureSet |
getSupportedFeatureSet()
Gets the supported feature set.
|
java.lang.String |
getVersion()
Gets the version as it appears in URI.
|
int |
hashCode() |
boolean |
isQueryPageable(java.lang.String queryName)
Finds out is given query pageable or not.
|
boolean |
isWeavingEnabled()
Checks if is weaving enabled.
|
void |
marshall(java.lang.Object object,
javax.ws.rs.core.MediaType mediaType,
java.io.OutputStream output,
boolean sendRelationships)
Marshall an entity to either JSON or XML.
|
void |
marshall(java.lang.Object object,
javax.ws.rs.core.MediaType mediaType,
java.io.OutputStream output,
boolean sendRelationships,
FieldsFilter fieldsFilter)
Marshall an entity to either JSON or XML.
|
void |
marshallEntity(java.lang.Object object,
FieldsFilter filter,
javax.ws.rs.core.MediaType mediaType,
java.io.OutputStream output)
Marshall an entity to either JSON or XML.
|
void |
marshallEntity(java.lang.Object object,
javax.ws.rs.core.MediaType mediaType,
java.io.OutputStream output)
Marshall an entity to either JSON or XML
Calling this method, will treat relationships as unfetched in the XML/JSON and marshall them as links
rather than attempting to marshall the data in those relationships
|
java.lang.Object |
merge(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.Object entity)
A part of the facade over the JPA API
Call jpa merge on the given object and commit
If the passed object is a list, we will iterate through the
list and merge each member
|
DynamicEntity |
newEntity(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String type)
A convenience method to create a new dynamic entity of the given type
|
DynamicEntity |
newEntity(java.lang.String type)
A convenience method to create a new dynamic entity of the given type
|
int |
queryExecuteUpdate(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String name,
java.util.Map<?,?> parameters,
java.util.Map<java.lang.String,?> hints)
Query execute update.
|
java.util.List |
queryMultipleResults(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String name,
java.util.Map<?,?> parameters,
java.util.Map<java.lang.String,?> hints)
Query multiple results.
|
java.lang.Object |
removeAttribute(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String entityName,
java.lang.Object id,
java.lang.String attribute,
java.lang.String listItemId,
java.lang.Object entity,
java.lang.String partner)
Removes the attribute.
|
void |
setBaseURI(java.net.URI baseURI)
Sets the base uri.
|
void |
setVersion(java.lang.String version)
Sets the version.
|
void |
stop()
Stop the current application instance
|
java.lang.String |
toString()
To string.
|
java.lang.Object |
unmarshal(java.lang.Class type,
javax.ws.rs.core.MediaType acceptedMediaType,
java.io.InputStream in)
Unmarshal.
|
java.lang.Object |
unmarshalEntity(java.lang.String type,
javax.ws.rs.core.MediaType acceptedMediaType,
java.io.InputStream in)
Unmarshal entity.
|
java.lang.Object |
updateOrAddAttribute(java.util.Map<java.lang.String,java.lang.String> tenantId,
java.lang.String entityName,
java.lang.Object id,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.lang.String attribute,
java.lang.Object attributeValue,
java.lang.String partner)
Update or add attribute.
|
public static final java.lang.String JPARS_CONTEXT
public static final java.lang.String CLASS_NAME
public static final java.lang.String SESSION_VERSION_PROPERTY
public PersistenceContext(java.lang.String emfName, org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl emf, java.net.URI defaultURI)
emfName
- the emf nameemf
- the emfdefaultURI
- the default uripublic PersistenceContext(java.lang.String emfName, org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl emf, java.net.URI defaultURI, ServiceVersion version)
emfName
- the emf nameemf
- the emfdefaultURI
- the default uriversion
- REST service versionpublic boolean isWeavingEnabled()
public java.lang.String getVersion()
public ServiceVersion getServiceVersion()
public void create(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.Object entity) throws java.lang.Exception
tenantId
- entity
- java.lang.Exception
public void delete(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String type, java.lang.Object id)
public boolean doesExist(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.Object entity)
tenantId
- the tenant identity
- the entitypublic void finalize()
finalize
in class java.lang.Object
public java.lang.Object find(java.lang.String entityName, java.lang.Object id)
entityName
- id
- public java.lang.Object find(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String entityName, java.lang.Object id)
tenantId
- entityName
- id
- public java.lang.Object find(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String entityName, java.lang.Object id, java.util.Map<java.lang.String,java.lang.Object> properties)
tenantId
- entityName
- id
- properties
- - query hints used on the findpublic java.lang.Object updateOrAddAttribute(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String entityName, java.lang.Object id, java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.String attribute, java.lang.Object attributeValue, java.lang.String partner)
tenantId
- the tenant identityName
- the entity nameid
- the idproperties
- the propertiesattribute
- the attributeattributeValue
- the attribute valuepartner
- the partnerpublic java.lang.Object removeAttribute(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String entityName, java.lang.Object id, java.lang.String attribute, java.lang.String listItemId, java.lang.Object entity, java.lang.String partner)
tenantId
- the tenant identityName
- the entity nameid
- the idattribute
- the attributelistItemId
- entity
- partner
- the partnerpublic java.net.URI getBaseURI()
public java.lang.Class<?> getClass(java.lang.String entityName)
entityName
- public DatabaseSession getServerSession()
public org.eclipse.persistence.internal.sessions.AbstractSession getClientSession(javax.persistence.EntityManager em)
em
- the empublic ClassDescriptor getDescriptor(java.lang.String entityName)
entityName
- public ClassDescriptor getDescriptorForClass(java.lang.Class clazz)
clazz
- the clazzpublic ClassDescriptor getJAXBDescriptorForClass(java.lang.Class clazz)
clazz
- the clazzpublic javax.persistence.EntityManagerFactory getEmf()
public JAXBContext getJAXBContext()
public java.lang.String getName()
public SessionLog getSessionLog()
public java.lang.Object merge(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.Object entity)
tenantId
- entity
- public DynamicEntity newEntity(java.lang.String type)
type
- public DynamicEntity newEntity(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String type)
tenantId
- type
- public int queryExecuteUpdate(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String name, java.util.Map<?,?> parameters, java.util.Map<java.lang.String,?> hints)
tenantId
- the tenant idname
- the nameparameters
- the parametershints
- the hintspublic java.util.List queryMultipleResults(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String name, java.util.Map<?,?> parameters, java.util.Map<java.lang.String,?> hints)
tenantId
- the tenant idname
- the nameparameters
- the parametershints
- the hintspublic javax.persistence.Query buildQuery(java.util.Map<java.lang.String,java.lang.String> tenantId, java.lang.String name, java.util.Map<?,?> parameters, java.util.Map<java.lang.String,?> hints)
tenantId
- the tenant idname
- the nameparameters
- the parametershints
- the hintspublic void stop()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object unmarshalEntity(java.lang.String type, javax.ws.rs.core.MediaType acceptedMediaType, java.io.InputStream in) throws javax.xml.bind.JAXBException
type
- the type of the entity to unmarshalacceptedMediaType
- the accepted media typein
- the input stream to unmarshaljavax.xml.bind.JAXBException
- the JAXB exceptionpublic java.lang.Object unmarshal(java.lang.Class type, javax.ws.rs.core.MediaType acceptedMediaType, java.io.InputStream in) throws javax.xml.bind.JAXBException
type
- the type of the entity to unmarshalacceptedMediaType
- the accepted media typein
- the input stream to unmarshaljavax.xml.bind.JAXBException
- the JAXB exceptionpublic void marshallEntity(java.lang.Object object, javax.ws.rs.core.MediaType mediaType, java.io.OutputStream output) throws javax.xml.bind.JAXBException
object
- mediaType
- output
- javax.xml.bind.JAXBException
public void marshallEntity(java.lang.Object object, FieldsFilter filter, javax.ws.rs.core.MediaType mediaType, java.io.OutputStream output) throws javax.xml.bind.JAXBException
object
- the object to marshal.filter
- the filter (included/excluded fields) to use.mediaType
- the media type (XML/JSON).output
- the result.javax.xml.bind.JAXBException
public void marshall(java.lang.Object object, javax.ws.rs.core.MediaType mediaType, java.io.OutputStream output, boolean sendRelationships) throws javax.xml.bind.JAXBException
object
- mediaType
- output
- sendRelationships
- if this is set to true, relationships will be sent as links instead of sending.
the actual objects in the relationshipsjavax.xml.bind.JAXBException
public void marshall(java.lang.Object object, javax.ws.rs.core.MediaType mediaType, java.io.OutputStream output, boolean sendRelationships, FieldsFilter fieldsFilter) throws javax.xml.bind.JAXBException
object
- the object to marshal.mediaType
- the media type (XML/JSON).output
- the result.sendRelationships
- if this is set to true, relationships will be sent as links instead of sending
the actual objects in the relationships.fieldsFilter
- Specifies fields to include/exclude from the response.javax.xml.bind.JAXBException
public FeatureSet getSupportedFeatureSet()
public boolean isQueryPageable(java.lang.String queryName)
queryName
- named query to check.public RestPageableQuery getPageableQuery(java.lang.String queryName)
queryName
- named query name.public void setVersion(java.lang.String version)
version
- the new version.public void setBaseURI(java.net.URI baseURI)
baseURI
- the new base uripublic CollectionWrapperBuilder getCollectionWrapperBuilder()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object