Package gov.niem.tools.api.db.facet
Class FacetService
Operations supporting facets.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(Type type, Facet.Category category, String value, String definition) Creates a new facet with the given fields and adds it to the given type.add(String stewardKey, String modelKey, String versionNumber, String qname, Facet.Category category, String value, String definition) Creates a new facet with the given facet fields and adds it to the type matching the given type fields.voidassertRequiredLocalFields(Facet facet) Checks that the facet has all required fields.voidassertUnique(Facet facet) Checks that the database does not already have a facet with the same identifying fields.longcountByNamespace(String stewardKey, String modelKey, String versionNumber, String prefix) Count all facets by the namespace with the given fields.longcountByProperty(String stewardKey, String modelKey, String versionNumber, String qname) Count all facets by the type of the property with the given fields.longcountByType(String stewardKey, String modelKey, String versionNumber, String qname) Count all facets by the type with the given fields.longcountByVersion(String stewardKey, String modelKey, String versionNumber) Count all facets by the version with the given fields.org.springframework.data.domain.Page<Facet> findByNamespace(String stewardKey, String modelKey, String versionNumber, String prefix, org.springframework.data.domain.Pageable pageable) Finds all facets in the database from the namespace matching the given fields.org.springframework.data.domain.Page<Facet> findByProperty(String stewardKey, String modelKey, String versionNumber, String qname, org.springframework.data.domain.Pageable pageable) Finds all facets in the database from the type of the property matching the given fields.org.springframework.data.domain.Page<Facet> findByType(String stewardKey, String modelKey, String versionNumber, String qname, org.springframework.data.domain.Pageable pageable) Finds all facets in the database from the type matching the given fields.org.springframework.data.domain.Page<Facet> findByVersion(String stewardKey, String modelKey, String versionNumber, org.springframework.data.domain.Pageable pageable) Finds all facets in the database from the version matching the given fields.Finds a facet in the database matching the fields in the given facet object.findOne(String stewardKey, String modelKey, String versionNumber, String qname, Facet.Category category, String value) Finds a facet in the database with the given fields.findOneOptional(String stewardKey, String modelKey, String versionNumber, String qname, Facet.Category category, String value) Optionally finds a facet in the database with the given fields.Methods inherited from class gov.niem.tools.api.db.base.BaseVersionEntityService
getHistory, getNext, getPrevMethods inherited from class gov.niem.tools.api.db.base.BaseEntityService
add, assertFieldNotNullAndNotEmpty, count, delete, edit, findOneOptional, getEntityClassName, getNotFoundException, loadId, merge, saveExisting, saveNew, throwNotFound, throwNotFound, throwNotFound, throwNotUnique, throwNotUnique, throwNotUnique
-
Constructor Details
-
FacetService
public FacetService()
-
-
Method Details
-
repository
- Specified by:
repositoryin classBaseEntityService<Facet>
-
add
public Facet add(String stewardKey, String modelKey, String versionNumber, String qname, Facet.Category category, String value, String definition) throws Exception Creates a new facet with the given facet fields and adds it to the type matching the given type fields.- Throws:
Exception
-
add
public Facet add(Type type, Facet.Category category, String value, String definition) throws Exception Creates a new facet with the given fields and adds it to the given type.- Throws:
Exception
-
findOneOptional
public Optional<Facet> findOneOptional(String stewardKey, String modelKey, String versionNumber, String qname, Facet.Category category, String value) throws EntityNotFoundException Optionally finds a facet in the database with the given fields.- Throws:
EntityNotFoundException
-
findOne
public Facet findOne(String stewardKey, String modelKey, String versionNumber, String qname, Facet.Category category, String value) throws EntityNotFoundException Finds a facet in the database with the given fields.- Throws:
EntityNotFoundException
-
findOne
Finds a facet in the database matching the fields in the given facet object.- Specified by:
findOnein classBaseEntityService<Facet>- Throws:
EntityNotFoundException
-
findByVersion
public org.springframework.data.domain.Page<Facet> findByVersion(String stewardKey, String modelKey, String versionNumber, org.springframework.data.domain.Pageable pageable) throws EntityNotFoundException Finds all facets in the database from the version matching the given fields.- Throws:
EntityNotFoundException
-
findByNamespace
public org.springframework.data.domain.Page<Facet> findByNamespace(String stewardKey, String modelKey, String versionNumber, String prefix, org.springframework.data.domain.Pageable pageable) throws EntityNotFoundException Finds all facets in the database from the namespace matching the given fields.- Throws:
EntityNotFoundException
-
findByType
public org.springframework.data.domain.Page<Facet> findByType(String stewardKey, String modelKey, String versionNumber, String qname, org.springframework.data.domain.Pageable pageable) throws EntityNotFoundException Finds all facets in the database from the type matching the given fields.- Throws:
EntityNotFoundException
-
findByProperty
public org.springframework.data.domain.Page<Facet> findByProperty(String stewardKey, String modelKey, String versionNumber, String qname, org.springframework.data.domain.Pageable pageable) throws EntityNotFoundException Finds all facets in the database from the type of the property matching the given fields.- Throws:
EntityNotFoundException
-
countByVersion
public long countByVersion(String stewardKey, String modelKey, String versionNumber) throws EntityNotFoundException Count all facets by the version with the given fields.- Throws:
EntityNotFoundException
-
countByNamespace
public long countByNamespace(String stewardKey, String modelKey, String versionNumber, String prefix) throws EntityNotFoundException Count all facets by the namespace with the given fields.- Throws:
EntityNotFoundException
-
countByType
public long countByType(String stewardKey, String modelKey, String versionNumber, String qname) throws EntityNotFoundException Count all facets by the type with the given fields.- Throws:
EntityNotFoundException
-
countByProperty
public long countByProperty(String stewardKey, String modelKey, String versionNumber, String qname) throws EntityNotFoundException Count all facets by the type of the property with the given fields.- Throws:
EntityNotFoundException
-
assertRequiredLocalFields
Checks that the facet has all required fields.- Specified by:
assertRequiredLocalFieldsin classBaseEntityService<Facet>- Throws:
FieldNotFoundException
-
assertUnique
Checks that the database does not already have a facet with the same identifying fields.- Specified by:
assertUniquein classBaseEntityService<Facet>- Throws:
EntityNotUniqueException
-