Package gov.niem.tools.api.db.model
Class ModelService
Operations supporting a model.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new model in the database with the fields in the given model object and adds it to the steward with the steward key in the given model object.add(Steward steward, String shortName, String longName, Model.Category category, String description) Creates a new model in the database with the given fields and adds it to the given steward.Creates a new model in the database with the fields in the given model object and adds it to the steward with the given steward key.add(String stewardKey, String shortName, String longName, Model.Category category) Creates a new model in the database with the given fields and adds it to the steward with the given key.add(String stewardKey, String shortName, String longName, Model.Category category, String description) Creates a new model in the database with the given fields and adds it to the steward with the given key.voidassertRequiredLocalFields(Model model) Checks that the object has the required fields.voidassertUnique(Model model) Checks that the object will be unique and will not clash with another object in the database.longGet the count of all models for stewards with the given key.Gets the version from the NIEM reference model labeled as current.voidDeletes a model in the database with the given steward and model keys.Edits a model in the database with the given steward and model key with the fields in the given model object.Edits a model in the database with the given steward and model keys with the fields in the given model object.findAll()Gets a sorted list of all models in the database.findBySteward(String stewardKey) Gets a sorted list of all models in the database from the given steward.Finds a model in the database with the steward and model keys in the given model object.Finds a model in the database with the given steward and model keys.findOneByShortName(String stewardKey, String shortName) Finds a model in the database with the given steward key and model short name.findOneByShortNameOptional(String stewardKey, String shortName) Optionally finds a model in the database with the given steward key and model short name.Finds the NIEM reference model.findOneOptional(String stewardKey, String modelKey) Optionally finds a model in the database with the given steward and model keys.Methods 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
-
Constructor Details
-
ModelService
public ModelService()
-
-
Method Details
-
repository
- Specified by:
repositoryin classBaseEntityService<Model>
-
add
public Model add(String stewardKey, String shortName, String longName, Model.Category category) throws Exception Creates a new model in the database with the given fields and adds it to the steward with the given key.- Throws:
Exception
-
add
public Model add(String stewardKey, String shortName, String longName, Model.Category category, String description) throws Exception Creates a new model in the database with the given fields and adds it to the steward with the given key.- Throws:
Exception
-
add
public Model add(Steward steward, String shortName, String longName, Model.Category category, String description) throws Exception Creates a new model in the database with the given fields and adds it to the given steward.- Throws:
Exception
-
add
Creates a new model in the database with the fields in the given model object and adds it to the steward with the steward key in the given model object.- Overrides:
addin classBaseEntityService<Model>- Throws:
Exception
-
add
Creates a new model in the database with the fields in the given model object and adds it to the steward with the given steward key.- Throws:
Exception
-
edit
Edits a model in the database with the given steward and model keys with the fields in the given model object.- Throws:
Exception
-
edit
Edits a model in the database with the given steward and model key with the fields in the given model object.- Throws:
Exception
-
delete
Deletes a model in the database with the given steward and model keys.- Throws:
Exception
-
findOne
Finds a model in the database with the steward and model keys in the given model object.- Specified by:
findOnein classBaseEntityService<Model>- Throws:
EntityNotFoundException
-
findOne
Finds a model in the database with the given steward and model keys.- Throws:
EntityNotFoundException
-
findOneOptional
public Optional<Model> findOneOptional(String stewardKey, String modelKey) throws EntityNotFoundException Optionally finds a model in the database with the given steward and model keys.- Throws:
EntityNotFoundException
-
findOneByShortNameOptional
Optionally finds a model in the database with the given steward key and model short name. -
findOneByShortName
Finds a model in the database with the given steward key and model short name.- Throws:
Exception
-
findOneNiem
Finds the NIEM reference model.- Throws:
EntityNotFoundException
-
currentNiemVersion
Gets the version from the NIEM reference model labeled as current. -
findAll
Gets a sorted list of all models in the database. -
findBySteward
Gets a sorted list of all models in the database from the given steward. -
count
Get the count of all models for stewards with the given key. -
assertRequiredLocalFields
Description copied from class:BaseEntityServiceChecks that the object has the required fields.- Specified by:
assertRequiredLocalFieldsin classBaseEntityService<Model>- Throws:
FieldNotFoundException
-
assertUnique
Description copied from class:BaseEntityServiceChecks that the object will be unique and will not clash with another object in the database.- Specified by:
assertUniquein classBaseEntityService<Model>- Throws:
EntityNotUniqueException
-