Package org.eclipse.emf.cdo.view

# Interface CDOView

All Superinterfaces:
  `AutoCloseable`, `CDOBranchPoint`, `CDOBranchProvider`, `CDOCommitHistory.Provider<CDOObject,CDOObjectHistory>`, `CDOCommonView`, `CDORevisionProvider`, `CDOTimeProvider`, `CDOUpdatable`, `org.eclipse.net4j.util.collection.Closeable`, `IAdaptable`, `org.eclipse.net4j.util.container.IContainer<CDOResourceNode>`, `org.eclipse.net4j.util.event.INotifier`, `org.eclipse.net4j.util.options.IOptionsContainer`, `org.eclipse.net4j.util.properties.IPropertiesContainer`

All Known Subinterfaces:
  `CDOFileTransaction`, `CDONestedTransaction`, `CDOTransaction`, `DelegatingCDOTransaction`, `InternalCDOTransaction`, `InternalCDOView`

All Known Implementing Classes:
  `CDOPushTransaction`

public interface CDOView extends CDOCommonView, CDOUpdatable, CDOCommitHistory.Provider<CDOObject,CDOObjectHistory>, org.eclipse.net4j.util.container.IContainer<CDOResourceNode>
A read-only view to the state of the object graph in the repository of the underlying `session` at a specific `time` at a specific `branch`.

If the `time` of a view is `unspecified` the objects provided and managed by that view always show the latest state the repository graph.

Objects that are accessed through this view are immutable for the client. Each attempt to call a mutator on one of these objects or one of their feature lists will result in a `ReadOnlyException` being thrown immediately. Mutable objects can be provided by a `transaction`.

A view is opened through API of the underlying session like this:

       CDOSession session = ...
       CDOView view = session.openView();
       ...

Views and their model objects are thread-safe. They can be used concurrently from different threads without additional synchronization. Note that this guarantee only applies to single accesses to the view or its objects. If multiple accesses need to be guarded against invalidation or other internal operations of the view, the `critical section` of the view must be used.

Since:
  2.0
Author:
  Eike Stepper
No Implement
  This interface is not intended to be implemented by clients.
No Extend
  This interface is not intended to be extended by clients.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`CDOView.Options`
Encapsulates a set of notifying `view` configuration options.

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer

`org.eclipse.net4j.util.container.IContainer.Modifiable<E>, org.eclipse.net4j.util.container.IContainer.Persistable<E>, org.eclipse.net4j.util.container.IContainer.Persistence<E>`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

`org.eclipse.net4j.util.event.INotifier.INotifier2`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`PROP_LIFECYCLE_EXCEPTION_HANDLER`
`static final String`
`PROP_TIME_MACHINE_DISABLED`

### Fields inherited from interface org.eclipse.emf.cdo.common.branch.CDOBranchPoint

`INVALID_DATE, UNSPECIFIED_DATE`

### Fields inherited from interface org.eclipse.emf.cdo.util.CDOUpdatable

`NO_TIMEOUT`

## Method Summary

Modifier and Type
Method
Description
`void`
`addObjectHandler(CDOObjectHandler handler)`
`void`
`addRegistrationHandler(CDORegistrationHandler handler)`
`CDOChangeSetData`
`compareRevisions(CDOBranchPoint source)`
`CDOQuery`
`createQuery(String language, String queryString)`
Same as `createQuery(language, queryString, null)`.
`CDOQuery`
`createQuery(String language, String queryString, Object context)`
`URI`
`createResourceURI(String path)`
Returns a `URI` that can be used in `ResourceSet.getResource(URI, boolean)` to load the resource with the specified path.
`void`
`disableDurableLocking(boolean releaseLocks)`
Disables the storage of all information that's needed to `reopen` this view at a later point in time.
`String`
`enableDurableLocking()`
Enables the storage of all information that's needed to `reopen` this view at a later point in time.
`String`
`enableDurableLocking(boolean enable)`
Deprecated.
Use `enableDurableLocking()` instead or `disableDurableLocking(boolean)`, respectively.
`CDOBinaryResource`
`getBinaryResource(String path)`
`CDOLockState[]`
`getLockStates(Collection<CDOID> ids)`
Get an array of `lock states` corresponding to the specified collection of `ids`.
`CDOLockState[]`
`getLockStates(Collection<CDOID> ids, boolean loadOnDemand)`
Get an array of `lock states` corresponding to the specified collection of `ids`.
`CDOLockState[]`
`getLockStatesOfObjects(Collection<? extends CDOObject> objects)`
Get an array of `lock states` corresponding to the specified collection of `objects`.
`CDOObject`
`getObject(CDOID id)`
Returns the object for the given CDOID.
`CDOObject`
`getObject(CDOID id, boolean loadOnDemand)`
Returns the object for the given CDOID.
`<T extends EObject>
T`
`getObject(T objectFromDifferentView)`
Takes an object from a (possibly) different view and contextifies it for the usage with this view.
`CDOObjectHandler[]`
`getObjectHandlers()`
`Map<CDOID,CDOObject>`
`getObjects(Collection<CDOID> ids)`
Returns the objects with the given CDOIDs.
`CDOViewProvider`
`getProvider()`
Returns the `provider` that has opened this view.
`CDORegistrationHandler[]`
`getRegistrationHandlers()`
`CDOResource`
`getResource(String path)`
Same as `getResource(String, true)`.
`CDOResource`
`getResource(String path, boolean loadOnDemand)`
`CDOResourceFolder`
`getResourceFolder(String path)`
`CDOResourceNode`
`getResourceNode(String path)`
Returns the resource node with the given path.
`ResourceSet`
`getResourceSet()`
Returns the `resource set` this view is associated with.
`CDOResource`
`getRootResource()`
Returns the root resource of the repository.
`CDOSession`
`getSession()`
Returns the `session` this view was opened by.
`CDOTextResource`
`getTextResource(String path)`
`CDOUnitManager`
`getUnitManager()`
`URI`
`getURI()`
`URIHandler`
`getURIHandler()`
`Lock`
`getViewLock()`
Deprecated.
As of 4.29 use `sync()`.
`CDOViewSet`
`getViewSet()`
Returns the `view set` this view is associated with.
`boolean`
`hasConflict()`
Returns always `false`.
`boolean`
`hasResource(String path)`
Returns `true` if a resource with the given path exists in the repository, `false`.
`boolean`
`isDirty()`
Returns always `false`.
`boolean`
`isInvalidating()`
`boolean`
`isInvalidationRunnerActive()`
Deprecated.
As of 4.7 use `isInvalidating()`.
`boolean`
`isLegacyModeEnabled()`
Deprecated.
As of 4.2 the legacy mode is always enabled.
`boolean`
`isObjectRegistered(CDOID id)`
Returns `true` if an `object` with the given `id` is currently registered in this view, `false` otherwise.
`void`
`lockObjects(Collection<? extends CDOObject> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, long timeout)`
Locks the given objects.
`void`
`lockObjects(Collection<? extends CDOObject> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, long timeout, boolean recursive)`
`CDOView.Options`
`options()`
Returns the `options` of this view.
`<T extends EObject>
List<T>`
`queryInstances(EClass type)`
Returns a list of the instances of the given type.
`<T extends EObject>
org.eclipse.net4j.util.collection.CloseableIterator<T>`
`queryInstancesAsync(EClass type)`
Returns an iterator over the instances of the given type.
`<T extends EObject>
org.eclipse.net4j.util.collection.CloseableIterator<T>`
`queryInstancesAsync(EClass type, boolean exact)`
Returns an iterator over the instances of the given type.
`List<CDOResourceNode>`
`queryResources(CDOResourceFolder folder, String name, boolean exactMatch)`
Returns a list of the resources in the given folder with a name equal to or starting with the value of the name parameter.
`org.eclipse.net4j.util.collection.CloseableIterator<CDOResourceNode>`
`queryResourcesAsync(CDOResourceFolder folder, String name, boolean exactMatch)`
Returns an iterator over the resources in the given folder with a name equal to or starting with the value of the name parameter.
`List<CDOObjectReference>`
`queryXRefs(Set<CDOObject> targetObjects, EReference... sourceReferences)`
Returns a list of `object references` that represent the cross references to the specified target objects.
`List<CDOObjectReference>`
`queryXRefs(CDOObject targetObject, EReference... sourceReferences)`
Returns a list of `object references` that represent the cross references to the specified target object.
`org.eclipse.net4j.util.collection.CloseableIterator<CDOObjectReference>`
`queryXRefsAsync(Set<CDOObject> targetObjects, EReference... sourceReferences)`
Returns an iterator over the `object references` that represent the cross references to the specified target objects.
`void`
`refreshLockStates(Consumer<CDOLockState> consumer)`
Refreshes the `lock states` of this `view` with the latest states from the repository.
`int`
`reload(CDOObject... objects)`
Deprecated.
As of 4.3 no longer supported because it is unsafe to reload single objects.
`void`
`removeObjectHandler(CDOObjectHandler handler)`
`void`
`removeRegistrationHandler(CDORegistrationHandler handler)`
`boolean`
`setBranch(CDOBranch branch)`
Same as calling `setBranchPoint(branch, getTimeStamp())`.
`boolean`
`setBranch(CDOBranch branch, IProgressMonitor monitor)`
Same as `setBranch(CDOBranch)` with `IProgressMonitor`.
`boolean`
`setBranchPoint(CDOBranch branch, long timeStamp)`
Sets the `branch` and the point in (repository) time this view should refer to.
`boolean`
`setBranchPoint(CDOBranch branch, long timeStamp, IProgressMonitor monitor)`
Same as `setBranchPoint(CDOBranch, long)` with a `IProgressMonitor`.
`boolean`
`setBranchPoint(CDOBranchPoint branchPoint)`
Same as calling `setBranchPoint(branchPoint.getBranch(), branchPoint.getTimeStamp())`.
`boolean`
`setBranchPoint(CDOBranchPoint branchPoint, IProgressMonitor monitor)`
Same as calling `setBranchPoint(CDOBranchPoint)` with a `IProgressMonitor` .
`void`
`setResourcePathCache(Map<String,CDOID> resourcePathCache)`
Sets the new `map` to be used as a cache for various `get*Resource*(String path)` methods.
`boolean`
`setTimeStamp(long timeStamp)`
Same as calling `setBranchPoint(getBranch(), timeStamp)`.
`boolean`
`setTimeStamp(long timeStamp, IProgressMonitor monitor)`
Same as `setTimeStamp(long)` with `IProgressMonitor`.
`org.eclipse.net4j.util.concurrent.CriticalSection`
`sync()`
Returns a `critical section` that can be used to execute a block of code that needs to be synchronized with the internal operations of this view and its `objects`.
`void`
`syncExec(Runnable runnable)`
Deprecated.
As of 4.29 use `sync()`.
`<V> V`
`syncExec(Callable<V> callable)`
Deprecated.
As of 4.29 use `sync()`.
`void`
`unlockObjects()`
Unlocks all locked objects of this view.
`void`
`unlockObjects(Collection<? extends CDOObject> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType)`
Unlocks the given locked objects of this view.
`void`
`unlockObjects(Collection<? extends CDOObject> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, boolean recursive)`

### Methods inherited from interface java.lang.AutoCloseable

`close`

### Methods inherited from interface org.eclipse.emf.cdo.common.branch.CDOBranchPoint

`getBranch, getTimeStamp`

### Methods inherited from interface org.eclipse.emf.cdo.common.commit.CDOCommitHistory.Provider

`getHistory, getHistory`

### Methods inherited from interface org.eclipse.emf.cdo.common.CDOCommonView

`getDurableLockingID, getLockOwner, getSessionID, getViewID, isDurableView, isHistorical, isReadOnly`

### Methods inherited from interface org.eclipse.emf.cdo.common.revision.CDORevisionProvider

`getRevision`

### Methods inherited from interface org.eclipse.emf.cdo.util.CDOUpdatable

`getLastUpdateTime, runAfterUpdate, waitForUpdate, waitForUpdate`

### Methods inherited from interface org.eclipse.net4j.util.collection.Closeable

`close, isClosed`

### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

`getAdapter`

### Methods inherited from interface org.eclipse.net4j.util.container.IContainer

`getElements, isEmpty`

### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

`addListener, getListeners, hasListeners, removeListener`

### Methods inherited from interface org.eclipse.net4j.util.properties.IPropertiesContainer

`properties`

## Field Details

### PROP_TIME_MACHINE_DISABLED

static final String PROP_TIME_MACHINE_DISABLED

Since:
  4.5
See Also:
  - Constant Field Values

### PROP_LIFECYCLE_EXCEPTION_HANDLER

static final String PROP_LIFECYCLE_EXCEPTION_HANDLER

Since:
  4.19
See Also:
  - Constant Field Values

## Method Details

### getSession

CDOSession getSession()
Returns the `session` this view was opened by.

Specified by:
  `getSession` in interface `CDOCommonView`
Returns:
  The session this view was opened by, or `null` if this view is closed.
See Also:
  - `Closeable.close()`
  - `Closeable.isClosed()`
  - `CDOViewContainer.openView()`
  - `CDOTransactionContainer.openTransaction()`

### getProvider

CDOViewProvider getProvider()
Returns the `provider` that has opened this view.

Since:
  4.4

### getURI

URI getURI()

Since:
  4.24

### getViewSet

CDOViewSet getViewSet()
Returns the `view set` this view is associated with.

Returns:
  The view set this view is associated with, never `null`.
See Also:
  - `CDOViewSet.getViews()`

### sync

org.eclipse.net4j.util.concurrent.CriticalSection sync()
Returns a `critical section` that can be used to execute a block of code that needs to be synchronized with the internal operations of this view and its `objects`.

Here is an example:

     CDOView view = ...;
     CriticalSection sync = view.sync();

     MyResult result = sync.call(() -> {
       // Access the view and its objects safely here.
       CDOObject object1 = view.getObject(id1);
       CDOObject object2 = view.getObject(id2);
       CDOObject object3 = view.getObject(id3);
       ...
       return new MyResult(...);
     });

The critical section ensures that no invalidation or other internal operation of the view can occur while the block of code is executed. This is particularly important if the block of code accesses the view or `objects` of the view multiple times, because these objects can be `invalidated` by network threads at any time in between these accesses otherwise. This can lead to wrong computation results in the block of code being executed.

Note that single accesses to the view or its objects are always safe, even without using the critical section.

There are some other useful methods in CriticalSection that can be used to execute a block of code, such as `run(Runnable)` or `supply(Supplier)`.

By default the critical section uses the monitor lock of this view to synchronize. If you need a different locking strategy you can override this by calling `CDOUtil.setNextViewLock(Lock)` before opening the view.

In particular you can use a `DelegableReentrantLock`, which allows to delegate the lock ownership to a different thread. This is useful in scenarios where you need to hold the lock while waiting for an asynchronous operation to complete in a different thread.

A typical example is the Display.syncExec() method in SWT/JFace UI applications. With the default locking strategy this can lead to deadlocks:

1. Thread A (not the UI thread) holds the view lock and calls `Display.syncExec()` to execute some code in the UI thread.
2. The Runnable passed to syncExec() is scheduled for execution in the UI thread. Thread A waits for the Runnable to complete.
3. The UI thread executes the Runnable, which tries to access the view or an object of the view. This requires the view lock, which is already held by thread A.
4. Deadlock: Thread A waits for the Runnable to complete and the UI thread waits for the view lock to be released.

Note that, in this scenario, Thread A is holding the view lock while waiting for the Runnable to complete. This is kind of an anti-pattern, because it blocks other threads from accessing the view for an indeterminate amount of time. In addition, it is not necessary to hold the view lock while waiting for the Runnable to complete, because Thread A can not access the view in that time.

A `DelegableReentrantLock` can be used to avoid the deadlock. It uses so called lock delegation to temporarily transfer the ownership of the lock to a different thread. In the scenario described above, Thread A can delegate the lock ownership to the UI thread while waiting for the Runnable to complete. When the Runnable completes, the lock ownership is transferred back to Thread A. This way, the UI thread can access the view while executing the Runnable and no deadlock occurs.

`DelegableReentrantLock` uses `DelegableReentrantLock.DelegateDetector`s to determine whether the current thread is allowed to delegate the lock ownership to a different thread. A `DelegateDetector` can be registered with the lock by calling `DelegableReentrantLock.addDelegateDetector(DelegateDetector)`. The `org.eclipse.net4j.util.ui` plugin provides a `DisplayDelegateDetector` for the SWT/JFace UI thread that detects calls to `Display.syncExec()`.

Since:
  4.29
See Also:
  - `CDOUtil.sync(CDOView)`
  - `CDOUtil.sync(Notifier)`

### getViewLock

@Deprecated Lock getViewLock()
Deprecated.
As of 4.29 use `sync()`.

Since:
  4.5

### syncExec

@Deprecated void syncExec(Runnable runnable)
Deprecated.
As of 4.29 use `sync()`.

Since:
  4.5

### syncExec

@Deprecated <V> V syncExec(Callable<V> callable) throws Exception
Deprecated.
As of 4.29 use `sync()`.

Throws:
  `Exception`
Since:
  4.5

### getResourceSet

ResourceSet getResourceSet()
Returns the `resource set` this view is associated with.

Same as calling `getViewSet().getResourceSet()`.

See Also:
  - `CDOViewSet.getResourceSet()`

### getURIHandler

URIHandler getURIHandler()

### getUnitManager

CDOUnitManager getUnitManager()

Since:
  4.5

### setBranchPoint

boolean setBranchPoint(CDOBranch branch, long timeStamp)
Sets the `branch` and the point in (repository) time this view should refer to. `Objects` provided by this view will be `valid` at this time. The special value `UNSPECIFIED_DATE` denotes a "floating view" that always shows the latest state of the repository.

Returns:
  `true` if the branch point was changed, `false` otherwise.
Since:
  3.0

### setBranchPoint

boolean setBranchPoint(CDOBranch branch, long timeStamp, IProgressMonitor monitor)
Same as `setBranchPoint(CDOBranch, long)` with a `IProgressMonitor`.

Since:
  4.4

### setBranchPoint

boolean setBranchPoint(CDOBranchPoint branchPoint)
Same as calling `setBranchPoint(branchPoint.getBranch(), branchPoint.getTimeStamp())`.

Since:
  3.0

### setBranchPoint

boolean setBranchPoint(CDOBranchPoint branchPoint, IProgressMonitor monitor)
Same as calling `setBranchPoint(CDOBranchPoint)` with a `IProgressMonitor` .

Since:
  4.4

### setBranch

boolean setBranch(CDOBranch branch)
Same as calling `setBranchPoint(branch, getTimeStamp())`.

Since:
  3.0

### setBranch

boolean setBranch(CDOBranch branch, IProgressMonitor monitor)
Same as `setBranch(CDOBranch)` with `IProgressMonitor`.

Since:
  4.4

### setTimeStamp

boolean setTimeStamp(long timeStamp)
Same as calling `setBranchPoint(getBranch(), timeStamp)`.

Since:
  3.0

### setTimeStamp

boolean setTimeStamp(long timeStamp, IProgressMonitor monitor)
Same as `setTimeStamp(long)` with `IProgressMonitor`.

Since:
  4.4

### isInvalidating

boolean isInvalidating()

Since:
  4.8

### isInvalidationRunnerActive

@Deprecated boolean isInvalidationRunnerActive()
Deprecated.
As of 4.7 use `isInvalidating()`.

Since:
  4.0

### isLegacyModeEnabled

@Deprecated boolean isLegacyModeEnabled()
Deprecated.
As of 4.2 the legacy mode is always enabled.

Since:
  3.0
See Also:
  - `CDOUtil.setLegacyModeDefault(boolean)`

### isDirty

boolean isDirty()
Returns always `false`.

This method has a special implementation in `CDOTransaction` as well.

See Also:
  - `CDOTransaction.isDirty()`

### hasConflict

boolean hasConflict()
Returns always `false`.

This method has a special implementation in `CDOTransaction` as well.

See Also:
  - `CDOTransaction.hasConflict()`

### hasResource

boolean hasResource(String path)
Returns `true` if a resource with the given path exists in the repository, `false`. Applies to `file resources`, as well.

See Also:
  - `getResource(String, boolean)`

### getResource

CDOResource getResource(String path, boolean loadOnDemand) throws CDOResourceNodeNotFoundException

Throws:
  `CDOResourceNodeNotFoundException`
See Also:
  - `ResourceSet.getResource(URI, boolean)`

### getResource

CDOResource getResource(String path) throws CDOResourceNodeNotFoundException
Same as `getResource(String, true)`.

Throws:
  `CDOResourceNodeNotFoundException`
See Also:
  - `ResourceSet.getResource(URI, boolean)`

### getTextResource

CDOTextResource getTextResource(String path) throws CDOResourceNodeNotFoundException

Throws:
  `CDOResourceNodeNotFoundException`
Since:
  4.2

### getBinaryResource

CDOBinaryResource getBinaryResource(String path) throws CDOResourceNodeNotFoundException

Throws:
  `CDOResourceNodeNotFoundException`
Since:
  4.2

### getResourceNode

CDOResourceNode getResourceNode(String path) throws CDOResourceNodeNotFoundException
Returns the resource node with the given path.

Returns:
  never `null`.
Throws:
  `CDOException` - if no such resource node exists.
  `CDOResourceNodeNotFoundException`

### getResourceFolder

CDOResourceFolder getResourceFolder(String path) throws CDOResourceNodeNotFoundException

Throws:
  `CDOResourceNodeNotFoundException`
Since:
  4.2

### getRootResource

CDOResource getRootResource()
Returns the root resource of the repository.

The root resource is a special resource with only `CDOResourceNodes` in its contents list. You can use it as the main entry into the new resource and folder structure.

### setResourcePathCache

void setResourcePathCache(Map<String,CDOID> resourcePathCache)
Sets the new `map` to be used as a cache for various `get*Resource*(String path)` methods.

Can be used to reset/clear the resource path cache by passing a `new HashMap<String, CDOID>()`. Smarter maps could implement a LRU eviction policy to limit the map capacity. Passing `null` disables resource path caching.

The default value is `new HashMap<String, CDOID>()`.

Since:
  4.2
See Also:
  - `getResourceNode(String)`
  - `getResource(String)`
  - `getResource(String, boolean)`
  - `getBinaryResource(String)`
  - `getTextResource(String)`
  - `getResourceFolder(String)`
  - `hasResource(String)`

### createResourceURI

URI createResourceURI(String path)
Returns a `URI` that can be used in `ResourceSet.getResource(URI, boolean)` to load the resource with the specified path.

Since:
  4.4

### queryResources

List<CDOResourceNode> queryResources(CDOResourceFolder folder, String name, boolean exactMatch)
Returns a list of the resources in the given folder with a name equal to or starting with the value of the name parameter.

Parameters:
  `folder` - The folder to search in, or `null` for top level resource nodes.
  `name` - the name or prefix of the resource nodes to return.
  `exactMatch` - `true` if the complete name of the resource must match, `false` if only a common prefix of the name must match.

### queryResourcesAsync

org.eclipse.net4j.util.collection.CloseableIterator<CDOResourceNode> queryResourcesAsync(CDOResourceFolder folder, String name, boolean exactMatch)
Returns an iterator over the resources in the given folder with a name equal to or starting with the value of the name parameter. The underlying query will be executed asynchronously.

Parameters:
  `folder` - The folder to search in, or `null` for top level resource nodes.
  `name` - the name or prefix of the resource nodes to return.
  `exactMatch` - `true` if the complete name of the resource must match, `false` if only a common prefix of the name must match.

### queryInstances

<T extends EObject> List<T> queryInstances(EClass type)
Returns a list of the instances of the given type.

Since:
  4.3

### queryInstancesAsync

<T extends EObject> org.eclipse.net4j.util.collection.CloseableIterator<T> queryInstancesAsync(EClass type)
Returns an iterator over the instances of the given type. The underlying query will be executed asynchronously.

Since:
  4.3

### queryInstancesAsync

<T extends EObject> org.eclipse.net4j.util.collection.CloseableIterator<T> queryInstancesAsync(EClass type, boolean exact)
Returns an iterator over the instances of the given type. The underlying query will be executed asynchronously.

Since:
  4.6

### queryXRefs

List<CDOObjectReference> queryXRefs(CDOObject targetObject, EReference... sourceReferences)
Returns a list of `object references` that represent the cross references to the specified target object.

Parameters:
  `targetObject` - The target object that referencing objects are requested for. An external target object can be used with the help of `CDOUtil.wrapExternalObject()`.
  `sourceReferences` - The reference features that referencing objects are requested for, or an empty array if all reference features are to be used in the request.
Since:
  4.0
See Also:
  - `queryXRefs(Set, EReference...)`
  - `queryXRefsAsync(Set, EReference...)`
  - `CDOUtil.wrapExternalObject(EObject, CDOView)`

### queryXRefs

List<CDOObjectReference> queryXRefs(Set<CDOObject> targetObjects, EReference... sourceReferences)
Returns a list of `object references` that represent the cross references to the specified target objects.

Parameters:
  `targetObjects` - The set of target objects that referencing objects are requested for. External target objects can be used with the help of `CDOUtil.wrapExternalObject()`.
  `sourceReferences` - The reference features that referencing objects are requested for, or an empty array if all reference features are to be used in the request.
Since:
  3.0
See Also:
  - `queryXRefs(CDOObject, EReference...)`
  - `queryXRefsAsync(Set, EReference...)`
  - `CDOUtil.wrapExternalObject(EObject, CDOView)`

### queryXRefsAsync

org.eclipse.net4j.util.collection.CloseableIterator<CDOObjectReference> queryXRefsAsync(Set<CDOObject> targetObjects, EReference... sourceReferences)
Returns an iterator over the `object references` that represent the cross references to the specified target objects. The underlying query will be executed asynchronously.

Parameters:
  `targetObjects` - The set of target objects that referencing objects are requested for. External target objects can be used with the help of `CDOUtil.wrapExternalObject()`.
  `sourceReferences` - The reference features that referencing objects are requested for, or an empty array if all reference features are to be used in the request.
Since:
  3.0
See Also:
  - `queryXRefs(CDOObject, EReference...)`
  - `queryXRefs(Set, EReference...)`
  - `CDOUtil.wrapExternalObject(EObject, CDOView)`

### getObjects

Map<CDOID,CDOObject> getObjects(Collection<CDOID> ids)
Returns the objects with the given CDOIDs.

If objects are missing from the local cache they are loaded from the server in one round-trip.

Parameters:
  `ids` - the collection of CDOIDs that identify the CDOObjects to return.
Returns:
  a map that contains the CDOObjects with the given CDOIDs.
Since:
  4.13

### getObject

CDOObject getObject(CDOID id, boolean loadOnDemand)
Returns the object for the given CDOID.

Parameters:
  `loadOnDemand` - whether to create and load the object, if it doesn't already exist.
Returns:
  the object resolved by the CDOID if the id is not `null`, or `null` if there isn't one and loadOnDemand is `false`.

### getObject

CDOObject getObject(CDOID id)
Returns the object for the given CDOID.

Same as `getObject(id, true)`.

See Also:
  - `getObject(CDOID, boolean)`

### getObject

<T extends EObject> T getObject(T objectFromDifferentView)
Takes an object from a (possibly) different view and contextifies it for the usage with this view.

- If the given object is contained in this view it is returned unmodified.
- If the given object can not be cast to `CDOObject` it is returned unmodified.
- If the view of the given object is contained in a different session an `IllegalArgumentException` is thrown.
- If `null` is passed `null` is returned.

### isObjectRegistered

boolean isObjectRegistered(CDOID id)
Returns `true` if an `object` with the given `id` is currently registered in this view, `false` otherwise.

### reload

@Deprecated int reload(CDOObject... objects)
Deprecated.
As of 4.3 no longer supported because it is unsafe to reload single objects.
Reloads the given `objects` from the repository.

### refreshLockStates

void refreshLockStates(Consumer<CDOLockState> consumer)
Refreshes the `lock states` of this `view` with the latest states from the repository. If a lock state consumer is passed it is called for each resulting new lock state.

Since:
  4.12

### getLockStates

CDOLockState[] getLockStates(Collection<CDOID> ids)
Get an array of `lock states` corresponding to the specified collection of `ids`. If the collection of `ids` is empty, `lock states` of all objects are returned.

Since:
  4.6

### getLockStates

CDOLockState[] getLockStates(Collection<CDOID> ids, boolean loadOnDemand)
Get an array of `lock states` corresponding to the specified collection of `ids`. If the collection of `ids` is empty, `lock states` of all objects are returned.

Since:
  4.19

### getLockStatesOfObjects

CDOLockState[] getLockStatesOfObjects(Collection<? extends CDOObject> objects)
Get an array of `lock states` corresponding to the specified collection of `objects`. If the collection of `objects` is empty, `lock states` of all locked objects are returned.

Since:
  4.6

### lockObjects

void lockObjects(Collection<? extends CDOObject> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, long timeout) throws InterruptedException
Locks the given objects. Once the objects are locked, they will not be changed remotely or go in conflict state.

Throws:
  `InterruptedException`
Since:
  3.0

### lockObjects

void lockObjects(Collection<? extends CDOObject> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, long timeout, boolean recursive) throws InterruptedException

Throws:
  `InterruptedException`

### unlockObjects

void unlockObjects(Collection<? extends CDOObject> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType)
Unlocks the given locked objects of this view.

### unlockObjects

void unlockObjects(Collection<? extends CDOObject> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, boolean recursive)

### unlockObjects

void unlockObjects()
Unlocks all locked objects of this view.

Since:
  2.0

### enableDurableLocking

@Deprecated String enableDurableLocking(boolean enable)
Deprecated.
Use `enableDurableLocking()` instead or `disableDurableLocking(boolean)`, respectively.

Since:
  4.0

### enableDurableLocking

String enableDurableLocking()
Enables the storage of all information that's needed to `reopen` this view at a later point in time. This information includes the `branch point`, the user ID of the `session`, whether it's a read-only view or a `transaction` and all the locks that are acquired or will be acquired while durable locking is enabled.

Since:
  4.1
See Also:
  - `CDOViewContainer.openView(String)`
  - `CDOViewOpener.openView(String, ResourceSet)`
  - `CDOTransactionContainer.openTransaction(String)`
  - `CDOTransactionOpener.openTransaction(String, ResourceSet)`
  - `disableDurableLocking(boolean)`

### disableDurableLocking

void disableDurableLocking(boolean releaseLocks)
Disables the storage of all information that's needed to `reopen` this view at a later point in time. If such information is stored when this method is called it is removed. Note that locks acquired by this view are only released if `true` is passed to the `releaseLocks` parameter.

Since:
  4.1
See Also:
  - `enableDurableLocking()`

### addObjectHandler

void addObjectHandler(CDOObjectHandler handler)

Since:
  3.0

### removeObjectHandler

void removeObjectHandler(CDOObjectHandler handler)

Since:
  3.0

### getObjectHandlers

CDOObjectHandler[] getObjectHandlers()

Since:
  3.0

### addRegistrationHandler

void addRegistrationHandler(CDORegistrationHandler handler)

Since:
  4.6

### removeRegistrationHandler

void removeRegistrationHandler(CDORegistrationHandler handler)

Since:
  4.6

### getRegistrationHandlers

CDORegistrationHandler[] getRegistrationHandlers()

Since:
  4.6

### createQuery

CDOQuery createQuery(String language, String queryString)
Same as `createQuery(language, queryString, null)`.

Since:
  2.0
See Also:
  - `createQuery(String, String, Object)`

### createQuery

CDOQuery createQuery(String language, String queryString, Object context)

Since:
  4.0

### compareRevisions

CDOChangeSetData compareRevisions(CDOBranchPoint source)

Since:
  4.0

### options

CDOView.Options options()
Description copied from interface: `CDOCommonView`
Returns the `options` of this view.

Specified by:
  `options` in interface `CDOCommonView`
Specified by:
  `options` in interface `org.eclipse.net4j.util.options.IOptionsContainer`
Since:
  2.0