use of org.jaffa.modules.printing.domain.PrinterDefinition in project jaffa-framework by jaffa-projects.
the class PrinterDefinitionMaintenanceTx method prevalidateCreate.
// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_prevalidateCreate_1_be
/**
* This method is used to perform prevalidations before creating a new instance of PrinterDefinition.
* @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 PrinterDefinitionMaintenancePrevalidateOutDto prevalidateCreate(PrinterDefinitionMaintenanceCreateInDto 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
PrinterDefinition domain = createDomain(uow, input, true);
// Perform post create processing
postCreate(uow, input, domain, true);
// Build the outbound dto
PrinterDefinitionMaintenancePrevalidateOutDto 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.PrinterDefinition in project jaffa-framework by jaffa-projects.
the class PrinterOutputType method performPreDeleteReferentialIntegrity.
// .//GEN-END:performForeignKeyValidations_1_be
// .//GEN-BEGIN:performPreDeleteReferentialIntegrity_1_be
/**
* This method is triggered by the UOW, before adding this object to the Delete-Store.
* This will raise an exception if any associated/aggregated objects exist.
* This will cascade delete all composite objects.
* @throws PreDeleteFailedException if any error occurs during the process.
*/
public void performPreDeleteReferentialIntegrity() throws PreDeleteFailedException {
OutputCommand[] outputCommandArray = null;
try {
outputCommandArray = getOutputCommandArray();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (outputCommandArray != null && outputCommandArray.length > 0) {
try {
// Perform cascade deletes
for (int i = 0; i < outputCommandArray.length; i++) getUOW().delete(outputCommandArray[i]);
} catch (Exception e) {
throw new PreDeleteFailedException(null, e);
}
}
PrinterDefinition[] printerDefinitionArray = null;
try {
printerDefinitionArray = getPrinterDefinitionArray();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (printerDefinitionArray != null && printerDefinitionArray.length > 0) {
// Stop the deletion !!
throw new PreDeleteFailedException(null, new RelatedDomainObjectFoundException(PrinterDefinitionMeta.getLabelToken()));
}
}
Aggregations