Example usage for org.hibernate.criterion Restrictions ge

List of usage examples for org.hibernate.criterion Restrictions ge

Introduction

In this page you can find the example usage for org.hibernate.criterion Restrictions ge.

Prototype

public static SimpleExpression ge(String propertyName, Object value) 

Source Link

Document

Apply a "greater than or equal" constraint to the named property

Usage

From source file:com.ut.tekir.finance.PromissoryToBankPayrollBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(PromissoryToBankPayroll.class);

    crit.createAlias("this.bank", "bank");
    crit.createAlias("this.bankBranch", "bankBranch");
    crit.createAlias("this.bankAccount", "bankAccount");

    crit.setProjection(Projections.projectionList().add(Projections.property("this.id"), "id")
            .add(Projections.property("this.serial"), "serial")
            .add(Projections.property("this.reference"), "reference")
            .add(Projections.property("this.code"), "code").add(Projections.property("this.date"), "date")
            .add(Projections.property("this.info"), "info").add(Projections.property("bank.name"), "bankName")
            .add(Projections.property("bankBranch.name"), "bankBranchName")
            .add(Projections.property("bankAccount.name"), "bankAccountName"))
            .setResultTransformer(Transformers.aliasToBean(PromissoryToBankPayrollFilterModel.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }/*from   w  ww . j av a 2  s . c om*/

    if (isNotEmpty(filterModel.getReference())) {
        crit.add(Restrictions.ilike("this.reference", filterModel.getReference(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getCode())) {
        crit.add(Restrictions.ilike("this.code", filterModel.getCode(), MatchMode.START));
    }

    if (filterModel.getBeginDate() != null) {
        crit.add(Restrictions.ge("this.date", filterModel.getBeginDate()));
    }

    if (filterModel.getEndDate() != null) {
        crit.add(Restrictions.le("this.date", filterModel.getEndDate()));
    }

    if (filterModel.getBank() != null) {
        crit.add(Restrictions.eq("this.bank", filterModel.getBank()));
    }
    if (filterModel.getBankBranch() != null) {
        crit.add(Restrictions.eq("this.bankBranch", filterModel.getBankBranch()));
    }
    if (filterModel.getBankAccount() != null) {
        crit.add(Restrictions.eq("this.bankAccount", filterModel.getBankAccount()));
    }

    crit.addOrder(Order.desc("this.date"));

    return crit;
}

From source file:com.ut.tekir.finance.PromissoryToContactPayrollBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(PromissoryToContactPayroll.class);

    crit.createAlias("contact", "contact");

    crit.setProjection(Projections.projectionList().add(Projections.property("this.id"), "id")
            .add(Projections.property("this.serial"), "serial")
            .add(Projections.property("this.reference"), "reference")
            .add(Projections.property("this.code"), "code").add(Projections.property("this.date"), "date")
            .add(Projections.property("this.info"), "info")
            .add(Projections.property("contact.code"), "contactCode")
            .add(Projections.property("contact.company"), "company")
            .add(Projections.property("contact.person"), "person")
            .add(Projections.property("contact.name"), "contactName"))
            .setResultTransformer(Transformers.aliasToBean(PromissoryToContactPayrollFilterModel.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }/*from   w ww.j a  v  a2  s.  c o  m*/

    if (isNotEmpty(filterModel.getReference())) {
        crit.add(Restrictions.ilike("this.reference", filterModel.getReference(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getCode())) {
        crit.add(Restrictions.ilike("this.code", filterModel.getCode(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getContactName())) {
        crit.add(Restrictions.ilike("contact.name", "%" + filterModel.getContactName(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getContactCode())) {
        crit.add(Restrictions.ilike("contact.code", "%" + filterModel.getContactCode(), MatchMode.START));
    }

    if (filterModel.getBeginDate() != null) {
        crit.add(Restrictions.ge("this.date", filterModel.getBeginDate()));
    }

    if (filterModel.getEndDate() != null) {
        crit.add(Restrictions.le("this.date", filterModel.getEndDate()));
    }

    crit.addOrder(Order.desc("this.date"));
    crit.addOrder(Order.desc("this.serial"));

    return crit;
}

From source file:com.ut.tekir.finance.SecurityBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(Security.class);

    if (isNotEmpty(filterModel.getIsin())) {
        crit.add(Restrictions.like("isin", filterModel.getIsin() + "%"));
    }//from w w w .  ja v  a  2s.  c  o m

    if (isNotEmpty(filterModel.getCode())) {
        crit.add(Restrictions.like("code", filterModel.getCode() + "%"));
    }

    if (filterModel.getBeginIssueDate() != null) {
        crit.add(Restrictions.ge("issueDate", filterModel.getBeginIssueDate()));
    }

    if (filterModel.getEndIssueDate() != null) {
        crit.add(Restrictions.le("issueDate", filterModel.getEndIssueDate()));
    }
    if (filterModel.getBeginMaturityDate() != null) {
        crit.add(Restrictions.ge("maturityDate", filterModel.getBeginMaturityDate()));
    }

    if (filterModel.getEndMaturityDate() != null) {
        crit.add(Restrictions.le("maturityDate", filterModel.getEndMaturityDate()));
    }

    if (filterModel.getSecurityType() != null && !filterModel.getSecurityType().equals(SecurityType.All)) {
        crit.add(Restrictions.eq("securityType", filterModel.getSecurityType()));
    }
    return crit;
}

From source file:com.ut.tekir.finance.WorkBunchBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(WorkBunch.class);
    if (isNotEmpty(filterModel.getCode())) {
        crit.add(Restrictions.ilike("this.code", filterModel.getCode(), MatchMode.START));
    }/* w ww. j  av a2  s. com*/
    if (filterModel.getContact() != null) {
        crit.add(Restrictions.eq("this.contact", filterModel.getContact()));
    }
    if (filterModel.getBeginDate() != null) {
        crit.add(Restrictions.ge("this.beginDate", filterModel.getBeginDate()));
    }
    if (filterModel.getEndDate() != null) {
        crit.add(Restrictions.le("this.endDate", filterModel.getEndDate()));
    }
    if (filterModel.getWorkBunchStatus() != null && filterModel.getWorkBunchStatus() != WorkBunchStatus.All) {
        crit.add(Restrictions.eq("this.workBunchStatus", filterModel.getWorkBunchStatus()));
    }
    if (isNotEmpty(filterModel.getName())) {
        crit.add(Restrictions.ilike("this.name", filterModel.getName(), MatchMode.ANYWHERE));
    }
    crit.addOrder(Order.desc("this.beginDate"));
    crit.addOrder(Order.desc("this.endDate"));
    crit.addOrder(Order.asc("this.code"));

    return crit;
}

From source file:com.ut.tekir.general.PaymentContractBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(PaymentContract.class);

    if (isNotEmpty(filterModel.getCode())) {
        crit.add(Restrictions.ilike("this.code", filterModel.getCode(), MatchMode.START));
    }/*w w  w . ja v  a  2 s .  c o  m*/

    if (isNotEmpty(filterModel.getName())) {
        crit.add(Restrictions.ilike("this.name", filterModel.getName(), MatchMode.START));
    }

    if (filterModel.getBeginDate() != null) {
        crit.add(Restrictions.ge("this.beginDate", filterModel.getBeginDate()));
    }

    if (filterModel.getEndDate() != null) {
        crit.add(Restrictions.le("this.endDate", filterModel.getEndDate()));
    }

    if (filterModel.getCardOwnerType() != null) {
        crit.add(Restrictions.eq("this.cardOwnerType", filterModel.getCardOwnerType()));
    }

    if (filterModel.getPaymentType() != null) {
        crit.add(Restrictions.eq("this.paymentType", filterModel.getPaymentType()));
    }

    if (filterModel.getOwnerType() != null) {
        crit.add(Restrictions.eq("this.ownerType", filterModel.getOwnerType()));
    }

    crit.addOrder(Order.desc("this.beginDate"));
    crit.addOrder(Order.desc("this.code"));

    return crit;
}

From source file:com.ut.tekir.general.PosCommisionBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(PosCommision.class);

    //crit.createAlias("detailList", "detailList");
    crit.createAlias("pos", "pos");
    crit.createAlias("pos.bank", "bank");
    crit.createAlias("pos.bankBranch", "bankBranch");
    crit.createAlias("pos.bankAccount", "bankAccount");
    crit.setProjection(Projections.projectionList()
            //                .add(Projections.property("detailList.month"), "month")
            //              .add(Projections.property("detailList.rate"), "rate")
            //                .add(Projections.property("detailList.valor"), "valor")
            //                .add(Projections.property("detailList"), "detailList")
            .add(Projections.property("pos"), "pos").add(Projections.property("id"), "id")
            .add(Projections.property("pos.bank"), "bank")
            .add(Projections.property("pos.bankBranch"), "bankBranch")
            .add(Projections.property("pos.bankAccount"), "bankAccount")
            .add(Projections.property("startDate"), "startDate").add(Projections.property("endDate"), "endDate")

    ).setResultTransformer(Transformers.aliasToBean(PosCommisionFilterModel.class));

    if (filterModel.getBank() != null) {
        crit.add(Restrictions.eq("pos.bank", filterModel.getBank()));
    }//from   w w w.  j  ava  2 s .com

    if (filterModel.getBankBranch() != null) {
        crit.add(Restrictions.eq("pos.bankBranch", filterModel.getBankBranch()));
    }

    if (filterModel.getBankAccount() != null) {
        crit.add(Restrictions.eq("pos.bankAccount", filterModel.getBankAccount()));
    }

    if (filterModel.getPos() != null) {
        crit.add(Restrictions.eq("this.pos", filterModel.getPos()));
    }

    //        if (filterModel.getMonth() != null) {
    //            crit.add(Restrictions.eq("detailList.month", filterModel.getMonth()));
    //        }

    if (filterModel.getStartDate() != null) {
        crit.add(Restrictions.ge("this.startDate", filterModel.getStartDate()));
    }

    if (filterModel.getEndDate() != null) {
        crit.add(Restrictions.le("this.endDate", filterModel.getEndDate()));
    }

    crit.addOrder(Order.desc("this.id"));

    return crit;
}

From source file:com.ut.tekir.general.WorkBunchSuggestionBean.java

License:LGPL

@SuppressWarnings("unchecked")
public void selectWorkBunchList() {

    HibernateSessionProxy session = (HibernateSessionProxy) entityManager.getDelegate();
    Criteria crit = session.createCriteria(WorkBunch.class);

    if (getCode() != null && getCode().length() > 0) {
        crit.add(Restrictions.like("this.code", getCode() + "%"));
    }/* www .ja  v  a 2 s  .  c o m*/
    if (getName() != null && getName().length() > 0) {
        crit.add(Restrictions.like("this.name", getName() + "%"));
    }
    if (getContact() != null) {
        crit.add(Restrictions.eq("this.contact", getContact()));
    }
    if (getWorkBunchStatus() != null && getWorkBunchStatus() != WorkBunchStatus.All) {
        crit.add(Restrictions.eq("this.WorkBunchStatus", getWorkBunchStatus()));
    }
    if (getEndDate() != null) {
        crit.add(Restrictions.le("this.endDate", getEndDate()));
    }
    if (getBeginDate() != null) {
        crit.add(Restrictions.ge("this.beginDate", getBeginDate()));
    }
    crit.add(Restrictions.eq("this.active", true));

    crit.setProjection(Projections.projectionList().add(Projections.property("code"), "code")
            .add(Projections.property("name"), "name").add(Projections.property("contact"), "contact")
            .add(Projections.property("workBunchStatus"), "workBunchStatus")
            .add(Projections.property("beginDate"), "beginDate")
            .add(Projections.property("endDate"), "endDate"));

    crit.setMaxResults(30);

    setWorkBunchList(crit.list());
}

From source file:com.ut.tekir.invoice.PurchaseInvoiceBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(Invoice.class);

    crit.createAlias("this.contact", "contact");

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("serial", filterModel.getSerial(), MatchMode.START));
    }/*from ww w  .j a va 2  s.  c om*/

    if (isNotEmpty(filterModel.getReference())) {
        crit.add(Restrictions.ilike("reference", filterModel.getReference(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getCode())) {
        crit.add(Restrictions.ilike("code", filterModel.getCode(), MatchMode.START));
    }

    if (filterModel.getBeginDate() != null) {
        crit.add(Restrictions.ge("date", filterModel.getBeginDate()));
    }

    if (filterModel.getEndDate() != null) {
        crit.add(Restrictions.le("date", filterModel.getEndDate()));
    }

    /*
    if( filterModel.getWarehouse() != null ){
    crit.add( Restrictions.eq("warehouse", filterModel.getWarehouse() ));
    }
            
    */

    if (isNotEmpty(filterModel.getContactCode())) {
        crit.add(Restrictions.ilike("contact.code", filterModel.getContactCode(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getContactName())) {
        crit.add(Restrictions.ilike("contact.fullname", filterModel.getContactName(), MatchMode.START));
    }

    crit.add(Restrictions.eq("action", TradeAction.Purchase));
    crit.addOrder(Order.desc("serial"));

    return crit;
}

From source file:com.ut.tekir.invoice.SaleInvoiceBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(Invoice.class);

    crit.createAlias("this.contact", "contact");

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("serial", filterModel.getSerial(), MatchMode.START));
    }/*from  w  w w.j a  v a2s .  c o m*/

    if (isNotEmpty(filterModel.getReference())) {
        crit.add(Restrictions.ilike("reference", filterModel.getReference(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getCode())) {
        crit.add(Restrictions.ilike("code", filterModel.getCode(), MatchMode.START));
    }

    if (filterModel.getBeginDate() != null) {
        crit.add(Restrictions.ge("date", filterModel.getBeginDate()));
    }

    if (filterModel.getEndDate() != null) {
        crit.add(Restrictions.le("date", filterModel.getEndDate()));
    }

    /*
    if( filterModel.getWarehouse() != null ){
    crit.add( Restrictions.eq("warehouse", filterModel.getWarehouse() ));
    }
     */

    if (isNotEmpty(filterModel.getContactCode())) {
        crit.add(Restrictions.ilike("contact.code", filterModel.getContactCode(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getContactName())) {
        crit.add(Restrictions.ilike("contact.fullname", filterModel.getContactName(), MatchMode.START));
    }

    crit.add(Restrictions.eq("action", TradeAction.Sale));
    crit.addOrder(Order.desc("serial"));

    return crit;
}

From source file:com.ut.tekir.invoice.yeni.PurchaseInvoiceBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

    DetachedCriteria crit = DetachedCriteria.forClass(TekirInvoice.class);

    crit.createAlias("this.contact", "contact");
    crit.createAlias("this.warehouse", "warehouse");

    crit.setProjection(Projections.projectionList().add(Projections.property("contact"), "contact")
            .add(Projections.property("warehouse"), "warehouse").add(Projections.property("serial"), "serial")
            .add(Projections.property("reference"), "reference").add(Projections.property("code"), "code")
            .add(Projections.property("date"), "date").add(Projections.property("contact.code"), "contactCode")
            .add(Projections.property("contact.fullname"), "contactName")
            .add(Projections.property("tradeAction"), "tradeAction")
            .add(Projections.property("documentType"), "documentType").add(Projections.property("id"), "id")
            .add(Projections.property("info"), "info")
            .add(Projections.property("totalBeforeTax.localAmount"), "totalBeforeTaxLocalAmount")
            .add(Projections.property("totalBeforeTax.value"), "totalBeforeTaxValue")
            .add(Projections.property("totalBeforeTax.currency"), "totalBeforeTaxCurrency")
            .add(Projections.property("totalTax.localAmount"), "totalTaxLocalAmount")
            .add(Projections.property("totalTax.value"), "totalTaxValue")
            .add(Projections.property("totalTax.currency"), "totalTaxCurrency")
            .add(Projections.property("grandTotal.localAmount"), "grandTotalLocalAmount")
            .add(Projections.property("grandTotal.value"), "grandTotalValue")
            .add(Projections.property("grandTotal.currency"), "grandTotalCurrency")
            .add(Projections.property("workBunch"), "workBunch"));

    crit.setResultTransformer(Transformers.aliasToBean(InvoiceFilterModel.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }/*  w  w  w  . j  a v a 2  s .  com*/

    if (isNotEmpty(filterModel.getReference())) {
        crit.add(Restrictions.ilike("this.reference", filterModel.getReference(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getCode())) {
        crit.add(Restrictions.ilike("this.code", filterModel.getCode(), MatchMode.START));
    }

    if (filterModel.getBeginDate() != null) {
        crit.add(Restrictions.ge("this.date", filterModel.getBeginDate()));
    }

    if (filterModel.getEndDate() != null) {
        crit.add(Restrictions.le("this.date", filterModel.getEndDate()));
    }

    if (isNotEmpty(filterModel.getContactCode())) {
        crit.add(Restrictions.ilike("contact.code", filterModel.getContactCode(), MatchMode.START));
    }

    if (isNotEmpty(filterModel.getContactName())) {
        crit.add(Restrictions.ilike("contact.fullname", filterModel.getContactName(), MatchMode.ANYWHERE));
    }

    if (isNotEmpty(filterModel.getInfo())) {
        crit.add(Restrictions.ilike("this.info", filterModel.getInfo(), MatchMode.ANYWHERE));
    }

    if (filterModel.getWorkBunch() != null) {
        crit.add(Restrictions.eq("this.workBunch", filterModel.getWorkBunch()));
    }

    if (filterModel.getReturned() != null) {
        if (filterModel.getReturned()) {
            crit.add(Restrictions.eq("this.tradeAction", TradeAction.SaleReturn));
        } else {
            crit.add(Restrictions.eq("this.tradeAction", TradeAction.Purchase));
        }
    } else {
        crit.add(Restrictions.or(Restrictions.eq("this.tradeAction", TradeAction.SaleReturn),
                Restrictions.eq("this.tradeAction", TradeAction.Purchase)));
    }

    crit.add(Restrictions.or(Restrictions.eq("this.documentType", DocumentType.PurchaseInvoice),
            Restrictions.eq("this.documentType", DocumentType.PurchaseShipmentInvoice)));

    crit.addOrder(Order.desc("this.date"));
    crit.addOrder(Order.desc("this.serial"));

    return crit;
}