Validation - STARIONGROUP/COMET-SDK-Community-Edition GitHub Wiki
Introduction
The correctness of POCO and DTO objects is validated/verified at different levels in the COMET-SDK. The following aspects are checked:
- CDP4-COMET Data Model property multiplicity
- CDP4-COMET Data Model Rule verification
- Value validation
property multiplicity
Each property of a class in the CDP4-COMET Data Model has its multiplicity specified.
- [POCO]] properties are validated using the
ValidatePoco
method. Any validation errors that are encountered during the validation are availble via theValidationErrors
getter. The [[Assembler]] uses theValidatePoco
method during the synchronization process when [[DTO]] objects are transformed into [[POCO]] objects. A side-effect of theValidatePoco
method is that the properties of [[POCO]] classes that have a multiplicity of [1..1] and are not [Containment are set to a sentinel Thing by the SentinelThingProvider. This is used to make sure that the Cache is populated with Thing objects that have no unresolved references. TheValidationErrors
property is used by the GUI of the COMET-IME to display errors to the end user. - [DTO]] properties are validated by means of the [MetaInfo Classes
Validate
method. A Cdp4ModelValidationException is thrown when a validation error is incurred. The CDP4-COMET Web Services make use of this mechanism to validate DTO objects that are sent to it.
User Defined Rules
ECSS-E-TM-10-25A-Annex-A contains 5 different kinds or Rule classes that can be used to verify the correctness of a Model.
- BinaryRelationshipRule: representation of a validation rule for BinaryRelationships.
- DecompositionRule: representation of a validation rule for system-of-interest decomposition through containingElement ElementDefinitions and containedElement ElementUsages.
- MultiRelationshipRule: representation of a validation rule for MultiRelationships that relate (potentially) more than two CategorizableThings.
- ParameterizedCategoryRule: A Rule that asserts that one or more parameters of a given ParameterType should be defined for CategorizableThings that are a member of the associated Category.
- ReferencerRule: representation of a validation rule for ElementDefinitions and the referencedElement NestedElements.
Each of these classes implements the IRuleVerification
interface which exposes the Verify
method. The Verify method is used to verify the contents of an Iteration.
Value validation
The ValueValidator class is used to validate the correctness of values set on ParameterValueSet.
The default for value properties is
-
(hyphen).
For each ParameterType there is a dedicated implementation of the Validate
method. The ValueValidator is used by the GUI of the COMET-IME to display validate user input for Parameters.
Valid values for the BooleanParameterType are "-", "true", "false", "True", "False", "1" and "0".