Java Code Examples for org.hibernate.Criteria#createCriteria()

The following examples show how to use org.hibernate.Criteria#createCriteria() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: kardio   File: DBQueryUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get the component id for the given compName
 * 
 * @return int
 */
public static int getComponentId(final String compName, final String parentCompName) {

	Session session = HibernateConfig.getSessionFactory().getCurrentSession();
	Transaction txn = session.beginTransaction();
	Criteria componentCriteria = session.createCriteria(ComponentEntity.class);
	componentCriteria.createCriteria("parentComponent", "pc");
	componentCriteria.add(Restrictions.eq("componentName",compName));
	componentCriteria.add(Restrictions.eq("pc.componentName",parentCompName));
	componentCriteria.setMaxResults(1);
	ComponentEntity com =(ComponentEntity) componentCriteria.uniqueResult();
	int compId = 0;
	if(com != null){
		compId = com.getComponentId();
	}
	txn.commit();
	return compId;
}
 
Example 2
Source Project: kardio   File: DBQueryUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get All the APPS with the launch date null
 */
public static Set<Integer> getAppsLauchDateNull(int envId) {

	Session session = HibernateConfig.getSessionFactory().getCurrentSession();
	Transaction txn = session.beginTransaction();
	Criteria healthCheckCriteria = session.createCriteria(HealthCheckEntity.class, "health");
	healthCheckCriteria.createCriteria("health.component", "component");
	healthCheckCriteria.add(Restrictions.isNull("health.createdDate"));
	healthCheckCriteria.add(Restrictions.eq("health.environment.environmentId", envId));
	
	ProjectionList projectionList = Projections.projectionList();
       projectionList.add(Projections.property("component.componentId"));
       healthCheckCriteria.setProjection(projectionList);
       
       Set<Integer> compSet = new HashSet<Integer>();
	@SuppressWarnings("unchecked")
	List<Integer> resultList = (List<Integer>) healthCheckCriteria.list();
	compSet.addAll(resultList); 
	txn.commit();
	return compSet;         
}
 
Example 3
Source Project: kardio   File: DBQueryUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get the current prom_lookup details of the environment
 * 
 */
public static Map<String, String> getPromLookupDetails(int envId, String platform) {
	Session session = HibernateConfig.getSessionFactory().getCurrentSession();
	Transaction txn = session.beginTransaction();
	Criteria promLookCriteria = session.createCriteria(PromLookupEntity.class, "promLook");
	promLookCriteria.createCriteria("promLook.component", "comp");
	promLookCriteria.add(Restrictions.eq("comp.platform", platform));
	promLookCriteria.add(Restrictions.eq("promLook.environment.environmentId", envId));
	@SuppressWarnings("unchecked")
	List<PromLookupEntity> promLookEntityList = promLookCriteria.list();
	Map<String, String> mapPromLook = new HashMap<String, String>();
	for(PromLookupEntity promLookEntity : promLookEntityList){
		if(promLookEntity.getComponent() != null){
			if(platform.equals(SurveillerConstants.K8S_PLATFORM)){
				mapPromLook.put(promLookEntity.getComponent().getComponentName()+"/"+promLookEntity.getHttpPath(), promLookEntity.getHttpPath());
	    	}else{
	    		mapPromLook.put(promLookEntity.getComponent().getParentComponent().getComponentName()+"/"+promLookEntity.getComponent().getComponentName(), promLookEntity.getHttpPath());
	    	}		 
		}
    }
	txn.commit();
	return mapPromLook;
}
 
Example 4
Source Project: kardio   File: DBQueryUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get the current prom_lookup details of the environment
 * 
 */
public static Map<String, Integer> getPromLookupHttpPath(int envId, String platform) {
	Session session = HibernateConfig.getSessionFactory().getCurrentSession();
	Transaction txn = session.beginTransaction();
	Criteria promLookCriteria = session.createCriteria(PromLookupEntity.class, "promLook");
	promLookCriteria.createCriteria("promLook.component", "comp");
	promLookCriteria.add(Restrictions.eq("comp.platform", platform));
	promLookCriteria.add(Restrictions.eq("promLook.environment.environmentId", envId));
	@SuppressWarnings("unchecked")
	List<PromLookupEntity> promLookEntityList = promLookCriteria.list();
	Map<String, Integer> mapPromLook = new HashMap<String, Integer>();
	for(PromLookupEntity promLookEntity : promLookEntityList){
		if(promLookEntity.getComponent() != null){
			mapPromLook.put(promLookEntity.getHttpPath(), promLookEntity.getComponent().getComponentId());
	    }
    }
	txn.commit();
	return mapPromLook;
}
 
Example 5
@Override
protected Collection<StaffStatusEntry> handleFindByStaffInterval(
		Long staffId, Timestamp from, Timestamp to, Boolean staffActive, Boolean allocatable, Boolean hideAvailability)
		throws Exception {
	Criteria statusEntryCriteria = createStatusEntryCriteria();
	CriteriaUtil.applyStopOpenIntervalCriterion(statusEntryCriteria, from, to, null);
	if (staffActive != null || hideAvailability != null) {
		Criteria statusTypeCriteria = statusEntryCriteria.createCriteria("type", CriteriaSpecification.INNER_JOIN);
		if (staffActive != null) {
			statusTypeCriteria.add(Restrictions.eq("staffActive", staffActive.booleanValue()));
		}
		if (hideAvailability != null) {
			statusTypeCriteria.add(Restrictions.eq("hideAvailability", hideAvailability.booleanValue()));
		}
	}
	if (staffId != null) {
		statusEntryCriteria.add(Restrictions.eq("staff.id", staffId.longValue()));
	}
	if (allocatable != null) {
		statusEntryCriteria.createCriteria("staff", CriteriaSpecification.INNER_JOIN).add(Restrictions.eq("allocatable", allocatable.booleanValue()));
	}
	return statusEntryCriteria.list();
}
 
Example 6
/**
 * Add order to criteria, creating necessary subCriteria if nested sort property (ie. sort:'nested.property').
 */
private static void addOrderPossiblyNested(Criteria c, PersistentEntity entity, String sort, String order, boolean ignoreCase) {
    int firstDotPos = sort.indexOf(".");
    if (firstDotPos == -1) {
        addOrder(c, sort, order, ignoreCase);
    } else { // nested property
        String sortHead = sort.substring(0, firstDotPos);
        String sortTail = sort.substring(firstDotPos + 1);
        PersistentProperty property = entity.getPropertyByName(sortHead);
        if (property instanceof Embedded) {
            // embedded objects cannot reference entities (at time of writing), so no more recursion needed
            addOrder(c, sort, order, ignoreCase);
        } else if (property instanceof Association) {
            Association a = (Association) property;
            Criteria subCriteria = c.createCriteria(sortHead);
            PersistentEntity associatedEntity = a.getAssociatedEntity();
            Class<?> propertyTargetClass = associatedEntity.getJavaClass();
            cacheCriteriaByMapping(propertyTargetClass, subCriteria);
            addOrderPossiblyNested(subCriteria, associatedEntity, sortTail, order, ignoreCase); // Recurse on nested sort
        }
    }
}
 
Example 7
@Override
public List<K8sPodsContainersEntity> getEnvContainers(String startDate, String endDate, int envId, String componentIdsStrg, boolean isParentComponents) throws ParseException {
	final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	List<Integer> comIdList = DaoUtil.convertCSVToList(componentIdsStrg);

	
	Date sDate = sdf.parse(startDate);
	Date eDate = sdf.parse(endDate);
	Session session = sessionFactory.openSession();
	Criteria containerCriteria = session.createCriteria(K8sPodsContainersEntity.class, "contSts");
	containerCriteria.createCriteria("contSts.component", "component");
	containerCriteria.add(Restrictions.gt("contSts.statusDate", sDate ));
	containerCriteria.add(Restrictions.le("contSts.statusDate", eDate ));

	DaoUtil.addEnvironmentToCriteria(envId, isParentComponents, comIdList, containerCriteria);

	@SuppressWarnings("unchecked")
	List<K8sPodsContainersEntity> listContEntity = containerCriteria.list();
	session.close();
	return listContEntity;
}
 
Example 8
@Override
public long getCurrentNumberOfContainsers(int envId,String componentIdsStrg, boolean isParentComponents) throws ParseException {
	
	List<Integer> comIdList = DaoUtil.convertCSVToList(componentIdsStrg);

	Session session = sessionFactory.openSession();
	DetachedCriteria subMaxDate = DetachedCriteria.forClass(K8sPodsContainersEntity.class);
	subMaxDate.setProjection(Projections.max("statusDate"));
	Criteria crtCurrentCont = session.createCriteria(K8sPodsContainersEntity.class, "contSts");
	crtCurrentCont.createCriteria("contSts.component", "component");
	crtCurrentCont.add(Property.forName("statusDate").eq(subMaxDate));
	
	DaoUtil.addEnvironmentToCriteria(envId, isParentComponents, comIdList, crtCurrentCont);
	
	crtCurrentCont.setProjection(Projections.sum("totalContainers"));
	long currentNumOfCont = (long) (crtCurrentCont.uniqueResult() == null ? (long)0 : crtCurrentCont.uniqueResult());
	session.close();
	return currentNumOfCont;
	
}
 
Example 9
/**
 * @inheritDoc
 */
@Override
protected Collection<ProbandStatusEntry> handleFindByProbandInterval(Long probandId, Timestamp from, Timestamp to, Boolean probandActive, Boolean hideAvailability) {
	Criteria statusEntryCriteria = createStatusEntryCriteria();
	CriteriaUtil.applyStopOpenIntervalCriterion(statusEntryCriteria, from, to, null);
	if (probandActive != null || hideAvailability != null) {
		Criteria statusTypeCriteria = statusEntryCriteria.createCriteria("type", CriteriaSpecification.INNER_JOIN);
		if (probandActive != null) {
			statusTypeCriteria.add(Restrictions.eq("probandActive", probandActive.booleanValue()));
		}
		if (hideAvailability != null) {
			statusTypeCriteria.add(Restrictions.eq("hideAvailability", hideAvailability.booleanValue()));
		}
	}
	if (probandId != null) {
		statusEntryCriteria.add(Restrictions.eq("proband.id", probandId.longValue()));
	}
	return statusEntryCriteria.list();
}
 
Example 10
@Override
protected Collection<InventoryStatusEntry> handleFindByInventoryInterval(
		Long inventoryId, Timestamp from, Timestamp to, Boolean inventoryActive, Boolean hideAvailability) throws Exception {
	Criteria statusEntryCriteria = createStatusEntryCriteria();
	CriteriaUtil.applyStopOpenIntervalCriterion(statusEntryCriteria, from, to, null);
	if (inventoryActive != null || hideAvailability != null) {
		Criteria statusTypeCriteria = statusEntryCriteria.createCriteria("type", CriteriaSpecification.INNER_JOIN);
		if (inventoryActive != null) {
			statusTypeCriteria.add(Restrictions.eq("inventoryActive", inventoryActive.booleanValue()));
		}
		if (hideAvailability != null) {
			statusTypeCriteria.add(Restrictions.eq("hideAvailability", hideAvailability.booleanValue()));
		}
	}
	if (inventoryId != null) {
		statusEntryCriteria.add(Restrictions.eq("inventory.id", inventoryId.longValue()));
	}
	return statusEntryCriteria.list();
}
 
Example 11
Source Project: kardio   File: AlertSubscribeDaoImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get the list of all the subscription for the given componentId and environmentId
 */
@Override
public List<AlertSubscriptionEntity> getSubscribedEmailIdList(final int componentId, final int environmentId) {
    Session session = sessionFactory.openSession();

    Criteria aseCriteria = session.createCriteria(AlertSubscriptionEntity.class);
    aseCriteria.createCriteria("component", "c");
    aseCriteria.createCriteria("environment", "e");
    aseCriteria.add(Restrictions.eq("c.componentId", componentId));
    aseCriteria.add(Restrictions.eq("e.environmentId", environmentId));

    @SuppressWarnings("unchecked")
    List<AlertSubscriptionEntity> alertSubscriptionList = (List<AlertSubscriptionEntity>) aseCriteria.list();
    session.close();
    return alertSubscriptionList;
}
 
Example 12
@Override
protected Collection<TimelineEvent> handleFindByTrialDepartmentStatusTypeShowInterval(
		Long trialId, Long departmentId, Long statusId, Long typeId,
		Boolean show, Timestamp from, Timestamp to) throws Exception {
	Criteria timelineEventCriteria = createTimelineEventCriteria();
	CriteriaUtil.applyStopOptionalIntervalCriterion(timelineEventCriteria, from, to, null, true);
	if (trialId != null || departmentId != null || statusId != null) {
		Criteria trialCriteria = timelineEventCriteria.createCriteria("trial", CriteriaSpecification.INNER_JOIN);
		if (trialId != null) {
			trialCriteria.add(Restrictions.idEq(trialId.longValue()));
		}
		if (departmentId != null) {
			trialCriteria.add(Restrictions.eq("department.id", departmentId.longValue()));
		}
		if (statusId != null) {
			trialCriteria.add(Restrictions.eq("status.id", statusId.longValue()));
		}
	}
	if (typeId != null) {
		timelineEventCriteria.add(Restrictions.eq("type.id", typeId.longValue()));
	}
	if (show != null) {
		timelineEventCriteria.add(Restrictions.eq("show", show.booleanValue()));
	}
	return timelineEventCriteria.list();
}
 
Example 13
@Override
protected Collection<CourseParticipationStatusEntry> handleFindByCourseSorted(
		Long courseId) throws Exception {
	org.hibernate.Criteria courseParticipationStatusEntryCriteria = createCourseParticipationStatusEntryCriteria();
	if (courseId != null) {
		courseParticipationStatusEntryCriteria.add(Restrictions.eq("course.id", courseId.longValue()));
	}
	Criteria staffCriteria = courseParticipationStatusEntryCriteria.createCriteria("staff", CriteriaSpecification.INNER_JOIN);
	Criteria personParticularsCriteria = staffCriteria.createCriteria("personParticulars", CriteriaSpecification.INNER_JOIN);
	personParticularsCriteria.addOrder(Order.asc("lastName"));
	personParticularsCriteria.addOrder(Order.asc("firstName"));
	return courseParticipationStatusEntryCriteria.list();
}
 
Example 14
/**
 * @inheritDoc
 */
@Override
protected Collection<ProbandStatusEntry> handleFindByDepartmentCategoryInterval(Long departmentId, Long probandCategoryId, Timestamp from, Timestamp to, Boolean probandActive,
		Boolean available, Boolean hideAvailability) {
	Criteria statusEntryCriteria = createStatusEntryCriteria();
	CriteriaUtil.applyStopOpenIntervalCriterion(statusEntryCriteria, from, to, null);
	if (probandActive != null || hideAvailability != null) {
		Criteria typeCriteria = statusEntryCriteria.createCriteria("type", CriteriaSpecification.INNER_JOIN);
		if (probandActive != null) {
			typeCriteria.add(Restrictions.eq("probandActive", probandActive.booleanValue()));
		}
		if (hideAvailability != null) {
			typeCriteria.add(Restrictions.eq("hideAvailability", hideAvailability.booleanValue()));
		}
	}
	if (departmentId != null || available != null) {
		Criteria probandCriteria = statusEntryCriteria.createCriteria("proband", CriteriaSpecification.INNER_JOIN);
		if (departmentId != null) {
			probandCriteria.add(Restrictions.eq("department.id", departmentId.longValue()));
		}
		if (probandCategoryId != null) {
			probandCriteria.add(Restrictions.eq("category.id", probandCategoryId.longValue()));
		}
		if (available != null) {
			probandCriteria.add(Restrictions.eq("available", available.booleanValue()));
		}
	}
	return statusEntryCriteria.list();
}
 
Example 15
Source Project: kardio   File: DaoUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static void addEnvironmentToCriteria(int envId, boolean isParentComponents, List<Integer> compIds,
		Criteria criteria) {
	criteria.createCriteria("environment", "environment");
	if(envId != 0){
		criteria.add(Restrictions.eq("environment.environmentId", envId));
	}
	criteria.add(Restrictions.eq("environment.envLock", 0));
	if (compIds.size() > 0) {
		if (isParentComponents) {
			criteria.add(Restrictions.in("component.parentComponent.componentId", compIds));
		} else {
			criteria.add(Restrictions.in("component.componentId", compIds));
		}
	}
}
 
Example 16
@Override
protected Collection<InventoryBooking> handleFindByDepartmentCategoryInventoryOnBehalfOfProbandCourseTrialCalendarInterval(
		Long departmentId, Long inventoryCategoryId, Long inventoryId, Long onBehalfOfId, Long probandId, Long courseId, Long trialId, String calendar, Timestamp from,
		Timestamp to)
		throws Exception {
	Criteria bookingCriteria = createBookingCriteria();
	CriteriaUtil.applyClosedIntervalCriterion(bookingCriteria, from, to, null);
	if (departmentId != null || inventoryCategoryId != null) {
		Criteria inventoryCriteria = bookingCriteria.createCriteria("inventory", CriteriaSpecification.INNER_JOIN);
		if (departmentId != null) {
			inventoryCriteria.add(Restrictions.eq("department.id", departmentId.longValue()));
		}
		if (inventoryCategoryId != null) {
			inventoryCriteria.add(Restrictions.eq("category.id", inventoryCategoryId.longValue()));
		}
	}
	if (inventoryId != null) {
		bookingCriteria.add(Restrictions.eq("inventory.id", inventoryId.longValue()));
	}
	if (onBehalfOfId != null) {
		bookingCriteria.add(Restrictions.eq("onBehalfOf.id", onBehalfOfId.longValue()));
	}
	if (probandId != null) {
		bookingCriteria.add(Restrictions.eq("proband.id", probandId.longValue()));
	}
	if (courseId != null) {
		bookingCriteria.add(Restrictions.eq("course.id", courseId.longValue()));
	}
	if (trialId != null) {
		bookingCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
	}
	CategoryCriterion.apply(bookingCriteria, new CategoryCriterion(calendar, "calendar", MatchMode.EXACT, EmptyPrefixModes.ALL_ROWS));
	return bookingCriteria.list();
}
 
Example 17
Source Project: kardio   File: CounterMatrixDaoImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Function to create criteria for CounterEntity class
 * @param envId
 * @param session
 * @param platform
 * @return Criteria
 */
private Criteria createCounterCriteria(final int envId, Session session, String platform) {
	DetachedCriteria counterSubquery = DetachedCriteria.forClass(CounterMetricEntity.class, "cm")
			.setProjection(Property.forName("metricDate").max());
	Criteria counterCriteria = session.createCriteria(CounterEntity.class, "counter");
	counterCriteria.addOrder(Order.asc("counter.position"));
	Criteria envCounCriteria = counterCriteria.createCriteria("counter.envCounter", "ec");
	if(platform != null && !platform.equalsIgnoreCase("All")){
		envCounCriteria.add(Restrictions.eq("ec.platform", platform));
	}
	Criteria metricCriteria = envCounCriteria.createCriteria("ec.countMetric", "counterMetric");
	counterSubquery.add(Property.forName("ec.envCounterId").eqProperty("cm.envCounterId"));
	metricCriteria.add(Subqueries.propertyEq("counterMetric.metricDate", counterSubquery));
	//metricCriteria.add(Restrictions.le("counterMetric.metricDate", new Date()));
	counterCriteria.add(Restrictions.eq("counter.delInd", 0));
	if(envId != 0) {
		envCounCriteria.add(Restrictions.eq("environmentId", envId));
	} else {
		envCounCriteria.add(Restrictions.isNull("environmentId"));
	}
	counterCriteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
	
	ProjectionList projectionList = Projections.projectionList();
	projectionList.add(Projections.max("counter.counterName"));
	projectionList.add(Projections.max("counterMetric.metricDate"));
	projectionList.add(Projections.sum("counterMetric.metricVal"));
	projectionList.add(Projections.max("counter.position"));
	projectionList.add(Projections.property("counter.counterId"));
	projectionList.add(Projections.groupProperty("counter.counterId"));
	counterCriteria.setProjection(projectionList);
	
	return counterCriteria;
}
 
Example 18
private void buildCriteria(final Criteria criteria)
{
  for (final Object obj : filterSettings) {
    if (obj instanceof Criterion) {
      criteria.add((Criterion) obj);
    } else if (obj instanceof Order) {
      criteria.addOrder((Order) obj);
    } else if (obj instanceof Alias) {
      final Alias alias = (Alias) obj;
      criteria.createAlias(alias.arg0, alias.arg1, alias.joinType);
    } else if (obj instanceof QueryFilter) {
      final QueryFilter filter = (QueryFilter) obj;
      Criteria subCriteria;
      if (StringUtils.isEmpty(filter.getAlias()) == true) {
        subCriteria = criteria.createCriteria(filter.getName());
      } else {
        subCriteria = criteria.createCriteria(filter.getName(), filter.getAlias());
      }
      filter.buildCriteria(subCriteria);
    }
  }
  if (associationPath != null) {
    criteria.setFetchMode(associationPath, fetchMode);
  }
  if (maxResults > 0) {
    criteria.setMaxResults(maxResults);
  }
}
 
Example 19
Source Project: kardio   File: DBQueryUtil.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Function to get all components in database
 * 
 * @return
 * 
 */
public static List<ComponentVO> getAllAPIComponentDetails(final int environmentId, String platform, long regionId) {
	
	AppTransformConfig config = readAppTransformConfig();
	
	
	Session session = HibernateConfig.getSessionFactory().getCurrentSession();
	Transaction txn = session.beginTransaction();
	Criteria healthCheckCriteria = session.createCriteria(HealthCheckEntity.class, "hc");
	healthCheckCriteria.createCriteria("hc.component","cmp");
	healthCheckCriteria.createCriteria("hc.component.parentComponent","prnt");
	healthCheckCriteria.createCriteria("hc.component.componentType", "ct");
	healthCheckCriteria.add(Restrictions.eq("hc.environment.environmentId", environmentId));
	healthCheckCriteria.add(Restrictions.eq("hc.region.regionId", regionId));
	healthCheckCriteria.add(Restrictions.isNotNull("prnt.componentId"));
	healthCheckCriteria.add(Restrictions.eq("cmp.platform", platform));
	if(config == null){
		healthCheckCriteria.add(Restrictions.eq("ct.componentTypeId", ComponentType.APP.getComponentTypeId()));
	}else{
		healthCheckCriteria.add(Restrictions.or(Restrictions.eq("ct.componentTypeId",ComponentType.APP.getComponentTypeId()),
        		Restrictions.in("prnt.componentName", config.getTransformName().values() )) );
	}
	
	@SuppressWarnings("unchecked")
	List<HealthCheckEntity> compHltDetails = healthCheckCriteria.list();
	txn.commit();
	ArrayList<ComponentVO> returnList = new ArrayList<ComponentVO>();

	for (HealthCheckEntity hc: compHltDetails) {
		ComponentVO cVO = new ComponentVO();
		cVO.setDelInd(hc.getDelInd());
		ComponentEntity comp = hc.getComponent();
		cVO.setComponentId(comp.getComponentId());
		cVO.setComponentName(comp.getComponentName());
		cVO.setComponentDesc(comp.getComponentDesc());
		cVO.setParentComponentId(comp.getParentComponent().getComponentId());
		cVO.setComponentTypeId(comp.getComponentType().getComponentTypeId());
		
		returnList.add(cVO);
	}
	return returnList;
}
 
Example 20
@Override
public List<K8sContainerStatus> getAllContainersOfParent(String startDate, String endDate, int envId, String componentIdsStrg) throws ParseException {
	
	final SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
	List<Integer> comIdList = DaoUtil.convertCSVToList(componentIdsStrg);

	Date sDate = sdf1.parse(startDate);
	Date eDate = sdf1.parse(endDate);
	Session session = sessionFactory.openSession();
	Criteria containerCriteria = session.createCriteria(K8sPodsContainersEntity.class, "contSts");
	containerCriteria.createCriteria("contSts.component", "component");
	containerCriteria.createCriteria("contSts.environment", "environment");
	containerCriteria.add(Restrictions.ge("contSts.statusDate", sDate ));
	containerCriteria.add(Restrictions.le("contSts.statusDate", eDate ));
	if(envId != 0){
	   containerCriteria.add(Restrictions.eq("environment.environmentId", envId));
	}
	containerCriteria.add(Restrictions.eq("environment.envLock", 0));
	if(comIdList != null && comIdList.size() != 0){
		containerCriteria.add(Restrictions.in("component.parentComponent.componentId", comIdList));
	}
	
	ProjectionList projectionList = DaoUtil.getContainerStatusProjectionList();
	containerCriteria.setProjection(projectionList);
    @SuppressWarnings("unchecked")
	List<Object[]> conList = containerCriteria.list();
    List<K8sContainerStatus> contStatusList = new ArrayList<K8sContainerStatus>();
       for (Object[] aRow : conList) {
       	K8sContainerStatus contStatus = new K8sContainerStatus();
           Integer comId = (Integer) aRow[0];
           contStatus.setComponentId(comId);
           Date statsDate = (Date) aRow[1];
           contStatus.setStatusDate(statsDate.toString());
           long totalCont = (long) aRow[2];
           contStatus.setTotalContainers(totalCont);
           contStatusList.add(contStatus);   		
       } 	    
       session.close();
       return contStatusList;
        
}