Search in sources :

Example 1 with FormGroupViewerOutDto

use of org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto in project jaffa-framework by jaffa-projects.

the class FormGroupViewerTx method read.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_read_1_be
/**
 * Returns the details for FormGroup.
 * @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 FormGroupViewerOutDto read(FormGroupViewerInDto 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();
        // 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
        FormGroupViewerOutDto output = buildDto(uow, results);
        // Print Debug Information for the output
        if (log.isDebugEnabled()) {
            log.debug("Output: " + (output != null ? output.toString() : null));
        }
        return output;
    } finally {
        if (uow != null)
            uow.rollback();
    }
}
Also used : FormGroupViewerOutDto(org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW)

Example 2 with FormGroupViewerOutDto

use of org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto in project jaffa-framework by jaffa-projects.

the class FormGroupViewerForm method populateRelatedFormUsage.

private void populateRelatedFormUsage(GridModel rows) {
    rows.clearRows();
    FormGroupViewerOutDto outputDto = ((FormGroupViewerComponent) getComponent()).getFormGroupViewerOutDto();
    if (outputDto != null) {
        GridModelRow row = null;
        FormUsageDto[] formUsage = outputDto.getFormUsage();
        for (int i = 0; i < formUsage.length; i++) {
            FormUsageDto rowDto = formUsage[i];
            row = rows.newRow();
            row.addElement("eventName", rowDto.getEventName());
            row.addElement("formAlternate", rowDto.getFormAlternate());
            row.addElement("copies", rowDto.getCopies());
            row.addElement("description", rowDto.getDescription());
        // .//GEN-END:RelatedFormUsage_1_be
        // Add custom code for the row//GEN-FIRST:RelatedFormUsage_1
        // .//GEN-LAST:RelatedFormUsage_1
        // .//GEN-BEGIN:RelatedFormUsage_2_be
        }
    }
}
Also used : FormUsageDto(org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto) FormGroupViewerOutDto(org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 3 with FormGroupViewerOutDto

use of org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto in project jaffa-framework by jaffa-projects.

the class FormGroupViewerTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormGroupViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
    FormGroupViewerOutDto output = null;
    Iterator itr = results.iterator();
    if (itr.hasNext()) {
        // just return the details for the 1st record retrieved.
        FormGroup formGroup = (FormGroup) itr.next();
        output = new FormGroupViewerOutDto();
        // .//GEN-END:_buildDto_1_be
        // Add custom code before all the setters //GEN-FIRST:_buildDto_1
        // .//GEN-LAST:_buildDto_1
        // .//GEN-BEGIN:_buildDto_FormName_1_be
        output.setFormName(formGroup.getFormName());
        // .//GEN-END:_buildDto_FormName_1_be
        // .//GEN-BEGIN:_buildDto_Description_1_be
        output.setDescription(formGroup.getDescription());
        // .//GEN-END:_buildDto_Description_1_be
        // .//GEN-BEGIN:_buildDto_FormType_1_be
        output.setFormType(formGroup.getFormType());
        // .//GEN-END:_buildDto_FormType_1_be
        // .//GEN-BEGIN:_buildDto_2_be
        // Add related objects, if required
        addRelatedDtos(uow, output, formGroup);
    // .//GEN-END:_buildDto_2_be
    // Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
    // .//GEN-LAST:_buildDto_2
    // .//GEN-BEGIN:_buildDto_3_be
    }
    return output;
}
Also used : FormGroup(org.jaffa.modules.printing.domain.FormGroup) FormGroupViewerOutDto(org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto)

Aggregations

FormGroupViewerOutDto (org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto)3 FormUsageDto (org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto)1 FormGroup (org.jaffa.modules.printing.domain.FormGroup)1 Criteria (org.jaffa.persistence.Criteria)1 UOW (org.jaffa.persistence.UOW)1 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)1