List of usage examples for org.hibernate.criterion Restrictions and
public static LogicalExpression and(Criterion lhs, Criterion rhs)
From source file:br.com.hrstatus.dao.impl.BancoDadosDAO.java
License:Open Source License
public int countPostgreOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreOK()"); try {/*from w w w . j a v a2 s . c o m*/ final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add( Restrictions.and(Restrictions.eq("vendor", "POSTGRESQL"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countPostgreOK -> " + 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 {// w ww . j av a 2 s . co 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 countSqlServerOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countSqlServerOK()"); try {//from w w w .j a v a 2s. c om final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "SQLSERVER"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countSqlServerOK -> " + 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 countSqlServerNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countSqlServerNOK"); try {/*from w ww .ja v a 2 s .co m*/ 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 countDB2OK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2OK()"); try {// ww w .jav a2 s . c o m final Criteria criteria = session().createCriteria(BancoDados.class); criteria.add(Restrictions.and(Restrictions.eq("vendor", "DB2"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2OK -> " + 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 countDB2NOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countDB2NOK"); try {//from ww w. j a v a 2 s . c o m 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.ServersDAO.java
License:Open Source License
public int countUnixOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countUnixOK()"); try {/* ww w. j a v a2 s . c om*/ final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.and(Restrictions.eq("SO", "UNIX"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countUnixOK -> " + count + " found."); return count; } catch (Exception e) { log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public int countUnixNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countUnixNOK()"); try {//from w w w .java 2s .com final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.and(Restrictions.eq("SO", "UNIX"), (Restrictions.eq("trClass", "Error")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countUnixNOK -> " + count + " found."); return count; } catch (Exception e) { log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public int countWindowsOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countWindowsOK()"); try {//from www . ja v a2 s . c om final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.and(Restrictions.eq("SO", "WINDOWS"), Restrictions.eq("status", "OK"))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countWindowsOK -> " + count + " found."); return count; } catch (Exception e) { log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return 0; } }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public int countWindowsNOK() { log.fine("[ " + userInfo.getLoggedUsername() + " ] countWindowsOK()"); try {/*from w w w .jav a 2 s .c o m*/ final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.and(Restrictions.eq("SO", "WINDOWS"), (Restrictions.eq("trClass", "Error")))); criteria.setProjection(Projections.rowCount()); final int count = ((Long) criteria.uniqueResult()).intValue(); log.fine("[ " + userInfo.getLoggedUsername() + " ] countWindowsNOK -> " + count + " found."); return count; } catch (Exception e) { log.severe("Error: " + e); return 0; } }