OcdsController extends GenericOCDSController { @ApiOperation(value = "Returns all available packages, filtered by the given criteria." + "This will contain the OCDS package information (metadata about publisher) plus the release itself.") @RequestMapping(value = "/api/ocds/package/all", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) public List<ReleasePackage> ocdsPackages(@ModelAttribute @Valid final YearFilterPagingRequest releaseRequest) { List<Release> ocdsReleases = ocdsReleases(releaseRequest); List<ReleasePackage> releasePackages = new ArrayList<>(ocdsReleases.size()); for (Release release : ocdsReleases) { releasePackages.add(createReleasePackage(release)); } return releasePackages; }  @ApiOperation(value = "Returns a release entity for the given project id. " + "The project id is read from planning.budget.projectID") @RequestMapping(value = "/api/ocds/release/budgetProjectId/{projectId:^[a-zA-Z0-9]*$}", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) Release ocdsByProjectId(@PathVariable final String projectId); @ApiOperation(value = "Returns a release entity for the given open contracting id (OCID).") @RequestMapping(value = "/api/ocds/release/ocid/{ocid}", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) Release ocdsByOcid(@PathVariable final String ocid); @ApiOperation(value = "Returns a release package for the given open contracting id (OCID)." + "This will contain the OCDS package information (metadata about publisher) plus the release itself.") @RequestMapping(value = "/api/ocds/package/ocid/{ocid}", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) ReleasePackage ocdsPackageByOcid(@PathVariable final String ocid); ReleasePackage createReleasePackage(final Release release); @ApiOperation(value = "Returns a release package for the given project id. " + "The project id is read from planning.budget.projectID." + "This will contain the OCDS package information (metadata about publisher) plus the release itself.") @RequestMapping(value = "/api/ocds/package/budgetProjectId/{projectId:^[a-zA-Z0-9]*$}", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) ReleasePackage packagedReleaseByProjectId(@PathVariable final String projectId); @ApiOperation(value = "Resturns all available releases, filtered by the given criteria.") @RequestMapping(value = "/api/ocds/release/all", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) List<Release> ocdsReleases(@ModelAttribute @Valid final YearFilterPagingRequest releaseRequest); @ApiOperation(value = "Counts releases, filter by given criteria") @RequestMapping(value = "/api/ocds/release/count", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) @Cacheable Long ocdsReleasesCount(@ModelAttribute @Valid final YearFilterPagingRequest releaseRequest); @ApiOperation(value = "Resturns all available releases with flags, filtered by the given criteria.") @RequestMapping(value = "/api/flaggedRelease/all", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Internal.class) List<FlaggedRelease> flaggedOcdsReleases(
            @ModelAttribute @Valid final YearFilterPagingRequest releaseRequest); @ApiOperation(value = "Counts all available releases with flags, filtered by the given criteria.") @RequestMapping(value = "/api/flaggedRelease/count", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Internal.class) @Cacheable Long countFlaggedOcdsReleases(
            @ModelAttribute @Valid final YearFilterPagingRequest releaseRequest); @ApiOperation(value = "Returns a release entity for the given open contracting id (OCID).") @RequestMapping(value = "/api/flaggedRelease/ocid/{ocid}", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Internal.class) FlaggedRelease flaggedReleaseByOcid(@PathVariable final String ocid); @ApiOperation(value = "Returns all available packages, filtered by the given criteria." + "This will contain the OCDS package information (metadata about publisher) plus the release itself.") @RequestMapping(value = "/api/ocds/package/all", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) List<ReleasePackage> ocdsPackages(@ModelAttribute @Valid final YearFilterPagingRequest releaseRequest);  }
@Test public void ocdsPackages() throws Exception { final List<ReleasePackage> releasePackages = ocdsController.ocdsPackages(new YearFilterPagingRequest()); Assert.assertEquals(3, releasePackages.size()); }