use of gov.ca.cwds.cms.data.access.service.lifecycle.DataAccessBundle in project api-core by ca-cwds.
the class DataAccessServiceBase method update.
@Override
public T update(P entityAwareDTO) throws DataAccessServicesException, DroolsException {
try {
DataAccessBundle<P> dataAccessBundle = new DataAccessBundle<>(entityAwareDTO);
updateLifecycle.beforeDataProcessing(dataAccessBundle);
PerryAccount perryAccount = PrincipalUtils.getPrincipal();
updateLifecycle.dataProcessing(dataAccessBundle, perryAccount);
updateLifecycle.afterDataProcessing(dataAccessBundle);
updateLifecycle.beforeBusinessValidation(dataAccessBundle);
updateLifecycle.businessValidation(dataAccessBundle, perryAccount);
updateLifecycle.afterBusinessValidation(dataAccessBundle);
T t = crudDao.update(entityAwareDTO.getEntity());
updateLifecycle.afterStore(dataAccessBundle);
return t;
} catch (DroolsException e) {
throw new DataAccessServicesException(e);
}
}
use of gov.ca.cwds.cms.data.access.service.lifecycle.DataAccessBundle in project api-core by ca-cwds.
the class DataAccessServiceBase method create.
@Override
public T create(P entityAwareDTO) throws DataAccessServicesException {
try {
DataAccessBundle<P> dataAccessBundle = new DataAccessBundle<>(entityAwareDTO);
createLifecycle.beforeDataProcessing(dataAccessBundle);
PerryAccount perryAccount = PrincipalUtils.getPrincipal();
createLifecycle.dataProcessing(dataAccessBundle, perryAccount);
createLifecycle.afterDataProcessing(dataAccessBundle);
createLifecycle.beforeBusinessValidation(dataAccessBundle);
createLifecycle.businessValidation(dataAccessBundle, perryAccount);
createLifecycle.afterBusinessValidation(dataAccessBundle);
T t = crudDao.create(entityAwareDTO.getEntity());
createLifecycle.afterStore(dataAccessBundle);
return t;
} catch (DroolsException e) {
throw new DataAccessServicesException(e);
}
}
Aggregations