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.base.BaseVersionEntityService<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 BaseVersionEntityService<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.voidassertRequiredLocalFields(T component) Check that the given component has its required fields.voidassertUnique(T component) Check that the required fields in the given component do not already exist in the database.longcountByNamespace(String stewardKey, String modelKey, String versionNumber, String prefix) Count all components in a namespace with the given fields.longcountByVersion(String stewardKey, String modelKey, String versionNumber) Count all components in a version with the given fields.findByKeyword(String stewardKey, String modelKey, String versionKey, String keyword) Find a list of the top components matching the keyword in the version with the given fields.org.springframework.data.domain.Page<T> findByNamespace(String stewardKey, String modelKey, String versionKey, String prefix, org.springframework.data.domain.Pageable pageable) Find a page of all components in the namespace with the given fields.org.springframework.data.domain.Page<T> findByVersion(String stewardKey, String modelKey, String versionKey, org.springframework.data.domain.Pageable pageable) Find a page 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 StringgetQualifiedName(String qname) Return the name from the given qualified name.static StringgetQualifiedPrefix(String qname) Return the prefix from the given qualified name.Methods inherited from class gov.niem.tools.api.db.base.BaseVersionEntityService
getHistory, getNext, getPrevMethods inherited from class gov.niem.tools.api.db.base.BaseEntityService
assertFieldNotNullAndNotEmpty, count, 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:
repositoryin 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:
findOnein 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 org.springframework.data.domain.Page<T> findByVersion(String stewardKey, String modelKey, String versionKey, org.springframework.data.domain.Pageable pageable) throws Exception Find a page of all components in the version with the given fields.- Throws:
Exception
-
findByNamespace
public org.springframework.data.domain.Page<T> findByNamespace(String stewardKey, String modelKey, String versionKey, String prefix, org.springframework.data.domain.Pageable pageable) throws Exception Find a page of all components in the namespace with the given fields.- Throws:
Exception
-
findByKeyword
public List<T> findByKeyword(String stewardKey, String modelKey, String versionKey, String keyword) throws Exception Find a list of the top components matching the keyword in the version with the given fields.Note that the keyword may be qualified with a namespace prefix.
Additional, a qualified keyword or a keyword with a leading ':' (but no prefix) will be treated as name-starts-wth vs leading and trailing wildcards.
- Throws:
Exception
-
countByVersion
public long countByVersion(String stewardKey, String modelKey, String versionNumber) throws EntityNotFoundException Count all components in a version with the given fields.- Throws:
EntityNotFoundException
-
countByNamespace
public long countByNamespace(String stewardKey, String modelKey, String versionNumber, String prefix) throws EntityNotFoundException Count all components in a namespace with the given fields.- Throws:
EntityNotFoundException
-
assertRequiredLocalFields
Check that the given component has its required fields.- Specified by:
assertRequiredLocalFieldsin 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:
assertUniquein 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.
-