use of org.jaffa.persistence.Criteria in project jaffa-framework by jaffa-projects.
the class FormDefinitionMaintenanceTx method load.
// .//GEN-END:_preprocessDelete_2_be
// .//GEN-BEGIN:_loadDelete_1_be
/**
* Retrieve the domain object.
*/
private FormDefinition load(UOW uow, FormDefinitionMaintenanceDeleteInDto input) throws FrameworkException, ApplicationExceptions {
FormDefinition domain = null;
Criteria criteria = new Criteria();
criteria.setTable(FormDefinitionMeta.getName());
// .//GEN-END:_loadDelete_1_be
// Add custom criteria//GEN-FIRST:_loadDelete_1
// .//GEN-LAST:_loadDelete_1
// .//GEN-BEGIN:_loadDelete_2_be
criteria.addCriteria(FormDefinitionMeta.FORM_ID, input.getFormId());
criteria.setLocking(Criteria.LOCKING_PARANOID);
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext())
domain = (FormDefinition) itr.next();
// .//GEN-BEGIN:_loadDelete_3_be
if (domain == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(FormDefinitionMeta.getLabelToken()));
throw appExps;
}
return domain;
}
use of org.jaffa.persistence.Criteria in project jaffa-framework by jaffa-projects.
the class FormDefinitionMaintenanceTx method preprocess.
// .//GEN-END:_buildRetrieveOutDto_3_be
// .//GEN-BEGIN:_preprocessUpdate_1_be
/**
* Preprocess the input for the update method.
*/
private void preprocess(UOW uow, FormDefinitionMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
if (input.getFollowOnFormName() != null) {
Criteria criteria = new Criteria();
criteria.setTable(FormGroupMeta.getName());
criteria.addCriteria(FormGroupMeta.FORM_NAME, input.getFollowOnFormName());
Iterator it = uow.query(criteria).iterator();
if (!it.hasNext())
throw new ApplicationExceptions(new ApplicationException("exception.Jaffa.Printing.FormDefinitionMaintenance.ValidFollowOnForm") {
});
}
// .//GEN-LAST:_preprocessUpdate_1
// .//GEN-BEGIN:_preprocessUpdate_2_be
}
use of org.jaffa.persistence.Criteria in project jaffa-framework by jaffa-projects.
the class FormDefinitionViewerTx method loadFormTemplate.
public byte[] loadFormTemplate(FormDefinitionViewerInDto input) throws FrameworkException, ApplicationExceptions {
UOW uow = new UOW();
try {
Criteria criteria = new Criteria();
criteria.setTable(FormTemplateMeta.getName());
criteria.addCriteria(FormTemplateMeta.FORM_ID, input.getFormId());
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext()) {
FormTemplate formTemplate = (FormTemplate) itr.next();
formTemplateContents = formTemplate.getTemplateData();
}
} finally {
if (uow != null)
uow.rollback();
}
return formTemplateContents;
}
use of org.jaffa.persistence.Criteria in project jaffa-framework by jaffa-projects.
the class BusinessEventLogViewerTx method buildCriteria.
// .//GEN-END:_read_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(BusinessEventLogViewerInDto input, UOW uow) {
Criteria criteria = new Criteria();
criteria.setTable(BusinessEventLogMeta.getName());
// .//GEN-END:_buildCriteria_1_be
// Add custom criteria//GEN-FIRST:_buildCriteria_1
// .//GEN-LAST:_buildCriteria_1
// .//GEN-BEGIN:_buildCriteria_2_be
criteria.addCriteria(BusinessEventLogMeta.LOG_ID, input.getLogId());
// .//GEN-BEGIN:_buildCriteria_3_be
return criteria;
}
use of org.jaffa.persistence.Criteria in project jaffa-framework by jaffa-projects.
the class BusinessEventLogViewerTx method read.
// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_read_1_be
/**
* Returns the details for BusinessEventLog.
* @param input The criteria based on which an object will be retrieved.
* @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
* @throws FrameworkException Indicates some system error.
* @return The object details. A null indicates, the object was not found.
*/
public BusinessEventLogViewerOutDto read(BusinessEventLogViewerInDto input) throws FrameworkException, ApplicationExceptions {
UOW uow = null;
try {
// Print Debug Information for the input
if (log.isDebugEnabled()) {
log.debug("Input: " + (input != null ? input.toString() : null));
}
// create the UOW
uow = new UOW();
// Build the Criteria Object
Criteria criteria = buildCriteria(input, uow);
// .//GEN-END:_read_1_be
// Add custom code before the query//GEN-FIRST:_read_1
// .//GEN-LAST:_read_1
// .//GEN-BEGIN:_read_2_be
// Execute The Query
Collection results = uow.query(criteria);
// .//GEN-END:_read_2_be
// Add custom code after the query//GEN-FIRST:_read_2
// .//GEN-LAST:_read_2
// .//GEN-BEGIN:_read_3_be
// Convert the domain objects into the outbound dto
BusinessEventLogViewerOutDto output = buildDto(uow, results);
// Print Debug Information for the output
if (log.isDebugEnabled()) {
log.debug("Output: " + (output != null ? output.toString() : null));
}
return output;
} finally {
if (uow != null)
uow.rollback();
}
}
Aggregations