use of org.jaffa.exceptions.RelatedDomainObjectFoundException 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