Package gov.niem.tools.api.db.namespace
Class NamespaceController
java.lang.Object
gov.niem.tools.api.db.namespace.NamespaceController
@Validated
@RestController
@RequestMapping("/stewards/{stewardKey}/models/{modelKey}/versions/{versionNumber}")
public class NamespaceController
extends Object
REST controller for namespaces.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcountNamespaces(String stewardKey, String modelKey, String versionNumber, Namespace.Category category) Count all namespaces in the version with the given fields.getHistory(String stewardKey, String modelKey, String versionNumber, String prefix, boolean includePreRelease) Get the history of the namespace with the given fields.getNamespace(String stewardKey, String modelKey, String versionNumber, String prefix) Get a namespace with the given fields.getNamespaceCmf(String stewardKey, String modelKey, String versionNumber, String prefix, Config.AppMediaType mediaType) Get a namespace in CMF with the given fields.Get the current version of the namespace with the given fields.getNext(String stewardKey, String modelKey, String versionNumber, String prefix, boolean includePreRelease) Get the next version of the namespace with the given fields.getPrev(String stewardKey, String modelKey, String versionNumber, String prefix, boolean includePreRelease) Get the previous version of the namespace with the given fields.getVersionNamespaces(String stewardKey, String modelKey, String versionNumber) Get all namespaces from a version of a model.getVersionNamespacesCmf(String stewardKey, String modelKey, String versionNumber, Config.AppMediaType mediaType) Get all namespaces as CMF from a version of a model.
-
Constructor Details
-
NamespaceController
public NamespaceController()
-
-
Method Details
-
getNamespace
@GetMapping("/namespaces/{prefix}") @ResponseStatus(code=OK) public Namespace getNamespace(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix) throws Exception Get a namespace with the given fields.- Throws:
Exception- Example:
- http://api.niemopen.org/v2/stewards/niem/models/model/versions/5.2/namespaces/nc
-
getNamespaceCmf
@GetMapping("/namespaces/{prefix}/formats/cmf") @ResponseStatus(code=OK) public Object getNamespaceCmf(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix, @RequestParam(required=false,defaultValue="json") Config.AppMediaType mediaType) throws Exception Get a namespace in CMF with the given fields.- Throws:
Exception
-
getVersionNamespaces
@GetMapping("/namespaces") @ResponseStatus(code=OK) public List<Namespace> getVersionNamespaces(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber) throws Exception Get all namespaces from a version of a model.- Throws:
Exception- Example:
- http://api.niemopen.org/v2/stewards/niem/models/model/versions/5.2/namespaces
-
getVersionNamespacesCmf
@GetMapping("/namespaces/formats/cmf") @ResponseStatus(code=OK) public Object getVersionNamespacesCmf(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @RequestParam(required=false,defaultValue="json") Config.AppMediaType mediaType) throws Exception Get all namespaces as CMF from a version of a model.- Throws:
Exception
-
countNamespaces
@GetMapping("/namespaces/count") @ResponseStatus(code=OK) public long countNamespaces(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @RequestParam(required=false) Namespace.Category category) throws EntityNotFoundException Count all namespaces in the version with the given fields.- Throws:
EntityNotFoundException
-
getPrev
@GetMapping("/namespaces/{prefix}/prev") @ResponseStatus(code=OK) public Namespace getPrev(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the previous version of the namespace 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("/namespaces/{prefix}/next") @ResponseStatus(code=OK) public Namespace getNext(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the next version of the namespace 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("/namespaces/{prefix}/current") @ResponseStatus(code=OK) public Namespace getNext(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix) throws Exception Get the current version of the namespace with the given fields.- Throws:
Exception
-
getHistory
@GetMapping("/namespaces/{prefix}/history") @ResponseStatus(code=OK) public List<Namespace> getHistory(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the history of the namespace 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
-