Package gov.niem.tools.api.db.version
Class VersionController
java.lang.Object
gov.niem.tools.api.db.version.VersionController
@Validated
@RestController
@RequestMapping("/stewards/{stewardKey}/models/{modelKey}")
public class VersionController
extends Object
REST controller for versions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcountVersions(String stewardKey, String modelKey) Count all versions from the model with the given fields.getCurrent(String stewardKey, String modelKey) Get the current instance of the version with the given fields.getHistory(String stewardKey, String modelKey, String versionNumber, boolean includePreRelease) Get the history of the version with the given fields.Get the next version of the version with the given fields.Get the previous version of the version with the given fields.getVersion(String stewardKey, String modelKey, String versionNumber) Gets the version with the given fields.getVersionCmf(String stewardKey, String modelKey, String versionNumber, Config.AppMediaType mediaType) Gets the version with the given fields in CMF.getVersions(String stewardKey, String modelKey) Gets all versions from the model with the given fields.
-
Constructor Details
-
VersionController
public VersionController()
-
-
Method Details
-
getVersion
@GetMapping("/versions/{versionNumber}") @ResponseStatus(code=OK) public Version getVersion(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber) throws Exception Gets the version with the given fields.- Throws:
Exception
-
getVersionCmf
@GetMapping("/versions/{versionNumber}/formats/cmf") @ResponseStatus(code=OK) public Object getVersionCmf(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @RequestParam(required=false,defaultValue="json") Config.AppMediaType mediaType) throws Exception Gets the version with the given fields in CMF.- Throws:
Exception
-
getVersions
@GetMapping("/versions") @ResponseStatus(code=OK) public List<Version> getVersions(@PathVariable String stewardKey, @PathVariable String modelKey) throws Exception Gets all versions from the model with the given fields.- Throws:
Exception
-
countVersions
@GetMapping("/versions/count") @ResponseStatus(code=OK) public long countVersions(@PathVariable String stewardKey, @PathVariable String modelKey) Count all versions from the model with the given fields. -
getPrev
@GetMapping("/versions/{versionNumber}/prev") @ResponseStatus(code=OK) public Version getPrev(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the previous version of the version with the given fields.- Parameters:
includePreRelease- - True to return a result from a pre-release if applicable; false to iterate until an official version is reached.- Throws:
Exception
-
getNext
@GetMapping("/versions/{versionNumber}/next") @ResponseStatus(code=OK) public Version getNext(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the next version of the version with the given fields.- Parameters:
includePreRelease- - True to return a result from a pre-release if applicable; false to iterate until an official version is reached.- Throws:
Exception
-
getHistory
@GetMapping("/versions/{versionNumber}/history") @ResponseStatus(code=OK) public List<Version> getHistory(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the history of the version with the given fields.- Parameters:
includePreRelease- - True to return a result from a pre-release if applicable; false to iterate until an official version is reached.- Throws:
Exception
-
getCurrent
@GetMapping("/versions/current") @ResponseStatus(code=OK) public Version getCurrent(@PathVariable String stewardKey, @PathVariable String modelKey) throws Exception Get the current instance of the version with the given fields.- Throws:
Exception
-