Java Code Examples for org.apache.deltaspike.data.api.criteria.Criteria#orderAsc()

The following examples show how to use org.apache.deltaspike.data.api.criteria.Criteria#orderAsc() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreditCardInvoiceRepository.java    From web-budget with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Build the {@link Criteria} to search for {@link CreditCardInvoice}
 *
 * @param filter value
 * @param invoiceState to filter
 * @return the {@link Criteria} ready to search
 */
@SuppressWarnings("unchecked")
default Criteria<CreditCardInvoice, CreditCardInvoice> buildCriteria(String filter, InvoiceState invoiceState) {

    final Criteria<CreditCardInvoice, CreditCardInvoice> criteria = this.criteria();

    if (invoiceState != null) {
        criteria.eq(CreditCardInvoice_.invoiceState, invoiceState);
    }

    if (StringUtils.isNotBlank(filter)) {
        criteria.or(
                this.criteria().join(CreditCardInvoice_.card, where(Card.class)
                        .likeIgnoreCase(Card_.name, this.likeAny(filter))),
                this.criteria().join(CreditCardInvoice_.financialPeriod, where(FinancialPeriod.class)
                        .likeIgnoreCase(FinancialPeriod_.identification, this.likeAny(filter)))
        );
    }

    criteria.orderAsc(CreditCardInvoice_.financialPeriod);

    return criteria;
}
 
Example 2
Source File: CreditCardInvoiceRepository.java    From web-budget with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Build the {@link Criteria} to search for {@link CreditCardInvoice}
 *
 * @param filter value
 * @param invoiceState to filter
 * @return the {@link Criteria} ready to search
 */
@SuppressWarnings("unchecked")
default Criteria<CreditCardInvoice, CreditCardInvoice> buildCriteria(String filter, InvoiceState invoiceState) {

    final Criteria<CreditCardInvoice, CreditCardInvoice> criteria = this.criteria();

    if (invoiceState != null) {
        criteria.eq(CreditCardInvoice_.invoiceState, invoiceState);
    }

    if (StringUtils.isNotBlank(filter)) {
        criteria.or(
                this.criteria().join(CreditCardInvoice_.card, where(Card.class)
                        .likeIgnoreCase(Card_.name, this.likeAny(filter))),
                this.criteria().join(CreditCardInvoice_.financialPeriod, where(FinancialPeriod.class)
                        .likeIgnoreCase(FinancialPeriod_.identification, this.likeAny(filter)))
        );
    }

    criteria.orderAsc(CreditCardInvoice_.financialPeriod);

    return criteria;
}
 
Example 3
Source File: DeltaSpikeRepository.java    From library with Apache License 2.0 2 votes vote down vote up
/**
 * Method used to apply the order to the query
 *
 * @param criteria to be ordered
 */
default void applyOrder(Criteria<T, T> criteria) {
    criteria.orderAsc(PersistentEntity_.id);
}
 
Example 4
Source File: GroupRepository.java    From library with Apache License 2.0 2 votes vote down vote up
/**
 * {@inheritDoc }
 *
 * @param criteria
 */
@Override
default void applyOrder(Criteria<Group, Group> criteria) {
    criteria.orderAsc(Group_.name);
}
 
Example 5
Source File: DefaultRepository.java    From web-budget with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Use this method to set the default order to all the queries using the default repository
 *
 * @param criteria the criteria to be used
 */
default void setOrder(Criteria<T, T> criteria) {
    criteria.orderAsc(PersistentEntity_.id);
}
 
Example 6
Source File: MovementClassRepository.java    From web-budget with GNU General Public License v3.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @param criteria
 */
@Override
default void setOrder(Criteria<MovementClass, MovementClass> criteria) {
    criteria.orderAsc(MovementClass_.name);
}
 
Example 7
Source File: CostCenterRepository.java    From web-budget with GNU General Public License v3.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @param criteria
 */
@Override
default void setOrder(Criteria<CostCenter, CostCenter> criteria) {
    criteria.orderAsc(CostCenter_.name);
}
 
Example 8
Source File: DefaultRepository.java    From web-budget with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Use this method to set the default order to all the queries using the default repository
 *
 * @param criteria the criteria to be used
 */
default void setOrder(Criteria<T, T> criteria) {
    criteria.orderAsc(PersistentEntity_.id);
}
 
Example 9
Source File: MovementClassRepository.java    From web-budget with GNU General Public License v3.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @param criteria
 */
@Override
default void setOrder(Criteria<MovementClass, MovementClass> criteria) {
    criteria.orderAsc(MovementClass_.name);
}
 
Example 10
Source File: CostCenterRepository.java    From web-budget with GNU General Public License v3.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @param criteria
 */
@Override
default void setOrder(Criteria<CostCenter, CostCenter> criteria) {
    criteria.orderAsc(CostCenter_.name);
}