Package gov.niem.tools.api.db.version
Class VersionService
Operations supporting versions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new version in the database with the given version number and adds it to the given model.Creates a new version in the database with the fields in the given version object and adds it to the model with the given model fields.void
assertRequiredLocalFields
(Version version) Checks that the object has the required fields.void
assertUnique
(Version version) Checks the the database does not contain another version with the same identifying fields as the given version object.void
Deletes a version in the database with the given fields.Updates a version in the database with the given fields to the fields in the given version object.findAll()
Finds all versions in the database.findByKeys
(String stewardKey, String modelKey) Finds all versions in the model with the given fields.Finds the version with the given fields.Finds the version in the database with the identifying fields from the given version object.Finds the version in the database with the given fields.findOneNiem
(String versionNumber) Finds the version from the NIEM reference model with the given version number.findOneOptional
(String stewardKey, String modelKey, String versionNumber) Optionally finds the version 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
-
VersionService
public VersionService()
-
-
Method Details
-
repository
- Specified by:
repository
in classBaseEntityService<Version>
-
add
- Throws:
Exception
-
add
Creates a new version in the database with the fields in the given version object and adds it to the model with the given model fields.- Throws:
Exception
-
add
Creates a new version in the database with the given version number and adds it to the given model.- Throws:
Exception
-
edit
public Version edit(String oldStewardKey, String oldModelKey, String oldVersionNumber, Version updatedVersion) throws Exception Updates a version in the database with the given fields to the fields in the given version object.- Throws:
Exception
-
delete
Deletes a version in the database with the given fields.- Throws:
Exception
-
findAll
Finds all versions in the database. -
findOne
Finds the version in the database with the identifying fields from the given version object.- Specified by:
findOne
in classBaseEntityService<Version>
- Throws:
EntityNotFoundException
-
findOne
public Version findOne(String stewardKey, String modelKey, String versionNumber) throws EntityNotFoundException Finds the version in the database with the given fields.- Throws:
EntityNotFoundException
-
findOneOptional
Optionally finds the version in the database with the given fields. -
findOneNiem
Finds the version from the NIEM reference model with the given version number.- Throws:
EntityNotFoundException
-
findByKeys
Finds all versions in the model with the given fields.- Throws:
Exception
-
findId
public Long findId(String stewardKey, String modelKey, String versionNumber) throws EntityNotFoundException Finds the version with the given fields.- Throws:
EntityNotFoundException
-
assertRequiredLocalFields
Description copied from class:BaseEntityService
Checks that the object has the required fields.- Specified by:
assertRequiredLocalFields
in classBaseEntityService<Version>
- Throws:
FieldNotFoundException
-
assertUnique
Checks the the database does not contain another version with the same identifying fields as the given version object.- Specified by:
assertUnique
in classBaseEntityService<Version>
- Throws:
EntityNotUniqueException
-