Search in sources :

Example 1 with FormUsageLookupOutDto

use of org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutDto in project jaffa-framework by jaffa-projects.

the class FormUsageLookupTx method find.

// .//GEN-END:_destroy_2_be
// .//GEN-BEGIN:_find_1_be
/**
 * Searches for FormUsage 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 FormUsageLookupOutDto find(FormUsageLookupInDto 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
        FormUsageLookupOutDto 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 : FormUsageLookupOutDto(org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutDto) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria) UOW(org.jaffa.persistence.UOW)

Example 2 with FormUsageLookupOutDto

use of org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutDto in project jaffa-framework by jaffa-projects.

the class FormUsageLookupTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormUsageLookupOutDto buildDto(UOW uow, Collection results, FormUsageLookupInDto input) throws UOWException {
    FormUsageLookupOutDto output = new FormUsageLookupOutDto();
    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;
        }
        FormUsageLookupOutRowDto row = new FormUsageLookupOutRowDto();
        FormUsage formUsage = (FormUsage) 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_FormName_1_be
        row.setFormName(formUsage.getFormName());
        // .//GEN-END:_buildDto_FormName_1_be
        // .//GEN-BEGIN:_buildDto_EventName_1_be
        row.setEventName(formUsage.getEventName());
        // .//GEN-END:_buildDto_EventName_1_be
        // .//GEN-BEGIN:_buildDto_FormAlternate_1_be
        row.setFormAlternate(formUsage.getFormAlternate());
        // .//GEN-END:_buildDto_FormAlternate_1_be
        // .//GEN-BEGIN:_buildDto_Copies_1_be
        row.setCopies(formUsage.getCopies());
        // .//GEN-END:_buildDto_Copies_1_be
        // .//GEN-BEGIN:_buildDto_CreatedOn_1_be
        row.setCreatedOn(formUsage.getCreatedOn());
        // .//GEN-END:_buildDto_CreatedOn_1_be
        // .//GEN-BEGIN:_buildDto_CreatedBy_1_be
        row.setCreatedBy(formUsage.getCreatedBy());
        // .//GEN-END:_buildDto_CreatedBy_1_be
        // .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
        row.setLastChangedOn(formUsage.getLastChangedOn());
        // .//GEN-END:_buildDto_LastChangedOn_1_be
        // .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
        row.setLastChangedBy(formUsage.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 : FormUsageLookupOutRowDto(org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutRowDto) FormUsageLookupOutDto(org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutDto) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 3 with FormUsageLookupOutDto

use of org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutDto in project jaffa-framework by jaffa-projects.

the class FormUsageLookupForm 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();
    FormUsageLookupOutDto outputDto = (FormUsageLookupOutDto) ((FormUsageLookupComponent) getComponent()).getFinderOutDto();
    if (outputDto != null) {
        GridModelRow row;
        for (int i = 0; i < outputDto.getRowsCount(); i++) {
            FormUsageLookupOutRowDto rowDto = outputDto.getRows(i);
            row = rows.newRow();
            row.addElement(LookupComponent2.MULTI_SELECT_CHECKBOX, new CheckBoxModel(false));
            row.addElement("formName", rowDto.getFormName());
            row.addElement("eventName", rowDto.getEventName());
            row.addElement("formAlternate", rowDto.getFormAlternate());
            row.addElement("copies", rowDto.getCopies());
            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 : FormUsageLookupOutRowDto(org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutRowDto) FormUsageLookupOutDto(org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutDto)

Aggregations

FormUsageLookupOutDto (org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutDto)3 FormUsageLookupOutRowDto (org.jaffa.modules.printing.components.formusagelookup.dto.FormUsageLookupOutRowDto)2 FormUsage (org.jaffa.modules.printing.domain.FormUsage)1 AtomicCriteria (org.jaffa.persistence.AtomicCriteria)1 Criteria (org.jaffa.persistence.Criteria)1 UOW (org.jaffa.persistence.UOW)1