org.jpox.store.mapping
Class VersionMapping

java.lang.Object
  extended byorg.jpox.store.mapping.JavaTypeMapping
      extended byorg.jpox.store.mapping.SingleFieldMapping
          extended byorg.jpox.store.mapping.VersionMapping
All Implemented Interfaces:
SimpleDatastoreRepresentation

public final class VersionMapping
extends SingleFieldMapping
implements SimpleDatastoreRepresentation

Mapping class for mapping version state/timestamp columns in the database. This class is for internal use only. It should not be used in user mappings.

Version:
$Revision: 1.18 $

Field Summary
 
Fields inherited from class org.jpox.store.mapping.SingleFieldMapping
datastoreContainer, typeInfo
 
Fields inherited from class org.jpox.store.mapping.JavaTypeMapping
datastoreMappings, dba, fmd, LOCALISER, referenceMapping, type
 
Constructor Summary
VersionMapping(DatastoreAdapter dba, DatastoreContainerObject datastoreContainer, JavaTypeMapping delegate)
          Constructor.
 
Method Summary
 void addDataStoreMapping(DatastoreMapping datastoreMapping)
          Method to add a datastore mapping.
 boolean compareVersion(java.lang.Object versionDatastore, java.lang.Object versionTransaction)
          Compare the transaction vs datastore version.
 DatastoreMapping getDataStoreMapping(int index)
          Accessor for a datastore mapping.
 java.lang.Class getJavaType()
          Accessor for the type represented here, returning the class itself
 java.lang.Object getNextVersion(java.lang.Object actualVersion)
          Accessor for the next version of the object
 int getNumberOfDatastoreFields()
          Accessor for the number of datastore fields.
 java.lang.Object getObject(PersistenceManager pm, java.lang.Object resultSet, int[] exprIndex)
          Accessor for the object in this column
 java.lang.Object getSampleValue()
          Accessor for a sample value for this column
 boolean includeInFetchStatement()
          Accessor for whether to include this column in any fetch statement
 ScalarExpression newLiteral(QueryExpression qs, java.lang.Object value)
          Accessor for a new literal for this mapping.
 ScalarExpression newScalarExpression(QueryExpression qs, LogicSetExpression te)
          Accessor for a new literal for this mapping.
 void setObject(PersistenceManager pm, java.lang.Object preparedStatement, int[] exprIndex, java.lang.Object value)
          Mutator for the object in this column
 
Methods inherited from class org.jpox.store.mapping.SingleFieldMapping
equals, getBoolean, getByte, getChar, getDatastoreContainer, getDouble, getFloat, getInt, getLong, getShort, getString, hasValue, includeInInsertStatement, includeInUpdateStatement, prepareDatastoreMapping, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString
 
Methods inherited from class org.jpox.store.mapping.JavaTypeMapping
failureMessage, getDataStoreMappings, getFieldMetaData, getObject, getReferenceMapping, getType, isNullable, setDefault, setObject, setReferenceMapping
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionMapping

public VersionMapping(DatastoreAdapter dba,
                      DatastoreContainerObject datastoreContainer,
                      JavaTypeMapping delegate)
Constructor.

Parameters:
dba - Datastore Adapter
datastoreContainer - Datastore table
delegate - The JavaTypeMapping to delegate the storage
Method Detail

getSampleValue

public java.lang.Object getSampleValue()
Accessor for a sample value for this column

Specified by:
getSampleValue in class JavaTypeMapping
Returns:
The sample value

newLiteral

public ScalarExpression newLiteral(QueryExpression qs,
                                   java.lang.Object value)
Accessor for a new literal for this mapping.

Specified by:
newLiteral in class JavaTypeMapping
Parameters:
qs - The QueryStatement
value - The value of the object
Returns:
The new literal

newScalarExpression

public ScalarExpression newScalarExpression(QueryExpression qs,
                                            LogicSetExpression te)
Accessor for a new literal for this mapping.

Specified by:
newScalarExpression in class JavaTypeMapping
Parameters:
qs - The QueryStatement
te - The table expression
Returns:
The new literal

includeInFetchStatement

public boolean includeInFetchStatement()
Accessor for whether to include this column in any fetch statement

Overrides:
includeInFetchStatement in class SingleFieldMapping
Returns:
Whether to include the column when fetching.

getNumberOfDatastoreFields

public int getNumberOfDatastoreFields()
Accessor for the number of datastore fields.

Overrides:
getNumberOfDatastoreFields in class JavaTypeMapping
Returns:
Number of datastore fields.

getDataStoreMapping

public DatastoreMapping getDataStoreMapping(int index)
Accessor for a datastore mapping.

Overrides:
getDataStoreMapping in class JavaTypeMapping
Parameters:
index - The mapping index
Returns:
the datastore mapping

addDataStoreMapping

public void addDataStoreMapping(DatastoreMapping datastoreMapping)
Method to add a datastore mapping.

Overrides:
addDataStoreMapping in class JavaTypeMapping
Parameters:
datastoreMapping - The mapping

getNextVersion

public java.lang.Object getNextVersion(java.lang.Object actualVersion)
Accessor for the next version of the object

Parameters:
actualVersion - The actual version
Returns:
The next version

compareVersion

public boolean compareVersion(java.lang.Object versionDatastore,
                              java.lang.Object versionTransaction)
Compare the transaction vs datastore version.

Parameters:
versionDatastore -
versionTransaction -
Returns:
true if transaction version == datastore version

getJavaType

public java.lang.Class getJavaType()
Accessor for the type represented here, returning the class itself

Specified by:
getJavaType in class JavaTypeMapping
Returns:
This class.

setObject

public void setObject(PersistenceManager pm,
                      java.lang.Object preparedStatement,
                      int[] exprIndex,
                      java.lang.Object value)
Mutator for the object in this column

Overrides:
setObject in class SingleFieldMapping
Parameters:
pm - The Persistence Manager
preparedStatement - The statement
exprIndex - The indexes
value - The value to set it to

getObject

public java.lang.Object getObject(PersistenceManager pm,
                                  java.lang.Object resultSet,
                                  int[] exprIndex)
Accessor for the object in this column

Overrides:
getObject in class SingleFieldMapping
Parameters:
pm - The Persistence manager
resultSet - The ResultSet to get the value from
exprIndex - The indexes
Returns:
The object


Copyright © -2007 . All Rights Reserved.