@Query("{ $and: [ {'scheduledNotifications.BACKUP.active': true }, { $where: 'this.scheduledNotifications.BACKUP.lastNotified < " + "new Date(new Date().setDate(new Date().getDate() - this.scheduledNotifications.BACKUP.frequency ))' }] }") List<Recipient> findReadyForBackup();
@Query("{ $and: [ {'scheduledNotifications.REMIND.active': true }, { $where: 'this.scheduledNotifications.REMIND.lastNotified < " + "new Date(new Date().setDate(new Date().getDate() - this.scheduledNotifications.REMIND.frequency ))' }] }") List<Recipient> findReadyForRemind();
/** * String query selecting one entity. * * @param lastname * @return */ @Query("{ 'firstname': ?0, 'lastname': ?1}") Maybe<Person> findByFirstnameAndLastname(String firstname, String lastname);
/** * String query selecting one entity. * * @param lastname * @return */ @Query("{ 'firstname': ?0, 'lastname': ?1}") Mono<Person> findByFirstnameAndLastname(String firstname, String lastname);
@Query("{id: ?#{ hasRole('ROLE_ADMIN') ? {$exists:true} : principal.id}}") List<Person> findAllForCurrentUserById(); }
@Query("{}") Stream<Person> findAllByCustomQueryWithStream(); }
/** * Returns all {@link Product}s having the given attribute. * * @param attribute * @return */ @Query("{ ?0 : ?1 }") List<Product> findByAttributes(String key, String value); }
/** * Finds the {@link EnvironmentComponent} collector item id, environment name and component name. * * @param collectorItemId collector item id * @param environmentName environment name * @param componentName component name * @return a {@link EnvironmentComponent} */ @Query(value="{ collectorItemId : ?0, environmentName : ?1, componentName : ?2}") EnvironmentComponent findComponent(ObjectId collectorItemId, String environmentName, String componentName);
/** * Finds the {@link CollectorItem} for a given collector and options. This should represent a unique * instance of a {@link CollectorItem} for a given {@link com.capitalone.dashboard.model.Collector}. * * @param collectorId {@link com.capitalone.dashboard.model.Collector} id * @param options options * @return a {@link CollectorItem} */ @Query(value="{ 'collectorId' : ?0, options : ?1}") T findByCollectorAndOptions(ObjectId collectorId, Map<String, Object> options);
/** * Find {@link Launch} by id, load only next fields: * <li>id; * <li>startTime; * <li>status. * * @param id ID of Launch * @return {@link Launch} */ @Query(value = "{ '_id': ?0 }", fields = "{'id' : 1, 'startTime':1, 'status':1, 'projectRef':1 }") Launch loadStatusProjectRefAndStartTime(String id);
/** * Find ID of dashboard by user and projectName, load only id field * * @param userName Name of user * @param projectName Name of project * @param dashName Name of dashboard * @return {@link Dashboard} */ @Query(value = SELECT_BY_USER_PROJECT_DASHNAME, fields = ID_FIELD) Dashboard findOneByUserProject(String userName, String projectName, String dashName);
/** * Finds log by TestStep ID. Returns fully populated * {@link com.epam.ta.reportportal.database.entity.Log} * * @param testItem * @return */ @Query(value = FIND_LOG_ENTRY_BY_STEP_ID, fields = "{'id' : 1}") List<Log> findLogIdsByTestItemId(String testItem);
/** * Find {@link UserFilter} by user, project and id, load all fields * * @param userName * @param projectName * @param id * @return {@link UserFilter} */ @Query(value = SELECT_BY_USER_ID_PROJECT) UserFilter findOne(String userName, String id, String projectName);
/** * Finds all enabled {@link ScoreCollectorItem}s * * @param collectorId ID * @return list of {@link ScoreCollectorItem}s */ @Query(value = "{ 'collectorId' : ?0, enabled: true}") List<ScoreCollectorItem> findEnabledScores(ObjectId collectorId);
/** * Streaming launches by provided project ID * * @param id * @return */ @Query(value = FIND_LAUNCH_ENTRY_BY_PROJECT_ID, fields = "{'id' : 1}") Stream<Launch> streamIdsByProject(String id);
/** * Find {@link UserFilter} by userName, projectName and id, load only id field * * @param user * @param projectName * @param id * @return {@link UserFilter} */ @Query(value = SELECT_BY_USER_ID_PROJECT, fields = ID_FIELD) UserFilter findOneLoadId(String userName, String id, String projectName);