test_class.declarator: countPlansTendersAwardsController
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private CountPlansTendersAwardsController countPlansTendersAwardsController;
test_class.type: CountPlansTendersAwardsController
test_class.var_name: countPlansTendersAwardsController
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/CountPlansTendersAwardsControllerTest.java
test_class.identifier: CountPlansTendersAwardsControllerTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void countTendersByYear() throws Exception {
          final List<Document> countTendersByYear = countPlansTendersAwardsController
                  .countTendersByYear(new YearFilterPagingRequest());
  
          final Document first = countTendersByYear.get(0);
          int year = (int) first.get(CountPlansTendersAwardsController.Keys.YEAR);
          int count = (int) first.get(CountPlansTendersAwardsController.Keys.COUNT);
          Assert.assertEquals(2014, year);
          Assert.assertEquals(1, count);
  
          final Document second = countTendersByYear.get(1);
          year = (int) second.get(CountPlansTendersAwardsController.Keys.YEAR);
          count = (int) second.get(CountPlansTendersAwardsController.Keys.COUNT);
          Assert.assertEquals(2015, year);
          Assert.assertEquals(2, count);
      }
test_case.class_method_signature: CountPlansTendersAwardsControllerTest.countTendersByYear()
test_case.full_signature: @Test public void countTendersByYear()
test_case.identifier: countTendersByYear
test_case.invocations: countTendersByYear get get get assertEquals assertEquals get get get assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void countTendersByYear()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/CountPlansTendersAwardsController.java
focal_class.identifier: CountPlansTendersAwardsController
focal_class.class_method_signature: CountPlansTendersAwardsController.countTendersByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Count the tenders and group the results by year. The year is calculated from " + "tender.tenderPeriod.startDate.") @RequestMapping(value = "/api/countTendersByYear", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> countTendersByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: countTendersByYear
focal_class.modifiers: @ApiOperation(value = "Count the tenders and group the results by year. The year is calculated from " + "tender.tenderPeriod.startDate.") @RequestMapping(value = "/api/countTendersByYear", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public
focal_class.parameters: (@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.return: List<Document>
focal_class.signature: List<Document> countTendersByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.class_method_signature: CountPlansTendersAwardsController.countAwardsByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Count the awards and group the results by year. " + "The year is calculated from the awards.date field.") @RequestMapping(value = "/api/countAwardsByYear", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> countAwardsByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: countAwardsByYear
focal_class.modifiers: @ApiOperation(value = "Count the awards and group the results by year. " + "The year is calculated from the awards.date field.") @RequestMapping(value = "/api/countAwardsByYear", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public
focal_class.parameters: (@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.return: List<Document>
focal_class.signature: List<Document> countAwardsByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation(value = "Count the tenders and group the results by year. The year is calculated from "
              + "tender.tenderPeriod.startDate.")
      @RequestMapping(value = "/api/countTendersByYear",
              method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
      public List<Document> countTendersByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          DBObject project = new BasicDBObject();
          addYearlyMonthlyProjection(filter, project, ref(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE));
  
          Aggregation agg = Aggregation.newAggregation(match(
                  where(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE).exists(true).
                          andOperator(getYearDefaultFilterCriteria(filter,
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE
                          ))),
                  new CustomOperation(new Document("$project", project)),
                  group(getYearlyMonthlyGroupingFields(filter)).count().as(Keys.COUNT),
                  transformYearlyGrouping(filter).andInclude(Keys.COUNT),
                  getSortByYearMonth(filter),
                  skip(filter.getSkip()), limit(filter.getPageSize())
          );
  
          return releaseAgg(agg);
      }
focal_method.class_method_signature: CountPlansTendersAwardsController.countTendersByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation(value = "Count the tenders and group the results by year. The year is calculated from " + "tender.tenderPeriod.startDate.") @RequestMapping(value = "/api/countTendersByYear", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> countTendersByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: countTendersByYear
focal_method.invocations: addYearlyMonthlyProjection ref newAggregation match andOperator exists where getYearDefaultFilterCriteria as count group getYearlyMonthlyGroupingFields andInclude transformYearlyGrouping getSortByYearMonth skip getSkip limit getPageSize releaseAgg
focal_method.modifiers: @ApiOperation(value = "Count the tenders and group the results by year. The year is calculated from " + "tender.tenderPeriod.startDate.") @RequestMapping(value = "/api/countTendersByYear", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public
focal_method.parameters: (@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.return: List<Document>
focal_method.signature: List<Document> countTendersByYear(@ModelAttribute @Valid final YearFilterPagingRequest filter)