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.void
assertRequiredLocalFields
(Model model) Checks that the object has the required fields.void
assertUnique
(Model model) Checks that the object will be unique and will not clash with another object in the database.Gets the version from the NIEM reference model labeled as current.void
Deletes 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 list of all models in the database.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, 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:
repository
in 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:
add
in 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:
findOne
in 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 list of all models in the database. -
assertRequiredLocalFields
Description copied from class:BaseEntityService
Checks that the object has the required fields.- Specified by:
assertRequiredLocalFields
in classBaseEntityService<Model>
- Throws:
FieldNotFoundException
-
assertUnique
Description copied from class:BaseEntityService
Checks that the object will be unique and will not clash with another object in the database.- Specified by:
assertUnique
in classBaseEntityService<Model>
- Throws:
EntityNotUniqueException
-