Search in sources :

Example 1 with Asset

use of org.jaffa.persistence.domainobjects.Asset in project jaffa-framework by jaffa-projects.

the class Condition method newAssetObject.

/**
 * Creates a new Asset object and initializes the related fields.
 * This will uncache the related Asset objects.
 * @throws ValidationException if an invalid value is passed.
 * @throws FrameworkException Indicates some system error
 * @return the related Asset object with the initialized related fields.
 */
public Asset newAssetObject() throws ValidationException, FrameworkException {
    m_assetCollection = null;
    Asset asset = new Asset();
    asset.setCondition(getCondition());
    // .//GEN-BEGIN:assetArray_3_be
    return asset;
}
Also used : Asset(org.jaffa.persistence.domainobjects.Asset)

Example 2 with Asset

use of org.jaffa.persistence.domainobjects.Asset in project jaffa-framework by jaffa-projects.

the class Part method newAssetObject.

/**
 * Creates a new Asset object and initializes the related fields.
 * This will uncache the related Asset objects.
 * @throws ValidationException if an invalid value is passed.
 * @throws FrameworkException Indicates some system error
 * @return the related Asset object with the initialized related fields.
 */
public Asset newAssetObject() throws ValidationException, FrameworkException {
    m_assetCollection = null;
    Asset asset = new Asset();
    asset.setPart(getPart());
    // .//GEN-BEGIN:assetArray_3_be
    return asset;
}
Also used : Asset(org.jaffa.persistence.domainobjects.Asset)

Example 3 with Asset

use of org.jaffa.persistence.domainobjects.Asset 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()));
    }
}
Also used : Item(org.jaffa.persistence.domainobjects.Item) FrameworkException(org.jaffa.exceptions.FrameworkException) Asset(org.jaffa.persistence.domainobjects.Asset) RelatedDomainObjectFoundException(org.jaffa.exceptions.RelatedDomainObjectFoundException)

Example 4 with Asset

use of org.jaffa.persistence.domainobjects.Asset 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);
        }
    }
}
Also used : FrameworkException(org.jaffa.exceptions.FrameworkException) PartRemarksPicture(org.jaffa.persistence.domainobjects.PartRemarksPicture) RelatedDomainObjectFoundException(org.jaffa.exceptions.RelatedDomainObjectFoundException) FrameworkException(org.jaffa.exceptions.FrameworkException) InvalidForeignKeyException(org.jaffa.datatypes.exceptions.InvalidForeignKeyException) DuplicateKeyException(org.jaffa.exceptions.DuplicateKeyException) RelatedDomainObjectFoundException(org.jaffa.exceptions.RelatedDomainObjectFoundException) Item(org.jaffa.persistence.domainobjects.Item) PartRemarks(org.jaffa.persistence.domainobjects.PartRemarks) Asset(org.jaffa.persistence.domainobjects.Asset) PartAdditional(org.jaffa.persistence.domainobjects.PartAdditional) PartPicture(org.jaffa.persistence.domainobjects.PartPicture)

Aggregations

Asset (org.jaffa.persistence.domainobjects.Asset)4 FrameworkException (org.jaffa.exceptions.FrameworkException)2 RelatedDomainObjectFoundException (org.jaffa.exceptions.RelatedDomainObjectFoundException)2 Item (org.jaffa.persistence.domainobjects.Item)2 InvalidForeignKeyException (org.jaffa.datatypes.exceptions.InvalidForeignKeyException)1 DuplicateKeyException (org.jaffa.exceptions.DuplicateKeyException)1 PartAdditional (org.jaffa.persistence.domainobjects.PartAdditional)1 PartPicture (org.jaffa.persistence.domainobjects.PartPicture)1 PartRemarks (org.jaffa.persistence.domainobjects.PartRemarks)1 PartRemarksPicture (org.jaffa.persistence.domainobjects.PartRemarksPicture)1