Search in sources :

Example 1 with OrderByField

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

the class BusinessEventLogFinderTx method buildCriteria.

// .//GEN-END:_find_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(BusinessEventLogFinderInDto input, UOW uow) {
    Criteria criteria = new Criteria();
    criteria.setTable(BusinessEventLogMeta.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.getLogId(), BusinessEventLogMeta.LOG_ID, criteria);
    FinderTx.addCriteria(input.getCorrelationType(), BusinessEventLogMeta.CORRELATION_TYPE, criteria);
    FinderTx.addCriteria(input.getCorrelationKey1(), BusinessEventLogMeta.CORRELATION_KEY1, criteria);
    FinderTx.addCriteria(input.getCorrelationKey2(), BusinessEventLogMeta.CORRELATION_KEY2, criteria);
    FinderTx.addCriteria(input.getCorrelationKey3(), BusinessEventLogMeta.CORRELATION_KEY3, criteria);
    FinderTx.addCriteria(input.getScheduledTaskId(), BusinessEventLogMeta.SCHEDULED_TASK_ID, criteria);
    FinderTx.addCriteria(input.getMessageId(), BusinessEventLogMeta.MESSAGE_ID, criteria);
    FinderTx.addCriteria(input.getLoggedOn(), BusinessEventLogMeta.LOGGED_ON, criteria);
    FinderTx.addCriteria(input.getLoggedBy(), BusinessEventLogMeta.LOGGED_BY, criteria);
    FinderTx.addCriteria(input.getProcessName(), BusinessEventLogMeta.PROCESS_NAME, criteria);
    FinderTx.addCriteria(input.getSubProcessName(), BusinessEventLogMeta.SUB_PROCESS_NAME, criteria);
    FinderTx.addCriteria(input.getMessageType(), BusinessEventLogMeta.MESSAGE_TYPE, criteria);
    FinderTx.addCriteria(input.getMessageText(), BusinessEventLogMeta.MESSAGE_TEXT, criteria);
    FinderTx.addCriteria(input.getSourceClass(), BusinessEventLogMeta.SOURCE_CLASS, criteria);
    FinderTx.addCriteria(input.getSourceMethod(), BusinessEventLogMeta.SOURCE_METHOD, criteria);
    FinderTx.addCriteria(input.getSourceLine(), BusinessEventLogMeta.SOURCE_LINE, criteria);
    FinderTx.addCriteria(input.getStackTrace(), BusinessEventLogMeta.STACK_TRACE, 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 2 with OrderByField

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

the class FormEventLookupTx method buildCriteria.

// .//GEN-END:_find_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(FormEventLookupInDto input, UOW uow) {
    Criteria criteria = new Criteria();
    criteria.setTable(FormEventMeta.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.getEventName(), FormEventMeta.EVENT_NAME, criteria);
    FinderTx.addCriteria(input.getDescription(), FormEventMeta.DESCRIPTION, 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 3 with OrderByField

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

the class MessageViewerTx method buildBusinessEventLogDto.

/**
 * Obtains the related business event logs.
 */
private void buildBusinessEventLogDto(MessageViewerInDto input, MessageViewerOutDto output, Message message) throws FrameworkException, ApplicationExceptions, JMSException {
    BusinessEventLogFinderInDto inputDto = new BusinessEventLogFinderInDto();
    inputDto.setMessageId(message.getStringProperty(JmsBrowser.HEADER_ORIGINAL_MESSAGE_ID) != null ? new StringCriteriaField(CriteriaField.RELATIONAL_EQUALS, message.getStringProperty(JmsBrowser.HEADER_ORIGINAL_MESSAGE_ID)) : new StringCriteriaField(CriteriaField.RELATIONAL_EQUALS, message.getJMSMessageID()));
    inputDto.setMaxRecords(new Integer(10));
    inputDto.setOrderByFields(new OrderByField[] { new OrderByField(BusinessEventLogMeta.LOGGED_ON, Boolean.FALSE) });
    BusinessEventLogFinderOutDto businessEventLogFinderOutDto = new BusinessEventLogFinderTx().find(inputDto);
    output.setBusinessEventLog(businessEventLogFinderOutDto);
}
Also used : BusinessEventLogFinderTx(org.jaffa.modules.messaging.components.businesseventlogfinder.tx.BusinessEventLogFinderTx) OrderByField(org.jaffa.components.finder.OrderByField) BusinessEventLogFinderOutDto(org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderOutDto) BusinessEventLogFinderInDto(org.jaffa.modules.messaging.components.businesseventlogfinder.dto.BusinessEventLogFinderInDto) StringCriteriaField(org.jaffa.components.finder.StringCriteriaField)

Example 4 with OrderByField

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

the class FormTemplateFinderTx method buildCriteria.

// .//GEN-END:_find_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(FormTemplateFinderInDto input, UOW uow) {
    Criteria criteria = new Criteria();
    criteria.setTable(FormTemplateMeta.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.getFormId(), FormTemplateMeta.FORM_ID, criteria);
    FinderTx.addCriteria(input.getTemplateData(), FormTemplateMeta.TEMPLATE_DATA, criteria);
    FinderTx.addCriteria(input.getLayoutData(), FormTemplateMeta.LAYOUT_DATA, 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 5 with OrderByField

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

the class AttachmentLookupTx method buildCriteria.

// .//GEN-END:_find_3_be
// .//GEN-BEGIN:_buildCriteria_1_be
private Criteria buildCriteria(AttachmentLookupInDto input, UOW uow) {
    Criteria criteria = new Criteria();
    criteria.setTable(AttachmentMeta.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.getAttachmentId(), AttachmentMeta.ATTACHMENT_ID, criteria);
    FinderTx.addCriteria(input.getSerializedKey(), AttachmentMeta.SERIALIZED_KEY, criteria);
    FinderTx.addCriteria(input.getOriginalFileName(), AttachmentMeta.ORIGINAL_FILE_NAME, criteria);
    FinderTx.addCriteria(input.getAttachmentType(), AttachmentMeta.ATTACHMENT_TYPE, criteria);
    FinderTx.addCriteria(input.getContentType(), AttachmentMeta.CONTENT_TYPE, criteria);
    FinderTx.addCriteria(input.getDescription(), AttachmentMeta.DESCRIPTION, criteria);
    FinderTx.addCriteria(input.getRemarks(), AttachmentMeta.REMARKS, criteria);
    FinderTx.addCriteria(input.getSupercededBy(), AttachmentMeta.SUPERCEDED_BY, criteria);
    FinderTx.addCriteria(input.getCreatedOn(), AttachmentMeta.CREATED_ON, criteria);
    FinderTx.addCriteria(input.getCreatedBy(), AttachmentMeta.CREATED_BY, criteria);
    FinderTx.addCriteria(input.getLastChangedOn(), AttachmentMeta.LAST_CHANGED_ON, criteria);
    FinderTx.addCriteria(input.getLastChangedBy(), AttachmentMeta.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)

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