|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Constraint
Class Constraint
A Constraint defines a rule that restricts the state or behavior of one or more elements in the meta-model. When a Constraint is attached to a ModelElement, the rule it encodes applies to all relevant instances of the ModelElement in a model.
A Constraint rule, represented by the 'expression' attribute, may be encoded in any form. The 'language' attribute may be used to denote the language and encoding scheme used.
While some Constraints on a model may need to be treated as invariant, it is often convenient for other Constraints to be relaxed, for instance while a model is being edited. While, the 'evaluationPolicy' attribute is used to represent these two cases, this information is at best advisory, since the MOF specification does not currently state how and when Constraints should be enforced.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.opencrx.kernel.model1.cci2.Element |
---|
Element.Identity |
Method Summary | |
---|---|
short |
getEvaluationPolicy()
Retrieves the value for the attribute evaluationPolicy . |
String |
getExpression()
Retrieves the value for the attribute expression . |
String |
getLanguage()
Retrieves the value for the attribute language . |
void |
setEvaluationPolicy(short evaluationPolicy)
Sets a new value for the attribute evaluationPolicy . |
void |
setExpression(String expression)
Sets a new value for the attribute expression . |
void |
setLanguage(String language)
Sets a new value for the attribute language . |
Methods inherited from interface org.opencrx.kernel.model1.cci2.Element |
---|
getAnnotation, getContainer, getElementOrder, getName, getQualifiedName, getSegment, getStereotype, setAnnotation, setContainer, setElementOrder, setName, setQualifiedName, setStereotype |
Methods inherited from interface org.opencrx.kernel.base.cci2.AlertSender |
---|
sendAlert |
Methods inherited from interface org.opencrx.kernel.base.cci2.Auditee |
---|
getAudit |
Methods inherited from interface org.opencrx.kernel.base.cci2.Cloneable |
---|
clone_ |
Methods inherited from interface org.opencrx.kernel.base.cci2.Exporter |
---|
exportItem, exportItemAdvanced |
Methods inherited from interface org.opencrx.kernel.base.cci2.Importer |
---|
importItem |
Methods inherited from interface org.opencrx.kernel.base.cci2.Indexed |
---|
getIndexEntry, updateIndex |
Methods inherited from interface org.opencrx.kernel.base.cci2.SecureObject |
---|
addOwningGroup, checkPermissions, getAccessLevelBrowse, getAccessLevelDelete, getAccessLevelUpdate, getOwner, getOwningGroup, getOwningUser, removeAllOwningGroup, removeOwningGroup, replaceOwningGroup, setAccessLevel, setAccessLevelBrowse, setAccessLevelDelete, setAccessLevelUpdate, setOwner, setOwningUser, setOwningUser |
Methods inherited from interface org.opencrx.kernel.generic.cci2.LocalizedFieldContainer |
---|
getLocalizedField |
Methods inherited from interface org.openmdx.base.cci2.Creatable |
---|
getCreatedAt, getCreatedBy |
Methods inherited from interface org.openmdx.base.cci2.ExtentCapable |
---|
getIdentity |
Methods inherited from interface org.openmdx.base.cci2.Modifiable |
---|
getModifiedAt, getModifiedBy |
Method Detail |
---|
short getEvaluationPolicy()
evaluationPolicy
.
Each constraint can be defined as immediate or deferred. For immediate Constraints, the constraint violation will be detected and reported within an operation in the chain of operations between the operation initiated by the MOF user and the operation that caused the constraint violation. The effect of an operation that violates an immediate constraint on the state of the object or objects being altered is implementation specific, and possibly undefined. However, if possible, an implementation should reverse the effects of the operation.
For deferred Constraints, the constraint violation can only be detected when the Constraint is explicitly evaluated. The MOF defines an operation for such constraint evaluation, the verify operation. When the verify operation is invoked on a Constraint's container, the constraint is evaluated and a constraint violation is detected, if present.
evaluationPolicy
.void setEvaluationPolicy(short evaluationPolicy)
evaluationPolicy
.
Each constraint can be defined as immediate or deferred. For immediate Constraints, the constraint violation will be detected and reported within an operation in the chain of operations between the operation initiated by the MOF user and the operation that caused the constraint violation. The effect of an operation that violates an immediate constraint on the state of the object or objects being altered is implementation specific, and possibly undefined. However, if possible, an implementation should reverse the effects of the operation.
For deferred Constraints, the constraint violation can only be detected when the Constraint is explicitly evaluated. The MOF defines an operation for such constraint evaluation, the verify operation. When the verify operation is invoked on a Constraint's container, the constraint is evaluated and a constraint violation is detected, if present.
evaluationPolicy
- The non-null new value for attribute evaluationPolicy
.String getExpression()
expression
.
The Constraint's expression attribute provides a representation of the constraint. The MOF has no specific requirement to interpret this expression, or to validate it against the language attribute. The specific handling of the expression will necessarily vary with the language used. However, it is expected that for any language an implementation accepts, it will enforce the constraints expressed in that language. The expression can be represented in any format, including text or a composition of objects.
expression
.void setExpression(String expression)
expression
.
The Constraint's expression attribute provides a representation of the constraint. The MOF has no specific requirement to interpret this expression, or to validate it against the language attribute. The specific handling of the expression will necessarily vary with the language used. However, it is expected that for any language an implementation accepts, it will enforce the constraints expressed in that language. The expression can be represented in any format, including text or a composition of objects.
expression
- The non-null new value for attribute expression
.String getLanguage()
language
.
The language representing this Constraint's expression is defined in this attribute. Since it is a string, most any language can be represented, including format variances in a language (e.g., OCL as text verses OCL as a parse tree).
language
.void setLanguage(String language)
language
.
The language representing this Constraint's expression is defined in this attribute. Since it is a string, most any language can be represented, including format variances in a language (e.g., OCL as text verses OCL as a parse tree).
language
- The non-null new value for attribute language
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |