Package gov.niem.tools.api.db.property
Class PropertyController
java.lang.Object
gov.niem.tools.api.db.property.PropertyController
@RestController
@RequestMapping("stewards/{stewardKey}/models/{modelKey}/versions/{versionNumber}")
public class PropertyController
extends Object
REST controller for properties.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcountNamespaceProperties(String stewardKey, String modelKey, String versionNumber, String prefix, Property.Category category) Count all properties in the namespace with the given fields.longcountVersionProperties(String stewardKey, String modelKey, String versionNumber, Property.Category category) Count all properties in the version with the given fields.getCurrent(String stewardKey, String modelKey, String versionNumber, String qname) Get the current version of the property with the given fields.getHistory(String stewardKey, String modelKey, String versionNumber, String qname, boolean includePreRelease) Get the history of the property with the given fields.getKeywordProperties(String stewardKey, String modelKey, String versionNumber, String keyword) Gets a list of the top 10 properties with the keyword from the version with the given fields.org.springframework.data.domain.Page<Property> getNamespaceProperties(String stewardKey, String modelKey, String versionNumber, String prefix, org.springframework.data.domain.Pageable pageable) Gets all properties from the namespace with the given fields.getNamespacePropertiesCmf(String stewardKey, String modelKey, String versionNumber, String prefix, org.springframework.data.domain.Pageable pageable, Config.AppMediaType mediaType) Gets all properties from a namespace with the given fields in CMF.getNext(String stewardKey, String modelKey, String versionNumber, String qname, boolean includePreRelease) Get the next version of the property with the given fields.getPrev(String stewardKey, String modelKey, String versionNumber, String qname, boolean includePreRelease) Get the previous version of the property with the given fields.getProperty(String stewardKey, String modelKey, String versionNumber, String qname) Gets a property with the given fields.getPropertyCmf(String stewardKey, String modelKey, String versionNumber, String qname, Config.AppMediaType mediaType) Gets a property in CMF with the given fields.getSubstitutionGroups(String stewardKey, String modelKey, String versionNumber, String qname) Get the list of substitution group heads for the property with the given fields.getSubstitutions(String stewardKey, String modelKey, String versionNumber, String qname) Get the list of substitutions for the property with the given fields.org.springframework.data.domain.Page<Property> getVersionProperties(String stewardKey, String modelKey, String versionNumber, org.springframework.data.domain.Pageable pageable) Gets all properties from the version with the given fields.
-
Constructor Details
-
PropertyController
public PropertyController()
-
-
Method Details
-
getProperty
@GetMapping("/properties/{qname}") @ResponseStatus(code=OK) public Property getProperty(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String qname) throws Exception Gets a property with the given fields.- Throws:
Exception
-
getPropertyCmf
@GetMapping("/properties/{qname}/formats/cmf") @ResponseStatus(code=OK) public Object getPropertyCmf(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String qname, @RequestParam(required=false,defaultValue="json") Config.AppMediaType mediaType) throws Exception Gets a property in CMF with the given fields.- Throws:
Exception
-
getVersionProperties
@GetMapping("/properties") @ResponseStatus(code=OK) public org.springframework.data.domain.Page<Property> getVersionProperties(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PageableDefault(sort={"prefix","name"}) org.springframework.data.domain.Pageable pageable) throws Exception Gets all properties from the version with the given fields.- Throws:
Exception
-
getNamespaceProperties
@GetMapping("/namespaces/{prefix}/properties") @ResponseStatus(code=OK) public org.springframework.data.domain.Page<Property> getNamespaceProperties(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix, @PageableDefault(sort={"prefix","name"}) org.springframework.data.domain.Pageable pageable) throws Exception Gets all properties from the namespace with the given fields. Default sort is namespace rank (e.g., Core first), prefix, and then name.- Throws:
Exception
-
getKeywordProperties
@GetMapping("/properties/keyword/{keyword}") @ResponseStatus(code=OK) public List<Property> getKeywordProperties(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String keyword) throws Exception Gets a list of the top 10 properties with the keyword from the version with the given fields.- Parameters:
keyword- - A keyword in a property name. May be qualified with a namespace prefix or with an empty string to treat the keyword as a starts-with search vs leading and trailing wildcards. Note that spaces in the keyword are not supported.- Throws:
Exception
-
getNamespacePropertiesCmf
@GetMapping("/namespaces/{prefix}/properties/formats/cmf") @ResponseStatus(code=OK) public Object getNamespacePropertiesCmf(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix, @PageableDefault(sort={"namespace.prefix","name"}) org.springframework.data.domain.Pageable pageable, @RequestParam(required=false,defaultValue="json") Config.AppMediaType mediaType) throws Exception Gets all properties from a namespace with the given fields in CMF.- Throws:
Exception
-
countVersionProperties
@GetMapping("/properties/count") @ResponseStatus(code=OK) public long countVersionProperties(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @RequestParam(required=false) Property.Category category) throws EntityNotFoundException Count all properties in the version with the given fields.- Throws:
EntityNotFoundException
-
countNamespaceProperties
@GetMapping("/namespaces/{prefix}/properties/count") @ResponseStatus(code=OK) public long countNamespaceProperties(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String prefix, @RequestParam(required=false) Property.Category category) throws EntityNotFoundException Count all properties in the namespace with the given fields.- Throws:
EntityNotFoundException
-
getPrev
@GetMapping("/properties/{qname}/prev") @ResponseStatus(code=OK) public Property getPrev(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String qname, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the previous version of the property 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("/properties/{qname}/next") @ResponseStatus(code=OK) public Property getNext(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String qname, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the next version of the property 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("/properties/{qname}/current") @ResponseStatus(code=OK) public Property getCurrent(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String qname) throws Exception Get the current version of the property with the given fields.- Throws:
Exception
-
getHistory
@GetMapping("/properties/{qname}/history") @ResponseStatus(code=OK) public List<Property> getHistory(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String qname, @RequestParam(required=false,defaultValue="false") boolean includePreRelease) throws Exception Get the history of the property 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
-
getSubstitutions
@GetMapping("/properties/{qname}/substitutions") @ResponseStatus(code=OK) public List<Property> getSubstitutions(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String qname) throws Exception Get the list of substitutions for the property with the given fields.- Throws:
Exception
-
getSubstitutionGroups
@GetMapping("/properties/{qname}/groups") @ResponseStatus(code=OK) public List<Property> getSubstitutionGroups(@PathVariable String stewardKey, @PathVariable String modelKey, @PathVariable String versionNumber, @PathVariable String qname) throws Exception Get the list of substitution group heads for the property with the given fields.Note that for substitutable properties, this is usually a single abstract property on its own. Occasionally, this abstract property may also belong to its own substitution group. This chain of substitution groups may be needed when dealing with property dependencies.
- Throws:
Exception
-