Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327388

Summary: Make dirty state of local transactions available for server-side queries
Product: [Modeling] EMF Reporter: Eike Stepper <stepper>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: enhancement    
Priority: P3 Keywords: noteworthy
Version: 4.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: Power to the People

Description Eike Stepper CLA 2010-10-09 07:02:10 EDT
Sometimes it's desirable to make queries aware of local dirty state.
Comment 1 Eike Stepper CLA 2010-10-09 07:06:56 EDT
New API has been added to CDOTransaction:

  public CDOQuery createQuery(String language, String queryString, boolean considerDirtyState);
  public CDOQuery createQuery(String language, String queryString, Object context, boolean considerDirtyState);

An IQueryHandler can obtain the dirty state from the CDOQueryInfo passed into the executeQuery() method:

  public CDOChangeSetData getChangeSet();
  
The OCLQueryHandler uses this meachnism to provide a CDOView on the server that mimics the state of the dirty CDOTransaction on the client:

  public void executeQuery(CDOQueryInfo info, IQueryContext context)
  {
      ISession session = context.getView().getSession();
      CDOBranchPoint branchPoint = CDOBranchUtil.copyBranchPoint(context);

      CDORevisionProvider revisionProvider = context.getView();
      CDOChangeSetData changeSet = info.getChangeSet();
      if (changeSet != null)
      {
        revisionProvider = new CDOChangeSetRevisionProvider(revisionProvider, changeSet);
      }

      CDOView view = CDOServerUtil.openView(session, branchPoint, info.isLegacyModeEnabled(), revisionProvider);
      
      ...
      
}
Comment 2 Eike Stepper CLA 2010-10-09 07:07:32 EDT
Committed to HEAD
Comment 3 Eike Stepper CLA 2011-06-23 03:42:13 EDT
Available in R20110608-1407