Skip to content

Validation

samatrhea edited this page Aug 21, 2024 · 9 revisions

Introduction

The correctness of POCO and DTO objects is validated/verified at different levels in the COMET-SDK. The following aspects are checked:

  1. CDP4-COMET Data Model property multiplicity
  2. CDP4-COMET Data Model Rule verification
  3. 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 the ValidationErrors getter. The Assembler uses the ValidatePoco method during the synchronization process when DTO objects are transformed into POCO objects. A side-effect of the ValidatePoco 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. The ValidationErrors 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.

  1. BinaryRelationshipRule: representation of a validation rule for BinaryRelationships.
  2. DecompositionRule: representation of a validation rule for system-of-interest decomposition through containingElement ElementDefinitions and containedElement ElementUsages.
  3. MultiRelationshipRule: representation of a validation rule for MultiRelationships that relate (potentially) more than two CategorizableThings.
  4. 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.
  5. 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".


« CDP4Common-CE Polyfills  —  Documentation overview  —  CDP4Common-CE Classless DTO »

Clone this wiki locally