Package org.eclipse.emf.cdo.server.ocl

## Class OCLQueryHandler

- java.lang.Object
- - org.eclipse.emf.cdo.server.ocl.OCLQueryHandler

- All Implemented Interfaces:
    `IQueryHandler`

      public class OCLQueryHandler
      extends java.lang.Object
      implements IQueryHandler

  A `query handler` that evaluates OCL query expressions.
  Author:
    Eike Stepper

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected static class` | `OCLQueryHandler.ContextParameter` | An abstraction of the `classifier` and/or `obejct` of an OCL query context parameter.
    `static class` | `OCLQueryHandler.Factory` | Creates `OCLQueryHandler` instances.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `IMPLICIT_ROOT_CLASS_PARAMETER` | Query parameter indicating the `EClass` to set as the implicit root class of the type hierarchy.
    `static java.lang.String` | `LANGUAGE_NAME` |
    `static java.lang.String` | `LAZY_EXTENTS_PARAMETER` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OCLQueryHandler()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `addEnvironmentVariable​(org.eclipse.ocl.Environment<?,​EClassifier,​?,​?,​?,​?,​?,​?,​?,​org.eclipse.ocl.ecore.Constraint,​EClass,​EObject> environment, org.eclipse.ocl.expressions.Variable<EClassifier,​?> variable)` |
    `protected boolean` | `addResult​(java.lang.Object result, IQueryContext context, CDOView view)` |
    `protected CDOExtentMap` | `createExtentMap​(CDOView view, CDOChangeSetData changeSetData, IQueryContext context)` |
    `protected org.eclipse.ocl.expressions.OCLExpression<EClassifier>` | `createInitExpression​(org.eclipse.ocl.types.OCLStandardLibrary<EClassifier> stdLib, CDOPackageRegistry packageRegistry, java.lang.Object value)` |
    `protected org.eclipse.ocl.OCL<?,​EClassifier,​?,​?,​?,​?,​?,​?,​?,​org.eclipse.ocl.ecore.Constraint,​EClass,​EObject>` | `createOCL​(CDOView view, CDOExtentMap extentMap)` |
    `protected org.eclipse.ocl.Query<EClassifier,​EClass,​EObject>` | `createQuery​(CDOView view, CDOQueryInfo info, OCLQueryHandler.ContextParameter contextParameter, org.eclipse.ocl.OCL<?,​EClassifier,​?,​?,​?,​?,​?,​?,​?,​org.eclipse.ocl.ecore.Constraint,​EClass,​EObject> ocl)` |
    `protected boolean` | `createsLazyExtents()` |
    `protected java.lang.Object` | `evaluate​(org.eclipse.ocl.Query<EClassifier,​EClass,​EObject> query, EObject object)` |
    `void` | `executeQuery​(CDOQueryInfo info, IQueryContext context)` | Executes the `query` represented by the specified `query info` by `passing` the query results to the query execution engine represented by the specified `execution context`.
    `protected EClassifier` | `getArbitraryContextClassifier​(CDOPackageRegistry packageRegistry)` | Deprecated. As of 4.2 no longer supported.
    `protected OCLQueryHandler.ContextParameter` | `getContextParameter​(CDOQueryInfo info, CDOView view)` |
    `protected EClass` | `getImplicitRootClass()` |
    `protected CDORevision` | `getRevision​(EObject object, CDOView view)` |
    `protected void` | `initEnvironment​(org.eclipse.ocl.Environment<?,​EClassifier,​?,​?,​?,​?,​?,​?,​?,​org.eclipse.ocl.ecore.Constraint,​EClass,​EObject> environment, CDOPackageRegistry packageRegistry, java.util.Map<java.lang.String,​java.lang.Object> parameters)` |
    `protected boolean` | `isOCLQueryParameter​(java.lang.String name)` |
    `static void` | `prepareContainer​(org.eclipse.net4j.util.container.IManagedContainer container)` |
    `protected boolean` | `readParameter​(java.util.Map<java.lang.String,​?> queryParameters, java.lang.String name, boolean defaultValue)` |
    `protected <T> T` | `readParameter​(java.util.Map<java.lang.String,​?> queryParameters, java.lang.String name, java.lang.Class<T> type, T defaultValue)` |
    `protected void` | `readParameters​(java.util.Map<java.lang.String,​?> queryParameters)` |
    `protected void` | `setOCLQueryParameters​(java.util.Map<java.lang.String,​java.lang.Object> parameters, org.eclipse.ocl.Query<EClassifier,​EClass,​EObject> query)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LANGUAGE_NAME

          public static final java.lang.String LANGUAGE_NAME

      See Also:
        Constant Field Values

    - #### LAZY_EXTENTS_PARAMETER

          public static final java.lang.String LAZY_EXTENTS_PARAMETER

      Since:
        4.1
      See Also:
        Constant Field Values

    - #### IMPLICIT_ROOT_CLASS_PARAMETER

          public static final java.lang.String IMPLICIT_ROOT_CLASS_PARAMETER

      Query parameter indicating the `EClass` to set as the implicit root class of the type hierarchy. The default is `null`.
      Since:
        4.2
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### OCLQueryHandler

          public OCLQueryHandler()

  - ### Method Detail

    - #### executeQuery

          public void executeQuery​(CDOQueryInfo info,
                                   IQueryContext context)

      Description copied from interface: `IQueryHandler`
      Executes the `query` represented by the specified `query info` by `passing` the query results to the query execution engine represented by the specified `execution context`.
      Specified by:
        `executeQuery` in interface `IQueryHandler`

    - #### addResult

          protected boolean addResult​(java.lang.Object result,
                                      IQueryContext context,
                                      CDOView view)

    - #### getRevision

          protected CDORevision getRevision​(EObject object,
                                            CDOView view)

    - #### evaluate

          protected java.lang.Object evaluate​(org.eclipse.ocl.Query<EClassifier,​EClass,​EObject> query,
                                              EObject object)

    - #### createExtentMap

          protected CDOExtentMap createExtentMap​(CDOView view,
                                                 CDOChangeSetData changeSetData,
                                                 IQueryContext context)

    - #### createsLazyExtents

          protected boolean createsLazyExtents()

    - #### createOCL

          protected org.eclipse.ocl.OCL<?,​EClassifier,​?,​?,​?,​?,​?,​?,​?,​org.eclipse.ocl.ecore.Constraint,​EClass,​EObject> createOCL​(CDOView view,
                                                                                                                                                                                                 CDOExtentMap extentMap)

      Since:
        4.2

    - #### createQuery

          protected org.eclipse.ocl.Query<EClassifier,​EClass,​EObject> createQuery​(CDOView view,
                                                                                              CDOQueryInfo info,
                                                                                              OCLQueryHandler.ContextParameter contextParameter,
                                                                                              org.eclipse.ocl.OCL<?,​EClassifier,​?,​?,​?,​?,​?,​?,​?,​org.eclipse.ocl.ecore.Constraint,​EClass,​EObject> ocl)
                                                                                       throws org.eclipse.ocl.ParserException,
                                                                                              DiagnosticException

      Throws:
        `org.eclipse.ocl.ParserException`
        `DiagnosticException`
      Since:
        4.2

    - #### getArbitraryContextClassifier

          @Deprecated
          protected EClassifier getArbitraryContextClassifier​(CDOPackageRegistry packageRegistry)

      Deprecated.
      As of 4.2 no longer supported.

    - #### initEnvironment

          protected void initEnvironment​(org.eclipse.ocl.Environment<?,​EClassifier,​?,​?,​?,​?,​?,​?,​?,​org.eclipse.ocl.ecore.Constraint,​EClass,​EObject> environment,
                                         CDOPackageRegistry packageRegistry,
                                         java.util.Map<java.lang.String,​java.lang.Object> parameters)

    - #### getImplicitRootClass

          protected EClass getImplicitRootClass()

      Since:
        4.2

    - #### createInitExpression

          protected org.eclipse.ocl.expressions.OCLExpression<EClassifier> createInitExpression​(org.eclipse.ocl.types.OCLStandardLibrary<EClassifier> stdLib,
                                                                                                CDOPackageRegistry packageRegistry,
                                                                                                java.lang.Object value)

    - #### addEnvironmentVariable

          protected void addEnvironmentVariable​(org.eclipse.ocl.Environment<?,​EClassifier,​?,​?,​?,​?,​?,​?,​?,​org.eclipse.ocl.ecore.Constraint,​EClass,​EObject> environment,
                                                org.eclipse.ocl.expressions.Variable<EClassifier,​?> variable)

    - #### getContextParameter

          protected OCLQueryHandler.ContextParameter getContextParameter​(CDOQueryInfo info,
                                                                         CDOView view)

      Since:
        4.2

    - #### readParameters

          protected void readParameters​(java.util.Map<java.lang.String,​?> queryParameters)

      Since:
        4.2

    - #### readParameter

          protected boolean readParameter​(java.util.Map<java.lang.String,​?> queryParameters,
                                          java.lang.String name,
                                          boolean defaultValue)

      Since:
        4.2

    - #### readParameter

          protected <T> T readParameter​(java.util.Map<java.lang.String,​?> queryParameters,
                                        java.lang.String name,
                                        java.lang.Class<T> type,
                                        T defaultValue)

      Since:
        4.2

    - #### setOCLQueryParameters

          protected void setOCLQueryParameters​(java.util.Map<java.lang.String,​java.lang.Object> parameters,
                                               org.eclipse.ocl.Query<EClassifier,​EClass,​EObject> query)

      Since:
        4.2

    - #### isOCLQueryParameter

          protected boolean isOCLQueryParameter​(java.lang.String name)

      Since:
        4.2

    - #### prepareContainer

          public static void prepareContainer​(org.eclipse.net4j.util.container.IManagedContainer container)