Search in sources :

Example 1 with FormUsageDto

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

the class FormGroupViewerTx method addRelatedDtos.

// .//GEN-END:_buildDto_3_be
// .//GEN-BEGIN:_addRelatedDtos_1_be
private void addRelatedDtos(UOW uow, FormGroupViewerOutDto output, FormGroup formGroup) throws UOWException {
    // .//GEN-BEGIN:_addRelatedDtos_FormUsage_1_be
    if (formGroup.getFormName() != null) {
        Criteria criteria = new Criteria();
        criteria.setTable(FormUsageMeta.getName());
        criteria.addCriteria(FormUsageMeta.FORM_NAME, formGroup.getFormName());
        criteria.addOrderBy("FormName", Criteria.ORDER_BY_ASC);
        // .//GEN-END:_addRelatedDtos_FormUsage_1_be
        // Add custom code to set the criteria before the query //GEN-FIRST:_addRelatedDtos_FormUsage_1
        // .//GEN-LAST:_addRelatedDtos_FormUsage_1
        // .//GEN-BEGIN:_addRelatedDtos_FormUsage_2_be
        Iterator itr = uow.query(criteria).iterator();
        while (itr.hasNext()) {
            FormUsage formUsage = (FormUsage) itr.next();
            FormUsageDto dto = new FormUsageDto();
            // .//GEN-END:_addRelatedDtos_FormUsage_2_be
            // Add custom code before all the setters //GEN-FIRST:_addRelatedDtos_FormUsage_2
            // .//GEN-LAST:_addRelatedDtos_FormUsage_2
            // .//GEN-BEGIN:_addRelatedDtos_FormUsage_EventName_1_be
            dto.setEventName(formUsage.getEventName());
            // .//GEN-END:_addRelatedDtos_FormUsage_EventName_1_be
            // .//GEN-BEGIN:_addRelatedDtos_FormUsage_FormAlternate_1_be
            dto.setFormAlternate(formUsage.getFormAlternate());
            // .//GEN-END:_addRelatedDtos_FormUsage_FormAlternate_1_be
            // .//GEN-BEGIN:_addRelatedDtos_FormUsage_Copies_1_be
            dto.setCopies(formUsage.getCopies());
            // .//GEN-END:_addRelatedDtos_FormUsage_Copies_1_be
            // .//GEN-BEGIN:_addRelatedDtos_FormUsage_Description_1_be
            FormEvent chainFormEventEventNameEventName = null;
            {
                if (formUsage.getEventName() != null) {
                    Criteria criteriaFormEvent = new Criteria();
                    criteriaFormEvent.setTable(FormEventMeta.getName());
                    criteriaFormEvent.addCriteria(FormEventMeta.EVENT_NAME, formUsage.getEventName());
                    // .//GEN-END:_addRelatedDtos_FormUsage_Description_1_be
                    // Add custom code to modify the criteria //GEN-FIRST:_addRelatedDtos_FormUsage_Description_1
                    // .//GEN-LAST:_addRelatedDtos_FormUsage_Description_1
                    // .//GEN-BEGIN:_addRelatedDtos_FormUsage_Description_2_be
                    Iterator i = uow.query(criteriaFormEvent).iterator();
                    if (i.hasNext())
                        chainFormEventEventNameEventName = (FormEvent) i.next();
                }
            }
            // .//GEN-BEGIN:_addRelatedDtos_FormUsage_Description_3_be
            try {
                dto.setDescription(chainFormEventEventNameEventName.getDescription());
            } catch (NullPointerException e) {
            // Do nothing
            }
            // .//GEN-END:_addRelatedDtos_FormUsage_Description_3_be
            // Add custom code to pass values to the dto //GEN-FIRST:_addRelatedDtos_FormUsage_3
            // .//GEN-LAST:_addRelatedDtos_FormUsage_3
            // .//GEN-BEGIN:_addRelatedDtos_FormUsage_3_be
            output.addFormUsage(dto);
        }
    }
// .//GEN-END:_addRelatedDtos_FormUsage_3_be
// .//GEN-BEGIN:_addRelatedDtos_2_be
}
Also used : FormEvent(org.jaffa.modules.printing.domain.FormEvent) FormUsageDto(org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto) Criteria(org.jaffa.persistence.Criteria) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 2 with FormUsageDto

use of org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto 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)

Aggregations

FormUsageDto (org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto)2 FormGroupViewerOutDto (org.jaffa.modules.printing.components.formgroupviewer.dto.FormGroupViewerOutDto)1 FormEvent (org.jaffa.modules.printing.domain.FormEvent)1 FormUsage (org.jaffa.modules.printing.domain.FormUsage)1 Criteria (org.jaffa.persistence.Criteria)1 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)1