org.eclipse.emf.validation.service
Class ValidationEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.eclipse.emf.validation.service.ValidationEvent
All Implemented Interfaces:
Serializable

public final class ValidationEvent
extends EventObject

Event notifying IValidationListeners that a validation operation has occurred.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ValidationEvent(EvaluationMode<T> mode, Map<String,?> clientData, Collection<? extends T> targets, IStatus status)
          Initializes me with the evaluation mode, client data, elements or notifications validated, and validation results that I will pass along to listeners.
ValidationEvent(EvaluationMode<T> mode, Map<String,?> clientData, Collection<? extends T> targets, IStatus status, Collection<String> clientContextIds)
          Initializes me with the evaluation mode, client data, elements or notifications validated, and validation results that I will pass along to listeners.
 
Method Summary
 Collection<String> getClientContextIds()
          Retrieves the client context ids that were involved in the validation that lead to this event.
 Map<String,Object> getClientData()
          Retrieves the client-specific data that the client that initiated the validation operation publishes to listeners.
 EvaluationMode<?> getEvaluationMode()
          Queries the mode in which the validation operation occurred.
 int getSeverity()
          Queries the overall severity of the validation results.
 List<IConstraintStatus> getValidationResults()
          Obtains the results of the validation operation.
 Collection<?> getValidationTargets()
          Obtains the collection of EObjects (in the batch mode case) or Notifications (in the live mode case) that were validated.
 boolean matches(int severityMask)
          Queries whether the overall severity of the validation results matches the specified severity mask.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidationEvent

public ValidationEvent(EvaluationMode<T> mode,
                       Map<String,?> clientData,
                       Collection<? extends T> targets,
                       IStatus status)
Initializes me with the evaluation mode, client data, elements or notifications validated, and validation results that I will pass along to listeners.

Type Parameters:
T - the kind of objects that were validated
Parameters:
mode - the evaluation mode
clientData - data specific to the particular validation client that performed the validation wishes to make available to listeners
targets - the elements or notifications (according to the evaluation mode) that were validated
status - the validation results

ValidationEvent

public ValidationEvent(EvaluationMode<T> mode,
                       Map<String,?> clientData,
                       Collection<? extends T> targets,
                       IStatus status,
                       Collection<String> clientContextIds)
Initializes me with the evaluation mode, client data, elements or notifications validated, and validation results that I will pass along to listeners. Also, I will be initialized with the client context IDs that were involved in the validation.

Type Parameters:
T - the kind of objects that were validated
Parameters:
mode - the evaluation mode
clientData - data specific to the particular validation client that performed the validation wishes to make available to listeners
targets - the elements or notifications (according to the evaluation mode) that were validated
status - the validation results
clientContextIds - the client context Ids that were involved in the validation.
Method Detail

getClientContextIds

public Collection<String> getClientContextIds()
Retrieves the client context ids that were involved in the validation that lead to this event.

Returns:
A collection of the client context ids in String form. These ids should not be modified in any way as they may affect other listeners.

getEvaluationMode

public EvaluationMode<?> getEvaluationMode()
Queries the mode in which the validation operation occurred.

Returns:
the evaluation mode; never null or even EvaluationMode.NULL

getClientData

public Map<String,Object> getClientData()
Retrieves the client-specific data that the client that initiated the validation operation publishes to listeners. It is up to listeners to make what they will of the information that they do or do not find in this map. Two things the caller may be assured of:
  1. the map is never null
  2. its keys are Strings

Returns:
an unmodifiable mapping of client data

getValidationTargets

public Collection<?> getValidationTargets()
Obtains the collection of EObjects (in the batch mode case) or Notifications (in the live mode case) that were validated.

Returns:
an unmodifiable collection of the validation targets
See Also:
getValidationResults()

getSeverity

public int getSeverity()
Queries the overall severity of the validation results.

Returns:
the severity, enumerated by the IStatus interface
See Also:
IStatus.getSeverity()

matches

public boolean matches(int severityMask)
Queries whether the overall severity of the validation results matches the specified severity mask.

Parameters:
severityMask - the severity mask to match
Returns:
whether the overall severity matches
See Also:
IStatus.matches(int)

getValidationResults

public List<IConstraintStatus> getValidationResults()
Obtains the results of the validation operation.

Returns:
the validation results, as an unmodifiable list of IConstraintStatuses
See Also:
getValidationTargets()

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