use of org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutDto in project jaffa-framework by jaffa-projects.
the class FormSelectionMaintenanceTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormSelectionMaintenanceOutDto buildDto(UOW uow, Collection results, FormSelectionMaintenanceInDto input) throws UOWException {
FormSelectionMaintenanceOutDto output = new FormSelectionMaintenanceOutDto();
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;
}
FormSelectionMaintenanceOutRowDto row = new FormSelectionMaintenanceOutRowDto();
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
// Add custom code to pass values to the dto//GEN-FIRST:_buildDto_2
row.setCopies(formUsage.getCopies());
// .//GEN-LAST:_buildDto_2
// .//GEN-BEGIN:_buildDto_3_be
output.addRows(row);
}
return output;
}
use of org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutDto in project jaffa-framework by jaffa-projects.
the class FormSelectionMaintenanceComponent method display.
/**
* Following attributes can be set on component invocation to control the types of output allowed
* directDisplay (), printing (), email(), webPublish(), autoDisplayAll()
*/
public FormKey display() throws ApplicationExceptions, FrameworkException {
FormKey fk = null;
GridModel rows = new GridModel();
fileNames = new StringBuilder();
if (getAutoDisplayAll()) {
setDirectDisplay(true);
setPrinting(false);
setEmail(false);
setWebPublish(false);
}
if (getAutoDisplayAll()) {
FormSelectionMaintenanceOutDto finderOutDto = (FormSelectionMaintenanceOutDto) doInquiry();
if (finderOutDto != null && finderOutDto.getRowsCount() > 0) {
if (log.isDebugEnabled()) {
log.debug("Form Preview for event " + getEvent() + ", Key1=" + getKey1() + ", Key2=" + getKey2() + ", Key3=" + getKey3() + ", Key4=" + getKey4() + ", Key5=" + getKey5() + ", Key6=" + getKey6() + ". Found " + finderOutDto.getRowsCount() + " rows.");
}
for (int i = 0; i < finderOutDto.getRowsCount(); i++) {
FormSelectionMaintenanceOutRowDto rowDto = finderOutDto.getRows(i);
rowDto.setSelect(Boolean.TRUE);
rowDto.setAdditionalDataObject(getAdditionalDataObject());
GridModelRow row = rows.newRow();
row.addElement("select", new CheckBoxModel((rowDto.getSelect() != null ? rowDto.getSelect() : Boolean.FALSE)));
row.addElement("errMessage", rowDto.getErrMessage());
row.addElement("formName", rowDto.getFormName());
row.addElement("event", rowDto.getEvent());
row.addElement("key1", rowDto.getKey1());
row.addElement("key2", rowDto.getKey2());
row.addElement("key3", rowDto.getKey3());
row.addElement("key4", rowDto.getKey4());
row.addElement("key5", rowDto.getKey5());
row.addElement("key6", rowDto.getKey6());
row.addElement("value1", rowDto.getValue1());
row.addElement("value2", rowDto.getValue2());
row.addElement("value3", rowDto.getValue3());
row.addElement("value4", rowDto.getValue4());
row.addElement("value5", rowDto.getValue5());
row.addElement("value6", rowDto.getValue6());
row.addElement("printer", rowDto.getPrinter());
row.addElement("email", rowDto.getEmail());
row.addElement("publish", new CheckBoxModel((rowDto.getPublish() != null ? rowDto.getPublish() : Boolean.FALSE)));
row.addElement("copies", rowDto.getCopies());
EditBoxModel printerModel = new EditBoxModel(rowDto.getPrinter(), PrinterDefinitionMeta.META_PRINTER_ID);
printerModel.setMandatory(false);
row.addElement("printer", printerModel);
row.addElement("email", new EditBoxModel(rowDto.getEmail()));
row.addElement("copies", new EditBoxModel(rowDto.getCopies()));
row.addElement("formType", rowDto.getFormType());
row.addElement("object", rowDto);
row.addElement("additionalDataComponent", rowDto.getAdditionalDataComponent());
fk = doShowForm(row);
if (finderOutDto.getRowsCount() == 1 && ((HttpServletRequest) ContextManagerFactory.instance().getProperty("request")).getHeader("user-agent").indexOf("UnixWare") >= 0) {
String tmpDir = System.getProperty("java.io.tmpdir");
String[] path = getFileNames().split(",");
((HttpServletRequest) ContextManagerFactory.instance().getProperty("request")).setAttribute("org.jaffa.applications.jaffa.modules.admin.components.fileexplorer", new File(tmpDir, path[0]));
fk = new FormKey("jaffa_admin_fileExplorer_download", null);
}
}
} else {
throw new ApplicationExceptions(new FormSelectionException(FormSelectionException.NO_FORM_DEFINED_FOR_EVENT, getEvent()) {
});
}
} else {
fk = super.display();
}
return fk;
}
Aggregations