Search in sources :

Example 1 with FormDefinitionLookupOutDto

use of org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutDto in project jaffa-framework by jaffa-projects.

the class FormDefinitionLookupTx method find.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_find_1_be
/**
 * Searches for FormDefinition 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 FormDefinitionLookupOutDto find(FormDefinitionLookupInDto 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:_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
        FormDefinitionLookupOutDto output = buildDto(uow, results, input);
        // 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 : FormDefinitionLookupOutDto(org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutDto) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW)

Example 2 with FormDefinitionLookupOutDto

use of org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutDto in project jaffa-framework by jaffa-projects.

the class FormDefinitionLookupTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormDefinitionLookupOutDto buildDto(UOW uow, Collection results, FormDefinitionLookupInDto input) throws UOWException {
    FormDefinitionLookupOutDto output = new FormDefinitionLookupOutDto();
    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;
        }
        FormDefinitionLookupOutRowDto row = new FormDefinitionLookupOutRowDto();
        FormDefinition formDefinition = (FormDefinition) 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_FormId_1_be
        row.setFormId(formDefinition.getFormId());
        // .//GEN-END:_buildDto_FormId_1_be
        // .//GEN-BEGIN:_buildDto_FormName_1_be
        row.setFormName(formDefinition.getFormName());
        // .//GEN-END:_buildDto_FormName_1_be
        // .//GEN-BEGIN:_buildDto_FormAlternate_1_be
        row.setFormAlternate(formDefinition.getFormAlternate());
        // .//GEN-END:_buildDto_FormAlternate_1_be
        // .//GEN-BEGIN:_buildDto_FormVariation_1_be
        row.setFormVariation(formDefinition.getFormVariation());
        // .//GEN-END:_buildDto_FormVariation_1_be
        // .//GEN-BEGIN:_buildDto_OutputType_1_be
        row.setOutputType(formDefinition.getOutputType());
        // .//GEN-END:_buildDto_OutputType_1_be
        // .//GEN-BEGIN:_buildDto_FormTemplate_1_be
        row.setFormTemplate(formDefinition.getFormTemplate());
        // .//GEN-END:_buildDto_FormTemplate_1_be
        // .//GEN-BEGIN:_buildDto_FieldLayout_1_be
        row.setFieldLayout(formDefinition.getFieldLayout());
        // .//GEN-END:_buildDto_FieldLayout_1_be
        // .//GEN-BEGIN:_buildDto_Description_1_be
        row.setDescription(formDefinition.getDescription());
        // .//GEN-END:_buildDto_Description_1_be
        // .//GEN-BEGIN:_buildDto_Remarks_1_be
        row.setRemarks(formDefinition.getRemarks());
        // .//GEN-END:_buildDto_Remarks_1_be
        // .//GEN-BEGIN:_buildDto_DomFactory_1_be
        row.setDomFactory(formDefinition.getDomFactory());
        // .//GEN-END:_buildDto_DomFactory_1_be
        // .//GEN-BEGIN:_buildDto_DomClass_1_be
        row.setDomClass(formDefinition.getDomClass());
        // .//GEN-END:_buildDto_DomClass_1_be
        // .//GEN-BEGIN:_buildDto_DomKey1_1_be
        row.setDomKey1(formDefinition.getDomKey1());
        // .//GEN-END:_buildDto_DomKey1_1_be
        // .//GEN-BEGIN:_buildDto_DomKey2_1_be
        row.setDomKey2(formDefinition.getDomKey2());
        // .//GEN-END:_buildDto_DomKey2_1_be
        // .//GEN-BEGIN:_buildDto_DomKey3_1_be
        row.setDomKey3(formDefinition.getDomKey3());
        // .//GEN-END:_buildDto_DomKey3_1_be
        // .//GEN-BEGIN:_buildDto_DomKey4_1_be
        row.setDomKey4(formDefinition.getDomKey4());
        // .//GEN-END:_buildDto_DomKey4_1_be
        // .//GEN-BEGIN:_buildDto_DomKey5_1_be
        row.setDomKey5(formDefinition.getDomKey5());
        // .//GEN-END:_buildDto_DomKey5_1_be
        // .//GEN-BEGIN:_buildDto_DomKey6_1_be
        row.setDomKey6(formDefinition.getDomKey6());
        // .//GEN-END:_buildDto_DomKey6_1_be
        // .//GEN-BEGIN:_buildDto_AdditionalDataComponent_1_be
        row.setAdditionalDataComponent(formDefinition.getAdditionalDataComponent());
        // .//GEN-END:_buildDto_AdditionalDataComponent_1_be
        // .//GEN-BEGIN:_buildDto_FollowOnFormName_1_be
        row.setFollowOnFormName(formDefinition.getFollowOnFormName());
        // .//GEN-END:_buildDto_FollowOnFormName_1_be
        // .//GEN-BEGIN:_buildDto_FollowOnFormAlternate_1_be
        row.setFollowOnFormAlternate(formDefinition.getFollowOnFormAlternate());
        // .//GEN-END:_buildDto_FollowOnFormAlternate_1_be
        // .//GEN-BEGIN:_buildDto_CreatedOn_1_be
        row.setCreatedOn(formDefinition.getCreatedOn());
        // .//GEN-END:_buildDto_CreatedOn_1_be
        // .//GEN-BEGIN:_buildDto_CreatedBy_1_be
        row.setCreatedBy(formDefinition.getCreatedBy());
        // .//GEN-END:_buildDto_CreatedBy_1_be
        // .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
        row.setLastChangedOn(formDefinition.getLastChangedOn());
        // .//GEN-END:_buildDto_LastChangedOn_1_be
        // .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
        row.setLastChangedBy(formDefinition.getLastChangedBy());
        // .//GEN-END:_buildDto_LastChangedBy_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 : FormDefinitionLookupOutRowDto(org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutRowDto) FormDefinitionLookupOutDto(org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutDto) FormDefinition(org.jaffa.modules.printing.domain.FormDefinition)

Example 3 with FormDefinitionLookupOutDto

use of org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutDto in project jaffa-framework by jaffa-projects.

the class FormDefinitionLookupForm method populateRows.

// .//GEN-END:_doValidate_2_be
// .//GEN-BEGIN:_populateRows_1_be
/**
 * This will populate the input GridModel with the data in the finderOutDto of the Component.
 * @param rows The GridModel object to populate.
 */
public void populateRows(GridModel rows) {
    rows.clearRows();
    FormDefinitionLookupOutDto outputDto = (FormDefinitionLookupOutDto) ((FormDefinitionLookupComponent) getComponent()).getFinderOutDto();
    if (outputDto != null) {
        GridModelRow row;
        for (int i = 0; i < outputDto.getRowsCount(); i++) {
            FormDefinitionLookupOutRowDto rowDto = outputDto.getRows(i);
            row = rows.newRow();
            row.addElement(LookupComponent2.MULTI_SELECT_CHECKBOX, new CheckBoxModel(false));
            row.addElement("formId", rowDto.getFormId());
            row.addElement("formName", rowDto.getFormName());
            row.addElement("formAlternate", rowDto.getFormAlternate());
            row.addElement("formVariation", rowDto.getFormVariation());
            row.addElement("outputType", rowDto.getOutputType());
            row.addElement("formTemplate", rowDto.getFormTemplate());
            row.addElement("fieldLayout", rowDto.getFieldLayout());
            row.addElement("description", rowDto.getDescription());
            row.addElement("remarks", rowDto.getRemarks());
            row.addElement("domFactory", rowDto.getDomFactory());
            row.addElement("domClass", rowDto.getDomClass());
            row.addElement("domKey1", rowDto.getDomKey1());
            row.addElement("domKey2", rowDto.getDomKey2());
            row.addElement("domKey3", rowDto.getDomKey3());
            row.addElement("domKey4", rowDto.getDomKey4());
            row.addElement("domKey5", rowDto.getDomKey5());
            row.addElement("domKey6", rowDto.getDomKey6());
            row.addElement("additionalDataComponent", rowDto.getAdditionalDataComponent());
            row.addElement("followOnFormName", rowDto.getFollowOnFormName());
            row.addElement("followOnFormAlternate", rowDto.getFollowOnFormAlternate());
            row.addElement("createdOn", rowDto.getCreatedOn());
            row.addElement("createdBy", rowDto.getCreatedBy());
            row.addElement("lastChangedOn", rowDto.getLastChangedOn());
            row.addElement("lastChangedBy", rowDto.getLastChangedBy());
        // .//GEN-END:_populateRows_1_be
        // Add custom code for the row //GEN-FIRST:_populateRows_1
        // .//GEN-LAST:_populateRows_1
        // .//GEN-BEGIN:_populateRows_2_be
        }
    }
}
Also used : FormDefinitionLookupOutRowDto(org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutRowDto) FormDefinitionLookupOutDto(org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutDto)

Aggregations

FormDefinitionLookupOutDto (org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutDto)3 FormDefinitionLookupOutRowDto (org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutRowDto)2 FormDefinition (org.jaffa.modules.printing.domain.FormDefinition)1 AtomicCriteria (org.jaffa.persistence.AtomicCriteria)1 Criteria (org.jaffa.persistence.Criteria)1 UOW (org.jaffa.persistence.UOW)1