use of org.springframework.data.mongodb.core.query.Query in project cas by apereo.
the class GoogleAuthenticatorMongoDbTokenRepository method get.
@Override
public GoogleAuthenticatorToken get(final String uid, final Integer otp) {
try {
final Query query = new Query();
query.addCriteria(Criteria.where("userId").is(uid).and("token").is(otp));
final GoogleAuthenticatorToken r = this.mongoTemplate.findOne(query, GoogleAuthenticatorToken.class, this.collectionName);
return r;
} catch (final NoResultException e) {
LOGGER.debug("No record could be found for google authenticator id [{}]", uid);
}
return null;
}
use of org.springframework.data.mongodb.core.query.Query in project cas by apereo.
the class MongoDbGoogleAuthenticatorTokenCredentialRepository method get.
@Override
public OneTimeTokenAccount get(final String username) {
try {
final Query query = new Query();
query.addCriteria(Criteria.where("username").is(username));
final GoogleAuthenticatorAccount r = this.mongoTemplate.findOne(query, GoogleAuthenticatorAccount.class, this.collectionName);
if (r != null) {
return decode(r);
}
} catch (final NoResultException e) {
LOGGER.debug("No record could be found for google authenticator id [{}]", username);
}
return null;
}
use of org.springframework.data.mongodb.core.query.Query in project commons-dao by reportportal.
the class LaunchRepositoryCustomImpl method findIdsByFilter.
@Override
public List<Launch> findIdsByFilter(Filter filter, int limit) {
Query query = QueryBuilder.newBuilder().with(filter).with(limit).build();
query.fields().include(ID_REFERENCE);
return mongoTemplate.find(query, Launch.class);
}
use of org.springframework.data.mongodb.core.query.Query in project commons-dao by reportportal.
the class LaunchRepositoryCustomImpl method findIdsByFilter.
@Override
public List<Launch> findIdsByFilter(Filter filter, Sort sort, int quantity) {
Query query = QueryBuilder.newBuilder().with(filter).with(sort).with(quantity).build();
query.fields().include(NAME);
query.fields().include(ID_REFERENCE);
query.fields().include(NUMBER);
query.fields().include(START_TIME);
query.fields().include(STATUS);
return mongoTemplate.find(query, Launch.class);
}
use of org.springframework.data.mongodb.core.query.Query in project commons-dao by reportportal.
the class LogRepositoryCustomImpl method deleteByPeriodAndItemsRef.
@Override
public void deleteByPeriodAndItemsRef(Duration time, List<String> itemsRef) {
Query query = findModifiedLaterThanPeriod(time).addCriteria(where(ITEM_REFERENCE).in(itemsRef));
mongoTemplate.remove(query, Log.class);
}
Aggregations