Example usage for org.hibernate.criterion Restrictions le

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

Introduction

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

Prototype

public static SimpleExpression le(String propertyName, Object value) 

Source Link

Document

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

Usage

From source file:com.ut.tekir.stock.ProductVirementBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("serial", filterModel.getSerial(), MatchMode.START));
    }//from  w  w w  . ja v a  2s.co  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.getWarehouse() != null) {
        crit.add(Restrictions.eq("warehouse", filterModel.getWarehouse()));
    }

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

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

    crit.addOrder(Order.desc("date"));
    crit.addOrder(Order.desc("serial"));
    return crit;
}

From source file:com.ut.tekir.stock.PurchaseOrderBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

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

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

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }/*from  w w  w  .j  a va 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.getWarehouse() != null) {
        crit.add(Restrictions.eq("this.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.name", filterModel.getContactName(), MatchMode.START));
    }

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

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

    return crit;
}

From source file:com.ut.tekir.stock.PurchaseShipmentBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

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

    crit.setProjection(Projections.projectionList().add(Projections.property("id"), "id")
            .add(Projections.property("serial"), "serial").add(Projections.property("reference"), "reference")
            .add(Projections.property("code"), "code").add(Projections.property("date"), "date")
            .add(Projections.property("info"), "info").add(Projections.property("warehouse"), "warehouse")
            .add(Projections.property("contact.fullname"), "contactName")
            .add(Projections.property("contact.code"), "contactCode"))
            .setResultTransformer(Transformers.aliasToBean(ShipmentFilterModel.class));

    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.getContactName())) {
        crit.add(Restrictions.ilike("contact.fullname", filterModel.getContactName(), MatchMode.ANYWHERE));
    }

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

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

    return crit;
}

From source file:com.ut.tekir.stock.SaleOrderBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

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

    crit.setProjection(Projections.projectionList().add(Projections.property("id"), "id")
            .add(Projections.property("serial"), "serial").add(Projections.property("reference"), "reference")
            .add(Projections.property("code"), "code").add(Projections.property("status"), "status")
            .add(Projections.property("date"), "date").add(Projections.property("info"), "info")
            .add(Projections.property("warehouse"), "warehouse")
            .add(Projections.property("contact.name"), "contactName")
            .add(Projections.property("contact.code"), "contactCode"))
            .setResultTransformer(Transformers.aliasToBean(OrderFilterModel.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("serial", filterModel.getSerial(), MatchMode.START));
    }/* ww  w.  j a  va2  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.name", filterModel.getContactName(), MatchMode.START));
    }

    if (filterModel.getStatus() != null) {
        crit.add(Restrictions.eq("status", filterModel.getStatus()));
    }

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

    return crit;
}

From source file:com.ut.tekir.stock.SaleShipmentBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

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

    crit.setProjection(Projections.projectionList().add(Projections.property("id"), "id")
            .add(Projections.property("serial"), "serial").add(Projections.property("reference"), "reference")
            .add(Projections.property("code"), "code").add(Projections.property("date"), "date")
            .add(Projections.property("info"), "info").add(Projections.property("warehouse"), "warehouse")
            .add(Projections.property("contact.fullname"), "contactName")
            .add(Projections.property("contact.code"), "contactCode"))
            .setResultTransformer(Transformers.aliasToBean(ShipmentFilterModel.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }//  w w w  . j  a  va 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.getWarehouse() != null) {
        crit.add(Restrictions.eq("this.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.ANYWHERE));
    }

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

    return crit;
}

From source file:com.ut.tekir.stock.SpendingNoteBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

    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.info"), "info")
            .add(Projections.property("this.date"), "date")
            .add(Projections.property("this.warehouse"), "warehouse")
            .add(Projections.property("this.employee"), "employee"))
            .setResultTransformer(Transformers.aliasToBean(SpendingNote.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.like("this.serial", filterModel.getSerial() + "%"));
    }//from w  w  w.ja  va 2  s .  c  o  m

    if (isNotEmpty(filterModel.getReference())) {
        crit.add(Restrictions.like("this.reference", filterModel.getReference() + "%"));
    }

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

    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.getWarehouse() != null) {
        crit.add(Restrictions.eq("this.warehouse", filterModel.getWarehouse()));
    }

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

    return crit;
}

From source file:com.ut.tekir.stock.yeni.PurchaseShipmentBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

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

    crit.setProjection(Projections.projectionList().add(Projections.property("id"), "id")
            .add(Projections.property("serial"), "serial").add(Projections.property("reference"), "reference")
            .add(Projections.property("code"), "code").add(Projections.property("date"), "date")
            .add(Projections.property("info"), "info").add(Projections.property("info1"), "info1")
            .add(Projections.property("info2"), "info2").add(Projections.property("warehouse"), "warehouse")
            .add(Projections.property("contact.fullname"), "contactName")
            .add(Projections.property("contact.company"), "company")
            .add(Projections.property("contact.person"), "person")
            .add(Projections.property("contact.code"), "contactCode")
            .add(Projections.property("workBunch"), "workBunch"))
            .setResultTransformer(Transformers.aliasToBean(ShipmentFilterModel.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }//from   w w  w  .ja  va  2  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 (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.getWarehouse() != null) {
        crit.add(Restrictions.eq("this.warehouse", filterModel.getWarehouse()));
    }

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

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

    if (filterModel.getInvoiced() != null) {
        if (filterModel.getInvoiced().equals(Boolean.TRUE)) {
            crit.add(Restrictions.isNotNull("this.invoice"));
        } else {
            crit.add(Restrictions.isNull("this.invoice"));
        }
    }

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

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

    return crit;
}

From source file:com.ut.tekir.stock.yeni.SaleOrderBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

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

    crit.setProjection(Projections.projectionList().add(Projections.property("id"), "id")
            .add(Projections.property("serial"), "serial").add(Projections.property("reference"), "reference")
            .add(Projections.property("code"), "code").add(Projections.property("status"), "status")
            .add(Projections.property("date"), "date").add(Projections.property("deliveryDate"), "deliveryDate")
            .add(Projections.property("info"), "info").add(Projections.property("warehouse"), "warehouse")
            .add(Projections.property("contact.fullname"), "contactName")
            .add(Projections.property("contact.code"), "contactCode")
            .add(Projections.property("contact.person"), "person")
            .add(Projections.property("contact.company"), "company")
            .add(Projections.property("workBunch"), "workBunch"))
            .setResultTransformer(Transformers.aliasToBean(OrderFilterModel.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }//w w  w . ja v a 2s .  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 (filterModel.getDeliveryBeginDate() != null) {
        crit.add(Restrictions.ge("this.deliveryDate", filterModel.getDeliveryBeginDate()));
    }

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

    if (filterModel.getWarehouse() != null) {
        crit.add(Restrictions.eq("this.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.name", filterModel.getContactName(), MatchMode.START));
    }

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

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

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

    return crit;
}

From source file:com.ut.tekir.stock.yeni.SaleShipmentBrowseBean.java

License:LGPL

@Override
public DetachedCriteria buildCriteria() {

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

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

    crit.setProjection(Projections.projectionList().add(Projections.property("id"), "id")
            .add(Projections.property("serial"), "serial").add(Projections.property("reference"), "reference")
            .add(Projections.property("code"), "code").add(Projections.property("date"), "date")
            .add(Projections.property("info1"), "info1").add(Projections.property("info2"), "info2")
            .add(Projections.property("warehouse"), "warehouse")
            .add(Projections.property("contact.fullname"), "contactName")
            .add(Projections.property("contact.company"), "company")
            .add(Projections.property("contact.person"), "person")
            .add(Projections.property("contact.code"), "contactCode")
            .add(Projections.property("workBunch"), "workBunch"))
            .setResultTransformer(Transformers.aliasToBean(ShipmentFilterModel.class));

    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }//  w  w  w  .j  a v  a 2s.  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 (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.getWarehouse() != null) {
        crit.add(Restrictions.eq("this.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.ANYWHERE));
    }

    if (filterModel.getInvoiced() != null) {
        if (filterModel.getInvoiced().equals(Boolean.TRUE)) {
            crit.add(Restrictions.isNotNull("this.invoice"));
        } else {
            crit.add(Restrictions.isNull("this.invoice"));
        }
    }

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

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

    return crit;
}

From source file:com.ut.tekir.tender.TenderBrowseBean.java

License:LGPL

private void addRestrictions(DetachedCriteria crit) {
    if (isNotEmpty(filterModel.getSerial())) {
        crit.add(Restrictions.ilike("this.serial", filterModel.getSerial(), MatchMode.START));
    }//from   ww w. jav a 2  s. co m

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

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

    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()));
    }
}