org.castor.ddlgen.keygenerator

Class SequenceKeyGenerator

Implemented Interfaces:
SchemaObject

public final class SequenceKeyGenerator
extends KeyGenerator

SEQUENCE key generator can be used only with Oracle, PostgreSQL, Interbase and SAP DB. It generates keys using sequences.
Version:
$Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Authors:
Le Duc Bao
Ralf Joachim
Since:
1.1

Field Summary

static String
ALGORITHM_NAME
Name of key generator algorithm.

Fields inherited from class org.castor.ddlgen.schemaobject.AbstractSchemaObject

HASHFACTOR

Constructor Summary

SequenceKeyGenerator(SequenceKeyGeneratorFactory factory)
Constructor for default SEQUENCE key generator.
SequenceKeyGenerator(SequenceKeyGeneratorFactory factory, KeyGeneratorDef definition)
Constructor for SEQUENCE key generator specified by given defintion.

Method Summary

int
getIncrement()
Get increment for the sequence.
String
getSequence()
Get name of the sequence.
boolean
isReturning()
Get returning mode for the sequence.
boolean
isTrigger()
Shell a trigger be used to generates keys?
void
toCreateDDL(DDLWriter writer)
Delegate generation of create script to factory.
void
toDropDDL(DDLWriter writer)
Delegate generation of drop script to factory.

Methods inherited from class org.castor.ddlgen.schemaobject.KeyGenerator

equals, getAlias, getTable, hashCode, merge, setAlias, setTable

Methods inherited from class org.castor.ddlgen.schemaobject.AbstractSchemaObject

equals, getConfiguration, getName, setConfiguration, setName

Field Details

ALGORITHM_NAME

public static final String ALGORITHM_NAME
Name of key generator algorithm.

Constructor Details

SequenceKeyGenerator

protected SequenceKeyGenerator(SequenceKeyGeneratorFactory factory)
Constructor for default SEQUENCE key generator.
Parameters:
factory - The key generator factory that has created this key generator and will also be responsible to generate the DDL for the sequence.

SequenceKeyGenerator

protected SequenceKeyGenerator(SequenceKeyGeneratorFactory factory,
                               KeyGeneratorDef definition)
            throws GeneratorException
Constructor for SEQUENCE key generator specified by given defintion.
Parameters:
factory - The key generator factory that has created this key generator and will also be responsible to generate the DDL for the sequence.
definition - Key generator definition.
Throws:
GeneratorException - If increment parameter can't be parsed as integer.

Method Details

getIncrement

public int getIncrement()
Get increment for the sequence.
Returns:
Increment for the sequence.

getSequence

public String getSequence()
Get name of the sequence.
Returns:
Name of the sequence.

isReturning

public boolean isReturning()
Get returning mode for the sequence.
Returns:
Returning mode for the sequence.

isTrigger

public boolean isTrigger()
Shell a trigger be used to generates keys?
Returns:
true if keys are to be generated by a trigger, false otherwise.

toCreateDDL

public void toCreateDDL(DDLWriter writer)
Delegate generation of create script to factory.
Specified by:
toCreateDDL in interface SchemaObject

toDropDDL

public void toDropDDL(DDLWriter writer)
Delegate generation of drop script to factory.
Specified by:
toDropDDL in interface SchemaObject

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com