org.eclipse.emf.cdo.server.db.mapping
Interface IClassMapping


public interface IClassMapping

Basic interface for class mappings.

Since:
2.0

Method Summary
 java.sql.PreparedStatement createObjectIdStatement(IDBStoreAccessor accessor)
          Create a prepared statement which returns all IDs of instances of the corresponding class.
 java.sql.PreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, java.lang.String name, boolean exactMatch, long timeStamp)
          Create a prepared statement which returns all IDs of instances of the corresponding class.
 void detachObject(IDBStoreAccessor dbStoreAccessor, CDOID id, long revised, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)
          Removes an object from the database.
 java.util.Collection<org.eclipse.net4j.db.ddl.IDBTable> getDBTables()
          Returns all DB tables which are used by this class and all its contained features.
 IListMapping getListMapping(org.eclipse.emf.ecore.EStructuralFeature feature)
          Get the mapping of the many-valued feature.
 boolean readRevision(IDBStoreAccessor dbStoreAccessor, InternalCDORevision revision, int listChunk)
          Read the current version of a revision.
 void writeRevision(IDBStoreAccessor dbStoreAccessor, InternalCDORevision revision, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)
          Write the revision data to the database.
 

Method Detail

getDBTables

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

Returns:
a collection of all tables of this class and all its contained features.

getListMapping

IListMapping getListMapping(org.eclipse.emf.ecore.EStructuralFeature feature)
Get the mapping of the many-valued feature.

Parameters:
feature - the feature for which the mapping should be returned. feature.isMany() has to be true.
Returns:
the list mapping corresponding to the feature.

readRevision

boolean readRevision(IDBStoreAccessor dbStoreAccessor,
                     InternalCDORevision revision,
                     int listChunk)
Read the current version of a revision.

Parameters:
dbStoreAccessor - 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.
Returns:
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 dbStoreAccessor,
                   InternalCDORevision revision,
                   org.eclipse.net4j.util.om.monitor.OMMonitor monitor)
Write the revision data to the database.

Parameters:
dbStoreAccessor - the accessor to use.
revision - the revision to write.
monitor - the monitor to indicate progress.

detachObject

void detachObject(IDBStoreAccessor dbStoreAccessor,
                  CDOID id,
                  long revised,
                  org.eclipse.net4j.util.om.monitor.OMMonitor monitor)
Removes an object from the database. In the case of auditing support the object is just marked as revised, else it it permanently deleted.

Parameters:
dbStoreAccessor - the accessor to use.
id - the ID of the object to remove.
revised - the timeStamp when this object became detached.
monitor - the monitor to indicate progress.

createObjectIdStatement

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

Parameters:
accessor - the accessor to use to create the statement
Returns:
the prepared statement ready to be executed using result.executeQuery().

createResourceQueryStatement

java.sql.PreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor,
                                                        CDOID folderId,
                                                        java.lang.String name,
                                                        boolean exactMatch,
                                                        long timeStamp)
Create a prepared statement which returns all IDs of instances of the corresponding class.

Parameters:
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.
timeStamp - a timestamp in the past if past versions should be looked up. In case of no audit support, this must be CDORevision.UNSPECIFIED_DATE.
Returns:
the prepared statement ready to be executed using result.executeQuery().
Throws:
org.eclipse.net4j.util.ImplementationError - if called on a mapping which does not map an EClass instanceof CDOResourceNode.

Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
All Rights Reserved.