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.void
assertRequiredLocalFields
(Facet facet) Checks that the facet has all required fields.void
assertUnique
(Facet facet) Checks that the database does not already have a facet with the same identifying fields.Finds all facets in the database from the type 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.BaseEntityService
add, assertFieldNotNullAndNotEmpty, 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:
repository
in 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:
findOne
in classBaseEntityService<Facet>
- Throws:
EntityNotFoundException
-
find
public Set<Facet> find(String stewardKey, String modelKey, String versionNumber, String qname) throws EntityNotFoundException Finds all facets in the database from the type matching the given fields.- Throws:
EntityNotFoundException
-
assertRequiredLocalFields
Checks that the facet has all required fields.- Specified by:
assertRequiredLocalFields
in classBaseEntityService<Facet>
- Throws:
FieldNotFoundException
-
assertUnique
Checks that the database does not already have a facet with the same identifying fields.- Specified by:
assertUnique
in classBaseEntityService<Facet>
- Throws:
EntityNotUniqueException
-