List of usage examples for org.springframework.data.mongodb.core.query Criteria Criteria
public Criteria(String key)
From source file:com.comcast.video.dawg.service.house.MongoHouseService.java
@Override public Map<String, Object>[] getStbsById(String... id) { Criteria c = new Criteria(MetaStb.ID).in(Arrays.asList(id)); List<PersistableDevice> list = template.find(new Query(c), PersistableDevice.class, COLLECTION_NAME); return toArray(list); }
From source file:eu.cloudwave.wp5.feedbackhandler.repositories.ProcedureExecutionRepositoryImpl.java
/** * Criteria that filters requests with @MicroserviceClientMethodDeclaration annotation * //from w ww. ja va2 s.c o m * @return {@link Criteria} */ private Criteria getClientRequestAnnotationCriteria() { return new Criteria(ANNOTATION_NAME).is(Ids.MICROSERVICE_CLIENT_REQUEST_ANNOTATION_IDENTIFIER); }
From source file:com.comcast.video.dawg.service.house.MongoHouseService.java
@Override public Map<String, Object>[] getStbsByKey(String... keys) { Collection<String> keyList = new ArrayList<String>(); for (String key : keys) { keyList.add(key.toLowerCase().trim()); }/*from ww w. jav a 2 s . c o m*/ Criteria criteria = new Criteria("keys").all(keyList); List<PersistableDevice> list = template.find(new Query(criteria), PersistableDevice.class, COLLECTION_NAME); return toArray(list); }
From source file:org.starfishrespect.myconsumption.server.business.repositories.repositoriesimpl.SensorRepositoryImpl.java
private Query idQuery(String id) { return new Query(new Criteria("_id").is(id)); }
From source file:com.comcast.video.dawg.service.house.MongoHouseService.java
@Override public Map<String, Object>[] getStbsByQuery(String query) { Criteria c = new Criteria("keys").regex(query); List<PersistableDevice> list = template.find(new Query(c), PersistableDevice.class, COLLECTION_NAME); return toArray(list); }
From source file:eu.cloudwave.wp5.feedbackhandler.repositories.ProcedureExecutionRepositoryImpl.java
/** * Criteria that filters requests with @MicroserviceMethodDeclaration annotation. * /* w w w. j av a2 s . c o m*/ * @return {@link Criteria} */ private Criteria getMicroserviceMethodDeclarationAnnotationCriteria() { return new Criteria(ANNOTATION_NAME).is(Ids.MICROSERVICE_ENDPOINT_ANNOTATION_IDENTIFIER); }
From source file:com.comcast.video.dawg.service.house.MongoHouseService.java
@Override public void deleteStbById(String... id) { Criteria c = new Criteria("id").in(Arrays.asList(id)); template.remove(new Query(c), COLLECTION_NAME); }
From source file:eu.trentorise.smartcampus.mobility.controller.rest.JourneyPlannerController.java
private List<RouteMonitoring> checkTime(String userId) { long now = System.currentTimeMillis(); Date nowDate = new Date(now); Calendar cal = new GregorianCalendar(); cal.setTime(nowDate);//from ww w. j a v a2 s . co m SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); String nowHour = sdf.format(nowDate); Criteria criteria = new Criteria("userId").is(userId); List<RouteMonitoring> res1 = domainStorage.searchDomainObjects(criteria, RouteMonitoring.class); List<RouteMonitoring> res2 = Lists.newArrayList(); for (RouteMonitoring rm : res1) { if (rm.getRecurrency() == null) { continue; } if (rm.getRecurrency().getFromDate() != null) { if (rm.getRecurrency().getFromDate() > now) { continue; } } if (rm.getRecurrency().getToDate() != null) { if (rm.getRecurrency().getToDate() < now) { continue; } } if (rm.getRecurrency().getFromHour() != null) { if (rm.getRecurrency().getFromHour().compareTo(nowHour) > 0) { continue; } } if (rm.getRecurrency().getToHour() != null) { if (rm.getRecurrency().getToHour().compareTo(nowHour) < 0) { continue; } } if (rm.getRecurrency().getDaysOfWeek() != null && !rm.getRecurrency().getDaysOfWeek().isEmpty()) { if (!rm.getRecurrency().getDaysOfWeek().contains(cal.get(Calendar.DAY_OF_WEEK))) { continue; } } res2.add(rm); } return res2; }