use of org.jaffa.persistence.UOW in project jaffa-framework by jaffa-projects.
the class FormGroupFinderTx method find.
// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_find_1_be
/**
* Searches for FormGroup objects.
* @param input The criteria based on which the search will be performed.
* @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
* @throws FrameworkException Indicates some system error
* @return The search results.
*/
public FormGroupFinderOutDto find(FormGroupFinderInDto 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();
// Build the Criteria Object
Criteria criteria = buildCriteria(input, uow);
// .//GEN-END:_find_1_be
// Add custom code before the query //GEN-FIRST:_find_1
// .//GEN-LAST:_find_1
// .//GEN-BEGIN:_find_2_be
// Execute The Query
Collection results = uow.query(criteria);
// .//GEN-END:_find_2_be
// Add custom code after the query //GEN-FIRST:_find_2
// .//GEN-LAST:_find_2
// .//GEN-BEGIN:_find_3_be
// Convert the domain objects into the outbound dto
FormGroupFinderOutDto output = buildDto(uow, results, input);
// Print Debug Information for the output
if (log.isDebugEnabled()) {
log.debug("Output: " + (output != null ? output.toString() : null));
}
return output;
} finally {
if (uow != null)
uow.rollback();
}
}
use of org.jaffa.persistence.UOW in project jaffa-framework by jaffa-projects.
the class FormGroupLookupTx method find.
// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_find_1_be
/**
* Searches for FormGroup objects.
* @param input The criteria based on which the search will be performed.
* @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
* @throws FrameworkException Indicates some system error
* @return The search results.
*/
public FormGroupLookupOutDto find(FormGroupLookupInDto 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();
// Build the Criteria Object
Criteria criteria = buildCriteria(input, uow);
// .//GEN-END:_find_1_be
// Add custom code before the query //GEN-FIRST:_find_1
// .//GEN-LAST:_find_1
// .//GEN-BEGIN:_find_2_be
// Execute The Query
Collection results = uow.query(criteria);
// .//GEN-END:_find_2_be
// Add custom code after the query //GEN-FIRST:_find_2
// .//GEN-LAST:_find_2
// .//GEN-BEGIN:_find_3_be
// Convert the domain objects into the outbound dto
FormGroupLookupOutDto output = buildDto(uow, results, input);
// Print Debug Information for the output
if (log.isDebugEnabled()) {
log.debug("Output: " + (output != null ? output.toString() : null));
}
return output;
} finally {
if (uow != null)
uow.rollback();
}
}
use of org.jaffa.persistence.UOW in project jaffa-framework by jaffa-projects.
the class FormDefinitionLookupTx method find.
// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_find_1_be
/**
* Searches for FormDefinition objects.
* @param input The criteria based on which the search will be performed.
* @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
* @throws FrameworkException Indicates some system error
* @return The search results.
*/
public FormDefinitionLookupOutDto find(FormDefinitionLookupInDto 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();
// Build the Criteria Object
Criteria criteria = buildCriteria(input, uow);
// .//GEN-END:_find_1_be
// Add custom code before the query //GEN-FIRST:_find_1
// .//GEN-LAST:_find_1
// .//GEN-BEGIN:_find_2_be
// Execute The Query
Collection results = uow.query(criteria);
// .//GEN-END:_find_2_be
// Add custom code after the query //GEN-FIRST:_find_2
// .//GEN-LAST:_find_2
// .//GEN-BEGIN:_find_3_be
// Convert the domain objects into the outbound dto
FormDefinitionLookupOutDto output = buildDto(uow, results, input);
// Print Debug Information for the output
if (log.isDebugEnabled()) {
log.debug("Output: " + (output != null ? output.toString() : null));
}
return output;
} finally {
if (uow != null)
uow.rollback();
}
}
use of org.jaffa.persistence.UOW in project jaffa-framework by jaffa-projects.
the class FormDefinitionMaintenanceTx method retrieve.
// .//GEN-END:_create_1_be
// .//GEN-BEGIN:_retrieve_1_be
/**
* Returns the details for FormDefinition.
* @param input The criteria based on which an object will be retrieved.
* @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
* @throws FrameworkException Indicates some system error.
* @return The object details. A null indicates, the object was not found.
*/
public FormDefinitionMaintenanceRetrieveOutDto retrieve(FormDefinitionMaintenanceRetrieveInDto 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
FormDefinition domain = load(uow, input);
// Convert the domain objects into the outbound dto
FormDefinitionMaintenanceRetrieveOutDto output = buildRetrieveOutDto(uow, input, domain);
// 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.persistence.UOW in project jaffa-framework by jaffa-projects.
the class FormDefinitionMaintenanceTx method update.
// .//GEN-END:_prevalidateUpdate_1_be
// .//GEN-BEGIN:_update_1_be
/**
* Updates an existing instance of FormDefinition.
* @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 FormDefinitionMaintenanceRetrieveOutDto update(FormDefinitionMaintenanceUpdateInDto 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
FormDefinition domain = load(uow, input);
// Ensure the domain object has not been modified
domainObjectChangedTest(input.getPerformDirtyReadCheck(), domain, input.getLastChangedOn());
// Validate the foreign objects
validateForeignObjects(uow, input);
// Update the domain object
updateDomain(uow, input, domain, false);
uow.update(domain);
FormTemplate formTemplate = createOrLoadFormTemplate(uow, input, domain, false);
if (formTemplate != null && formTemplate.isModified()) {
if (formTemplate.isDatabaseOccurence())
uow.update(formTemplate);
else
uow.add(formTemplate);
}
// 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
FormDefinitionMaintenanceRetrieveInDto retrieveInDto = new FormDefinitionMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setFormId(input.getFormId());
FormDefinitionMaintenanceRetrieveOutDto 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();
}
}
Aggregations