FacilityFacadeEjb implements FacilityFacade { @Override public boolean hasArchivedParentInfrastructure(Collection<String> facilityUuids) { if (CollectionUtils.isEmpty(facilityUuids)) { return false; } CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Long> cq = cb.createQuery(Long.class); Root<Facility> root = cq.from(Facility.class); Join<Facility, Community> communityJoin = root.join(Facility.COMMUNITY); Join<Facility, District> districtJoin = root.join(Facility.DISTRICT); Join<Facility, Region> regionJoin = root.join(Facility.REGION); cq.where( cb.and( cb.or( cb.isTrue(communityJoin.get(Community.ARCHIVED)), cb.isTrue(districtJoin.get(District.ARCHIVED)), cb.isTrue(regionJoin.get(Region.ARCHIVED))), root.get(Facility.UUID).in(facilityUuids))); cq.select(root.get(Facility.ID)); return !em.createQuery(cq).setMaxResults(1).getResultList().isEmpty(); }  @Override List<FacilityReferenceDto> getActiveFacilitiesByCommunityAndType(
		CommunityReferenceDto communityRef,
		FacilityType type,
		boolean includeOtherFacility,
		boolean includeNoneFacility); @Override List<FacilityReferenceDto> getActiveFacilitiesByDistrictAndType(
		DistrictReferenceDto districtRef,
		FacilityType type,
		boolean includeOtherFacility,
		boolean includeNoneFacility); @Override List<FacilityReferenceDto> getActiveHospitalsByCommunity(CommunityReferenceDto communityRef, boolean includeOtherFacility); @Override List<FacilityReferenceDto> getActiveHospitalsByDistrict(DistrictReferenceDto districtRef, boolean includeOtherFacility); @Override List<FacilityReferenceDto> getAllActiveLaboratories(boolean includeOtherFacility); @Override List<String> getAllUuids(); @Override List<FacilityDto> getAllByRegionAfter(String regionUuid, Date date); @Override List<FacilityDto> getAllWithoutRegionAfter(Date date); @Override FacilityDto getByUuid(String uuid); @Override List<FacilityDto> getByUuids(List<String> uuids); @Override FacilityReferenceDto getFacilityReferenceByUuid(String uuid); @Override FacilityReferenceDto getFacilityReferenceById(long id); @Override Map<String, String> getDistrictUuidsForFacilities(List<FacilityReferenceDto> facilities); @Override Map<String, String> getCommunityUuidsForFacilities(List<FacilityReferenceDto> facilities); @Override List<FacilityReferenceDto> getByNameAndType(
		String name,
		DistrictReferenceDto districtRef,
		CommunityReferenceDto communityRef,
		FacilityType type,
		boolean includeArchivedEntities); @Override List<FacilityReferenceDto> getLaboratoriesByName(String name, boolean includeArchivedEntities); @Override void archive(String facilityUuid); @Override void dearchive(String facilityUuid); @Override boolean hasArchivedParentInfrastructure(Collection<String> facilityUuids); static FacilityReferenceDto toReferenceDto(Facility entity); @Override List<FacilityDto> getIndexList(FacilityCriteria facilityCriteria, Integer first, Integer max, List<SortProperty> sortProperties); @Override long count(FacilityCriteria criteria); @Override void saveFacility(FacilityDto dto);  }
@Test public void testHasArchivedParentInfrastructureNoFacilities() { assertFalse(getFacilityFacade().hasArchivedParentInfrastructure(Collections.emptyList())); }