Search in sources :

Example 11 with FormEvent

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

the class FormEventLookupTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormEventLookupOutDto buildDto(UOW uow, Collection results, FormEventLookupInDto input) throws UOWException {
    FormEventLookupOutDto output = new FormEventLookupOutDto();
    int maxRecords = input.getMaxRecords() != null ? input.getMaxRecords().intValue() : 0;
    int counter = 0;
    for (Iterator i = results.iterator(); i.hasNext(); ) {
        if (++counter > maxRecords && maxRecords > 0) {
            output.setMoreRecordsExist(Boolean.TRUE);
            break;
        }
        FormEventLookupOutRowDto row = new FormEventLookupOutRowDto();
        FormEvent formEvent = (FormEvent) i.next();
        // .//GEN-END:_buildDto_1_be
        // Add custom code before all the setters //GEN-FIRST:_buildDto_1
        // .//GEN-LAST:_buildDto_1
        // .//GEN-BEGIN:_buildDto_EventName_1_be
        row.setEventName(formEvent.getEventName());
        // .//GEN-END:_buildDto_EventName_1_be
        // .//GEN-BEGIN:_buildDto_Description_1_be
        row.setDescription(formEvent.getDescription());
        // .//GEN-END:_buildDto_Description_1_be
        // Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
        // .//GEN-LAST:_buildDto_2
        // .//GEN-BEGIN:_buildDto_3_be
        output.addRows(row);
    }
    return output;
}
Also used : FormEvent(org.jaffa.modules.printing.domain.FormEvent) FormEventLookupOutRowDto(org.jaffa.modules.printing.components.formeventlookup.dto.FormEventLookupOutRowDto) FormEventLookupOutDto(org.jaffa.modules.printing.components.formeventlookup.dto.FormEventLookupOutDto)

Example 12 with FormEvent

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

the class FormEventMaintenanceTx 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 FormEvent.
 * @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 FormEventMaintenancePrevalidateOutDto prevalidateUpdate(FormEventMaintenanceUpdateInDto 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
        FormEvent domain = load(uow, input);
        // Validate the foreign objects
        validateForeignObjects(uow, input);
        // Update the domain object
        updateDomain(uow, input, domain, true);
        // Build the outbound dto
        FormEventMaintenancePrevalidateOutDto 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) FormEvent(org.jaffa.modules.printing.domain.FormEvent) FrameworkException(org.jaffa.exceptions.FrameworkException) UOW(org.jaffa.persistence.UOW)

Example 13 with FormEvent

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

the class FormEventMaintenanceTx 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 FormEvent.
 * @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 FormEventMaintenancePrevalidateOutDto prevalidateCreate(FormEventMaintenanceCreateInDto 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
        FormEvent domain = createDomain(uow, input, true);
        // Perform post create processing
        postCreate(uow, input, domain, true);
        // Build the outbound dto
        FormEventMaintenancePrevalidateOutDto 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) FormEvent(org.jaffa.modules.printing.domain.FormEvent) FrameworkException(org.jaffa.exceptions.FrameworkException) UOW(org.jaffa.persistence.UOW)

Example 14 with FormEvent

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

the class FormEventMaintenanceTx method retrieve.

// .//GEN-END:_create_1_be
// .//GEN-BEGIN:_retrieve_1_be
/**
 * Returns the details for FormEvent.
 * @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 FormEventMaintenanceRetrieveOutDto retrieve(FormEventMaintenanceRetrieveInDto 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
        FormEvent domain = load(uow, input);
        // Convert the domain objects into the outbound dto
        FormEventMaintenanceRetrieveOutDto output = buildRetrieveOutDto(uow, input, domain);
        // 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) FormEvent(org.jaffa.modules.printing.domain.FormEvent) FrameworkException(org.jaffa.exceptions.FrameworkException) UOW(org.jaffa.persistence.UOW)

Example 15 with FormEvent

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

the class FormEventMaintenanceTx method load.

// .//GEN-END:_preprocessRetrieve_2_be
// .//GEN-BEGIN:_loadRetrieve_1_be
/**
 * Retrieve the domain object.
 */
private FormEvent load(UOW uow, FormEventMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
    FormEvent domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(FormEventMeta.getName());
    // .//GEN-END:_loadRetrieve_1_be
    // Add custom criteria//GEN-FIRST:_loadRetrieve_1
    // .//GEN-LAST:_loadRetrieve_1
    // .//GEN-BEGIN:_loadRetrieve_2_be
    criteria.addCriteria(FormEventMeta.EVENT_NAME, input.getEventName());
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (FormEvent) itr.next();
    // .//GEN-BEGIN:_loadRetrieve_3_be
    if (domain == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(FormEventMeta.getLabelToken()));
        throw appExps;
    }
    return domain;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FormEvent(org.jaffa.modules.printing.domain.FormEvent) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) Criteria(org.jaffa.persistence.Criteria)

Aggregations

FormEvent (org.jaffa.modules.printing.domain.FormEvent)16 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)9 ApplicationException (org.jaffa.exceptions.ApplicationException)5 FrameworkException (org.jaffa.exceptions.FrameworkException)5 Criteria (org.jaffa.persistence.Criteria)5 UOW (org.jaffa.persistence.UOW)5 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)3 FormUsage (org.jaffa.modules.printing.domain.FormUsage)2 ValidationException (org.jaffa.datatypes.ValidationException)1 InvalidForeignKeyException (org.jaffa.datatypes.exceptions.InvalidForeignKeyException)1 FormEventFinderOutDto (org.jaffa.modules.printing.components.formeventfinder.dto.FormEventFinderOutDto)1 FormEventFinderOutRowDto (org.jaffa.modules.printing.components.formeventfinder.dto.FormEventFinderOutRowDto)1 FormEventLookupOutDto (org.jaffa.modules.printing.components.formeventlookup.dto.FormEventLookupOutDto)1 FormEventLookupOutRowDto (org.jaffa.modules.printing.components.formeventlookup.dto.FormEventLookupOutRowDto)1 FormEventViewerOutDto (org.jaffa.modules.printing.components.formeventviewer.dto.FormEventViewerOutDto)1 FormUsageDto (org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto)1