OcdsController extends GenericOCDSController { @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) public Release ocdsByProjectId(@PathVariable final String projectId) { Release release = releaseRepository.findByBudgetProjectId(projectId); return release; }  @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 Planning Bid Number." + "The planning bid number is taken from planning.bidNo") @RequestMapping(value = "/api/ocds/release/planningBidNo/{bidNo:^[a-zA-Z0-9]*$}", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") @JsonView(Views.Public.class) Release ocdsByPlanningBidNo(@PathVariable final String bidNo); @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 open contracting id (OCID)." + "This will contain the OCDS package information (metadata about publisher) plus the release itself.") @RequestMapping(value = "/api/ocds/package/planningBidNo/{bidNo:^[a-zA-Z0-9]*$}", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") @JsonView(Views.Public.class) ReleasePackage packagedReleaseByPlanningBidNo(@PathVariable final String bidNo); @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 = "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 ocdsByProjectId() throws Exception { final Release release = ocdsController.ocdsByProjectId("SP001"); Assert.assertNotNull(release); Assert.assertEquals("ocds-endpoint-001", release.getOcid()); }