use of org.jaffa.exceptions.RelatedDomainObjectFoundException in project jaffa-framework by jaffa-projects.
the class FormGroupMaintenanceTx method deleteRelatedObjects.
// .//GEN-END:_addRelatedDtosToRetrieveOut_2_be
// .//GEN-BEGIN:_deleteRelatedObjects_1_be
/**
* Delete the related domain objects if the 'Cascading' constraint is specified. Throw an exception in case 'Restricted' constraint is specified.
*/
private void deleteRelatedObjects(UOW uow, FormGroupMaintenanceDeleteInDto input, FormGroup formGroup) throws FrameworkException, ApplicationExceptions {
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_deleteRelatedObjects_FormUsage_1_be
if (formGroup.getFormName() != null) {
Criteria criteria = new Criteria();
criteria.setTable(FormUsageMeta.getName());
criteria.addCriteria(FormUsageMeta.FORM_NAME, formGroup.getFormName());
// .//GEN-END:_deleteRelatedObjects_FormUsage_1_be
// Add custom code to set the criteria before the query//GEN-FIRST:_deleteRelatedObjects_FormUsage_1
// .//GEN-LAST:_deleteRelatedObjects_FormUsage_1
// .//GEN-BEGIN:_deleteRelatedObjects_FormUsage_5_be
Collection col = uow.query(criteria);
Iterator itr = col.iterator();
if (itr.hasNext()) {
col.clear();
if (log.isDebugEnabled())
log.debug("The related formUsage object having 'Restricted Delete Constraint' was found. Delete cannot be performed");
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(new RelatedDomainObjectFoundException(FormUsageMeta.getLabelToken()));
}
// .//GEN-END:_deleteRelatedObjects_FormUsage_5_be
// .//GEN-BEGIN:_deleteRelatedObjects_FormUsage_6_be
}
// .//GEN-BEGIN:_deleteRelatedObjects_2_be
if (appExps != null)
throw appExps;
}
use of org.jaffa.exceptions.RelatedDomainObjectFoundException in project jaffa-framework by jaffa-projects.
the class FormEventMaintenanceTx method deleteRelatedObjects.
// .//GEN-END:_addRelatedDtosToRetrieveOut_2_be
// .//GEN-BEGIN:_deleteRelatedObjects_1_be
/**
* Delete the related domain objects if the 'Cascading' constraint is specified. Throw an exception in case 'Restricted' constraint is specified.
*/
private void deleteRelatedObjects(UOW uow, FormEventMaintenanceDeleteInDto input, FormEvent formEvent) throws FrameworkException, ApplicationExceptions {
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_deleteRelatedObjects_FormUsage_1_be
if (formEvent.getEventName() != null) {
Criteria criteria = new Criteria();
criteria.setTable(FormUsageMeta.getName());
criteria.addCriteria(FormUsageMeta.EVENT_NAME, formEvent.getEventName());
// .//GEN-END:_deleteRelatedObjects_FormUsage_1_be
// Add custom code to set the criteria before the query//GEN-FIRST:_deleteRelatedObjects_FormUsage_1
// .//GEN-LAST:_deleteRelatedObjects_FormUsage_1
// .//GEN-BEGIN:_deleteRelatedObjects_FormUsage_5_be
Collection col = uow.query(criteria);
Iterator itr = col.iterator();
if (itr.hasNext()) {
col.clear();
if (log.isDebugEnabled())
log.debug("The related formUsage object having 'Restricted Delete Constraint' was found. Delete cannot be performed");
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(new RelatedDomainObjectFoundException(FormUsageMeta.getLabelToken()));
}
// .//GEN-END:_deleteRelatedObjects_FormUsage_5_be
// .//GEN-BEGIN:_deleteRelatedObjects_FormUsage_6_be
}
// .//GEN-BEGIN:_deleteRelatedObjects_2_be
if (appExps != null)
throw appExps;
}
use of org.jaffa.exceptions.RelatedDomainObjectFoundException in project jaffa-framework by jaffa-projects.
the class Condition 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 {
Asset[] assetArray = null;
try {
assetArray = getAssetArray();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (assetArray != null && assetArray.length > 0) {
// Stop the deletion !!
throw new PreDeleteFailedException(null, new RelatedDomainObjectFoundException(AssetMeta.getLabelToken()));
}
Item[] itemArray = null;
try {
itemArray = getItemArray();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (itemArray != null && itemArray.length > 0) {
// Stop the deletion !!
throw new PreDeleteFailedException(null, new RelatedDomainObjectFoundException(ItemMeta.getLabelToken()));
}
}
use of org.jaffa.exceptions.RelatedDomainObjectFoundException in project jaffa-framework by jaffa-projects.
the class Part 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 {
Asset[] assetArray = null;
try {
assetArray = getAssetArray();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (assetArray != null && assetArray.length > 0) {
try {
// Perform cascade deletes
for (int i = 0; i < assetArray.length; i++) getUOW().delete(assetArray[i]);
} catch (Exception e) {
throw new PreDeleteFailedException(null, e);
}
}
Item[] itemArray = null;
try {
itemArray = getItemArray();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (itemArray != null && itemArray.length > 0) {
try {
// Perform cascade deletes
for (int i = 0; i < itemArray.length; i++) getUOW().delete(itemArray[i]);
} catch (Exception e) {
throw new PreDeleteFailedException(null, e);
}
}
PartRemarks partRemarksObject = null;
try {
partRemarksObject = getPartRemarksObject();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (partRemarksObject != null) {
// Stop the deletion !!
throw new PreDeleteFailedException(null, new RelatedDomainObjectFoundException(PartRemarksMeta.getLabelToken()));
}
PartPicture partPictureObject = null;
try {
partPictureObject = getPartPictureObject();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (partPictureObject != null) {
try {
// Perform cascade delete
getUOW().delete(partPictureObject);
} catch (Exception e) {
throw new PreDeleteFailedException(null, e);
}
}
PartRemarksPicture partRemarksPictureObject = null;
try {
partRemarksPictureObject = getPartRemarksPictureObject();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (partRemarksPictureObject != null) {
try {
// Perform cascade delete
getUOW().delete(partRemarksPictureObject);
} catch (Exception e) {
throw new PreDeleteFailedException(null, e);
}
}
PartAdditional partAdditionalObject = null;
try {
partAdditionalObject = getPartAdditionalObject();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (partAdditionalObject != null) {
try {
// Perform cascade delete
getUOW().delete(partAdditionalObject);
} catch (Exception e) {
throw new PreDeleteFailedException(null, e);
}
}
}
use of org.jaffa.exceptions.RelatedDomainObjectFoundException in project jaffa-framework by jaffa-projects.
the class FormGroup 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 {
FormUsage[] formUsageArray = null;
try {
formUsageArray = getFormUsageArray();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (formUsageArray != null && formUsageArray.length > 0) {
// Stop the deletion !!
throw new PreDeleteFailedException(null, new RelatedDomainObjectFoundException(FormUsageMeta.getLabelToken()));
}
FormDefinition[] formDefinitionArray = null;
try {
formDefinitionArray = getFormDefinitionArray();
} catch (FrameworkException e) {
throw new PreDeleteFailedException(null, e);
}
if (formDefinitionArray != null && formDefinitionArray.length > 0) {
try {
// Perform cascade deletes
for (int i = 0; i < formDefinitionArray.length; i++) getUOW().delete(formDefinitionArray[i]);
} catch (Exception e) {
throw new PreDeleteFailedException(null, e);
}
}
}
Aggregations