use of org.jaffa.modules.printing.domain.FormUsage in project jaffa-framework by jaffa-projects.
the class FormUsageFinderTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormUsageFinderOutDto buildDto(UOW uow, Collection results, FormUsageFinderInDto input) throws UOWException {
FormUsageFinderOutDto output = new FormUsageFinderOutDto();
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;
}
FormUsageFinderOutRowDto row = new FormUsageFinderOutRowDto();
FormUsage formUsage = (FormUsage) 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_FormName_1_be
row.setFormName(formUsage.getFormName());
// .//GEN-END:_buildDto_FormName_1_be
// .//GEN-BEGIN:_buildDto_EventName_1_be
row.setEventName(formUsage.getEventName());
// .//GEN-END:_buildDto_EventName_1_be
// .//GEN-BEGIN:_buildDto_FormAlternate_1_be
row.setFormAlternate(formUsage.getFormAlternate());
// .//GEN-END:_buildDto_FormAlternate_1_be
// .//GEN-BEGIN:_buildDto_Copies_1_be
row.setCopies(formUsage.getCopies());
// .//GEN-END:_buildDto_Copies_1_be
// .//GEN-BEGIN:_buildDto_CreatedOn_1_be
row.setCreatedOn(formUsage.getCreatedOn());
// .//GEN-END:_buildDto_CreatedOn_1_be
// .//GEN-BEGIN:_buildDto_CreatedBy_1_be
row.setCreatedBy(formUsage.getCreatedBy());
// .//GEN-END:_buildDto_CreatedBy_1_be
// .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
row.setLastChangedOn(formUsage.getLastChangedOn());
// .//GEN-END:_buildDto_LastChangedOn_1_be
// .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
row.setLastChangedBy(formUsage.getLastChangedBy());
// .//GEN-END:_buildDto_LastChangedBy_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.FormUsage in project jaffa-framework by jaffa-projects.
the class FormUsageLookupTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormUsageLookupOutDto buildDto(UOW uow, Collection results, FormUsageLookupInDto input) throws UOWException {
FormUsageLookupOutDto output = new FormUsageLookupOutDto();
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;
}
FormUsageLookupOutRowDto row = new FormUsageLookupOutRowDto();
FormUsage formUsage = (FormUsage) 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_FormName_1_be
row.setFormName(formUsage.getFormName());
// .//GEN-END:_buildDto_FormName_1_be
// .//GEN-BEGIN:_buildDto_EventName_1_be
row.setEventName(formUsage.getEventName());
// .//GEN-END:_buildDto_EventName_1_be
// .//GEN-BEGIN:_buildDto_FormAlternate_1_be
row.setFormAlternate(formUsage.getFormAlternate());
// .//GEN-END:_buildDto_FormAlternate_1_be
// .//GEN-BEGIN:_buildDto_Copies_1_be
row.setCopies(formUsage.getCopies());
// .//GEN-END:_buildDto_Copies_1_be
// .//GEN-BEGIN:_buildDto_CreatedOn_1_be
row.setCreatedOn(formUsage.getCreatedOn());
// .//GEN-END:_buildDto_CreatedOn_1_be
// .//GEN-BEGIN:_buildDto_CreatedBy_1_be
row.setCreatedBy(formUsage.getCreatedBy());
// .//GEN-END:_buildDto_CreatedBy_1_be
// .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
row.setLastChangedOn(formUsage.getLastChangedOn());
// .//GEN-END:_buildDto_LastChangedOn_1_be
// .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
row.setLastChangedBy(formUsage.getLastChangedBy());
// .//GEN-END:_buildDto_LastChangedBy_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.FormUsage in project jaffa-framework by jaffa-projects.
the class FormUsageMaintenanceTx method delete.
/**
* Deletes an existing instance of FormUsage.
* @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(FormUsageMaintenanceDeleteInDto 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
FormUsage domain = load(uow, input);
// Ensure the domain object has not been modified
domainObjectChangedTest(input.getPerformDirtyReadCheck(), domain, input.getLastChangedOn());
// 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.FormUsage in project jaffa-framework by jaffa-projects.
the class FormUsageMaintenanceTx method load.
// .//GEN-END:_preprocessRetrieve_2_be
// .//GEN-BEGIN:_loadRetrieve_1_be
/**
* Retrieve the domain object.
*/
private FormUsage load(UOW uow, FormUsageMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
FormUsage domain = null;
Criteria criteria = new Criteria();
criteria.setTable(FormUsageMeta.getName());
// .//GEN-END:_loadRetrieve_1_be
// Add custom criteria //GEN-FIRST:_loadRetrieve_1
// .//GEN-LAST:_loadRetrieve_1
// .//GEN-BEGIN:_loadRetrieve_2_be
criteria.addCriteria(FormUsageMeta.FORM_NAME, input.getFormName());
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext())
domain = (FormUsage) itr.next();
// .//GEN-BEGIN:_loadRetrieve_3_be
if (domain == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(FormUsageMeta.getLabelToken()));
throw appExps;
}
return domain;
}
use of org.jaffa.modules.printing.domain.FormUsage in project jaffa-framework by jaffa-projects.
the class FormUsageMaintenanceTx method create.
// .//GEN-END:_prevalidateCreate_1_be
// .//GEN-BEGIN:_create_1_be
/**
* Persists a new instance of FormUsage.
* @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 FormUsageMaintenanceRetrieveOutDto create(FormUsageMaintenanceCreateInDto 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
FormUsage 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
FormUsageMaintenanceRetrieveInDto retrieveInDto = new FormUsageMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setFormName(input.getFormName());
FormUsageMaintenanceRetrieveOutDto 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();
}
}
Aggregations