BasePersistenceService

public abstract class BasePersistenceService

The BasePersistenceService class provides utility methods for communication with the database for HistoryServiceImpl and TrashServiceImpl. It allows to create and retrieve instances, load proper classes and parse values.

Methods

create

protected <T> Object create(Class<T> clazz, Object src, EntityType type)

create

protected <T> Object create(Class<T> clazz, Object src, EntityType type, ObjectReference objectReference)

findService

protected MotechDataService findService(Class<?> clazz)

getClass

protected Class<?> getClass(Object src, EntityType type)

getClass

protected Class<?> getClass(String srcClassName, EntityType type)

getCurrentSchemaVersion

protected Long getCurrentSchemaVersion(String className)

getEntities

protected List<Entity> getEntities()

getEntity

protected Entity getEntity(Long id)

getEntitySchemaVersion

protected Long getEntitySchemaVersion(Object src)

getInstanceClassName

protected String getInstanceClassName(Object instance)

getInstanceId

protected Long getInstanceId(Object instance)

getPersistenceManagerFactory

protected PersistenceManagerFactory getPersistenceManagerFactory()

getValue

protected Object getValue(Field field, Object src, Object target, EntityType type, ObjectReference objectReference)

setAllEntities

public void setAllEntities(AllEntities allEntities)

setBundleContext

public void setBundleContext(BundleContext bundleContext)

setPersistenceManagerFactory

public void setPersistenceManagerFactory(PersistenceManagerFactory persistenceManagerFactory)