public class PersistenceContext extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
JPARS_CONTEXT |
| Constructor and Description |
|---|
PersistenceContext(String emfName,
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl emf,
URI defaultURI)
Instantiates a new persistence context.
|
| Modifier and Type | Method and Description |
|---|---|
javax.persistence.Query |
buildQuery(Map<String,String> tenantId,
String name,
Map<?,?> parameters,
Map<String,?> hints) |
void |
create(Map<String,String> tenantId,
Object entity)
A part of the facade over the JPA API
Persist an entity in JPA and commit
|
void |
delete(Map<String,String> tenantId,
String type,
Object id)
A part of the facade over the JPA API
Delete the given entity in JPA and commit the changes
|
boolean |
doesExist(Map<String,String> tenantId,
Object entity)
Does exist.
|
void |
finalize()
Finalize.
|
Object |
find(Map<String,String> tenantId,
String entityName,
Object id)
A part of the facade over the JPA API
Find an entity with the given name and id in JPA
|
Object |
find(Map<String,String> tenantId,
String entityName,
Object id,
Map<String,Object> properties)
A part of the facade over the JPA API
Find an entity with the given name and id in JPA
|
Object |
find(String entityName,
Object id)
A part of the facade over the JPA API
Find an entity with the given name and id in JPA
|
Object |
findAttribute(Map<String,String> tenantId,
String entityName,
Object id,
Map<String,Object> properties,
String attribute)
Find attribute.
|
URI |
getBaseURI()
Gets the base uri.
|
Class<?> |
getClass(String entityName)
Look-up the given entity name in the EntityManagerFactory and return the class
is describes
|
ClassDescriptor |
getDescriptor(String entityName)
Lookup the descriptor for the given entity name.
|
ClassDescriptor |
getDescriptorForClass(Class clazz)
Gets the descriptor for class.
|
javax.persistence.EntityManagerFactory |
getEmf()
Gets the emf.
|
JAXBContext |
getJAXBContext()
Gets the jAXB context.
|
ClassDescriptor |
getJAXBDescriptorForClass(Class clazz)
Gets the jAXB descriptor for class.
|
DatabaseSession |
getJpaSession()
Gets the jpa session.
|
String |
getName()
Gets the name.
|
String |
getVersion() |
boolean |
isWeavingEnabled() |
void |
marshallEntity(Object object,
javax.ws.rs.core.MediaType mediaType,
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
|
void |
marshallEntity(Object object,
javax.ws.rs.core.MediaType mediaType,
OutputStream output,
boolean sendRelationships)
Marshall an entity to either JSON or XML
|
Object |
merge(Map<String,String> tenantId,
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(Map<String,String> tenantId,
String type)
A convenience method to create a new dynamic entity of the given type
|
DynamicEntity |
newEntity(String type)
A convenience method to create a new dynamic entity of the given type
|
int |
queryExecuteUpdate(Map<String,String> tenantId,
String name,
Map<?,?> parameters,
Map<String,?> hints)
Query execute update.
|
List |
queryMultipleResults(Map<String,String> tenantId,
String name,
Map<?,?> parameters,
Map<String,?> hints)
Query multiple results.
|
Object |
removeAttribute(Map<String,String> tenantId,
String entityName,
Object id,
String attribute,
String listItemId,
Object entity,
String partner)
Removes the attribute.
|
void |
setBaseURI(URI baseURI)
Sets the base uri.
|
void |
setVersion(String version) |
void |
stop()
Stop the current application instance
|
String |
toString()
To string.
|
Object |
unmarshalEntity(Class type,
javax.ws.rs.core.MediaType acceptedMedia,
InputStream in)
Marshall an entity to either JSON or XML
|
Object |
unmarshalEntity(String type,
javax.ws.rs.core.MediaType acceptedMedia,
InputStream in)
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
|
Object |
updateOrAddAttribute(Map<String,String> tenantId,
String entityName,
Object id,
Map<String,Object> properties,
String attribute,
Object attributeValue,
String partner)
Update or add attribute.
|
public static final String JPARS_CONTEXT
public boolean isWeavingEnabled()
public String getVersion()
public void setVersion(String version)
public void create(Map<String,String> tenantId, Object entity)
tenantId - entity - public void delete(Map<String,String> tenantId, String type, Object id)
public boolean doesExist(Map<String,String> tenantId, Object entity)
tenantId - the tenant identity - the entitypublic Object find(String entityName, Object id)
entityName - id - public Object find(Map<String,String> tenantId, String entityName, Object id)
tenantId - entityName - id - public Object find(Map<String,String> tenantId, String entityName, Object id, Map<String,Object> properties)
tenantId - entityName - id - properties - - query hints used on the findpublic Object findAttribute(Map<String,String> tenantId, String entityName, Object id, Map<String,Object> properties, String attribute)
tenantId - the tenant identityName - the entity nameid - the idproperties - the propertiesattribute - the attributepublic Object updateOrAddAttribute(Map<String,String> tenantId, String entityName, Object id, Map<String,Object> properties, String attribute, Object attributeValue, String partner)
tenantId - the tenant identityName - the entity nameid - the idproperties - the propertiesattribute - the attributeattributeValue - the attribute valuepartner - the partnerpublic Object removeAttribute(Map<String,String> tenantId, String entityName, Object id, String attribute, String listItemId, Object entity, String partner)
tenantId - the tenant identityName - the entity nameid - the idproperties - the propertiesattribute - the attributeattributeValue - the attribute valuepartner - the partnerpublic URI getBaseURI()
public Class<?> getClass(String entityName)
entityName - public DatabaseSession getJpaSession()
public ClassDescriptor getDescriptor(String entityName)
entityName - public ClassDescriptor getDescriptorForClass(Class clazz)
clazz - the clazzpublic ClassDescriptor getJAXBDescriptorForClass(Class clazz)
clazz - the clazzpublic javax.persistence.EntityManagerFactory getEmf()
public JAXBContext getJAXBContext()
public String getName()
public Object merge(Map<String,String> tenantId, Object entity)
tenantId - entity - public DynamicEntity newEntity(String type)
type - public DynamicEntity newEntity(Map<String,String> tenantId, String type)
tenantId - type - public int queryExecuteUpdate(Map<String,String> tenantId, String name, Map<?,?> parameters, Map<String,?> hints)
tenantId - the tenant idname - the nameparameters - the parametershints - the hintspublic List queryMultipleResults(Map<String,String> tenantId, String name, Map<?,?> parameters, Map<String,?> hints)
tenantId - the tenant idname - the nameparameters - the parametershints - the hintspublic javax.persistence.Query buildQuery(Map<String,String> tenantId, String name, Map<?,?> parameters, Map<String,?> hints)
public void setBaseURI(URI baseURI)
baseURI - the new base uripublic void stop()
public String toString()
public Object unmarshalEntity(String type, javax.ws.rs.core.MediaType acceptedMedia, InputStream in) throws JAXBException
object - mediaType - output - JAXBExceptionpublic Object unmarshalEntity(Class type, javax.ws.rs.core.MediaType acceptedMedia, InputStream in) throws 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 relationshipsJAXBExceptionpublic void marshallEntity(Object object, javax.ws.rs.core.MediaType mediaType, OutputStream output) throws JAXBException
object - mediaType - output - JAXBExceptionpublic void marshallEntity(Object object, javax.ws.rs.core.MediaType mediaType, OutputStream output, boolean sendRelationships) throws 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 relationshipsJAXBException