MotechDataService

public interface MotechDataService<T>

This is a basic service interface with CRUD operations. Mainly it is used as super interface to create service interface related with the given entity schema in org.motechproject.mds.builder.EntityInfrastructureBuilder but it can be also used by other service interfaces inside this package.

Parameters:
  • <T> – the type of entity schema.

Methods

count

long count()

countForFilter

long countForFilter(Filter filter)

create

T create(T object)

delete

void delete(T object)

delete

void delete(String primaryKeyName, Object value)

deleteAll

void deleteAll()

doInTransaction

<R> R doInTransaction(TransactionCallback<R> transactionCallback)

executeQuery

<R> R executeQuery(QueryExecution<R> queryExecution)

filter

List<T> filter(Filter filter)

filter

List<T> filter(Filter filter, QueryParams queryParams)

findById

T findById(Long id)

findTrashInstanceById

T findTrashInstanceById(Object instanceId, Object entityId)

getDetachedField

Object getDetachedField(T instance, String fieldName)

retrieve

T retrieve(String primaryKeyName, Object value)

retrieveAll

List<T> retrieveAll()

retrieveAll

List<T> retrieveAll(QueryParams queryParams)

revertFromTrash

void revertFromTrash(Object newInstance, Object trash)

update

T update(T object)