List of usage examples for org.springframework.data.mongodb.core.query Query Query
public Query()
From source file:com.card.loop.xyz.dao.LearningElementDAO.java
public boolean nameAvailability(String title, String subject) throws UnknownHostException { mongoOps.find(query(where("rating").is(5)), LearningElement.class); Query query = new Query(); query.addCriteria(where("title").is(title).andOperator(where("subject").is(subject))); return DatabaseManager.getMongoOpsInstance(AppConfig.DATABASE_LOOP).exists(query, LearningElement.class); }
From source file:com.card.loop.xyz.dao.UserDAO.java
public User getUser(String username, String type) throws UnknownHostException { Query query = new Query(); query.addCriteria(Criteria.where("username").is(username).and("userType").is(type)); User p = null;/*from w ww . java2 s . c o m*/ p = user.findOne(query, User.class); return p; }
From source file:net.cit.tetrad.utility.QueryUtils.java
/** * ? ? groupname,uid,type ?/* w ww.j a v a 2 s .c o m*/ */ public static Query setCriSearch(CommonDto dto) { Query query = new Query(); if (dto.getIdx() != 0) query.addCriteria(Criteria.where("idx").ne(dto.getIdx())); if (dto.getGroupCode() != 0) query.addCriteria(Criteria.where("groupCode").is(dto.getGroupCode())); if (dto.getDeviceCode() != 0) query.addCriteria(Criteria.where("deviceCode").is(dto.getDeviceCode())); if (!Utility.isNull(dto.getType()).equals("")) query.addCriteria(Criteria.where("type").is(dto.getType())); return query; }
From source file:com.epam.ta.reportportal.database.dao.TestItemRepositoryCustomImpl.java
private Query getItemDescendantsQuery(Object... id) { return new Query().addCriteria(where("path").in(id)); }
From source file:com.card.loop.xyz.dao.LearningObjectDAO.java
public List<LearningObject> getOldLO(String name) throws UnknownHostException { Query query = new Query(); query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "dateUploaded"))); return (mongoOps.find(query(where("status").is(0)), LearningObject.class)); }
From source file:com.tlantic.integration.authentication.service.security.TokenStoreService.java
@Override public OAuth2AccessToken getAccessToken(OAuth2Authentication authentication) { String authenticationId = authenticationKeyGenerator.extractKey(authentication); if (null == authenticationId) { return null; }//from w ww . j a v a2s . co m Query query = new Query(); query.addCriteria(Criteria.where("authenticationId").is(authenticationId)); OAuth2AuthenticationAccessToken token = mongoTemplate.findOne(query, OAuth2AuthenticationAccessToken.class, "oauth2_access_token"); return token == null ? null : token.getoAuth2AccessToken(); }
From source file:things.mongo.MongoConnector.java
@Override public Observable<? extends Thing<?>> getChildrenForId(String id) { Query q = new Query(); q.addCriteria(Criteria.where("parents").is(id)); List<Thing> result = mongoTemplate.find(q, Thing.class); return Observable.from(result).map(t -> (Thing<?>) t); }
From source file:org.oncoblocks.centromere.mongodb.GenericMongoRepository.java
/** * {@link RepositoryOperations#distinct(String, Iterable)} */// w w w . j a v a 2 s . c om public List<Object> distinct(String field, Iterable<QueryCriteria> queryCriterias) { Criteria criteria = MongoQueryUtils.getQueryFromQueryCriteria(queryCriterias); Query query = new Query(); if (criteria != null) { query.addCriteria(criteria); } return mongoOperations.getCollection(mongoOperations.getCollectionName(model)).distinct(field, query.getQueryObject()); }