List of usage examples for org.hibernate Criteria createCriteria
public Criteria createCriteria(String associationPath) throws HibernateException;
From source file:com.scopix.periscope.extractionservicesserversmanagement.dao.EvidenceExtractionServicesServerDAO.java
License:Open Source License
public List<EvidenceExtractionServicesServer> getAllEvidenceExtractionServicesServerEnabled() { Criteria criteria = this.getSession().createCriteria(EvidenceExtractionServicesServer.class); criteria.createCriteria("extractionPlans").add(Restrictions.isNull("expiration")); List<EvidenceExtractionServicesServer> evidenceExtractionServicesServers = criteria.list(); return evidenceExtractionServicesServers; }
From source file:com.scopix.periscope.extractionservicesserversmanagement.dao.EvidenceExtractionServicesServerDAO.java
License:Open Source License
public List<EvidenceRequest> getEvidenceRequestEnabled() { Criteria criteria = this.getSession().createCriteria(EvidenceRequest.class); criteria.addOrder(Order.asc("id")); criteria.createCriteria("extractionPlanDetail").createCriteria("extractionPlan") .add(Restrictions.isNull("expiration")); List<EvidenceRequest> list = criteria.list(); return list;//from w ww . j a va 2s . c om }
From source file:com.scopix.periscope.extractionservicesserversmanagement.dao.EvidenceExtractionServicesServerDAO.java
License:Open Source License
public ProcessEES getProcessEES(Integer extractionPlanId, Integer eesProcessId) { ProcessEES processEES = null;/* w ww . j ava 2 s . c om*/ try { Criteria criteria = this.getSession().createCriteria(ProcessEES.class); criteria.add(Restrictions.eq("processIdEes", eesProcessId)); criteria.createCriteria("extractionPlan").add(Restrictions.eq("id", extractionPlanId)); processEES = (ProcessEES) criteria.uniqueResult(); } catch (DataAccessResourceFailureException e) { log.error("DataAccessResourceFailureException " + e, e); throw (e); } catch (IllegalStateException e) { log.error("IllegalStateException " + e, e); throw (e); } catch (HibernateException e) { log.error("HibernateException " + e, e); throw (e); } return processEES; }
From source file:com.scopix.periscope.extractionservicesserversmanagement.dao.ExtractionPlanDetailDAO.java
License:Open Source License
public ExtractionPlan getExtractionPlanEnable(Integer evidenceExtractionServicesServerId) { log.info("start"); ExtractionPlan extractionPlan = null; Criteria criteria = this.getSession().createCriteria(ExtractionPlan.class); criteria.addOrder(Order.desc("id")); criteria.add(Restrictions.isNull("expiration")); criteria.createCriteria("evidenceExtractionServicesServer") .add(Restrictions.eq("serverId", evidenceExtractionServicesServerId)); List<ExtractionPlan> extractionPlans = criteria.list(); if (extractionPlans != null && !extractionPlans.isEmpty()) { extractionPlan = extractionPlans.get(0); }//from w w w. ja v a 2s. co m log.info("end"); return extractionPlan; }
From source file:com.scopix.periscope.extractionservicesserversmanagement.dao.ExtractionPlanDetailDAO.java
License:Open Source License
/** * Recupera el ExtractionPlan para el evidenceExtractionServicesServerId solicitado * // w w w . j a v a2 s . c o m * @param evidenceExtractionServicesServerId * @return ExtractionPlan plan para evidenceExtractionServicesServerId solicitado */ public ExtractionPlan getExtractionPlanByEvidenceExtractionServicesServer( Integer evidenceExtractionServicesServerId) { log.info("start"); ExtractionPlan extractionPlan = null; Criteria criteria = this.getSession().createCriteria(ExtractionPlan.class); criteria.addOrder(Order.desc("id")); criteria.createCriteria("evidenceExtractionServicesServer") .add(Restrictions.eq("id", evidenceExtractionServicesServerId)); List<ExtractionPlan> extractionPlans = criteria.list(); if (extractionPlans != null && !extractionPlans.isEmpty()) { extractionPlan = extractionPlans.get(0); } log.info("end"); return extractionPlan; }
From source file:com.scopix.periscope.queuemanagement.dao.OperatorQueueManagementHibernateDAO.java
License:Open Source License
public List<OperatorQueueDetail> getOperatorQueuesDetailList(OperatorQueueDetail operatorQueueDetail) throws ScopixException { log.debug("start"); List<OperatorQueueDetail> details = null; try {//from ww w. java2 s . c o m Criteria criteria = this.getSession().createCriteria(OperatorQueueDetail.class); if (operatorQueueDetail != null) { if (operatorQueueDetail.getStore().getId() != null && operatorQueueDetail.getStore().getId() > 0) { criteria.add(Restrictions.eq("store.id", operatorQueueDetail.getStore().getId())); } // if (operatorQueueDetail.getAreaType().getId() != null && operatorQueueDetail.getAreaType().getId() > 0) { // criteria.add(Restrictions.eq("areaType.id", operatorQueueDetail.getAreaType().getId())); // } if (operatorQueueDetail.getSituationTemplate().getId() != null && operatorQueueDetail.getSituationTemplate().getId() > 0) { criteria.add(Restrictions.eq("situationTemplate.id", operatorQueueDetail.getSituationTemplate().getId())); } Criteria crit = criteria.createCriteria("operatorQueue"); crit.add(Restrictions.eq("activo", Boolean.TRUE)); } details = criteria.list(); } catch (Exception ex) { log.debug("Error: ", ex); throw new ScopixException("operatorQueueManagement.error.detail.list"); } log.debug("end"); return details; }
From source file:com.scopix.periscope.queuemanagement.dao.QueueManagementHibernateDAO.java
License:Open Source License
/** * * @param pendingEvaluationId id de PendingEvaluation para filtro * @return List<MetricTemplate> lista de Metric Template asociados a un pendingEvaluation * @throws PeriscopeException Excepcion en caso de Error *///from w w w.ja v a2s . c o m public List<MetricTemplate> getMetricTemplateForAPendingEvaluation(Integer pendingEvaluationId) throws ScopixException { log.info("start"); List<MetricTemplate> metricTemplates = null; try { Criteria criteria = this.getSession().createCriteria(MetricTemplate.class).createCriteria("metrics") .createCriteria("situation").createCriteria("observedSituations"); criteria.createCriteria("pendingEvaluation").add(Restrictions.eq("id", pendingEvaluationId)); metricTemplates = criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list(); } catch (Exception e) { log.error("Error " + e, e); //"periscopeexception.list.error", new String[]{ throw new ScopixException("label.metricTemplateForAPendingEvaluation"); } log.info("end, result = " + metricTemplates); return metricTemplates; }
From source file:com.scopix.periscope.queuemanagement.dao.QueueManagementHibernateDAO.java
License:Open Source License
/** * * @param os// w w w. j a v a 2s.co m * @return */ public OperatorQueue getOperatorQueueForAObservedSituation(ObservedSituation os) { log.info("start"); OperatorQueue operatorQueue = null; Session session = this.getSession(); try { if (os != null) { Criteria criteria = session.createCriteria(OperatorQueue.class); criteria.add(Restrictions.eq("activo", Boolean.TRUE)); Criteria critDetail = criteria.createCriteria("operatorQueueDetailList"); //critDetail.add(Restrictions.eq("areaType", os.getObservedMetrics().get(0).getMetric().getArea().getAreaType())); critDetail.add(Restrictions.eq("situationTemplate", os.getSituation().getSituationTemplate())); critDetail.add( Restrictions.eq("store", os.getObservedMetrics().get(0).getMetric().getArea().getStore())); List<OperatorQueue> oqs = criteria.list(); if (oqs != null && !oqs.isEmpty()) { operatorQueue = oqs.get(0); } } } catch (HibernateException e) { log.error(e, e); } finally { this.releaseSession(session); } log.info("end, result = " + operatorQueue); return operatorQueue; }
From source file:com.scopix.periscope.reporting.dao.ReportingHibernateDAOImpl.java
License:Open Source License
@Override public List<UploadProcessDetail> getUploadProcessDetailList(ProcessState processState) throws ScopixException { log.debug("start"); Criteria c = this.getSession().createCriteria(UploadProcessDetail.class); c.createCriteria("uploadProcess").add(Restrictions.eq("processState", processState)); List<UploadProcessDetail> l = (List<UploadProcessDetail>) c.list(); log.debug("end"); return l;/* w w w. ja va 2 s .c o m*/ }
From source file:com.scopix.periscope.securitymanagement.dao.UserLoginHibernateDAOImpl.java
License:Open Source License
@Override public List<String> getUserPrivileges(PeriscopeUser periscopeUser) { List<String> privileges = null; List<Integer> rgIds = new ArrayList<Integer>(); for (RolesGroup rolesGroup : periscopeUser.getRolesGroups()) { rgIds.add(rolesGroup.getId());/* w w w . j a va 2 s . co m*/ } Criteria criteria = this.getSession().createCriteria(Role.class) .setProjection(Projections.property("roleName")); Criteria rg = criteria.createCriteria("rolesGroups"); rg.add(Restrictions.in("id", rgIds)); privileges = criteria.list(); return privileges; }