use of org.jaffa.modules.printing.domain.OutputCommand in project jaffa-framework by jaffa-projects.
the class OutputCommandMaintenanceTx 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 OutputCommand.
* @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 OutputCommandMaintenancePrevalidateOutDto prevalidateUpdate(OutputCommandMaintenanceUpdateInDto 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
OutputCommand domain = load(uow, input);
// Validate the foreign objects
validateForeignObjects(uow, input);
// Update the domain object
updateDomain(uow, input, domain, true);
// Build the outbound dto
OutputCommandMaintenancePrevalidateOutDto 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.OutputCommand in project jaffa-framework by jaffa-projects.
the class OutputCommandMaintenanceTx method delete.
/**
* Deletes an existing instance of OutputCommand.
* @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(OutputCommandMaintenanceDeleteInDto 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
OutputCommand 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.OutputCommand in project jaffa-framework by jaffa-projects.
the class OutputCommandMaintenanceTx method load.
// .//GEN-END:_preprocessRetrieve_2_be
// .//GEN-BEGIN:_loadRetrieve_1_be
/**
* Retrieve the domain object.
*/
private OutputCommand load(UOW uow, OutputCommandMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
OutputCommand domain = null;
Criteria criteria = new Criteria();
criteria.setTable(OutputCommandMeta.getName());
// .//GEN-END:_loadRetrieve_1_be
// Add custom criteria//GEN-FIRST:_loadRetrieve_1
// .//GEN-LAST:_loadRetrieve_1
// .//GEN-BEGIN:_loadRetrieve_2_be
criteria.addCriteria(OutputCommandMeta.OUTPUT_COMMAND_ID, input.getOutputCommandId());
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext())
domain = (OutputCommand) itr.next();
// .//GEN-BEGIN:_loadRetrieve_3_be
if (domain == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(OutputCommandMeta.getLabelToken()));
throw appExps;
}
return domain;
}
use of org.jaffa.modules.printing.domain.OutputCommand in project jaffa-framework by jaffa-projects.
the class OutputCommandMaintenanceTx method update.
// .//GEN-END:_prevalidateUpdate_1_be
// .//GEN-BEGIN:_update_1_be
/**
* Updates an existing instance of OutputCommand.
* @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 OutputCommandMaintenanceRetrieveOutDto update(OutputCommandMaintenanceUpdateInDto 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
OutputCommand 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
OutputCommandMaintenanceRetrieveInDto retrieveInDto = new OutputCommandMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setOutputCommandId(input.getOutputCommandId());
OutputCommandMaintenanceRetrieveOutDto 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.OutputCommand in project jaffa-framework by jaffa-projects.
the class OutputCommandMaintenanceTx method create.
// .//GEN-END:_prevalidateCreate_1_be
// .//GEN-BEGIN:_create_1_be
/**
* Persists a new instance of OutputCommand.
* @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 OutputCommandMaintenanceRetrieveOutDto create(OutputCommandMaintenanceCreateInDto 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
OutputCommand domain = createDomain(uow, input, false);
uow.add(domain);
domain = 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.");
if (input.getOutputCommandId() == null) {
if (log.isDebugEnabled())
log.debug("The Key is not set completely. Probably using AutoGenerated keys. Cannot re-retrieve the object details. Returning NULL instead");
return null;
}
// Build the outbound dto by performing a retrieve
OutputCommandMaintenanceRetrieveInDto retrieveInDto = new OutputCommandMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setOutputCommandId(input.getOutputCommandId());
OutputCommandMaintenanceRetrieveOutDto 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