use of org.jaffa.datatypes.ValidationException in project jaffa-framework by jaffa-projects.
the class PrinterDefinitionMaintenanceTx method createDomain.
// .//GEN-END:_duplicateCheck_4_be
// .//GEN-BEGIN:_createDomain_1_be
/**
* Create the domain object.
*/
private PrinterDefinition createDomain(UOW uow, PrinterDefinitionMaintenanceCreateInDto input, boolean fromPrevalidate) throws FrameworkException, ApplicationExceptions {
PrinterDefinition domain = new PrinterDefinition();
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_createDomain_2_be
try {
domain.updatePrinterId(input.getPrinterId());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDescription(input.getDescription());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateSiteCode(input.getSiteCode());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateLocationCode(input.getLocationCode());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateRemote(input.getRemote());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateRealPrinterName(input.getRealPrinterName());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updatePrinterOption1(input.getPrinterOption1());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updatePrinterOption2(input.getPrinterOption2());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateOutputType(input.getOutputType());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateScaleToPageSize(input.getScaleToPageSize());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
// .//GEN-BEGIN:_createDomain_3_be
if (appExps != null && appExps.size() > 0)
throw appExps;
return domain;
}
use of org.jaffa.datatypes.ValidationException in project jaffa-framework by jaffa-projects.
the class FormDefinitionMaintenanceTx method createDomain.
// .//GEN-END:_duplicateCheck_4_be
// .//GEN-BEGIN:_createDomain_1_be
/**
* Create the domain object.
*/
private FormDefinition createDomain(UOW uow, FormDefinitionMaintenanceCreateInDto input, boolean fromPrevalidate) throws FrameworkException, ApplicationExceptions {
FormDefinition domain = new FormDefinition();
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_createDomain_2_be
try {
domain.updateFormId(input.getFormId());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateFormName(input.getFormName());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateFormAlternate(input.getFormAlternate());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateFormVariation(input.getFormVariation());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateOutputType(input.getOutputType());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateFormTemplate(input.getFormTemplate());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateFieldLayout(input.getFieldLayout());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDescription(input.getDescription());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateRemarks(input.getRemarks());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDomFactory(input.getDomFactory());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDomClass(input.getDomClass());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDomKey1(input.getDomKey1());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDomKey2(input.getDomKey2());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDomKey3(input.getDomKey3());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDomKey4(input.getDomKey4());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDomKey5(input.getDomKey5());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateDomKey6(input.getDomKey6());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateAdditionalDataComponent(input.getAdditionalDataComponent());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateFollowOnFormName(input.getFollowOnFormName());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateFollowOnFormAlternate(input.getFollowOnFormAlternate());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
if (!fromPrevalidate)
domain.updateCreatedOn(new DateTime());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
if (!fromPrevalidate && input.getHeaderDto() != null && input.getHeaderDto().getUserId() != null)
domain.updateCreatedBy(input.getHeaderDto().getUserId());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
// .//GEN-BEGIN:_createDomain_3_be
if (appExps != null && appExps.size() > 0)
throw appExps;
return domain;
}
use of org.jaffa.datatypes.ValidationException in project jaffa-framework by jaffa-projects.
the class FormDefinitionMaintenanceTx method createOrLoadFormTemplate.
// .//GEN-END:_domainObjectChangedTest_1_be
// .//GEN-BEGIN:_createOrLoadFormTemplate_1_be
/**
* Create Or Load an existing instance of FormTemplate which has a 1-to-1 relationship with the domain object.
*/
private FormTemplate createOrLoadFormTemplate(UOW uow, FormDefinitionMaintenanceCreateInDto input, FormDefinition domain, boolean fromPrevalidate) throws FrameworkException, ApplicationExceptions {
FormTemplate formTemplate = null;
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_createOrLoadFormTemplate_2_be
if (domain.getFormId() != null) {
// load an existing instance
Criteria criteria = new Criteria();
criteria.setTable(FormTemplateMeta.getName());
criteria.addCriteria(FormTemplateMeta.FORM_ID, domain.getFormId());
// .//GEN-END:_createOrLoadFormTemplate_2_be
// Add custom code//GEN-FIRST:_createOrLoadFormTemplate_2
// .//GEN-LAST:_createOrLoadFormTemplate_2
// .//GEN-BEGIN:_createOrLoadFormTemplate_3_be
Iterator itrOne = uow.query(criteria).iterator();
if (itrOne.hasNext())
formTemplate = (FormTemplate) itrOne.next();
}
// create if it doesn't already exist
if (formTemplate == null)
formTemplate = new FormTemplate();
// Update the template if a file has been uploaded
if (input.getFormTemplate() != null) {
try {
formTemplate.setTemplateData(input.getTemplateData());
} catch (ValidationException e) {
throw new ApplicationExceptions(new ApplicationException("exception.Jaffa.Printing.FormDefinitionMaintenance.UploadTemplateData") {
});
}
}
if (input.getFieldLayout() != null) {
try {
formTemplate.setLayoutData(input.getLayoutData());
} catch (ValidationException e) {
throw new ApplicationExceptions(new ApplicationException("exception.Jaffa.Printing.FormDefinitionMaintenance.UploadLayOutData") {
});
}
}
if (!formTemplate.isDatabaseOccurence() && formTemplate.isModified()) {
// Finally set the join-fields
try {
formTemplate.updateFormId(domain.getFormId());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
}
// .//GEN-BEGIN:_createOrLoadFormTemplate_5_be
if (appExps != null && appExps.size() > 0)
throw appExps;
return formTemplate;
}
Aggregations