test_class.declarator: topTenController
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private TopTenController topTenController;
test_class.type: TopTenController
test_class.var_name: topTenController
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/TopTenControllerTest.java
test_class.identifier: TopTenControllerTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void topTenLargestAwards() throws Exception {
          final List<Document> topTenLargestAwards = topTenController
                  .topTenLargestAwards(new YearFilterPagingRequest());
  
          Assert.assertEquals(2, topTenLargestAwards.size());
  
          final Document first = topTenLargestAwards.get(0);
          BasicDBObject awards = (BasicDBObject) first.get("awards");
          BasicDBObject value = (BasicDBObject) awards.get("value");
          double amount = (double) value.get("amount");
          Assert.assertEquals(6000000.0, amount, 0);
  
          final Document second = topTenLargestAwards.get(1);
          awards = (BasicDBObject) second.get("awards");
          value = (BasicDBObject) awards.get("value");
          amount = (double) value.get("amount");
          Assert.assertEquals(40000.0, amount, 0);
      }
test_case.class_method_signature: TopTenControllerTest.topTenLargestAwards()
test_case.full_signature: @Test public void topTenLargestAwards()
test_case.identifier: topTenLargestAwards
test_case.invocations: topTenLargestAwards assertEquals size get get get get assertEquals get get get get assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void topTenLargestAwards()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/TopTenController.java
focal_class.identifier: TopTenController
focal_class.class_method_signature: TopTenController.topTenLargestAwards(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Returns the top ten largest active awards." + " The amount is taken from the award.value field. The returned data will contain" + "the following fields: " + "awards.date, awards.suppliers.name, " + "awards.value.amount, awards.suppliers.name, planning.budget (if any)") @RequestMapping(value = "/api/topTenLargestAwards", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> topTenLargestAwards(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: topTenLargestAwards
focal_class.modifiers: @ApiOperation(value = "Returns the top ten largest active awards." + " The amount is taken from the award.value field. The returned data will contain" + "the following fields: " + "awards.date, awards.suppliers.name, " + "awards.value.amount, awards.suppliers.name, planning.budget (if any)") @RequestMapping(value = "/api/topTenLargestAwards", 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> topTenLargestAwards(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.class_method_signature: TopTenController.topTenLargestTenders(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Returns the top ten largest active tenders." + " The amount is taken from the tender.value.amount field." + " The returned data will contain" + "the following fields: " + "tender.date, tender.value.amount, tender.tenderPeriod, " + "tender.procuringEntity.name") @RequestMapping(value = "/api/topTenLargestTenders", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> topTenLargestTenders(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: topTenLargestTenders
focal_class.modifiers: @ApiOperation(value = "Returns the top ten largest active tenders." + " The amount is taken from the tender.value.amount field." + " The returned data will contain" + "the following fields: " + "tender.date, tender.value.amount, tender.tenderPeriod, " + "tender.procuringEntity.name") @RequestMapping(value = "/api/topTenLargestTenders", 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> topTenLargestTenders(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.class_method_signature: TopTenController.topTenLargestSuppliers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "This endpoint should return the following data for the Top 10 suppliers (by award value)." + "Returns supplier id, total awarded amount of all awarded contracts, count of awarded contracts," + "Ids of the procuring entities from which they have received an award, and their count. " + "All filters ally here, the year filter uses the awards.date field.") @RequestMapping(value = "/api/topTenSuppliers", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> topTenLargestSuppliers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: topTenLargestSuppliers
focal_class.modifiers: @ApiOperation(value = "This endpoint should return the following data for the Top 10 suppliers (by award value)." + "Returns supplier id, total awarded amount of all awarded contracts, count of awarded contracts," + "Ids of the procuring entities from which they have received an award, and their count. " + "All filters ally here, the year filter uses the awards.date field.") @RequestMapping(value = "/api/topTenSuppliers", 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> topTenLargestSuppliers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation(value = "Returns the top ten largest active awards."
              + " The amount is taken from the award.value field. The returned data will contain"
              + "the following fields: "
              + "awards.date, awards.suppliers.name, "
              + "awards.value.amount, awards.suppliers.name, planning.budget (if any)")
      @RequestMapping(value = "/api/topTenLargestAwards", method = {RequestMethod.POST,
              RequestMethod.GET},
              produces = "application/json")
      public List<Document> topTenLargestAwards(@ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          BasicDBObject project = new BasicDBObject();
          project.put(Fields.UNDERSCORE_ID, 0);
          project.put(MongoConstants.FieldNames.AWARDS_DATE, 1);
          project.put("awards.suppliers.name", 1);
          project.put(MongoConstants.FieldNames.AWARDS_VALUE_AMOUNT, 1);
          project.put("planning.budget", 1);
  
          Aggregation agg = newAggregation(
                  match(where(MongoConstants.FieldNames.AWARDS_VALUE_AMOUNT).exists(true)
                          .and(MongoConstants.FieldNames.AWARDS_STATUS)
                          .is(Award.Status.active.toString())
                          .andOperator(getDefaultFilterCriteria(filter))),
                  unwind("awards"),
                  match(getYearFilterCriteria(filter.awardFiltering(), MongoConstants.FieldNames.AWARDS_DATE)),
                  new CustomOperation(new Document("$project", project)),
                  sort(Direction.DESC, MongoConstants.FieldNames.AWARDS_VALUE_AMOUNT), limit(10)
          );
  
          return releaseAgg(agg);
      }
focal_method.class_method_signature: TopTenController.topTenLargestAwards(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation(value = "Returns the top ten largest active awards." + " The amount is taken from the award.value field. The returned data will contain" + "the following fields: " + "awards.date, awards.suppliers.name, " + "awards.value.amount, awards.suppliers.name, planning.budget (if any)") @RequestMapping(value = "/api/topTenLargestAwards", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> topTenLargestAwards(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: topTenLargestAwards
focal_method.invocations: put put put put put newAggregation match andOperator is and exists where toString getDefaultFilterCriteria unwind match getYearFilterCriteria awardFiltering sort limit releaseAgg
focal_method.modifiers: @ApiOperation(value = "Returns the top ten largest active awards." + " The amount is taken from the award.value field. The returned data will contain" + "the following fields: " + "awards.date, awards.suppliers.name, " + "awards.value.amount, awards.suppliers.name, planning.budget (if any)") @RequestMapping(value = "/api/topTenLargestAwards", 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> topTenLargestAwards(@ModelAttribute @Valid final YearFilterPagingRequest filter)