use of org.jaffa.modules.printing.domain.FormEvent in project jaffa-framework by jaffa-projects.
the class FormGroupMaintenanceTx method addRelatedDtosToRetrieveOut.
// .//GEN-END:_createPrevalidateOutDto_2_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_1_be
/**
* Add related objects to FormGroupMaintenanceRetrieveOutDto
*/
private void addRelatedDtosToRetrieveOut(UOW uow, FormGroup formGroup, FormGroupMaintenanceRetrieveOutDto output) throws FrameworkException, ApplicationExceptions {
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_1_be
if (formGroup.getFormName() != null) {
Criteria criteria = new Criteria();
criteria.setTable(FormUsageMeta.getName());
criteria.addCriteria(FormUsageMeta.FORM_NAME, formGroup.getFormName());
criteria.addOrderBy("EventName", Criteria.ORDER_BY_ASC);
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_1_be
// Add custom code to set the criteria before the query//GEN-FIRST:_addRelatedDtosToRetrieveOut_FormUsage_1
// .//GEN-LAST:_addRelatedDtosToRetrieveOut_FormUsage_1
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_2_be
Iterator itrMany = uow.query(criteria).iterator();
while (itrMany.hasNext()) {
FormUsage formUsage = (FormUsage) itrMany.next();
FormUsageDto dto = new FormUsageDto();
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_2_be
// Add custom code before all the setters//GEN-FIRST:_addRelatedDtosToRetrieveOut_FormUsage_2
// .//GEN-LAST:_addRelatedDtosToRetrieveOut_FormUsage_2
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_EventName_1_be
dto.setEventName(formUsage.getEventName());
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_EventName_1_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_FormAlternate_1_be
dto.setFormAlternate(formUsage.getFormAlternate());
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_FormAlternate_1_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_Copies_1_be
dto.setCopies(formUsage.getCopies());
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_Copies_1_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_Description_1_be
FormEvent chainFormEventEventNameEventName = null;
{
if (formUsage.getEventName() != null) {
Criteria criteriaFormEvent = new Criteria();
criteriaFormEvent.setTable(FormEventMeta.getName());
criteriaFormEvent.addCriteria(FormEventMeta.EVENT_NAME, formUsage.getEventName());
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_Description_1_be
// Add custom code to modify the criteria//GEN-FIRST:_addRelatedDtosToRetrieveOut_FormUsage_Description_1
// .//GEN-LAST:_addRelatedDtosToRetrieveOut_FormUsage_Description_1
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_Description_2_be
Iterator i = uow.query(criteriaFormEvent).iterator();
if (i.hasNext())
chainFormEventEventNameEventName = (FormEvent) i.next();
}
}
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_Description_3_be
try {
dto.setDescription(chainFormEventEventNameEventName.getDescription());
} catch (NullPointerException e) {
// Do nothing
}
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_Description_3_be
// Add custom code to pass values to the dto//GEN-FIRST:_addRelatedDtosToRetrieveOut_FormUsage_3
// .//GEN-LAST:_addRelatedDtosToRetrieveOut_FormUsage_3
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_3_be
output.addFormUsage(dto);
}
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_3_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_6_be
}
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_6_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_2_be
}
use of org.jaffa.modules.printing.domain.FormEvent in project jaffa-framework by jaffa-projects.
the class FormGroupViewerTx method addRelatedDtos.
// .//GEN-END:_buildDto_3_be
// .//GEN-BEGIN:_addRelatedDtos_1_be
private void addRelatedDtos(UOW uow, FormGroupViewerOutDto output, FormGroup formGroup) throws UOWException {
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_1_be
if (formGroup.getFormName() != null) {
Criteria criteria = new Criteria();
criteria.setTable(FormUsageMeta.getName());
criteria.addCriteria(FormUsageMeta.FORM_NAME, formGroup.getFormName());
criteria.addOrderBy("FormName", Criteria.ORDER_BY_ASC);
// .//GEN-END:_addRelatedDtos_FormUsage_1_be
// Add custom code to set the criteria before the query //GEN-FIRST:_addRelatedDtos_FormUsage_1
// .//GEN-LAST:_addRelatedDtos_FormUsage_1
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_2_be
Iterator itr = uow.query(criteria).iterator();
while (itr.hasNext()) {
FormUsage formUsage = (FormUsage) itr.next();
FormUsageDto dto = new FormUsageDto();
// .//GEN-END:_addRelatedDtos_FormUsage_2_be
// Add custom code before all the setters //GEN-FIRST:_addRelatedDtos_FormUsage_2
// .//GEN-LAST:_addRelatedDtos_FormUsage_2
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_EventName_1_be
dto.setEventName(formUsage.getEventName());
// .//GEN-END:_addRelatedDtos_FormUsage_EventName_1_be
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_FormAlternate_1_be
dto.setFormAlternate(formUsage.getFormAlternate());
// .//GEN-END:_addRelatedDtos_FormUsage_FormAlternate_1_be
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_Copies_1_be
dto.setCopies(formUsage.getCopies());
// .//GEN-END:_addRelatedDtos_FormUsage_Copies_1_be
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_Description_1_be
FormEvent chainFormEventEventNameEventName = null;
{
if (formUsage.getEventName() != null) {
Criteria criteriaFormEvent = new Criteria();
criteriaFormEvent.setTable(FormEventMeta.getName());
criteriaFormEvent.addCriteria(FormEventMeta.EVENT_NAME, formUsage.getEventName());
// .//GEN-END:_addRelatedDtos_FormUsage_Description_1_be
// Add custom code to modify the criteria //GEN-FIRST:_addRelatedDtos_FormUsage_Description_1
// .//GEN-LAST:_addRelatedDtos_FormUsage_Description_1
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_Description_2_be
Iterator i = uow.query(criteriaFormEvent).iterator();
if (i.hasNext())
chainFormEventEventNameEventName = (FormEvent) i.next();
}
}
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_Description_3_be
try {
dto.setDescription(chainFormEventEventNameEventName.getDescription());
} catch (NullPointerException e) {
// Do nothing
}
// .//GEN-END:_addRelatedDtos_FormUsage_Description_3_be
// Add custom code to pass values to the dto //GEN-FIRST:_addRelatedDtos_FormUsage_3
// .//GEN-LAST:_addRelatedDtos_FormUsage_3
// .//GEN-BEGIN:_addRelatedDtos_FormUsage_3_be
output.addFormUsage(dto);
}
}
// .//GEN-END:_addRelatedDtos_FormUsage_3_be
// .//GEN-BEGIN:_addRelatedDtos_2_be
}
use of org.jaffa.modules.printing.domain.FormEvent in project jaffa-framework by jaffa-projects.
the class FormEventMaintenanceTx method update.
// .//GEN-END:_prevalidateUpdate_1_be
// .//GEN-BEGIN:_update_1_be
/**
* Updates an existing instance of FormEvent.
* @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 FormEventMaintenanceRetrieveOutDto update(FormEventMaintenanceUpdateInDto 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
FormEvent domain = load(uow, input);
// Validate the foreign objects
validateForeignObjects(uow, input);
// Update the domain object
updateDomain(uow, input, domain, false);
uow.update(domain);
// Commit the changes
uow.commit();
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("Successfully updated the domain object. Now retrieving the object details.");
// Build the outbound dto by performing a retrieve
FormEventMaintenanceRetrieveInDto retrieveInDto = new FormEventMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setEventName(input.getEventName());
FormEventMaintenanceRetrieveOutDto 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();
}
}
use of org.jaffa.modules.printing.domain.FormEvent in project jaffa-framework by jaffa-projects.
the class FormEventMaintenanceTx method create.
// .//GEN-END:_prevalidateCreate_1_be
// .//GEN-BEGIN:_create_1_be
/**
* Persists a new instance of FormEvent.
* @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 FormEventMaintenanceRetrieveOutDto create(FormEventMaintenanceCreateInDto 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
FormEvent 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
FormEventMaintenanceRetrieveInDto retrieveInDto = new FormEventMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setEventName(input.getEventName());
FormEventMaintenanceRetrieveOutDto 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();
}
}
use of org.jaffa.modules.printing.domain.FormEvent in project jaffa-framework by jaffa-projects.
the class FormEventMaintenanceTx method createDomain.
// .//GEN-END:_duplicateCheck_4_be
// .//GEN-BEGIN:_createDomain_1_be
/**
* Create the domain object.
*/
private FormEvent createDomain(UOW uow, FormEventMaintenanceCreateInDto input, boolean fromPrevalidate) throws FrameworkException, ApplicationExceptions {
FormEvent domain = new FormEvent();
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_createDomain_2_be
try {
domain.updateEventName(input.getEventName());
} 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);
}
// .//GEN-BEGIN:_createDomain_3_be
if (appExps != null && appExps.size() > 0)
throw appExps;
return domain;
}
Aggregations