Search in sources :

Example 1 with UOW

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

the class BusinessEventLogViewerTx method read.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_read_1_be
/**
 * Returns the details for BusinessEventLog.
 * @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 BusinessEventLogViewerOutDto read(BusinessEventLogViewerInDto 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();
        // Build the Criteria Object
        Criteria criteria = buildCriteria(input, uow);
        // .//GEN-END:_read_1_be
        // Add custom code before the query//GEN-FIRST:_read_1
        // .//GEN-LAST:_read_1
        // .//GEN-BEGIN:_read_2_be
        // Execute The Query
        Collection results = uow.query(criteria);
        // .//GEN-END:_read_2_be
        // Add custom code after the query//GEN-FIRST:_read_2
        // .//GEN-LAST:_read_2
        // .//GEN-BEGIN:_read_3_be
        // Convert the domain objects into the outbound dto
        BusinessEventLogViewerOutDto output = buildDto(uow, results);
        // Print Debug Information for the output
        if (log.isDebugEnabled()) {
            log.debug("Output: " + output);
        }
        return output;
    } finally {
        if (uow != null)
            uow.rollback();
    }
}
Also used : BusinessEventLogViewerOutDto(org.jaffa.modules.messaging.components.businesseventlogviewer.dto.BusinessEventLogViewerOutDto) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW)

Example 2 with UOW

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

the class FormGroupLookupTx method find.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_find_1_be
/**
 * Searches for FormGroup objects.
 * @param input The criteria based on which the search will be performed.
 * @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
 * @throws FrameworkException Indicates some system error
 * @return The search results.
 */
public FormGroupLookupOutDto find(FormGroupLookupInDto 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();
        // Build the Criteria Object
        Criteria criteria = buildCriteria(input, uow);
        // .//GEN-END:_find_1_be
        // Add custom code before the query //GEN-FIRST:_find_1
        // .//GEN-LAST:_find_1
        // .//GEN-BEGIN:_find_2_be
        // Execute The Query
        Collection results = uow.query(criteria);
        // .//GEN-END:_find_2_be
        // Add custom code after the query //GEN-FIRST:_find_2
        // .//GEN-LAST:_find_2
        // .//GEN-BEGIN:_find_3_be
        // Convert the domain objects into the outbound dto
        FormGroupLookupOutDto output = buildDto(uow, results, input);
        // Print Debug Information for the output
        if (log.isDebugEnabled()) {
            log.debug("Output: " + output);
        }
        return output;
    } finally {
        if (uow != null)
            uow.rollback();
    }
}
Also used : FormGroupLookupOutDto(org.jaffa.modules.printing.components.formgrouplookup.dto.FormGroupLookupOutDto) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW)

Example 3 with UOW

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

the class FormGroupMaintenanceTx method create.

// .//GEN-END:_prevalidateCreate_1_be
// .//GEN-BEGIN:_create_1_be
/**
 * Persists a new instance of FormGroup.
 * @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 FormGroupMaintenanceRetrieveOutDto create(FormGroupMaintenanceCreateInDto 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
        FormGroup domain = createDomain(uow, input, false);
        uow.add(domain);
        // Perform post create processing
        postCreate(uow, input, domain, false);
        // Commit the changes
        uow.commit();
        // Print Debug Information for the output
        if (log.isDebugEnabled())
            log.debug("Successfully created the domain object. Now retrieving the object details.");
        // Build the outbound dto by performing a retrieve
        FormGroupMaintenanceRetrieveInDto retrieveInDto = new FormGroupMaintenanceRetrieveInDto();
        retrieveInDto.setHeaderDto(input.getHeaderDto());
        retrieveInDto.setFormName(input.getFormName());
        FormGroupMaintenanceRetrieveOutDto 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) FormGroup(org.jaffa.modules.printing.domain.FormGroup) UOW(org.jaffa.persistence.UOW)

Example 4 with UOW

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

the class FormEventLookupTx method find.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_find_1_be
/**
 * Searches for FormEvent objects.
 * @param input The criteria based on which the search will be performed.
 * @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
 * @throws FrameworkException Indicates some system error
 * @return The search results.
 */
public FormEventLookupOutDto find(FormEventLookupInDto 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();
        // Build the Criteria Object
        Criteria criteria = buildCriteria(input, uow);
        // .//GEN-END:_find_1_be
        // Add custom code before the query //GEN-FIRST:_find_1
        // .//GEN-LAST:_find_1
        // .//GEN-BEGIN:_find_2_be
        // Execute The Query
        Collection results = uow.query(criteria);
        // .//GEN-END:_find_2_be
        // Add custom code after the query //GEN-FIRST:_find_2
        // .//GEN-LAST:_find_2
        // .//GEN-BEGIN:_find_3_be
        // Convert the domain objects into the outbound dto
        FormEventLookupOutDto output = buildDto(uow, results, input);
        // Print Debug Information for the output
        if (log.isDebugEnabled()) {
            log.debug("Output: " + output);
        }
        return output;
    } finally {
        if (uow != null)
            uow.rollback();
    }
}
Also used : AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW) FormEventLookupOutDto(org.jaffa.modules.printing.components.formeventlookup.dto.FormEventLookupOutDto)

Example 5 with UOW

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

the class FormDefinitionViewerTx method loadFormTemplate.

public byte[] loadFormTemplate(FormDefinitionViewerInDto input) throws FrameworkException, ApplicationExceptions {
    UOW uow = new UOW();
    try {
        Criteria criteria = new Criteria();
        criteria.setTable(FormTemplateMeta.getName());
        criteria.addCriteria(FormTemplateMeta.FORM_ID, input.getFormId());
        Iterator itr = uow.query(criteria).iterator();
        if (itr.hasNext()) {
            FormTemplate formTemplate = (FormTemplate) itr.next();
            formTemplateContents = formTemplate.getTemplateData();
        }
    } finally {
        if (uow != null)
            uow.rollback();
    }
    return formTemplateContents;
}
Also used : FormTemplate(org.jaffa.modules.printing.domain.FormTemplate) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW)

Aggregations

UOW (org.jaffa.persistence.UOW)260 Criteria (org.jaffa.persistence.Criteria)139 FrameworkException (org.jaffa.exceptions.FrameworkException)99 ApplicationException (org.jaffa.exceptions.ApplicationException)88 AtomicCriteria (org.jaffa.persistence.AtomicCriteria)87 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)82 Iterator (java.util.Iterator)47 TransactionCriteria (org.jaffa.transaction.apis.data.TransactionCriteria)33 TransactionFieldCriteria (org.jaffa.transaction.apis.data.TransactionFieldCriteria)33 ArrayList (java.util.ArrayList)19 Transaction (org.jaffa.transaction.domain.Transaction)19 Map (java.util.Map)16 LinkedHashMap (java.util.LinkedHashMap)13 HashMap (java.util.HashMap)12 DateTime (org.jaffa.datatypes.DateTime)11 FormTemplate (org.jaffa.modules.printing.domain.FormTemplate)10 IPersistent (org.jaffa.persistence.IPersistent)10 Method (java.lang.reflect.Method)9 Collection (java.util.Collection)8 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)8