use of org.jaffa.modules.printing.domain.FormTemplate in project jaffa-framework by jaffa-projects.
the class FormTemplateMaintenanceTx method load.
// .//GEN-END:_preprocessUpdate_2_be
// .//GEN-BEGIN:_loadUpdate_1_be
/**
* Retrieve the domain object.
*/
private FormTemplate load(UOW uow, FormTemplateMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
FormTemplate domain = null;
Criteria criteria = new Criteria();
criteria.setTable(FormTemplateMeta.getName());
// .//GEN-END:_loadUpdate_1_be
// Add custom criteria //GEN-FIRST:_loadUpdate_1
// .//GEN-LAST:_loadUpdate_1
// .//GEN-BEGIN:_loadUpdate_2_be
criteria.addCriteria(FormTemplateMeta.FORM_ID, input.getFormId());
criteria.setLocking(Criteria.LOCKING_PARANOID);
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext())
domain = (FormTemplate) itr.next();
// .//GEN-BEGIN:_loadUpdate_3_be
if (domain == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(FormTemplateMeta.getLabelToken()));
throw appExps;
}
return domain;
}
use of org.jaffa.modules.printing.domain.FormTemplate in project jaffa-framework by jaffa-projects.
the class FormTemplateMaintenanceTx method create.
// .//GEN-END:_prevalidateCreate_1_be
// .//GEN-BEGIN:_create_1_be
/**
* Persists a new instance of FormTemplate.
* @param input The new values for the domain object.
* @throws ApplicationExceptions This will be thrown if the input contains invalid data.
* @throws FrameworkException Indicates some system error.
* @return The object details.
*/
public FormTemplateMaintenanceRetrieveOutDto create(FormTemplateMaintenanceCreateInDto 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();
// Preprocess the input
preprocess(uow, input);
// Do not allow a Duplicate record
duplicateCheck(uow, input);
// Validate the foreign objects
validateForeignObjects(uow, input);
// Create the domain object
FormTemplate domain = createDomain(uow, input, false);
uow.add(domain);
// Perform post create processing
postCreate(uow, input, domain, false);
// Commit the changes
uow.commit();
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("Successfully created the domain object. Now retrieving the object details.");
// Build the outbound dto by performing a retrieve
FormTemplateMaintenanceRetrieveInDto retrieveInDto = new FormTemplateMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setFormId(input.getFormId());
FormTemplateMaintenanceRetrieveOutDto output = retrieve(retrieveInDto);
return output;
} catch (FrameworkException e) {
// If it is, then re-throw as ApplicationsExceptions, else throw the FrameworkException.
if (e.getCause() != null && e.getCause() instanceof ApplicationExceptions) {
throw (ApplicationExceptions) e.getCause();
} else if (e.getCause() != null && e.getCause() instanceof ApplicationException) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add((ApplicationException) e.getCause());
throw appExps;
} else
throw e;
} finally {
if (uow != null)
uow.rollback();
}
}
use of org.jaffa.modules.printing.domain.FormTemplate in project jaffa-framework by jaffa-projects.
the class FormTemplateFinderTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormTemplateFinderOutDto buildDto(UOW uow, Collection results, FormTemplateFinderInDto input) throws UOWException {
FormTemplateFinderOutDto output = new FormTemplateFinderOutDto();
int maxRecords = input.getMaxRecords() != null ? input.getMaxRecords().intValue() : 0;
int counter = 0;
for (Iterator i = results.iterator(); i.hasNext(); ) {
if (++counter > maxRecords && maxRecords > 0) {
output.setMoreRecordsExist(Boolean.TRUE);
break;
}
FormTemplateFinderOutRowDto row = new FormTemplateFinderOutRowDto();
FormTemplate formTemplate = (FormTemplate) i.next();
// .//GEN-END:_buildDto_1_be
// Add custom code before all the setters //GEN-FIRST:_buildDto_1
// .//GEN-LAST:_buildDto_1
// .//GEN-BEGIN:_buildDto_FormId_1_be
row.setFormId(formTemplate.getFormId());
// .//GEN-END:_buildDto_FormId_1_be
// .//GEN-BEGIN:_buildDto_TemplateData_1_be
row.setTemplateData(formTemplate.getTemplateData());
// .//GEN-END:_buildDto_TemplateData_1_be
// .//GEN-BEGIN:_buildDto_LayoutData_1_be
row.setLayoutData(formTemplate.getLayoutData());
// .//GEN-END:_buildDto_LayoutData_1_be
// Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
// .//GEN-LAST:_buildDto_2
// .//GEN-BEGIN:_buildDto_3_be
output.addRows(row);
}
return output;
}
use of org.jaffa.modules.printing.domain.FormTemplate in project jaffa-framework by jaffa-projects.
the class FormTemplateMaintenanceTx method delete.
/**
* Deletes an existing instance of FormTemplate.
* @param input The key values for the domain object to be deleted.
* @param uow The delete will be performed using the input UOW.
* @throws ApplicationExceptions This will be thrown if the input contains invalid data.
* @throws FrameworkException Indicates some system error.
*/
public void delete(FormTemplateMaintenanceDeleteInDto input, UOW uow) throws FrameworkException, ApplicationExceptions {
// Print Debug Information for the input
if (log.isDebugEnabled())
log.debug("Input: " + (input != null ? input.toString() : null));
// Preprocess the input
preprocess(uow, input);
// Retrieve the object
FormTemplate domain = load(uow, input);
// Delete the domain object
deleteDomain(uow, input, domain);
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("The domain object has been marked for deletion. It will be deleted when the UOW is committed");
}
use of org.jaffa.modules.printing.domain.FormTemplate in project jaffa-framework by jaffa-projects.
the class FormTemplateMaintenanceTx method load.
// .//GEN-END:_preprocessDelete_2_be
// .//GEN-BEGIN:_loadDelete_1_be
/**
* Retrieve the domain object.
*/
private FormTemplate load(UOW uow, FormTemplateMaintenanceDeleteInDto input) throws FrameworkException, ApplicationExceptions {
FormTemplate domain = null;
Criteria criteria = new Criteria();
criteria.setTable(FormTemplateMeta.getName());
// .//GEN-END:_loadDelete_1_be
// Add custom criteria //GEN-FIRST:_loadDelete_1
// .//GEN-LAST:_loadDelete_1
// .//GEN-BEGIN:_loadDelete_2_be
criteria.addCriteria(FormTemplateMeta.FORM_ID, input.getFormId());
criteria.setLocking(Criteria.LOCKING_PARANOID);
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext())
domain = (FormTemplate) itr.next();
// .//GEN-BEGIN:_loadDelete_3_be
if (domain == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(FormTemplateMeta.getLabelToken()));
throw appExps;
}
return domain;
}
Aggregations