public abstract class SequenceManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static SequenceHandler |
defaultHandler
A default handler for sequences that will return unknown values.
|
private static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> |
legacyMap
Mapping from 4GL-legacy names to db-oriented names used in application.
|
private static java.util.HashMap<java.lang.String,SequenceHandler> |
seqHandlers
Internal data structure with all instantiated
SequenceHandler s. |
private static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,Sequence>> |
sequences
The list of all known sequences in a double hashed Map (schema x sqlName).
|
Constructor and Description |
---|
SequenceManager() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
addSequenceDefinition(java.lang.String schema,
java.lang.String legName,
java.lang.String sqlName,
long sesInit,
long seqInc,
long seqMin,
long seqMax,
boolean seqCycle)
Creates the internal data structure representing a sequence object and add it to in-memory
list.
|
static int64 |
currentValue(java.lang.String legName)
Maps the
CURRENT-VALUE(seqName) function from Progress as
it is defined in Open Edge 10.x. |
static int64 |
currentValue(java.lang.String legName,
java.lang.String ldbName)
Maps the
CURRENT-VALUE(seqName, ldbName) function from
Progress as it is defined in Open Edge 10.x. |
static int64 |
dynamicCurrentValue(character legName,
character ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) function
from Progress as it is defined in Open Edge 10.x. |
static int64 |
dynamicCurrentValue(character legName,
java.lang.String ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) function
from Progress as it is defined in Open Edge 10.x. |
static int64 |
dynamicCurrentValue(java.lang.String legName,
character ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) function
from Progress as it is defined in Open Edge 10.x. |
static int64 |
dynamicCurrentValue(java.lang.String legName,
java.lang.String ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) function
from Progress as it is defined in Open Edge 10.x. |
static int64 |
dynamicNextValue(character legName,
character ldbName)
Maps the
DYNAMIC-NEXT-VALUE(seqName, ldbName) function
from Progress as it is defined in Open Edge 10.x. |
static int64 |
dynamicNextValue(character legName,
java.lang.String ldbName)
Maps the
DYNAMIC-NEXT-VALUE(seqName, ldbName) function
from Progress as it is defined in Open Edge 10.x. |
static int64 |
dynamicNextValue(java.lang.String legName,
character ldbName)
Maps the
DYNAMIC-NEXT-VALUE(seqName, ldbName) function
from Progress as it is defined in Open Edge 10.x. |
static int64 |
dynamicNextValue(java.lang.String legName,
java.lang.String ldbName)
Maps the
DYNAMIC-NEXT-VALUE(seqName, ldbName) function
from Progress as it is defined in Open Edge 10.x. |
static void |
dynamicSetValue(character legName,
int64 newValue,
character ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr statement from Progress
as it is defined in Open Edge 10.x. |
static void |
dynamicSetValue(character legName,
int64 newValue,
java.lang.String ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x. |
static void |
dynamicSetValue(character legName,
long newValue,
character ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x. |
static void |
dynamicSetValue(character legName,
long newValue,
java.lang.String ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x. |
static void |
dynamicSetValue(java.lang.String legName,
int64 newValue,
character ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x. |
static void |
dynamicSetValue(java.lang.String legName,
int64 newValue,
java.lang.String ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x. |
static void |
dynamicSetValue(java.lang.String legName,
long newValue,
character ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x. |
static void |
dynamicSetValue(java.lang.String legName,
long newValue,
java.lang.String ldbName)
Maps the
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x. |
private static java.lang.String |
getDatabaseForSequence(java.lang.String legacyName)
Seek the database in which the sequence is defined.
|
static Sequence |
getSequence(java.lang.String dbName,
java.lang.String name)
Lookups the internal data structure representing a sequence object.
|
private static SequenceHandler |
getSequenceHandler(java.lang.String ldbName)
Factory method for obtaining a sequence object for a database.
|
static int64 |
nextValue(java.lang.String legName)
Maps the
NEXT-VALUE(seqName) function from Progress as it
is defined in Open Edge 10.x. |
static int64 |
nextValue(java.lang.String legName,
java.lang.String ldbName)
Maps the
NEXT-VALUE(seqName, ldbName) function from
Progress as it is defined in Open Edge 10.x. |
private static java.lang.String |
resolveDynamicName(java.lang.String legacyName,
java.lang.String schema)
Resolve the legacy name to actual sql name of a sequence.
|
static void |
setValue(java.lang.String legName,
int64 newValue)
Maps the
CURRENT-VALUE(seqName) = expr statement from
Progress as it is defined in Open Edge 10.x. |
static void |
setValue(java.lang.String legName,
int64 newValue,
java.lang.String ldbName)
Maps the
CURRENT-VALUE(seqName, ldbName) = expr statement
from Progress as it is defined in Open Edge 10.x. |
static void |
setValue(java.lang.String legName,
long newValue)
Maps the
CURRENT-VALUE(seqName) = expr statement from
Progress as it is defined in Open Edge 10.x. |
static void |
setValue(java.lang.String legName,
long newValue,
java.lang.String ldbName)
Maps the
CURRENT-VALUE(seqName, ldbName) = expr statement
from Progress as it is defined in Open Edge 10.x. |
private static SequenceHandler defaultHandler
private static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,Sequence>> sequences
I wonder if the first level uses the sequence names and the second the database. This makes it easier to look for a sequence when the name of the database is default/unknown.
private static java.util.HashMap<java.lang.String,SequenceHandler> seqHandlers
SequenceHandler
s.
The keys are logical database names. This assures that for each database there is only one
SequenceHandler
which also serves for synchronizing access to sequence
functionality using these database-unique objects as locks.private static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> legacyMap
public static int64 currentValue(java.lang.String legName)
CURRENT-VALUE(seqName)
function from Progress as
it is defined in Open Edge 10.x.
Returns the current value of a sequence defined in the Data
Dictionary.legName
- An identifier that specifies the name of a sequence defined in 4GL.CURRENT-VALUE
statement or the
NEXT-VALUE
function.
?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 currentValue(java.lang.String legName, java.lang.String ldbName)
CURRENT-VALUE(seqName, ldbName)
function from
Progress as it is defined in Open Edge 10.x.
Returns the current value of the sequence defined in 4GL.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.ldbName
- An identifier that specifies the logical name of the database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If a sequence with this name exists in more than
one connected database, then you must specify
ldbName
.CURRENT-VALUE
statement or the
NEXT-VALUE
function.
?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 nextValue(java.lang.String legName)
NEXT-VALUE(seqName)
function from Progress as it
is defined in Open Edge 10.x.
Returns the next value of the sequence, incremented by the
positive or negative value defined in the Data Dictionary.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 nextValue(java.lang.String legName, java.lang.String ldbName)
NEXT-VALUE(seqName, ldbName)
function from
Progress as it is defined in Open Edge 10.x.
Returns the next value of the sequence, incremented by the
positive or negative value defined in the Data Dictionary.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.ldbName
- An identifier that specifies the logical name of the database
in which the sequence is defined. The database must be
connected. If multiple databases are connected, you can omit
this parameter if you specify a sequence that is unique to
one of the databases.CURRENT-VALUE
statement or the
NEXT-VALUE
function.
?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 dynamicCurrentValue(java.lang.String legName, java.lang.String ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName)
function
from Progress as it is defined in Open Edge 10.x.
Returns the current value of the sequence defined in the Data
Dictionary.legName
- The name of a sequence defined in the Data Dictionary.ldbName
- The logical name of the database in which the sequence is
defined. The database must be connected.CURRENT-VALUE
statement or the
NEXT-VALUE
function.
?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 dynamicCurrentValue(java.lang.String legName, character ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName)
function
from Progress as it is defined in Open Edge 10.x.
Returns the current value of the sequence defined in the Data
Dictionary.legName
- The name of a sequence defined in the Data Dictionary.ldbName
- A character expression that evaluates to a logical name of
the database in which the sequence is defined. The database
must be connected.CURRENT-VALUE
statement or the
NEXT-VALUE
function.
?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 dynamicCurrentValue(character legName, java.lang.String ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName)
function
from Progress as it is defined in Open Edge 10.x.
Returns the current value of the sequence defined in the Data
Dictionary.legName
- A character expression that evaluates to the name of a
sequence defined in the Data Dictionary.ldbName
- The logical name of the database in which the sequence is
defined. The database must be connected.CURRENT-VALUE
statement or the
NEXT-VALUE
function.
?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 dynamicCurrentValue(character legName, character ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName)
function
from Progress as it is defined in Open Edge 10.x.
Returns the current value of the sequence defined in the Data
Dictionary.legName
- A character expression that evaluates to the name of a
sequence defined in the Data Dictionary.ldbName
- A character expression that evaluates to a logical name of
the database in which the sequence is defined. The database
must be connected.CURRENT-VALUE
statement or the
NEXT-VALUE
function.
?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 dynamicNextValue(java.lang.String legName, java.lang.String ldbName)
DYNAMIC-NEXT-VALUE(seqName, ldbName)
function
from Progress as it is defined in Open Edge 10.x.
Returns the next value of the sequence, incremented by the
positive or negative value defined in the Data Dictionary.legName
- The name of a sequence defined in the Data Dictionary.ldbName
- The logical name of the database in which the sequence is
defined. The database must be connected.?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 dynamicNextValue(java.lang.String legName, character ldbName)
DYNAMIC-NEXT-VALUE(seqName, ldbName)
function
from Progress as it is defined in Open Edge 10.x.
Returns the next value of the sequence, incremented by the
positive or negative value defined in the Data Dictionary.legName
- The name of a sequence defined in the Data Dictionary.ldbName
- A character expression that evaluates to a logical name of
the database in which the sequence is defined. The database
must be connected.?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 dynamicNextValue(character legName, java.lang.String ldbName)
DYNAMIC-NEXT-VALUE(seqName, ldbName)
function
from Progress as it is defined in Open Edge 10.x.
Returns the next value of the sequence, incremented by the
positive or negative value defined in the Data Dictionary.legName
- A character expression that evaluates to the name of a
sequence defined in the Data Dictionary.ldbName
- The logical name of the database in which the sequence is
defined. The database must be connected.?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static int64 dynamicNextValue(character legName, character ldbName)
DYNAMIC-NEXT-VALUE(seqName, ldbName)
function
from Progress as it is defined in Open Edge 10.x.
Returns the next value of the sequence, incremented by the
positive or negative value defined in the Data Dictionary.legName
- A character expression that evaluates to the name of a
sequence defined in the Data Dictionary.ldbName
- A character expression that evaluates to a logical name of
the database in which the sequence is defined. The database
must be connected.?
) if the sequence has
exceeded its minimum or maximum and is not cycling.
public static void setValue(java.lang.String legName, int64 newValue)
CURRENT-VALUE(seqName) = expr
statement from
Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void setValue(java.lang.String legName, long newValue)
CURRENT-VALUE(seqName) = expr
statement from
Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void setValue(java.lang.String legName, long newValue, java.lang.String ldbName)
CURRENT-VALUE(seqName, ldbName) = expr
statement
from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.ldbName
- An identifier that specifies the logical name of the database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void setValue(java.lang.String legName, int64 newValue, java.lang.String ldbName)
CURRENT-VALUE(seqName, ldbName) = expr
statement
from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.ldbName
- An identifier that specifies the logical name of the database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void dynamicSetValue(java.lang.String legName, long newValue, java.lang.String ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.ldbName
- An identifier that specifies the logical name of the database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void dynamicSetValue(java.lang.String legName, long newValue, character ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.ldbName
- An identifier that specifies the logical name of the database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void dynamicSetValue(java.lang.String legName, int64 newValue, java.lang.String ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- A character expression that evaluates to the name of a
sequence defined in the Data Dictionary.ldbName
- A character expression that evaluates to the name of a database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void dynamicSetValue(java.lang.String legName, int64 newValue, character ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.ldbName
- An identifier that specifies the logical name of the database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void dynamicSetValue(character legName, long newValue, java.lang.String ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- A character expression that evaluates to the name of a
sequence defined in the Data Dictionary.ldbName
- A character expression that evaluates to the name of a database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void dynamicSetValue(character legName, long newValue, character ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- An identifier that specifies the name of a sequence defined
in the Data Dictionary.ldbName
- An identifier that specifies the logical name of the database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void dynamicSetValue(character legName, int64 newValue, java.lang.String ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- A character expression that evaluates to the name of a
sequence defined in the Data Dictionary.ldbName
- A character expression that evaluates to the name of a database
in which the sequence is defined. The database must be
connected. You can omit this parameter if the sequence name is
unambiguous. If more than one connected database has a sequence
with given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the
specified sequence. If expression is outside the boundary set
by the initial value (at one end) and the lower limit or upper
limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.public static void dynamicSetValue(character legName, int64 newValue, character ldbName)
DYNAMIC-CURRENT-VALUE(seqName, ldbName) = expr
statement from Progress
as it is defined in Open Edge 10.x.
Resets the current value of the sequence to the one specified as parameter.legName
- A character expression that evaluates to the name of a sequence defined in the Data
Dictionary.ldbName
- A character expression that evaluates to the name of a database in which the sequence
is defined. The database must be connected. You can omit this parameter if the
sequence name is unambiguous. If more than one connected database has a sequence with
given name, then you must supply ldbName
.newValue
- An integer expression assigned as the current value of the specified sequence. If
expression is outside the boundary set by the initial value (at one end) and the
lower limit or upper limit (at the other end) for the sequence, Progress returns an
error, and the sequence value remains unchanged.private static java.lang.String getDatabaseForSequence(java.lang.String legacyName)
SequenceHandler
has been loaded.legacyName
- The legacy sequence name of the sequence to lookup after.private static java.lang.String resolveDynamicName(java.lang.String legacyName, java.lang.String schema)
legacyName
- The name of the sequence in 4GL.schema
- The schema of the sequence.private static SequenceHandler getSequenceHandler(java.lang.String ldbName)
SequenceHandler
is
returned by default.ldbName
- The name of the databasestatic void addSequenceDefinition(java.lang.String schema, java.lang.String legName, java.lang.String sqlName, long sesInit, long seqInc, long seqMin, long seqMax, boolean seqCycle)
This method is only called at startup time by DMOIndex
when it is initializing
(from updateMap()
).
schema
- The schema/database.legName
- The legacy name of the sequence (as it was defined in 4GL).sqlName
- The sql-legal name of the sequence.sesInit
- The initial value of the sequence.seqInc
- The increment value of the sequence.seqMin
- The minimum value of the sequence.seqMax
- The maximum value of the sequence.seqCycle
- The cycle flag of the sequence.public static Sequence getSequence(java.lang.String dbName, java.lang.String name)
dbName
- The logical name or alias of the database.name
- The sql name of the sequence.Sequence
from the database and null
if something is wrong
(database not connected, sequence does not exist).