When using the Pivot metamodel, there are two specialized validators available to support integration of OCL in to a larger Ecore environment.
Unfortunately, in the Indigo release, EMF does not support this customization and so must be activated by explicitly using an EValidator that is aware of the ValidationDelegateExtension extended API. This is available by using the OCLinEcoreEObjectValidator, which you may install globally by:
EValidator.Registry.INSTANCE.put(null, new OCLinEcoreEObjectValidator());
or more selectively by adjusting the inheritance of the Validator class generated by EMF from (for a model of a Company):
import org.eclipse.emf.ecore.util.EObjectValidator;
/**
* <!-- begin-user-doc -->
* The <b>Validator</b> for the model.
* <!-- end-user-doc -->
* @see company.CompanyPackage
*/
public class CompanyValidator extends EObjectValidator {
to
import org.eclipse.ocl.xtext.oclinecore.validation.OCLinEcoreEObjectValidator;
/**
* <!-- begin-user-doc -->
* The <b>Validator</b> for the model.
* <!-- end-user-doc -->
* @see company.CompanyPackage
* @generated not
*/
public class CompanyValidator extends OCLinEcoreEObjectValidator {
Note the @generated not that indicates that the class interface is manually defined. Do not use @generated NOT since that indicates that the whole class is manually defined.