closeRelation Annotation

closeRelation is a CML annotation that controls addition of new line items to the relationship by the engine.

AnnotationcloseRelation
Applicable toRelationship
Value Type/Valuestrue, false
DescriptionIf closeRelation is not specified, the engine sets it implicitly as false for the relationship. If closeRelation is specified as true, the engine prevents the addition of new line items to the relationship. If closeRelation is specified as false, the engine allows the addition of new line items to the relationship.

Example 1 

In this example, the closeRelation annotation isn’t specified for the relationship (mainalternatorclassification). The model contains the constraint.

1type LineItem;
2type GeneratorSet : LineItem { 
3    @(defaultValue = "Emergency Standby Power (ESP)")
4    string dutyRating = ["Emergency Standby Power (ESP)", "Prime Power (PRP)", "Continuous Power (COP)", "Data Center Continuous (DCC)"];
5    relation mainalternatorclassification : MainAlternatorClassification;
6    constraint(dutyRating == "Continuous Power (COP)" -> mainalternatorclassification[Alternator_240] >= 1);
7}
8type MainAlternatorClassification : LineItem;
9type Alternator_220 : MainAlternatorClassification;
10type Alternator_440 : MainAlternatorClassification;
11type Alternator_240 : MainAlternatorClassification;

Example 2 

In this example, the closeRelationannotation is defined as false for the relationship (mainalternatorclassification). The model contains the constraint.

1type LineItem;
2type GeneratorSet : LineItem {
3    @(defaultValue = "Emergency Standby Power (ESP)")
4    string dutyRating = ["Emergency Standby Power (ESP)", "Prime Power (PRP)", "Continuous Power (COP)", "Data Center Continuous (DCC)"];
5    @(closeRelation = false)    
6    relation mainalternatorclassification : MainAlternatorClassification;
7    constraint(dutyRating == "Continuous Power (COP)" -> mainalternatorclassification[Alternator_240] >= 1);
8}
9type MainAlternatorClassification : LineItem;
10type Alternator_220 : MainAlternatorClassification;
11type Alternator_440 : MainAlternatorClassification;
12type Alternator_240 : MainAlternatorClassification;

Example Description and Configurator Result 

In example 1, the mainalternatorclassification relation is not specified with the closeRelation annotation, but the system considers it as false by default. In example 2, the relation is explicitly defined with false. As a result, if the user updates the dutyRating variable to "Continuous Power (COP)", the system adds the Alternator_240 product according to annotation and constraint logic and allows addition of other products from the mainalternatorclassification relation (Alternator_220,Alternator_440). The system does not allow to unselect the Alternator_240 product specified in the constraint while the "Continuous Power (COP)" is selected. If the user updates the dutyRating variable to another value (For example, Emergency Standby Power (ESP)"), the engine removes the Alternator_240 product, but the user can add/select/unselect all products from the relationship manually.

Example 3 

In this example, the closeRelation annotation is specified as true for the relationship (mainalternatorclassification). The model contains the constraint

1type LineItem;
2type GeneratorSet : LineItem {
3    @(defaultValue = "Emergency Standby Power (ESP)")
4    string dutyRating = ["Emergency Standby Power (ESP)", "Prime Power (PRP)", "Continuous Power (COP)", "Data Center Continuous (DCC)"];
5    @(closeRelation = true)    
6    relation mainalternatorclassification : MainAlternatorClassification;
7    constraint(dutyRating == "Continuous Power (COP)" -> mainalternatorclassification[Alternator_240] >= 1);
8}
9type MainAlternatorClassification : LineItem;
10type Alternator_220 : MainAlternatorClassification;
11type Alternator_440 : MainAlternatorClassification;
12type Alternator_240 : MainAlternatorClassification;

In example 3, the mainalternatorclassification relation is specified with the closeRelation annotation as true. As a result, if a user updates the dutyRating variable to "Continuous Power (COP)", the engine resets it back to "Emergency Standby Power (ESP)" to prevent adding the Alternator_240 product according to the annotation. The user can add all mainalternatorclassification products manually (including the Alternator_240 product specified in the constraint).

Associated ExampleProduct Group StructureApplicable to”closeRelation” annotationUser ActionEngine ActionUI Behavior
N/AIndividual productRelationshipnot specifiedChange variable value specified in constraint conditionAdd the product according to the constraint. Allow addition of other products to the relationshipDisplay product specified in constraint as pre-selected: if a User unselects it, the product returns back to selected state. User can select other products from the relationship.
N/AIndividual productRelationshipTRUEChange variable value specified in constraint conditionReset the variable value back to the default value to avoid addition the relation product specified in the constraintProducts from the relation are not added or selected (including the product specified in constraint). User can manually select any products from the relationship
N/AIndividual productRelationshipFALSEChange variable value specified in constraint conditionAdd the product according to the constraint. Allow addition of other products to the relationshipDisplay product specified in constraint as pre-selected: if a User unselects it, the product returns back to selected state. User can select other products from the relationship.
Example 1Product ClassificationRelationshipnot specifiedChange variable value specified in constraint conditionAdd the product according to the constraint. Allow addition of other products to the relationship from browse products pop upDisplay product specified in constraint as pre-selected: if a User unselects it, the product returns back to selected state. User can add other products from the relationship in browse products pop up.
Example 2Product ClassificationRelationshipFALSEChange variable value specified in constraint conditionAdd the product according to the constraint. Allow addition of other products to the relationship from browse products pop upDisplay product specified in constraint as pre-selected: if a User unselects it, the product returns back to selected state. User can add other products from the relationship in browse products pop up.
Example 3Product ClassificationRelationshipTRUEChange variable value specified in constraint conditionReset the variable value back to the default value to avoid addition the relation product specified in the constraintProducts from the relation are not added or selected (including the product specified in constraint). User can manually browse and add any products from the relationship