Package gov.niem.tools.api.db.component
Class ComponentService<T extends Component<T>,U extends ComponentRepository<T>>
java.lang.Object
gov.niem.tools.api.db.base.BaseEntityService<T>
gov.niem.tools.api.db.component.ComponentService<T,U>
- Direct Known Subclasses:
PropertyService
,TypeService
public abstract class ComponentService<T extends Component<T>,U extends ComponentRepository<T>>
extends BaseEntityService<T>
Operations for managing a component.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a component to the database.Add a component to the database.Add a component to the database.Add a component to the database.Add a component to the database.Add a component to the database.void
assertRequiredLocalFields
(T component) Check that the given component has its required fields.void
assertUnique
(T component) Check that the required fields in the given component do not already exist in the database.findByNamespace
(String stewardKey, String modelKey, String versionKey, String prefix) Find a list of all components in the namespace with the given fields.findByVersion
(String stewardKey, String modelKey, String versionKey) Find a list of all components in the version with the given fields.Find a component in the database matching the given version and qualified name.Find a component in the database matching the given fields.Find a component in the database matching the given fields.Find a component in the database matching identifying fields in the given component.findOneOptional
(Version version, String qname) Optionally find a component in the database matching the given fields.findOneOptional
(String stewardKey, String modelKey, String versionNumber, String qname) Optionally find a component in the database matching the given fields.findOneOptional
(String stewardKey, String modelKey, String versionNumber, String prefix, String name) Optionally find a component in the database matching the given fields.static String
getQualifiedName
(String qname) Return the name from the given qualified name.static String
getQualifiedPrefix
(String qname) Return the prefix from the given qualified name.Methods inherited from class gov.niem.tools.api.db.base.BaseEntityService
assertFieldNotNullAndNotEmpty, delete, edit, findOneOptional, getEntityClassName, getNotFoundException, loadId, merge, saveExisting, saveNew, throwNotFound, throwNotFound, throwNotFound, throwNotUnique, throwNotUnique, throwNotUnique
-
Field Details
-
repo
-
versionService
-
namespaceService
-
-
Constructor Details
-
ComponentService
public ComponentService()
-
-
Method Details
-
repository
- Specified by:
repository
in classBaseEntityService<T extends Component<T>>
-
add
Add a component to the database.- Throws:
Exception
-
add
Add a component to the database.- Throws:
Exception
-
add
Add a component to the database.- Throws:
Exception
-
add
Add a component to the database.- Throws:
Exception
-
add
Add a component to the database.- Throws:
Exception
-
add
Add a component to the database. -
findOne
Find a component in the database matching identifying fields in the given component.- Specified by:
findOne
in classBaseEntityService<T extends Component<T>>
- Throws:
EntityNotFoundException
-
findOne
Find a component in the database matching the given version and qualified name.- Throws:
EntityNotFoundException
-
findOne
public T findOne(String stewardKey, String modelKey, String versionNumber, String qname) throws EntityNotFoundException Find a component in the database matching the given fields.- Throws:
EntityNotFoundException
-
findOne
public T findOne(String stewardKey, String modelKey, String versionNumber, String prefix, String name) throws EntityNotFoundException Find a component in the database matching the given fields.- Throws:
EntityNotFoundException
-
findOneOptional
Optionally find a component in the database matching the given fields.- Throws:
EntityNotFoundException
-
findOneOptional
public Optional<T> findOneOptional(String stewardKey, String modelKey, String versionNumber, String qname) throws EntityNotFoundException Optionally find a component in the database matching the given fields.- Throws:
EntityNotFoundException
-
findOneOptional
public Optional<T> findOneOptional(String stewardKey, String modelKey, String versionNumber, String prefix, String name) throws EntityNotFoundException Optionally find a component in the database matching the given fields.- Throws:
EntityNotFoundException
-
findByVersion
public List<T> findByVersion(String stewardKey, String modelKey, String versionKey) throws Exception Find a list of all components in the version with the given fields.- Throws:
Exception
-
findByNamespace
public List<T> findByNamespace(String stewardKey, String modelKey, String versionKey, String prefix) throws Exception Find a list of all components in the namespace with the given fields.- Throws:
Exception
-
assertRequiredLocalFields
Check that the given component has its required fields.- Specified by:
assertRequiredLocalFields
in classBaseEntityService<T extends Component<T>>
- Throws:
FieldNotFoundException
-
assertUnique
Check that the required fields in the given component do not already exist in the database.- Specified by:
assertUnique
in classBaseEntityService<T extends Component<T>>
- Throws:
EntityNotUniqueException
-
getQualifiedPrefix
Return the prefix from the given qualified name. -
getQualifiedName
Return the name from the given qualified name.
-