test_class.declarator: frequentTenderersController
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private FrequentTenderersController frequentTenderersController;
test_class.type: FrequentTenderersController
test_class.var_name: frequentTenderersController
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/FrequentTenderersControllerTest.java
test_class.identifier: FrequentTenderersControllerTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void frequentTenderersTest() throws Exception {
          final List<Document> frequentTenderers = frequentTenderersController
                  .frequentTenderers(new YearFilterPagingRequest());
  
          Assert.assertEquals(0, frequentTenderers.size());
      }
test_case.class_method_signature: FrequentTenderersControllerTest.frequentTenderersTest()
test_case.full_signature: @Test public void frequentTenderersTest()
test_case.identifier: frequentTenderersTest
test_case.invocations: frequentTenderers assertEquals size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void frequentTenderersTest()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/FrequentTenderersController.java
focal_class.identifier: FrequentTenderersController
focal_class.class_method_signature: FrequentTenderersController.frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Detect frequent pairs of tenderers that apply together to bids." + "We are only showing pairs if they applied to more than one bid together." + "We are sorting the results after the number of occurences, descending." + "You can use all the filters that are available along with pagination options.") @RequestMapping(value = "/api/frequentTenderers", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: frequentTenderers
focal_class.modifiers: @ApiOperation(value = "Detect frequent pairs of tenderers that apply together to bids." + "We are only showing pairs if they applied to more than one bid together." + "We are sorting the results after the number of occurences, descending." + "You can use all the filters that are available along with pagination options.") @RequestMapping(value = "/api/frequentTenderers", 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> frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.class_method_signature: FrequentTenderersController.activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Counts the tenders/awards where the given supplier id is among the winners. " + "This assumes there is only one active award, which always seems to be the case, per tender. ") @RequestMapping(value = "/api/activeAwardsCount", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: activeAwardsCount
focal_class.modifiers: @ApiOperation(value = "Counts the tenders/awards where the given supplier id is among the winners. " + "This assumes there is only one active award, which always seems to be the case, per tender. ") @RequestMapping(value = "/api/activeAwardsCount", 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> activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation(value = "Detect frequent pairs of tenderers that apply together to bids."
              + "We are only showing pairs if they applied to more than one bid together."
              + "We are sorting the results after the number of occurences, descending."
              + "You can use all the filters that are available along with pagination options.")
      @RequestMapping(value = "/api/frequentTenderers", method = {RequestMethod.POST, RequestMethod.GET},
              produces = "application/json")
      public List<Document> frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          Aggregation agg = newAggregation(
                  match(where("tender.tenderers.1").exists(true).and("awards.suppliers.0").exists(true)
                          .and(MongoConstants.FieldNames.AWARDS_STATUS).is(Award.Status.active.toString())
                          .andOperator(getYearDefaultFilterCriteria(
                                  filter,
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE
                          ))),
                  unwind("tender.tenderers"),
                  unwind("awards"),
                  unwind("awards.suppliers"),
                  match(where(MongoConstants.FieldNames.AWARDS_STATUS).is(Award.Status.active.toString())
                          .andOperator(getYearFilterCriteria(
                                  filter.awardFiltering(),
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE
                          ))),
                  project().and(MongoConstants.FieldNames.AWARDS_SUPPLIERS_ID).as("supplierId")
                          .and("tender.tenderers._id").as("tendererId").andExclude(
                          Fields.UNDERSCORE_ID)
                          .and(ComparisonOperators.valueOf(MongoConstants.FieldNames.AWARDS_SUPPLIERS_ID).
                                  compareTo("tender.tenderers._id")).as("cmp"),
                  match((where("cmp").ne(0))),
                  project("supplierId", "tendererId", "cmp")
                          .and(ConditionalOperators.when(
                                  Criteria.where("cmp").is(1)).thenValueOf("$supplierId")
                                  .otherwiseValueOf("$tendererId")).as("tendererId1")
                          .and(ConditionalOperators.when(
                                  Criteria.where("cmp").is(1)).thenValueOf("$tendererId")
                                  .otherwiseValueOf("$supplierId")).as("tendererId2"),
                  group("tendererId1", "tendererId2").count().as("pairCount"),
                  sort(Sort.Direction.DESC, "pairCount"), skip(filter.getSkip()), limit(filter.getPageSize())
          );
  
          return releaseAgg(agg);
      }
focal_method.class_method_signature: FrequentTenderersController.frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation(value = "Detect frequent pairs of tenderers that apply together to bids." + "We are only showing pairs if they applied to more than one bid together." + "We are sorting the results after the number of occurences, descending." + "You can use all the filters that are available along with pagination options.") @RequestMapping(value = "/api/frequentTenderers", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: frequentTenderers
focal_method.invocations: newAggregation match andOperator is and exists and exists where toString getYearDefaultFilterCriteria unwind unwind unwind match andOperator is where toString getYearFilterCriteria awardFiltering as and andExclude as and as and project compareTo valueOf match ne where as and as and project otherwiseValueOf thenValueOf when is where otherwiseValueOf thenValueOf when is where as count group sort skip getSkip limit getPageSize releaseAgg
focal_method.modifiers: @ApiOperation(value = "Detect frequent pairs of tenderers that apply together to bids." + "We are only showing pairs if they applied to more than one bid together." + "We are sorting the results after the number of occurences, descending." + "You can use all the filters that are available along with pagination options.") @RequestMapping(value = "/api/frequentTenderers", 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> frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)