Search in sources :

Example 21 with OrderByField

use of org.jaffa.components.finder.OrderByField in project jaffa-framework by jaffa-projects.

the class FormUsageFinderTx method buildCriteria.

// .//GEN-END:_find_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(FormUsageFinderInDto input, UOW uow) {
    Criteria criteria = new Criteria();
    criteria.setTable(FormUsageMeta.getName());
    // .//GEN-END:_buildCriteria_1_be
    // Add custom criteria //GEN-FIRST:_buildCriteria_1
    // .//GEN-LAST:_buildCriteria_1
    // .//GEN-BEGIN:_buildCriteria_2_be
    FinderTx.addCriteria(input.getFormName(), FormUsageMeta.FORM_NAME, criteria);
    FinderTx.addCriteria(input.getEventName(), FormUsageMeta.EVENT_NAME, criteria);
    FinderTx.addCriteria(input.getFormAlternate(), FormUsageMeta.FORM_ALTERNATE, criteria);
    FinderTx.addCriteria(input.getCopies(), FormUsageMeta.COPIES, criteria);
    FinderTx.addCriteria(input.getCreatedOn(), FormUsageMeta.CREATED_ON, criteria);
    FinderTx.addCriteria(input.getCreatedBy(), FormUsageMeta.CREATED_BY, criteria);
    FinderTx.addCriteria(input.getLastChangedOn(), FormUsageMeta.LAST_CHANGED_ON, criteria);
    FinderTx.addCriteria(input.getLastChangedBy(), FormUsageMeta.LAST_CHANGED_BY, criteria);
    // append an orderBy clause to the criteria
    OrderByField[] orderByFields = input.getOrderByFields();
    if (orderByFields != null) {
        for (int i = 0; i < orderByFields.length; i++) {
            OrderByField orderByField = orderByFields[i];
            int sort = Criteria.ORDER_BY_ASC;
            if (orderByField.getSortAscending() != null && !orderByField.getSortAscending().booleanValue())
                sort = Criteria.ORDER_BY_DESC;
            criteria.addOrderBy(orderByField.getFieldName(), sort);
        }
    }
    // .//GEN-BEGIN:_buildCriteria_3_be
    return criteria;
}
Also used : OrderByField(org.jaffa.components.finder.OrderByField) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria)

Example 22 with OrderByField

use of org.jaffa.components.finder.OrderByField in project jaffa-framework by jaffa-projects.

the class FormUsageLookupTx method buildCriteria.

// .//GEN-END:_find_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(FormUsageLookupInDto input, UOW uow) {
    Criteria criteria = new Criteria();
    criteria.setTable(FormUsageMeta.getName());
    // .//GEN-END:_buildCriteria_1_be
    // Add custom criteria //GEN-FIRST:_buildCriteria_1
    // .//GEN-LAST:_buildCriteria_1
    // .//GEN-BEGIN:_buildCriteria_2_be
    FinderTx.addCriteria(input.getFormName(), FormUsageMeta.FORM_NAME, criteria);
    FinderTx.addCriteria(input.getEventName(), FormUsageMeta.EVENT_NAME, criteria);
    FinderTx.addCriteria(input.getFormAlternate(), FormUsageMeta.FORM_ALTERNATE, criteria);
    FinderTx.addCriteria(input.getCopies(), FormUsageMeta.COPIES, criteria);
    FinderTx.addCriteria(input.getCreatedOn(), FormUsageMeta.CREATED_ON, criteria);
    FinderTx.addCriteria(input.getCreatedBy(), FormUsageMeta.CREATED_BY, criteria);
    FinderTx.addCriteria(input.getLastChangedOn(), FormUsageMeta.LAST_CHANGED_ON, criteria);
    FinderTx.addCriteria(input.getLastChangedBy(), FormUsageMeta.LAST_CHANGED_BY, criteria);
    // append an orderBy clause to the criteria
    OrderByField[] orderByFields = input.getOrderByFields();
    if (orderByFields != null) {
        for (int i = 0; i < orderByFields.length; i++) {
            OrderByField orderByField = orderByFields[i];
            int sort = Criteria.ORDER_BY_ASC;
            if (orderByField.getSortAscending() != null && !orderByField.getSortAscending().booleanValue())
                sort = Criteria.ORDER_BY_DESC;
            criteria.addOrderBy(orderByField.getFieldName(), sort);
        }
    }
    // .//GEN-BEGIN:_buildCriteria_3_be
    return criteria;
}
Also used : OrderByField(org.jaffa.components.finder.OrderByField) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria)

Example 23 with OrderByField

use of org.jaffa.components.finder.OrderByField in project jaffa-framework by jaffa-projects.

the class OutputCommandFinderTx method buildCriteria.

// .//GEN-END:_find_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(OutputCommandFinderInDto input, UOW uow) {
    Criteria criteria = new Criteria();
    criteria.setTable(OutputCommandMeta.getName());
    // .//GEN-END:_buildCriteria_1_be
    // Add custom criteria //GEN-FIRST:_buildCriteria_1
    // .//GEN-LAST:_buildCriteria_1
    // .//GEN-BEGIN:_buildCriteria_2_be
    FinderTx.addCriteria(input.getOutputCommandId(), OutputCommandMeta.OUTPUT_COMMAND_ID, criteria);
    FinderTx.addCriteria(input.getOutputType(), OutputCommandMeta.OUTPUT_TYPE, criteria);
    FinderTx.addCriteria(input.getSequenceNo(), OutputCommandMeta.SEQUENCE_NO, criteria);
    FinderTx.addCriteria(input.getOsPattern(), OutputCommandMeta.OS_PATTERN, criteria);
    FinderTx.addCriteria(input.getCommandLine(), OutputCommandMeta.COMMAND_LINE, criteria);
    FinderTx.addCriteria(input.getCreatedOn(), OutputCommandMeta.CREATED_ON, criteria);
    FinderTx.addCriteria(input.getCreatedBy(), OutputCommandMeta.CREATED_BY, criteria);
    FinderTx.addCriteria(input.getLastChangedOn(), OutputCommandMeta.LAST_CHANGED_ON, criteria);
    FinderTx.addCriteria(input.getLastChangedBy(), OutputCommandMeta.LAST_CHANGED_BY, criteria);
    // append an orderBy clause to the criteria
    OrderByField[] orderByFields = input.getOrderByFields();
    if (orderByFields != null) {
        for (int i = 0; i < orderByFields.length; i++) {
            OrderByField orderByField = orderByFields[i];
            int sort = Criteria.ORDER_BY_ASC;
            if (orderByField.getSortAscending() != null && !orderByField.getSortAscending().booleanValue())
                sort = Criteria.ORDER_BY_DESC;
            criteria.addOrderBy(orderByField.getFieldName(), sort);
        }
    }
    // .//GEN-BEGIN:_buildCriteria_3_be
    return criteria;
}
Also used : OrderByField(org.jaffa.components.finder.OrderByField) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria)

Example 24 with OrderByField

use of org.jaffa.components.finder.OrderByField in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceTx method buildBusinessEventLogDto.

private BusinessEventLogFinderOutDto buildBusinessEventLogDto(ScheduledTask task) throws FrameworkException, ApplicationExceptions {
    // Create BusinessEventLogFinderInDto
    BusinessEventLogFinderInDto inputDto = new BusinessEventLogFinderInDto();
    inputDto.setScheduledTaskId(new StringCriteriaField(CriteriaField.RELATIONAL_EQUALS, task.getScheduledTaskId()));
    inputDto.setMaxRecords(new Integer(10));
    inputDto.setOrderByFields(new OrderByField[] { new OrderByField(BusinessEventLogMeta.LOGGED_ON, Boolean.FALSE) });
    // Retrive businessEventLogFinderOutDto
    return new BusinessEventLogFinderTx().find(inputDto);
}
Also used : BusinessEventLogFinderTx(org.jaffa.modules.messaging.components.businesseventlogfinder.tx.BusinessEventLogFinderTx) OrderByField(org.jaffa.components.finder.OrderByField) BusinessEventLogFinderInDto(org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderInDto) StringCriteriaField(org.jaffa.components.finder.StringCriteriaField)

Example 25 with OrderByField

use of org.jaffa.components.finder.OrderByField in project jaffa-framework by jaffa-projects.

the class PrinterDefinitionFinderTx method buildCriteria.

// .//GEN-END:_find_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(PrinterDefinitionFinderInDto input, UOW uow) {
    Criteria criteria = new Criteria();
    criteria.setTable(PrinterDefinitionMeta.getName());
    // .//GEN-END:_buildCriteria_1_be
    // Add custom criteria //GEN-FIRST:_buildCriteria_1
    // .//GEN-LAST:_buildCriteria_1
    // .//GEN-BEGIN:_buildCriteria_2_be
    FinderTx.addCriteria(input.getPrinterId(), PrinterDefinitionMeta.PRINTER_ID, criteria);
    FinderTx.addCriteria(input.getDescription(), PrinterDefinitionMeta.DESCRIPTION, criteria);
    FinderTx.addCriteria(input.getSiteCode(), PrinterDefinitionMeta.SITE_CODE, criteria);
    FinderTx.addCriteria(input.getLocationCode(), PrinterDefinitionMeta.LOCATION_CODE, criteria);
    FinderTx.addCriteria(input.getRealPrinterName(), PrinterDefinitionMeta.REAL_PRINTER_NAME, criteria);
    FinderTx.addCriteria(input.getOutputType(), PrinterDefinitionMeta.OUTPUT_TYPE, criteria);
    FinderTx.addCriteria(input.getScaleToPageSize(), PrinterDefinitionMeta.SCALE_TO_PAGE_SIZE, criteria);
    FinderTx.addCriteria(input.getRemote(), PrinterDefinitionMeta.REMOTE, criteria);
    // append an orderBy clause to the criteria
    OrderByField[] orderByFields = input.getOrderByFields();
    if (orderByFields != null) {
        for (int i = 0; i < orderByFields.length; i++) {
            OrderByField orderByField = orderByFields[i];
            int sort = Criteria.ORDER_BY_ASC;
            if (orderByField.getSortAscending() != null && !orderByField.getSortAscending().booleanValue())
                sort = Criteria.ORDER_BY_DESC;
            criteria.addOrderBy(orderByField.getFieldName(), sort);
        }
    }
    // limit the output
    criteria.setFirstResult(input.getFirstRecord());
    criteria.setMaxResults(input.getMaxRecords());
    // .//GEN-BEGIN:_buildCriteria_3_be
    return criteria;
}
Also used : OrderByField(org.jaffa.components.finder.OrderByField) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) Criteria(org.jaffa.persistence.Criteria)

Aggregations

OrderByField (org.jaffa.components.finder.OrderByField)31 Criteria (org.jaffa.persistence.Criteria)28 AtomicCriteria (org.jaffa.persistence.AtomicCriteria)27 StringCriteriaField (org.jaffa.components.finder.StringCriteriaField)2 BusinessEventLogFinderInDto (org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderInDto)2 BusinessEventLogFinderTx (org.jaffa.modules.messaging.components.businesseventlogfinder.tx.BusinessEventLogFinderTx)2 BusinessEventLogFinderOutDto (org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderOutDto)1