Class WriteAttribute


public class WriteAttribute
extends java.lang.Object

WriteAttribute CX writes a single node as an attribute in the saved configuration tables. Only one method is required to write the node as an attribute to the database. The tradeoff for the simplicity of only one method to do the work is that the CX is only meant for writing one attribute at a time. If your problem requires multiple attributes to be written to the database on a particular node, instead of using this CX (a SQL Exception is the likely result), you will need to create a CX that is meant to handle multiple attributes on a single node.

Rule Definition
Model Node Select the node upon which the attribute should be written (for example, the root component of the configuration)
Java Class
Java Class Instantiation With Model Node Instance

Ken Truesdale, Katharsys LLC

Constructor Summary
Method Summary
 void writeAttribute( headerNode, java.lang.String attribCat, java.lang.String attribName, attribNode)
          Defines the criteria for writing the attribute and writes the attribute to the CZ_CONFIG_ATTRIBUTES table.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public WriteAttribute()
Method Detail


public void writeAttribute( headerNode,
                           java.lang.String attribCat,
                           java.lang.String attribName,

Defines the criteria for writing the attribute and writes the attribute to the CZ_CONFIG_ATTRIBUTES table.

This CX won't work unless the event binding is PostConfigSave.

The attribute category (Arg 2) is an arbitrary name you use to define the criteria for this attribute. It can be used later in other applications but in Configurator, you can use any name you like.

The attribute name (Arg 3) will need to be one of the columns in the CZ_CONFIG_ATTRIBUTES table meant for storing attributes. The column names begin with ATTRIBUTE1, ATTRIBUTE2, and go up to ATTRIBUTE30. Any of those 30 column names can be used here.

The value is extracted from the attribute node (Arg 4). The way the value is determined depends on the type of node specified. If the node is an OptionFeature, the value is the name of the selected Options. (Note that mutually exclusive OptionFeatures work best but are not required - if you have more than one selection in the OptionFeature, the names of all the selected Options are strung together.) If the node is a BooleanFeature, the value is "True" when the Feature is true, "False" when it is false, and empty when the Feature is unknown. If the node is a numeric feature, the numeric value is used. (Note that in some cases, Configurator stores numeric values internally with slight imprecision and since this CX merely gets the values stored internally, the CX has no control over how the number comes out; if you need the number formatted a special way, you will need to create a CX to handle your numbers.) And if the node is a text feature, the text value of the text feature is used. (Note that text features are generally initialized with a single space as a value and this CX will pass on that value to the attributes table.) A CountFeature will be treated as a regular IntegerFeature for this CX. Options and all other node types will return an empty string for the value. (Let me know if there is a node type that should be included that is not currently.)

In most cases, this CX should only be used once per model. It is possible to use it multiple times in a model, but you need to be careful to only have one binding per CX Rule and each CX Rule will need to have a different base node. Multiple uses of the same base node (either with multiple bindings or with multiple CX Rules with the same ase node) will cause a SQL Exception since the method writes one row to the DB for each method call and since there is a DB restriction that each node in the configuration can only occur in the CZ_CONFIG_ATTRIBUTES table once.

Event Binding
Event postConfigSave
Scope Base Node
Method writeAttribute
Argument Binding(s)
Arg 1 Argument Type IRuntimeNode
Argument Name condNode
Argument Specification System Parameter
Binding <BaseNodeOfRule>
Arg 2 Argument Type String
Argument Name attribCat
Argument Specification Literal
Binding the name of the attribute category (written to the database)
Arg 3 Argument Type String
Argument Name attribName
Argument Specification Literal
Binding the name of the column in the CZ_CONFIG_ATTRIBUTES table in which the attribute should be stored
Arg 4 Argument Type IRuntimeNode
Argument Name attribNode
Argument Specification Model Node
Binding the node that contains the attribute value

Copyright © 2010 Katharsys LLC. All Rights Reserved. Implementation-Version: 0.1-b46