org.eclipse.hyades.logging.events.cbe.util
Class EventValidation

java.lang.Object
  |
  +--org.eclipse.hyades.logging.events.cbe.util.EventValidation

public class EventValidation
extends java.lang.Object

Helper methods for the several validate methods spread across the EMF generated classes.

Since:
1.0.1
Version:
1.0.1
Author:
Andrea Chiavegatto, Denilson Nastacio, Paul E. Slauenwhite, Scott Brown

Constructor Summary
EventValidation()
           
 
Method Summary
static java.lang.String getComponentName(org.eclipse.emf.ecore.EObject component)
          Returns the complete name of a component in the EMF model.
static java.lang.String getComponentName(org.eclipse.emf.ecore.EObject component, java.lang.String name)
          Returns the complete name of a component in the EMF model.
static void throwMissingPropertyException(java.lang.String className, java.lang.String resourceKey, java.lang.Object[] params)
          Deprecated. As of 3.1, use instantiate a new MissingPropertyException with a localized message using EventHelpers#getString(String, Object[]).
static void throwValidationException(java.lang.String className, java.lang.String resourceKey, java.lang.Object[] params)
          Deprecated. As of 3.1, use instantiate a new ValidationException with a localized message using EventHelpers#getString(String, Object[]).
static void validateId(java.lang.String classname, org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature att)
          Checks whether a string conforms to the ID type
static void validateId(java.lang.String classname, org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature att, java.lang.String id)
          Checks whether a string conforms to the ID type
static void validateLength(java.lang.String classname, org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature att, int maxLength)
          Checks whether a string conforms to the maximum length
static void validateLength(java.lang.String classname, org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature att, int minLength, int maxLength)
          Checks whether a string conforms to the maximum length
static void validateMutuallyExclusiveAttributes(java.lang.String classname, org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature att1, org.eclipse.emf.ecore.EStructuralFeature att2)
          Checks whether two attributes are mutually exclusive
static void validateRequiredProperties(java.lang.String className, org.eclipse.emf.ecore.EObject elementInstance)
          Determines whether one of the required attributes for a given CBE element is not set to null.
static void validateStringIdList(java.lang.String classname, org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature att)
          Checks whether the elements of the list conforms to the ID type
static void validateVersion(java.lang.String classname, org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature att)
          We support version 1.0.1 or null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventValidation

public EventValidation()
Method Detail

getComponentName

public static java.lang.String getComponentName(org.eclipse.emf.ecore.EObject component,
                                                java.lang.String name)
Returns the complete name of a component in the EMF model.

Parameters:
component - component for the name retrieval
name - feature name
Returns:
the complete name of the feature name passed as a parameter.

getComponentName

public static java.lang.String getComponentName(org.eclipse.emf.ecore.EObject component)
Returns the complete name of a component in the EMF model.

Parameters:
component - component for the name retrieval
Returns:
the complete name of the component passed as a parameter.

validateRequiredProperties

public static void validateRequiredProperties(java.lang.String className,
                                              org.eclipse.emf.ecore.EObject elementInstance)
                                       throws ValidationException
Determines whether one of the required attributes for a given CBE element is not set to null.

Parameters:
elementInstance - target element for verification.
Throws:
ValidationException - if one of the required attributes is null.

validateId

public static void validateId(java.lang.String classname,
                              org.eclipse.emf.ecore.EObject o,
                              org.eclipse.emf.ecore.EStructuralFeature att,
                              java.lang.String id)
                       throws ValidationException
Checks whether a string conforms to the ID type

ValidationException

validateId

public static void validateId(java.lang.String classname,
                              org.eclipse.emf.ecore.EObject o,
                              org.eclipse.emf.ecore.EStructuralFeature att)
                       throws ValidationException
Checks whether a string conforms to the ID type

ValidationException

validateStringIdList

public static void validateStringIdList(java.lang.String classname,
                                        org.eclipse.emf.ecore.EObject o,
                                        org.eclipse.emf.ecore.EStructuralFeature att)
                                 throws ValidationException
Checks whether the elements of the list conforms to the ID type

ValidationException

validateLength

public static void validateLength(java.lang.String classname,
                                  org.eclipse.emf.ecore.EObject o,
                                  org.eclipse.emf.ecore.EStructuralFeature att,
                                  int minLength,
                                  int maxLength)
                           throws ValidationException
Checks whether a string conforms to the maximum length

ValidationException

validateLength

public static void validateLength(java.lang.String classname,
                                  org.eclipse.emf.ecore.EObject o,
                                  org.eclipse.emf.ecore.EStructuralFeature att,
                                  int maxLength)
                           throws ValidationException
Checks whether a string conforms to the maximum length

ValidationException

validateMutuallyExclusiveAttributes

public static void validateMutuallyExclusiveAttributes(java.lang.String classname,
                                                       org.eclipse.emf.ecore.EObject o,
                                                       org.eclipse.emf.ecore.EStructuralFeature att1,
                                                       org.eclipse.emf.ecore.EStructuralFeature att2)
                                                throws ValidationException
Checks whether two attributes are mutually exclusive

Parameters:
att1 - is a basic object
att2 - is a basic object
ValidationException

validateVersion

public static void validateVersion(java.lang.String classname,
                                   org.eclipse.emf.ecore.EObject o,
                                   org.eclipse.emf.ecore.EStructuralFeature att)
                            throws ValidationException
We support version 1.0.1 or null

ValidationException

throwValidationException

public static void throwValidationException(java.lang.String className,
                                            java.lang.String resourceKey,
                                            java.lang.Object[] params)
                                     throws ValidationException
Deprecated. As of 3.1, use instantiate a new ValidationException with a localized message using EventHelpers#getString(String, Object[]).

Logs a message and throws a validation exception.

Parameters:
className - class name of the method from which the exception was thrown.
resourceKey - key in the resource bundle.
params - parameters for the message.
Throws:
ValidationException - containing the message associated with the validation failure.

throwMissingPropertyException

public static void throwMissingPropertyException(java.lang.String className,
                                                 java.lang.String resourceKey,
                                                 java.lang.Object[] params)
                                          throws ValidationException
Deprecated. As of 3.1, use instantiate a new MissingPropertyException with a localized message using EventHelpers#getString(String, Object[]).

Logs a message and throws a validation exception.

Parameters:
className - class name of the method from which the exception was thrown.
resourceKey - key in the resource bundle.
params - parameters for the message.
Throws:
ValidationException - containing the message associated with the validation failure.