org.eclipse.emf.validation.model
Class ConstraintStatus

java.lang.Object
  extended byorg.eclipse.core.runtime.Status
      extended byorg.eclipse.emf.validation.model.ConstraintStatus
All Implemented Interfaces:
IConstraintStatus, org.eclipse.core.runtime.IStatus

public class ConstraintStatus
extends org.eclipse.core.runtime.Status
implements IConstraintStatus

Indicates the result of evaluating a constraint on a model object. Any constraint which is met by the object results in an IStatus.OK status. Failure of a constraint results in a status severity matching the severity defined for the constraint.

As a special case of constraint failure, if the validation framework receives an uncaught exception from the constraint, then the constraint is disabled and the resulting ConstraintStatus is an IStatus.INFO indicating this fact and containing the exception that caused the failure. Once disabled, the constraint will not be evaluated again.

This class should not be extended outside of the validation framework.

See Also:
IModelConstraint.validate(org.eclipse.emf.validation.IValidationContext)

Field Summary
 
Fields inherited from class org.eclipse.core.runtime.Status
CANCEL_STATUS, OK_STATUS
 
Fields inherited from interface org.eclipse.core.runtime.IStatus
CANCEL, ERROR, INFO, OK, WARNING
 
Constructor Summary
ConstraintStatus(IModelConstraint constraint, org.eclipse.emf.ecore.EObject target)
          Initializes me as a successful execution of the specified constraint.
ConstraintStatus(IModelConstraint constraint, org.eclipse.emf.ecore.EObject target, int status, int code, java.lang.String message, java.util.Set resultLocus)
           Constructor that explicitly initializes all of my parts.
ConstraintStatus(IModelConstraint constraint, org.eclipse.emf.ecore.EObject target, java.lang.String message, java.util.Set resultLocus)
          Initializes me as a failure of the specified constraint with a message to be displayed somehow to the user.
 
Method Summary
 IModelConstraint getConstraint()
          Obtains the constraint which either succeeded or failed, according to what I have to say.
 java.util.Set getResultLocus()
          Obtains the objects which are involved in the failure of the constraint.
 org.eclipse.emf.ecore.EObject getTarget()
          Obtains the target object, on which the constraint was evaluated.
 
Methods inherited from class org.eclipse.core.runtime.Status
getChildren, getCode, getException, getMessage, getPlugin, getSeverity, isMultiStatus, isOK, matches, setCode, setException, setMessage, setPlugin, setSeverity, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IStatus
getChildren, getCode, getException, getMessage, getPlugin, getSeverity, isMultiStatus, isOK, matches
 

Constructor Detail

ConstraintStatus

public ConstraintStatus(IModelConstraint constraint,
                        org.eclipse.emf.ecore.EObject target,
                        java.lang.String message,
                        java.util.Set resultLocus)
Initializes me as a failure of the specified constraint with a message to be displayed somehow to the user.

Parameters:
constraint - the constraint that failed
target - the target of the failed validation
message - the message describing the failure
resultLocus - the objects which caused the constraint to fail (at least the original target should be among these). May be null if there really is no result locus

ConstraintStatus

public ConstraintStatus(IModelConstraint constraint,
                        org.eclipse.emf.ecore.EObject target)
Initializes me as a successful execution of the specified constraint.

Parameters:
constraint - the constraint that succeeded
target - the target of the successful validation

ConstraintStatus

public ConstraintStatus(IModelConstraint constraint,
                        org.eclipse.emf.ecore.EObject target,
                        int status,
                        int code,
                        java.lang.String message,
                        java.util.Set resultLocus)

Constructor that explicitly initializes all of my parts.

This constructor should not be used outside of the validation framework.

Parameters:
constraint - the constraint that was evaluated
target - the object on which validation was performed
status - the status of the constraint evaluation
code - the error code (if the constraint failed)
message - the error message (if the constraint failed)
resultLocus - the result locus (if the constraint failed)
Method Detail

getConstraint

public final IModelConstraint getConstraint()
Obtains the constraint which either succeeded or failed, according to what I have to say.

Specified by:
getConstraint in interface IConstraintStatus
Returns:
my constraint

getTarget

public final org.eclipse.emf.ecore.EObject getTarget()
Obtains the target object, on which the constraint was evaluated.

Specified by:
getTarget in interface IConstraintStatus
Returns:
the target of the validation operation

getResultLocus

public final java.util.Set getResultLocus()
Obtains the objects which are involved in the failure of the constraint. These are objects which caused the constraint to fail, and would be useful to link to from some display of the error message.

Specified by:
getResultLocus in interface IConstraintStatus
Returns:
the objects which caused the constraint to fail. In cases of successful validation, the result is an empty collection. The result is never null

Copyright 2002, 2006 IBM Corporation and others.
All Rights Reserved.