Search in sources :

Example 6 with FormUsage

use of org.jaffa.modules.printing.domain.FormUsage in project jaffa-framework by jaffa-projects.

the class FormEvent method newFormUsageObject.

/**
 * Creates a new FormUsage object and initializes the related fields.
 * This will uncache the related FormUsage objects.
 * @throws ValidationException if an invalid value is passed.
 * @throws FrameworkException Indicates some system error
 * @return the related FormUsage object with the initialized related fields.
 */
public FormUsage newFormUsageObject() throws ValidationException, FrameworkException {
    m_formUsageCollection = null;
    FormUsage formUsage = new FormUsage();
    formUsage.setEventName(getEventName());
    // .//GEN-BEGIN:formUsageArray_3_be
    return formUsage;
}
Also used : FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 7 with FormUsage

use of org.jaffa.modules.printing.domain.FormUsage in project jaffa-framework by jaffa-projects.

the class FormGroup method newFormUsageObject.

/**
 * Creates a new FormUsage object and initializes the related fields.
 * This will uncache the related FormUsage objects.
 * @throws ValidationException if an invalid value is passed.
 * @throws FrameworkException Indicates some system error
 * @return the related FormUsage object with the initialized related fields.
 */
public FormUsage newFormUsageObject() throws ValidationException, FrameworkException {
    m_formUsageCollection = null;
    FormUsage formUsage = new FormUsage();
    formUsage.setFormName(getFormName());
    // .//GEN-BEGIN:formUsageArray_3_be
    return formUsage;
}
Also used : FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 8 with FormUsage

use of org.jaffa.modules.printing.domain.FormUsage in project jaffa-framework by jaffa-projects.

the class FormUsageMaintenanceTx 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 FormUsage.
 * @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 FormUsageMaintenancePrevalidateOutDto prevalidateCreate(FormUsageMaintenanceCreateInDto 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
        FormUsage domain = createDomain(uow, input, true);
        // Perform post create processing
        postCreate(uow, input, domain, true);
        // Build the outbound dto
        FormUsageMaintenancePrevalidateOutDto 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();
    }
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) ApplicationException(org.jaffa.exceptions.ApplicationException) FrameworkException(org.jaffa.exceptions.FrameworkException) UOW(org.jaffa.persistence.UOW) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 9 with FormUsage

use of org.jaffa.modules.printing.domain.FormUsage in project jaffa-framework by jaffa-projects.

the class FormUsageMaintenanceTx 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 FormUsage.
 * @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 FormUsageMaintenancePrevalidateOutDto prevalidateUpdate(FormUsageMaintenanceUpdateInDto 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
        FormUsage domain = load(uow, input);
        // Ensure the domain object has not been modified
        domainObjectChangedTest(input.getPerformDirtyReadCheck(), domain, input.getLastChangedOn());
        // Validate the foreign objects
        validateForeignObjects(uow, input);
        // Update the domain object
        updateDomain(uow, input, domain, true);
        // Build the outbound dto
        FormUsageMaintenancePrevalidateOutDto 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();
    }
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) ApplicationException(org.jaffa.exceptions.ApplicationException) FrameworkException(org.jaffa.exceptions.FrameworkException) UOW(org.jaffa.persistence.UOW) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 10 with FormUsage

use of org.jaffa.modules.printing.domain.FormUsage in project jaffa-framework by jaffa-projects.

the class FormUsageMaintenanceTx method update.

// .//GEN-END:_prevalidateUpdate_1_be
// .//GEN-BEGIN:_update_1_be
/**
 * Updates an existing instance of FormUsage.
 * @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 FormUsageMaintenanceRetrieveOutDto update(FormUsageMaintenanceUpdateInDto 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
        FormUsage domain = load(uow, input);
        // Ensure the domain object has not been modified
        domainObjectChangedTest(input.getPerformDirtyReadCheck(), domain, input.getLastChangedOn());
        // 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
        FormUsageMaintenanceRetrieveInDto retrieveInDto = new FormUsageMaintenanceRetrieveInDto();
        retrieveInDto.setHeaderDto(input.getHeaderDto());
        retrieveInDto.setFormName(input.getFormName());
        FormUsageMaintenanceRetrieveOutDto 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();
    }
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) ApplicationException(org.jaffa.exceptions.ApplicationException) FrameworkException(org.jaffa.exceptions.FrameworkException) UOW(org.jaffa.persistence.UOW) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Aggregations

FormUsage (org.jaffa.modules.printing.domain.FormUsage)23 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)10 Criteria (org.jaffa.persistence.Criteria)9 FrameworkException (org.jaffa.exceptions.FrameworkException)6 ApplicationException (org.jaffa.exceptions.ApplicationException)5 UOW (org.jaffa.persistence.UOW)5 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)3 ValidationException (org.jaffa.datatypes.ValidationException)2 FormSelectionMaintenanceOutDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutDto)2 FormSelectionMaintenanceOutRowDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutRowDto)2 FormDefinition (org.jaffa.modules.printing.domain.FormDefinition)2 FormEvent (org.jaffa.modules.printing.domain.FormEvent)2 DateTime (org.jaffa.datatypes.DateTime)1 InvalidForeignKeyException (org.jaffa.datatypes.exceptions.InvalidForeignKeyException)1 DuplicateKeyException (org.jaffa.exceptions.DuplicateKeyException)1 RelatedDomainObjectFoundException (org.jaffa.exceptions.RelatedDomainObjectFoundException)1 FormUsageDto (org.jaffa.modules.printing.components.formeventviewer.dto.FormUsageDto)1 FormUsageDto (org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto)1 FormUsageFinderOutDto (org.jaffa.modules.printing.components.formusagefinder.dto.FormUsageFinderOutDto)1 FormUsageFinderOutRowDto (org.jaffa.modules.printing.components.formusagefinder.dto.FormUsageFinderOutRowDto)1