use of org.jaffa.modules.printing.components.formdefinitionviewer.IFormDefinitionViewer in project jaffa-framework by jaffa-projects.
the class FormDefinitionViewerComponent method loadFormTemplate.
// .//GEN-END:_addListeners_1_be
// All the custom code goes here//GEN-FIRST:_custom
public File loadFormTemplate() throws FrameworkException, ApplicationExceptions, IOException {
String formTemplate = getFormDefinitionViewerOutDto().getFormTemplate();
if (formTemplate != null) {
FormDefinitionViewerInDto inputDto = new FormDefinitionViewerInDto();
inputDto.setFormId(m_formId);
if (m_tx == null)
m_tx = (IFormDefinitionViewer) Factory.createObject(IFormDefinitionViewer.class);
byte[] formTemplateContents = m_tx.loadFormTemplate(inputDto);
// int i = formTemplate.lastIndexOf(".pdf");
// String prifix = i>0 ? formTemplate : formTemplate.substring(0,i);
// File formTemplateFile=File.createTempFile(prifix,"pdf");
SplitString ss = new SplitString(formTemplate, ".", false);
String suffix = ss.getSuffix() != null ? "." + ss.getSuffix() : null;
File formTemplateFile = File.createTempFile("jaffa", suffix);
OutputStream outputStream = null;
try {
outputStream = new BufferedOutputStream(new FileOutputStream(formTemplateFile));
outputStream.write(formTemplateContents);
outputStream.flush();
} finally {
if (outputStream != null)
outputStream.close();
}
return formTemplateFile;
}
return null;
}
use of org.jaffa.modules.printing.components.formdefinitionviewer.IFormDefinitionViewer in project jaffa-framework by jaffa-projects.
the class FormDefinitionViewerComponent method doInquiry.
// .//GEN-END:_display_2_be
// .//GEN-BEGIN:_inquiry_1_be
private void doInquiry() throws ApplicationExceptions, FrameworkException {
FormDefinitionViewerInDto inputDto = new FormDefinitionViewerInDto();
// .//GEN-END:_inquiry_1_be
// Add custom code before building the input dto//GEN-FIRST:_inquiry_1
// .//GEN-LAST:_inquiry_1
// .//GEN-BEGIN:_inquiry_2_be
inputDto.setFormId(m_formId);
inputDto.setHeaderDto(createHeaderDto());
// create the Tx
if (m_tx == null)
m_tx = (IFormDefinitionViewer) Factory.createObject(IFormDefinitionViewer.class);
// .//GEN-END:_inquiry_2_be
// Add custom code before invoking the Tx//GEN-FIRST:_inquiry_2
// .//GEN-LAST:_inquiry_2
// .//GEN-BEGIN:_inquiry_3_be
// now get the details
m_outputDto = m_tx.read(inputDto);
// uncache the widgets
getUserSession().getWidgetCache(getComponentId()).clear();
// throw an exception if the output is null
if (m_outputDto == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(FormDefinitionMeta.getLabelToken()));
throw appExps;
}
}
Aggregations