List of usage examples for org.springframework.data.mongodb.core.query Query Query
public Query()
From source file:org.obiba.mica.core.upgrade.Mica2Upgrade.java
private void migrateCustomCountryNames() { for (Map.Entry<String, String> mappingForOneCountry : getMappingOfCustomCountryNames().entrySet()) { mongoTemplate.updateMulti(//from w w w . j av a2s. co m new Query().addCriteria( Criteria.where("institution.address.countryIso").is(mappingForOneCountry.getKey())), new Update().set("institution.address.countryIso", mappingForOneCountry.getValue()), Person.class); } }
From source file:net.cit.tetrad.rrd.batch.TetradRrdInitializer.java
public void input(int deviceIdx) throws Exception { try {/*from w w w . j ava 2s. c o m*/ Config.initialG_Inc(); // ? int logGenerationIntervalSeconds = RrdUtil.readLogGenerationInterval(); Config.totalThreadCount = dataAccessObjectForMongo.getCount(new Query(), Device.class); int threadIndex = Config.totalThreadCount; Config.g_inc.put(threadIndex, 0); TetradInputThread inputThread = new TetradInputThread(deviceIdx, logGenerationIntervalSeconds, tetradRrdDbService, threadIndex); inputThread.start(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:com.epam.ta.reportportal.database.GridFSDataStorage.java
/** * Returns empty query which should find all objects * * @return Mongo's Query */ private Query queryForAll() { return new Query(); }
From source file:com.card.loop.xyz.dao.UserDAO.java
public boolean exists(String username, String userType) throws UnknownHostException { boolean ok = false; Query query = new Query(); query.addCriteria(where("username").is(username).andOperator(where("userType").is(userType))); ok = user.exists(query, User.class); return ok;/*from www . jav a 2 s .com*/ }
From source file:org.oncoblocks.centromere.mongodb.GenericMongoRepository.java
/** * {@link RepositoryOperations#findAll}// w w w .ja va2 s. c om */ public List<T> find(Iterable<QueryCriteria> queryCriterias, Sort sort) { Criteria criteria = MongoQueryUtils.getQueryFromQueryCriteria(queryCriterias); Query query = new Query(); if (criteria != null) { query.addCriteria(criteria); } return mongoOperations.find(query.with(sort), model); }
From source file:things.mongo.MongoConnector.java
private Optional<Thing<?>> findThingForIdQuery(String id) { if (id == null) { throw new IllegalArgumentException("Id can't be null"); }/*w ww . j av a 2 s . c o m*/ Query q = new Query(); try { q.addCriteria(Criteria.where("_id").is(new ObjectId(id))); } catch (IllegalArgumentException iae) { throw new NoSuchThingException(id); } Thing thing = mongoTemplate.findOne(q, Thing.class); if (thing == null) { return Optional.empty(); } return Optional.of(thing); }
From source file:com.tlantic.integration.authentication.service.security.TokenStoreService.java
@Override public void removeRefreshToken(OAuth2RefreshToken accessToken) { Query query = new Query(); query.addCriteria(Criteria.where("tokenId").is(accessToken.getValue())); OAuth2AuthenticationRefreshToken token = mongoTemplate.findOne(query, OAuth2AuthenticationRefreshToken.class, "oauth2_refresh_token"); if (token != null) { oAuth2RefreshTokenRepository.delete(token); }//from w ww. j a v a2 s .com }
From source file:net.cit.tetrad.resource.SubResource.java
/** * ? ? /*from w ww .jav a 2s. co m*/ * @param dto * @return * @throws Exception */ @RequestMapping("/subPageView.do") public ModelAndView subPageView(CommonDto dto) throws Exception { log.debug("start - subPageView()"); ModelAndView mav = commMav(); Query query = new Query(); query.sort().on("groupBind", Order.ASCENDING); List<Object> groupLst = monadService.getList(query, Group.class); List<Object> typeLst = new ArrayList<Object>(); typeLst = adminDao.typeList(); mav.addObject("type", typeLst); mav.addObject("group", groupLst); mav.addObject("comm", dto); mav.setViewName("sub_page"); log.debug("end - subPageView()"); return mav; }
From source file:lodsve.mongodb.core.GenericMongoRepository.java
public Page<T> findAll(final Pageable pageable) { Long count = count();/*ww w . j a v a2 s . co m*/ List<T> list = findAll(new Query().with(pageable)); return new PageImpl<>(list, pageable, count); }
From source file:net.cit.tetrad.utility.QueryUtils.java
public static Query setConfirm(int groupCode, int deviceCode, String type, int alarm, String groupBind) { Query query = new Query(); if (groupCode != 0) query.addCriteria(Criteria.where("groupCode").is(groupCode)); if (deviceCode != 0) query.addCriteria(Criteria.where("deviceCode").is(deviceCode)); if (!Utility.isNull(type).equals("")) query.addCriteria(Criteria.where("cri_type").is(type)); if (!Utility.isNull(groupBind).equals("")) query.addCriteria(Criteria.where("groupBind").is(groupBind)); query.addCriteria(Criteria.where("alarm").is(alarm)); query.addCriteria(Criteria.where("confirm").is(0)); return query; }