Package org.eclipse.emf.cdo.server.db.mapping

# Schnittstelle IClassMapping

Alle bekannten Unterschnittstellen:
  `IClassMappingUnitSupport`

public interface IClassMapping
Basic interface for class mappings.

Seit:
  2.0
Autor:
  Eike Stepper, Stefan Winkler

## Methodenübersicht

Modifizierer und Typ
Methode
Beschreibung
`PreparedStatement`
`createObjectIDStatement(IDBStoreAccessor accessor)`
Create a prepared statement which returns all IDs of instances of the corresponding class.
`PreparedStatement`
`createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, String name, boolean exactMatch, CDOBranchPoint branchPoint)`
Create a prepared statement which returns all IDs of instances of the corresponding class.
`void`
`detachObject(IDBStoreAccessor accessor, CDOID id, int version, CDOBranch branch, long timeStamp, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)`
Detaches (deletes) a CDO object leaving a "ghost" revision behind.
`List<org.eclipse.net4j.db.ddl.IDBTable>`
`getDBTables()`
Returns all DB tables which are used by this class and all its contained features.
`EClass`
`getEClass()`
`IListMapping`
`getListMapping(EStructuralFeature feature)`
Get the mapping of the many-valued feature.
`List<IListMapping>`
`getListMappings()`
`List<ITypeMapping>`
`getValueMappings()`
`void`
`handleRevisions(IDBStoreAccessor accessor, CDOBranch branch, long timeStamp, boolean exactTime, CDORevisionHandler handler)`
Passes all revisions of the store to the `handler` if all of the following conditions are met: The `branch` parameter is `null` or equal to `revision.getBranch()`.
`boolean`
`queryXRefs(IDBStoreAccessor accessor, IStoreAccessor.QueryXRefsContext context, String idString)`
Retrieve cross-references from DB
`Set<CDOID>`
`readChangeSet(IDBStoreAccessor accessor, CDOChangeSetSegment[] segments)`
Returns a set of CDOIDs that have at least one revision in any of the passed branches and time ranges.
`boolean`
`readRevision(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk)`
Read a revision.
`void`
`writeRevision(IDBStoreAccessor accessor, InternalCDORevision revision, boolean firstRevision, boolean revise, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)`
Write the revision data to the database.

## Methodendetails

### getEClass

EClass getEClass()

Seit:
  3.0

### getDBTables

List<org.eclipse.net4j.db.ddl.IDBTable> getDBTables()
Returns all DB tables which are used by this class and all its contained features.

Gibt zurück:
  a collection of all tables of this class and all its contained features.
Seit:
  3.0

### getListMapping

IListMapping getListMapping(EStructuralFeature feature)
Get the mapping of the many-valued feature.

Parameter:
  `feature` - the feature for which the mapping should be returned. `feature.isMany()` has to be `true`.
Gibt zurück:
  the list mapping corresponding to the feature.

### getListMappings

List<IListMapping> getListMappings()

Seit:
  3.0

### getValueMappings

List<ITypeMapping> getValueMappings()

Seit:
  4.0

### readRevision

boolean readRevision(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk)
Read a revision. The branch and timestamp to be read are derived from the branchPoint which is set to the Revision. Note that non-audit stores only support `CDOBranchPoint.UNSPECIFIED_DATE` and non-branching stores only support the main branch.

Parameter:
  `accessor` - the accessor to use.
  `revision` - the revision object into which the data should be read. The revision has to be have its ID set to the requested object's ID. The version is ignored, as the version parameter is used to determine the version to be read.
  `listChunk` - the chunk size to read attribute lists.
Gibt zurück:
  `true`, if the revision has been found and read correctly. `false` if the revision could not be found. In this case, the content of `revision` is undefined.

### writeRevision

void writeRevision(IDBStoreAccessor accessor, InternalCDORevision revision, boolean firstRevision, boolean revise, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)
Write the revision data to the database.

Parameter:
  `accessor` - the accessor to use.
  `revision` - the revision to write.
  `firstRevision` - `true` if the type of the object is supposed to be mapped, `false` otherwise.
  `revise` - `true` if the previous revision is supposed to be revised, `false` otherwise.
  `monitor` - the monitor to indicate progress.
Seit:
  4.0

### detachObject

void detachObject(IDBStoreAccessor accessor, CDOID id, int version, CDOBranch branch, long timeStamp, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)
Detaches (deletes) a CDO object leaving a "ghost" revision behind.

Parameter:
  `accessor` - the accessor to use.
  `id` - the id to revise.
  `version` - the last valid version.
  `timeStamp` - the timestamp of detach.
  `monitor` - the monitor to indicate progress.
Seit:
  3.0

### createObjectIDStatement

PreparedStatement createObjectIDStatement(IDBStoreAccessor accessor)
Create a prepared statement which returns all IDs of instances of the corresponding class.

Parameter:
  `accessor` - the accessor to use to create the statement
Gibt zurück:
  the prepared statement ready to be executed using `result.executeQuery()`.
Seit:
  3.0

### createResourceQueryStatement

PreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, String name, boolean exactMatch, CDOBranchPoint branchPoint)
Create a prepared statement which returns all IDs of instances of the corresponding class.

Parameter:
  `accessor` - the accessor to use to create the statement
  `folderId` - the ID of the containing folder. `0` means none.
  `name` - the name of the resource node to look up
  `exactMatch` - if `true`, `name` must match exactly, otherwise all resource nodes starting with `name` are returned.
  `branchPoint` - a branchPoint (branch and timestamp). A timestamp in the past if past versions should be looked up. In case of no audit support, this must be `CDOBranchPoint.UNSPECIFIED_DATE`. In case of non branching support the branch id must be equal to `CDOBranch.MAIN_BRANCH_ID`.
Gibt zurück:
  the prepared statement ready to be executed using `result.executeQuery()`.
Löst aus:
  `org.eclipse.net4j.util.ImplementationError` - if called on a mapping which does not map an `EClass instanceof CDOResourceNode`.
Seit:
  3.0

### handleRevisions

void handleRevisions(IDBStoreAccessor accessor, CDOBranch branch, long timeStamp, boolean exactTime, CDORevisionHandler handler)
Passes all revisions of the store to the `handler` if all of the following conditions are met:

- The `branch` parameter is `null` or equal to `revision.getBranch()`.
- The `timeStamp` parameter is `CDOBranchPoint.UNSPECIFIED_DATE` or equal to `revision.getTimeStamp()`.

Seit:
  4.0
Siehe auch:
  - `IMappingStrategy.handleRevisions(IDBStoreAccessor, org.eclipse.emf.ecore.EClass, CDOBranch, long, boolean, CDORevisionHandler)`

### readChangeSet

Set<CDOID> readChangeSet(IDBStoreAccessor accessor, CDOChangeSetSegment[] segments)
Returns a set of CDOIDs that have at least one revision in any of the passed branches and time ranges. DetachedCDORevisions must also be considered!

Seit:
  3.0
Siehe auch:
  - `IStoreAccessor.readChangeSet(OMMonitor, CDOChangeSetSegment...)`

### queryXRefs

boolean queryXRefs(IDBStoreAccessor accessor, IStoreAccessor.QueryXRefsContext context, String idString)
Retrieve cross-references from DB

Parameter:
  `idString` - a string of the form "(id1, id2, id3, ...)" which can be used directly in SQL to form the where-part "SELECT * FROM foobar WHERE foobar.target IN [idString]".
Seit:
  4.0
Siehe auch:
  - `IStoreAccessor.queryXRefs(QueryXRefsContext)`