use of org.jaffa.modules.printing.domain.PrinterDefinition in project jaffa-framework by jaffa-projects.
the class PrinterDefinitionMaintenanceTx method prevalidateUpdate.
// .//GEN-END:_retrieve_1_be
// .//GEN-BEGIN:_prevalidateUpdate_1_be
/**
* This method is used to perform prevalidations before updating an existing instance of PrinterDefinition.
* @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 PrinterDefinitionMaintenancePrevalidateOutDto prevalidateUpdate(PrinterDefinitionMaintenanceUpdateInDto 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);
// Retrieve the object
PrinterDefinition domain = load(uow, input);
// Validate the foreign objects
validateForeignObjects(uow, input);
// Update the domain object
updateDomain(uow, input, domain, true);
// Build the outbound dto
PrinterDefinitionMaintenancePrevalidateOutDto output = createPrevalidateOutDto(uow, domain, input);
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("Output: " + (output != null ? output.toString() : null));
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.PrinterDefinition in project jaffa-framework by jaffa-projects.
the class PrinterDefinitionViewerTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private PrinterDefinitionViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
PrinterDefinitionViewerOutDto output = null;
Iterator itr = results.iterator();
if (itr.hasNext()) {
// just return the details for the 1st record retrieved.
PrinterDefinition printerDefinition = (PrinterDefinition) itr.next();
output = new PrinterDefinitionViewerOutDto();
// .//GEN-END:_buildDto_1_be
// Add custom code before all the setters //GEN-FIRST:_buildDto_1
// .//GEN-LAST:_buildDto_1
// .//GEN-BEGIN:_buildDto_PrinterId_1_be
output.setPrinterId(printerDefinition.getPrinterId());
// .//GEN-END:_buildDto_PrinterId_1_be
// .//GEN-BEGIN:_buildDto_Description_1_be
output.setDescription(printerDefinition.getDescription());
// .//GEN-END:_buildDto_Description_1_be
// .//GEN-BEGIN:_buildDto_SiteCode_1_be
output.setSiteCode(printerDefinition.getSiteCode());
// .//GEN-END:_buildDto_SiteCode_1_be
// .//GEN-BEGIN:_buildDto_LocationCode_1_be
output.setLocationCode(printerDefinition.getLocationCode());
// .//GEN-END:_buildDto_LocationCode_1_be
// .//GEN-BEGIN:_buildDto_Remote_1_be
output.setRemote(printerDefinition.getRemote());
// .//GEN-END:_buildDto_Remote_1_be
// .//GEN-BEGIN:_buildDto_RealPrinterName_1_be
output.setRealPrinterName(printerDefinition.getRealPrinterName());
// .//GEN-END:_buildDto_RealPrinterName_1_be
// .//GEN-BEGIN:_buildDto_PrinterOption1_1_be
output.setPrinterOption1(printerDefinition.getPrinterOption1());
// .//GEN-END:_buildDto_PrinterOption1_1_be
// .//GEN-BEGIN:_buildDto_PrinterOption2_1_be
output.setPrinterOption2(printerDefinition.getPrinterOption2());
// .//GEN-END:_buildDto_PrinterOption2_1_be
// .//GEN-BEGIN:_buildDto_OutputType_1_be
output.setOutputType(printerDefinition.getOutputType());
// .//GEN-END:_buildDto_OutputType_1_be
// .//GEN-BEGIN:_buildDto_ScaleToPageSize_1_be
output.setScaleToPageSize(printerDefinition.getScaleToPageSize());
// .//GEN-END:_buildDto_ScaleToPageSize_1_be
// .//GEN-BEGIN:_buildDto_2_be
// Add related objects, if required
addRelatedDtos(uow, output, printerDefinition);
// .//GEN-END:_buildDto_2_be
// Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
// .//GEN-LAST:_buildDto_2
// .//GEN-BEGIN:_buildDto_3_be
}
return output;
}
use of org.jaffa.modules.printing.domain.PrinterDefinition in project jaffa-framework by jaffa-projects.
the class PrinterDefinitionFinderTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private PrinterDefinitionFinderOutDto buildDto(UOW uow, Collection results, PrinterDefinitionFinderInDto input) throws UOWException {
PrinterDefinitionFinderOutDto output = new PrinterDefinitionFinderOutDto();
for (Iterator i = results.iterator(); i.hasNext(); ) {
PrinterDefinitionFinderOutRowDto row = new PrinterDefinitionFinderOutRowDto();
PrinterDefinition printerDefinition = (PrinterDefinition) 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_PrinterId_1_be
row.setPrinterId(printerDefinition.getPrinterId());
// .//GEN-END:_buildDto_PrinterId_1_be
// .//GEN-BEGIN:_buildDto_Description_1_be
row.setDescription(printerDefinition.getDescription());
// .//GEN-END:_buildDto_Description_1_be
// .//GEN-BEGIN:_buildDto_SiteCode_1_be
row.setSiteCode(printerDefinition.getSiteCode());
// .//GEN-END:_buildDto_SiteCode_1_be
// .//GEN-BEGIN:_buildDto_LocationCode_1_be
row.setLocationCode(printerDefinition.getLocationCode());
// .//GEN-END:_buildDto_LocationCode_1_be
// .//GEN-BEGIN:_buildDto_Remote_1_be
row.setRemote(printerDefinition.getRemote());
// .//GEN-END:_buildDto_Remote_1_be
// .//GEN-BEGIN:_buildDto_RealPrinterName_1_be
row.setRealPrinterName(printerDefinition.getRealPrinterName());
// .//GEN-END:_buildDto_RealPrinterName_1_be
// .//GEN-BEGIN:_buildDto_OutputType_1_be
row.setOutputType(printerDefinition.getOutputType());
// .//GEN-END:_buildDto_OutputType_1_be
// .//GEN-BEGIN:_buildDto_ScaleToPageSize_1_be
row.setScaleToPageSize(printerDefinition.getScaleToPageSize());
// .//GEN-END:_buildDto_ScaleToPageSize_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.PrinterDefinition in project jaffa-framework by jaffa-projects.
the class PrinterDefinitionLookupTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private PrinterDefinitionLookupOutDto buildDto(UOW uow, Collection results, PrinterDefinitionLookupInDto input) throws UOWException {
PrinterDefinitionLookupOutDto output = new PrinterDefinitionLookupOutDto();
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;
}
PrinterDefinitionLookupOutRowDto row = new PrinterDefinitionLookupOutRowDto();
PrinterDefinition printerDefinition = (PrinterDefinition) 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_PrinterId_1_be
row.setPrinterId(printerDefinition.getPrinterId());
// .//GEN-END:_buildDto_PrinterId_1_be
// .//GEN-BEGIN:_buildDto_Description_1_be
row.setDescription(printerDefinition.getDescription());
// .//GEN-END:_buildDto_Description_1_be
// .//GEN-BEGIN:_buildDto_SiteCode_1_be
row.setSiteCode(printerDefinition.getSiteCode());
// .//GEN-END:_buildDto_SiteCode_1_be
// .//GEN-BEGIN:_buildDto_LocationCode_1_be
row.setLocationCode(printerDefinition.getLocationCode());
// .//GEN-END:_buildDto_LocationCode_1_be
// .//GEN-BEGIN:_buildDto_Remote_1_be
row.setRemote(printerDefinition.getRemote());
// .//GEN-END:_buildDto_Remote_1_be
// .//GEN-BEGIN:_buildDto_RealPrinterName_1_be
row.setRealPrinterName(printerDefinition.getRealPrinterName());
// .//GEN-END:_buildDto_RealPrinterName_1_be
// .//GEN-BEGIN:_buildDto_OutputType_1_be
row.setOutputType(printerDefinition.getOutputType());
// .//GEN-END:_buildDto_OutputType_1_be
// .//GEN-BEGIN:_buildDto_ScaleToPageSize_1_be
row.setScaleToPageSize(printerDefinition.getScaleToPageSize());
// .//GEN-END:_buildDto_ScaleToPageSize_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.PrinterDefinition in project jaffa-framework by jaffa-projects.
the class PrinterDefinitionMaintenanceTx method load.
// .//GEN-END:_preprocessDelete_2_be
// .//GEN-BEGIN:_loadDelete_1_be
/**
* Retrieve the domain object.
*/
private PrinterDefinition load(UOW uow, PrinterDefinitionMaintenanceDeleteInDto input) throws FrameworkException, ApplicationExceptions {
PrinterDefinition domain = null;
Criteria criteria = new Criteria();
criteria.setTable(PrinterDefinitionMeta.getName());
// .//GEN-END:_loadDelete_1_be
// Add custom criteria//GEN-FIRST:_loadDelete_1
// .//GEN-LAST:_loadDelete_1
// .//GEN-BEGIN:_loadDelete_2_be
criteria.addCriteria(PrinterDefinitionMeta.PRINTER_ID, input.getPrinterId());
criteria.setLocking(Criteria.LOCKING_PARANOID);
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext())
domain = (PrinterDefinition) itr.next();
// .//GEN-BEGIN:_loadDelete_3_be
if (domain == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(PrinterDefinitionMeta.getLabelToken()));
throw appExps;
}
return domain;
}
Aggregations