Package gov.niem.tools.api.db.version
Class VersionService
java.lang.Object
gov.niem.tools.api.db.base.BaseEntityService<Version>
gov.niem.tools.api.db.base.BaseVersionEntityService<Version>
gov.niem.tools.api.db.version.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.voidassertRequiredLocalFields(Version version) Checks that the object has the required fields.voidassertUnique(Version version) Checks the the database does not contain another version with the same identifying fields as the given version object.longCount the number of versions for the model with the given fields.voidDeletes 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.findByModel(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.findOneCurrent(String stewardKey, String modelKey) Finds the version with the given fields that is marked as current.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.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
-
VersionService
public VersionService()
-
-
Method Details
-
repository
- Specified by:
repositoryin 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:
findOnein 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
-
findOneCurrent
Finds the version with the given fields that is marked as current.- Throws:
EntityNotFoundException
-
findByModel
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
-
count
Count the number of versions for the model with the given fields.- Throws:
EntityNotFoundException
-
assertRequiredLocalFields
Description copied from class:BaseEntityServiceChecks that the object has the required fields.- Specified by:
assertRequiredLocalFieldsin 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:
assertUniquein classBaseEntityService<Version>- Throws:
EntityNotUniqueException
-