List of usage examples for org.hibernate.criterion Restrictions or
public static LogicalExpression or(Criterion lhs, Criterion rhs)
From source file:au.org.theark.study.model.dao.StudyDao.java
License:Open Source License
public List<CustomField> getBinaryCustomFieldsForPedigreeRelativesList(Long studyId) { List<CustomField> pedigreeCustomFields = null; Criteria criteria = getSession().createCriteria(CustomField.class, "cf"); criteria.createAlias("study", "st", JoinType.INNER_JOIN); criteria.createAlias("arkFunction", "af", JoinType.INNER_JOIN); criteria.createAlias("customFieldType", "cft", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("fieldType", "ft", JoinType.INNER_JOIN); criteria.add(Restrictions.eq("st.id", studyId)); criteria.add(//from w ww. java 2 s .co m Restrictions.eq("af.name", au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT_CUSTOM_FIELD)); criteria.add(Restrictions.eq("cf.encodedValues", "0=Yes;1=No;").ignoreCase()); criteria.add(Restrictions.or(Restrictions.isNull("cft.id"), Restrictions.eq("cft.name", au.org.theark.core.Constants.SUBJECT))); pedigreeCustomFields = criteria.list(); return pedigreeCustomFields; }
From source file:au.org.theark.study.model.dao.StudyDao.java
License:Open Source License
@Override public List<CustomField> getFamilyUIdCustomFieldsForPedigreeRelativesList(Long studyId) { List<CustomField> pedigreeCustomFields = null; Criteria criteria = getSession().createCriteria(CustomField.class, "cf"); criteria.createAlias("study", "st", JoinType.INNER_JOIN); criteria.createAlias("arkFunction", "af", JoinType.INNER_JOIN); criteria.createAlias("fieldType", "ft", JoinType.INNER_JOIN); criteria.createAlias("customFieldType", "cft", JoinType.LEFT_OUTER_JOIN); criteria.add(Restrictions.eq("st.id", studyId)); criteria.add(//from w w w. j ava 2 s . c o m Restrictions.eq("af.name", au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT_CUSTOM_FIELD)); criteria.add(Restrictions.isNull("cf.encodedValues")); criteria.add(Restrictions.eq("ft.name", au.org.theark.core.Constants.FIELD_TYPE_CHARACTER)); criteria.add(Restrictions.or(Restrictions.isNull("cft.id"), Restrictions.eq("cft.name", au.org.theark.core.Constants.SUBJECT))); pedigreeCustomFields = criteria.list(); return pedigreeCustomFields; }
From source file:be.wolkmaan.klimtoren.party.PartyRepositoryImpl.java
private Criteria createBidirectional(Party context, Party reference) { Criteria crit = getSession().createCriteria(PartyToPartyRelationship.class).add(Restrictions.or( Restrictions.and(Restrictions.eq("context", context), Restrictions.eq("reference", reference)), Restrictions.and(Restrictions.eq("context", reference), Restrictions.eq("reference", context)))) .add(Restrictions.isNull("end")); //for now only search live relations return crit;//from ww w. j a v a2s. c o m }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countDataBasesNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDataBasesNOK()"); try {//from w w w . j a va2 s . c o m final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] Data Bases not NOK: " + count); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countMySQLNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countMySQLNOK()"); try {// ww w . j a v a2s . c o m final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "MYSQL"), Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countMySQLNOK() -> " + count + " found."); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countOracleNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countOracleNOK()"); try {/*from www . j a va 2 s. c o m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "ORACLE"), Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countOracleNOK() -> " + count + " found."); return count; } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countPostgreNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreNOK"); try {//from w w w . ja v a 2 s.c o m final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "POSTGRESQL"), Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreNOK() -> " + count + " found."); return count; } catch (Exception e) { log.severe("Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countSqlServerNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countSqlServerNOK"); try {/* w w w . j a va 2s. com*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "SQLSERVER"), Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countSqlServerNOK() -> " + count + " found."); return count; } catch (Exception e) { log.severe("Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countDB2NOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2NOK"); try {//from ww w. j a va 2 s . c om final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "DB2"), Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2NOK() -> " + count + " found."); return count; } catch (Exception e) { log.severe("Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
@SuppressWarnings("unchecked") public List<BancoDados> getdataBasesNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] getdataBasesNOK()"); try {//www. j a v a2 s .c o m final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.or(Restrictions.eq("trClass", "Error"), Restrictions.eq("status", "NOK"))); return criteria.list(); } catch (Exception e) { System.out.println(e); log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return new ArrayList<BancoDados>(); } }