How Object Initialization Rules Work
The context in which a rule is created and the object type associated with the rule determine which objects are affected by the rule. To better understand how rules work, the discussion can be broken into two areas:
Every rule that is defined specifies the object type for which the rule applies.
Object types have their own hierarchy. This hierarchy is used when determining which rules apply to an object. The object type hierarchy defines the top-level type as the parent type and then any subtypes of the parent are children of the parent.
Every rule is defined in a specific context where the rule applies.
Contexts have their own hierarchy. This hierarchy is used when determining which rules apply to a specific object. The context hierarchy defines the site context as the top-level parent context and each organization context created as a child of the site context. Then, the application contexts created become children of the organization context under which they are created.
Rules do not replace other rules, but all rules that apply are merged to create a composite rule. The merging involves combining rule definitions using the object type and context hierarchies that are in place, where the rule definition from the lowest level in the hierarchy takes precedence over definitions in parent types and contexts.
Both the object type specified when the rule was created and the context in which the rule was created are taken into account. When all of the rules are defined for the same object type, then merging rules only involves using the established context hierarchy. When all of the rules that are defined are in the same context, then merging rules only involves using the established type hierarchy. When object type and context hierarchies are both involved for merging rules, then the object type hierarchy in the same context takes precedence over the context hierarchy.
The inheritance from the parent to child in both types or contexts can be changed by including the optional final or ignore attributes in an AttrValue, AttrConstraint, or VarDef element for a specific object attribute.
* 
Do not modify or remove the wt.fc.WTObject rule.
For examples and additional information about how rules are merged, see Слияние правил для создания композитного правила.
Было ли это полезно?