use of org.jaffa.modules.printing.domain.FormGroup in project jaffa-framework by jaffa-projects.
the class FormGroupMaintenanceTx 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 FormGroup.
* @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 FormGroupMaintenancePrevalidateOutDto prevalidateUpdate(FormGroupMaintenanceUpdateInDto 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
FormGroup domain = load(uow, input);
// Validate the foreign objects
validateForeignObjects(uow, input);
// Update the domain object
updateDomain(uow, input, domain, true);
// Build the outbound dto
FormGroupMaintenancePrevalidateOutDto 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.FormGroup in project jaffa-framework by jaffa-projects.
the class FormGroupMaintenanceTx method delete.
/**
* Deletes an existing instance of FormGroup.
* @param input The key values for the domain object to be deleted.
* @param uow The delete will be performed using the input UOW.
* @throws ApplicationExceptions This will be thrown if the input contains invalid data.
* @throws FrameworkException Indicates some system error.
*/
public void delete(FormGroupMaintenanceDeleteInDto input, UOW uow) throws FrameworkException, ApplicationExceptions {
// Print Debug Information for the input
if (log.isDebugEnabled())
log.debug("Input: " + (input != null ? input.toString() : null));
// Preprocess the input
preprocess(uow, input);
// Retrieve the object
FormGroup domain = load(uow, input);
// Delete the domain object
deleteDomain(uow, input, domain);
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("The domain object has been marked for deletion. It will be deleted when the UOW is committed");
}
use of org.jaffa.modules.printing.domain.FormGroup in project jaffa-framework by jaffa-projects.
the class FormGroupMaintenanceTx method update.
// .//GEN-END:_prevalidateUpdate_1_be
// .//GEN-BEGIN:_update_1_be
/**
* Updates an existing instance of FormGroup.
* @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 FormGroupMaintenanceRetrieveOutDto update(FormGroupMaintenanceUpdateInDto 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
FormGroup 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
FormGroupMaintenanceRetrieveInDto retrieveInDto = new FormGroupMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setFormName(input.getFormName());
FormGroupMaintenanceRetrieveOutDto 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.FormGroup in project jaffa-framework by jaffa-projects.
the class FormGroupViewerTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormGroupViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
FormGroupViewerOutDto output = null;
Iterator itr = results.iterator();
if (itr.hasNext()) {
// just return the details for the 1st record retrieved.
FormGroup formGroup = (FormGroup) itr.next();
output = new FormGroupViewerOutDto();
// .//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
output.setFormName(formGroup.getFormName());
// .//GEN-END:_buildDto_FormName_1_be
// .//GEN-BEGIN:_buildDto_Description_1_be
output.setDescription(formGroup.getDescription());
// .//GEN-END:_buildDto_Description_1_be
// .//GEN-BEGIN:_buildDto_FormType_1_be
output.setFormType(formGroup.getFormType());
// .//GEN-END:_buildDto_FormType_1_be
// .//GEN-BEGIN:_buildDto_2_be
// Add related objects, if required
addRelatedDtos(uow, output, formGroup);
// .//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.FormGroup in project jaffa-framework by jaffa-projects.
the class FormDefinition method findFormGroupObject.
/**
* Finds the related foreign FormGroup object.
* If checkExistenceOnly is false, then the foreign object will be fetched and assigned to the corresponding member variable of this class.
* If checkExistenceOnly is true, then a mere existence check is performed for the foreign object, as oppposed to fetching all the values for that object.
*/
private void findFormGroupObject(boolean checkExistenceOnly) throws ValidationException, FrameworkException {
UOW uow = getUOW();
boolean localUow = false;
try {
if (m_formGroupObject == null && getFormName() != null) {
Criteria criteria = new Criteria();
criteria.setTable(FormGroupMeta.getName());
criteria.addCriteria(FormGroupMeta.FORM_NAME, getFormName());
if (checkExistenceOnly)
criteria.addFunction(Criteria.FUNCTION_COUNT, null, Criteria.ID_FUNCTION_COUNT);
Number count = null;
if (uow == null || !uow.isActive()) {
uow = new UOW();
localUow = true;
}
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext()) {
if (checkExistenceOnly)
count = (Number) ((Map) itr.next()).get(Criteria.ID_FUNCTION_COUNT);
else
m_formGroupObject = (FormGroup) itr.next();
}
if (m_formGroupObject == null && (count == null || count.intValue() <= 0))
throw new InvalidForeignKeyException(FormDefinitionMeta.META_FORM_NAME.getLabelToken(), new Object[] { FormGroupMeta.getLabelToken(), FormGroupMeta.META_FORM_NAME.getLabelToken() });
}
} finally {
if (localUow && uow != null)
uow.rollback();
}
}
Aggregations