Search in sources :

Example 51 with ApplicationException

use of org.jaffa.exceptions.ApplicationException 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);
        // 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);
        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 52 with ApplicationException

use of org.jaffa.exceptions.ApplicationException 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);
        // 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);
        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 53 with ApplicationException

use of org.jaffa.exceptions.ApplicationException in project jaffa-framework by jaffa-projects.

the class FormUsageMaintenanceTx method retrieve.

// .//GEN-END:_create_1_be
// .//GEN-BEGIN:_retrieve_1_be
/**
 * Returns the details for FormUsage.
 * @param input The criteria based on which an object will be retrieved.
 * @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
 * @throws FrameworkException Indicates some system error.
 * @return The object details. A null indicates, the object was not found.
 */
public FormUsageMaintenanceRetrieveOutDto retrieve(FormUsageMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
    UOW uow = null;
    try {
        // Print Debug Information for the input
        if (log.isDebugEnabled())
            log.debug("Input: " + input);
        // create the UOW
        uow = new UOW();
        // Preprocess the input
        preprocess(uow, input);
        // Retrieve the object
        FormUsage domain = load(uow, input);
        // Convert the domain objects into the outbound dto
        FormUsageMaintenanceRetrieveOutDto output = buildRetrieveOutDto(uow, input, domain);
        // Print Debug Information for the output
        if (log.isDebugEnabled())
            log.debug("Output: " + output);
        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 54 with ApplicationException

use of org.jaffa.exceptions.ApplicationException in project jaffa-framework by jaffa-projects.

the class OutputCommandMaintenanceTx 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 OutputCommand.
 * @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 OutputCommandMaintenancePrevalidateOutDto prevalidateCreate(OutputCommandMaintenanceCreateInDto input) throws FrameworkException, ApplicationExceptions {
    UOW uow = null;
    try {
        // Print Debug Information for the input
        if (log.isDebugEnabled())
            log.debug("Input: " + input);
        // 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
        OutputCommand domain = createDomain(uow, input, true);
        domain = postCreate(uow, input, domain, true);
        // Build the outbound dto
        OutputCommandMaintenancePrevalidateOutDto output = createPrevalidateOutDto(uow, domain, input);
        // Print Debug Information for the output
        if (log.isDebugEnabled())
            log.debug("Output: " + output);
        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) OutputCommand(org.jaffa.modules.printing.domain.OutputCommand) UOW(org.jaffa.persistence.UOW)

Example 55 with ApplicationException

use of org.jaffa.exceptions.ApplicationException in project jaffa-framework by jaffa-projects.

the class OutputCommandMaintenanceTx method retrieve.

// .//GEN-END:_create_1_be
// .//GEN-BEGIN:_retrieve_1_be
/**
 * Returns the details for OutputCommand.
 * @param input The criteria based on which an object will be retrieved.
 * @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
 * @throws FrameworkException Indicates some system error.
 * @return The object details. A null indicates, the object was not found.
 */
public OutputCommandMaintenanceRetrieveOutDto retrieve(OutputCommandMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
    UOW uow = null;
    try {
        // Print Debug Information for the input
        if (log.isDebugEnabled())
            log.debug("Input: " + input);
        // create the UOW
        uow = new UOW();
        // Preprocess the input
        preprocess(uow, input);
        // Retrieve the object
        OutputCommand domain = load(uow, input);
        // Convert the domain objects into the outbound dto
        OutputCommandMaintenanceRetrieveOutDto output = buildRetrieveOutDto(uow, input, domain);
        // Print Debug Information for the output
        if (log.isDebugEnabled())
            log.debug("Output: " + output);
        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) OutputCommand(org.jaffa.modules.printing.domain.OutputCommand) UOW(org.jaffa.persistence.UOW)

Aggregations

ApplicationException (org.jaffa.exceptions.ApplicationException)125 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)114 FrameworkException (org.jaffa.exceptions.FrameworkException)97 UOW (org.jaffa.persistence.UOW)79 InvocationTargetException (java.lang.reflect.InvocationTargetException)12 FormTemplate (org.jaffa.modules.printing.domain.FormTemplate)11 Criteria (org.jaffa.persistence.Criteria)11 Method (java.lang.reflect.Method)10 Iterator (java.util.Iterator)10 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)6 Map (java.util.Map)6 GraphMapping (org.jaffa.beans.moulding.mapping.GraphMapping)6 OutputCommand (org.jaffa.modules.printing.domain.OutputCommand)6 PrinterDefinition (org.jaffa.modules.printing.domain.PrinterDefinition)6 PrinterOutputType (org.jaffa.modules.printing.domain.PrinterOutputType)6 User (org.jaffa.applications.jaffa.modules.admin.domain.User)5 UserRequest (org.jaffa.applications.jaffa.modules.user.domain.UserRequest)5 UserTimeEntry (org.jaffa.applications.test.modules.time.domain.UserTimeEntry)5 Attachment (org.jaffa.components.attachment.domain.Attachment)5