Sample Rules: Simple Attributes

Figure 1. Simple Attributes
<Class name="Person" extends="AbstractPerson" extendsRuleSet="MotivationRuleSet"
        xsi:noNamespaceSchemaLocation="http://www.curamsoftware.com/CreoleRulesSchema.xsd">

        <Attribute name="personID">
            <type>
                <javaclass name="Long">
            </type>
            <derivation>
                <specified>
            </derivation>
        </Attribute>

        <Attribute name="medicaidCategory">
            <type>
                <codetableentry table="MotivationTestCategory">
            </type>
            <derivation>
                <specified>
            </derivation>
        </Attribute>

    </Class>

The attributes above, personID and medicaidCategory are simple attributes, ie they are not RuleObjects. Rather than being added as child entities in the datastore, they will be added as attributes of the datastore entity created for their parent RuleObject, provided the names of the attributes are appropriate for the schema. Unlike attributes which are RuleObjects where the name of the attribute in the parent RuleObject is not important, for simple attributes the attribute name IS important. The processing will check whether Person.personID and Person.medicaidCategory are appropriate for the schema. Person.personID is appropriate so the personID will be added as an attribute of the Person entity. Person.medicaidCategory is not contained in the schema and this will not be added to the Person entity in the datastore.