List of usage examples for org.hibernate.criterion Restrictions ne
public static SimpleExpression ne(String propertyName, Object value)
From source file:gov.nih.nci.caintegrator.data.DateComparisonCriterionHandler.java
License:BSD License
/** * {@inheritDoc}/*from w ww . j a v a 2 s.c o m*/ */ @Override Criterion translate() { if (dateComparisonCriterion.getDateComparisonOperator() != null) { DateComparisonOperatorEnum operator = dateComparisonCriterion.getDateComparisonOperator(); switch (operator) { case EQUAL: return Restrictions.eq(DATE_VALUE_COLUMN, dateComparisonCriterion.getDateValue()); case GREATER: return Restrictions.gt(DATE_VALUE_COLUMN, dateComparisonCriterion.getDateValue()); case GREATEROREQUAL: return Restrictions.ge(DATE_VALUE_COLUMN, dateComparisonCriterion.getDateValue()); case LESS: return Restrictions.lt(DATE_VALUE_COLUMN, dateComparisonCriterion.getDateValue()); case LESSOREQUAL: return Restrictions.le(DATE_VALUE_COLUMN, dateComparisonCriterion.getDateValue()); case NOTEQUAL: return Restrictions.ne(DATE_VALUE_COLUMN, dateComparisonCriterion.getDateValue()); default: throw new IllegalStateException("Unknown DateComparisonOperator: " + operator); } } else { throw new IllegalStateException("DateComparisonOperator is not set"); } }
From source file:gov.nih.nci.caintegrator.data.NumericComparisonCriterionHandler.java
License:BSD License
/** * {@inheritDoc}// w ww. j a v a 2s .c o m */ @Override Criterion translate() { if (numericComparisonCriterion.getNumericComparisonOperator() != null) { NumericComparisonOperatorEnum operator = numericComparisonCriterion.getNumericComparisonOperator(); switch (operator) { case EQUAL: return Restrictions.eq(NUMERIC_VALUE_COLUMN, numericComparisonCriterion.getNumericValue()); case GREATER: return Restrictions.gt(NUMERIC_VALUE_COLUMN, numericComparisonCriterion.getNumericValue()); case GREATEROREQUAL: return Restrictions.ge(NUMERIC_VALUE_COLUMN, numericComparisonCriterion.getNumericValue()); case LESS: return Restrictions.lt(NUMERIC_VALUE_COLUMN, numericComparisonCriterion.getNumericValue()); case LESSOREQUAL: return Restrictions.le(NUMERIC_VALUE_COLUMN, numericComparisonCriterion.getNumericValue()); case NOTEQUAL: return Restrictions.ne(NUMERIC_VALUE_COLUMN, numericComparisonCriterion.getNumericValue()); default: throw new IllegalStateException("Unknown NumericComparisonOperator: " + operator); } } else { throw new IllegalStateException("NumericComparisonOperator is not set"); } }
From source file:gov.nih.nci.caintegrator.data.StringComparisonCriterionHandler.java
License:BSD License
/** * {@inheritDoc}//from ww w . ja v a2s .c o m */ @Override Criterion translate() { if (stringComparisonCriterion.getWildCardType() != null) { WildCardTypeEnum wildCardType = stringComparisonCriterion.getWildCardType(); switch (wildCardType) { case WILDCARD_OFF: return Restrictions.like(columnName, stringComparisonCriterion.getStringValue()); case WILDCARD_AFTER_STRING: return Restrictions.like(columnName, stringComparisonCriterion.getStringValue(), MatchMode.START); case WILDCARD_BEFORE_STRING: return Restrictions.like(columnName, stringComparisonCriterion.getStringValue(), MatchMode.END); case WILDCARD_BEFORE_AND_AFTER_STRING: return Restrictions.like(columnName, stringComparisonCriterion.getStringValue(), MatchMode.ANYWHERE); case NOT_EQUAL_TO: return Restrictions.ne(columnName, stringComparisonCriterion.getStringValue()); default: return Restrictions.like(columnName, stringComparisonCriterion.getStringValue()); } } else { return Restrictions.like(columnName, stringComparisonCriterion.getStringValue()); } }
From source file:gov.nih.nci.firebird.service.protocol.FormTypeServiceBean.java
License:Open Source License
@Override @SuppressWarnings("unchecked") // Hibernate list() method is untyped public List<FormType> getStandardConfigureableForms(RegistrationType registrationType) { List<FormType> allConfigurableForms = getSession().createCriteria(FormType.class) .add(Restrictions.isNotNull(FORM_TYPE_ENUM_PROP)) .add(Restrictions.ne(INV_OPTIONALITY_ENUM_PROP, FormOptionality.SUPPLEMENTARY)) .add(Restrictions.ne(SUBINV_OPTIONALITY_ENUM_PROP, FormOptionality.SUPPLEMENTARY)).list(); filterByType(allConfigurableForms, registrationType); return allConfigurableForms; }
From source file:grails.orm.HibernateCriteriaBuilder.java
License:Apache License
/** * Creates a "not equal" Criterion based on the specified property name and value * @param propertyName The property name * @param propertyValue The property value * @return The criterion object//w w w. j a va 2s .c om */ public org.grails.datastore.mapping.query.api.Criteria ne(String propertyName, Object propertyValue) { if (!validateSimpleExpression()) { throwRuntimeException(new IllegalArgumentException("Call to [ne] with propertyName [" + propertyName + "] and value [" + propertyValue + "] not allowed here.")); } propertyName = calculatePropertyName(propertyName); propertyValue = calculatePropertyValue(propertyValue); addToCriteria(Restrictions.ne(propertyName, propertyValue)); return this; }
From source file:helper.FirmaHelper.java
public List<Firma> list() throws Exception { Session session = null;//from w w w .jav a2 s . c o m List<Firma> list = new ArrayList<>(); try { session = sessionFactory.openSession(); list = session.createCriteria(Firma.class, "firma").add(Restrictions.ne("firma.isAktif", false)).list(); } catch (Exception e) { throw e; } finally { session.close(); } return list; }
From source file:helper.GelirHelper.java
public List<Siparis> listGelirRapor(Date startDate, Date endDate) throws Exception { List<Siparis> list = new ArrayList<>(); Session session = null;//w w w .ja va2s . c o m try { session = sessionFactory.openSession(); list = session.createCriteria(Siparis.class, "siparis").createAlias("siparis.personel", "personel") .createAlias("personel.yetki", "yetki").createAlias("siparis.masa", "masa") .createAlias("masa.gelir", "gelir").createAlias("siparis.stok", "stok") .createAlias("stok.urun", "urun").createAlias("stok.firma", "firma") .createAlias("urun.urunTur", "urunTuru") .add(Restrictions.between("siparis.satisTarihi", startDate, endDate)) .add(Restrictions.ne("siparis.isAktif", false)).add(Restrictions.ne("personel.isAktif", false)) .add(Restrictions.ne("masa.isAktif", false)).add(Restrictions.ne("gelir.isAktif", false)) .add(Restrictions.eq("siparis.isOdendi", true)).add(Restrictions.eq("masa.isOdendi", true)) .add(Restrictions.ne("siparis.isIptal", true)).addOrder(Order.desc("siparis.satisTarihi")) .list(); } catch (Exception e) { throw e; } finally { session.close(); } return list; }
From source file:helper.GiderHelper.java
public List<Gider> listStok(Date startDate, Date endDate) throws Exception { Session session = null;//from w w w . j a v a2 s. com List<Gider> list = new ArrayList<>(); try { session = sessionFactory.openSession(); list = session.createCriteria(Gider.class, "gider").createAlias("gider.giderTuru", "giderTuru") .createAlias("gider.stok", "stok").createAlias("stok.urun", "urun") .createAlias("stok.firma", "firma").createAlias("urun.urunTur", "urunTur") .add(Restrictions.ne("gider.isAktif", false)).add(Restrictions.ne("stok.isAktif", false)) .add(Restrictions.ne("giderTuru.isAktif", false)).add(Restrictions.ne("urun.isAktif", false)) .add(Restrictions.between("gider.alisTarihi", startDate, endDate)) .addOrder(Order.desc("gider.alisTarihi")).list(); System.out.println(list.size()); } catch (Exception e) { System.out.println(e.toString()); throw e; } finally { session.close(); } return list; }
From source file:helper.GiderTuruHelper.java
public List<GiderTuru> list() throws Exception { Session session = null;/*from w ww . ja va 2 s.co m*/ List<GiderTuru> list = new ArrayList<>(); try { session = sessionFactory.openSession(); list = session.createCriteria(GiderTuru.class, "giderTuru") .add(Restrictions.ne("giderTuru.isAktif", false)).list(); } catch (Exception e) { throw e; } finally { session.close(); } return list; }
From source file:helper.LogDurumHelper.java
public List<LogDurum> listLogDurum() throws Exception { Session session = null;//from w w w . j a v a 2 s.c om List<LogDurum> list = new ArrayList<>(); try { session = sessionFactory.openSession(); list = session.createCriteria(LogDurum.class, "logDurum") .add(Restrictions.ne("logDurum.isAktif", false)).list(); } catch (Exception e) { throw e; } finally { session.close(); } return list; }