Cumulus4j API
(1.0.0)

org.cumulus4j.store.model
Class Sequence

java.lang.Object
  extended by org.cumulus4j.store.model.Sequence

public class Sequence
extends Object

Persistent sequence entity used by Cumulus4jIncrementGenerator.

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de

Constructor Summary
protected Sequence()
          Default constructor.
protected Sequence(String sequenceName)
          Constructor creating a Sequence with the given primary key.
 
Method Summary
static Sequence createSequence(PersistenceManager pm, String sequenceName)
          Get the Sequence identified by the given sequenceName.
 long getNextValue()
          Get the next value (i.e.
static Sequence getSequence(PersistenceManager pm, String sequenceName)
          Get the Sequence identified by the given sequenceName.
 String getSequenceName()
          Get the name of the sequence.
 void setNextValue(long nextValue)
          Set the next value (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sequence

protected Sequence()
Default constructor. Should never be used by actual code! It exists only to fulfill the JDO requirements.


Sequence

protected Sequence(String sequenceName)
Constructor creating a Sequence with the given primary key.

Parameters:
sequenceName - the name of the sequence; must not be null.
Method Detail

getSequence

public static Sequence getSequence(PersistenceManager pm,
                                   String sequenceName)
Get the Sequence identified by the given sequenceName. If no such Sequence exists, this method returns null.

Parameters:
pm - the backend-PersistenceManager used to access the underlying datastore; must not be null.
sequenceName - the name of the sequence; must not be null.
Returns:
the Sequence identified by the given sequenceName or null, if no such Sequence exists.

createSequence

public static Sequence createSequence(PersistenceManager pm,
                                      String sequenceName)
Get the Sequence identified by the given sequenceName. If no such Sequence exists, this method creates & persists one.

Parameters:
pm - the backend-PersistenceManager used to access the underlying datastore; must not be null.
sequenceName - the name of the sequence; must not be null.
Returns:
the Sequence identified by the given sequenceName; never null.

getSequenceName

public String getSequenceName()
Get the name of the sequence.

Returns:
the name of the sequence.

getNextValue

public long getNextValue()
Get the next value (i.e. the first unused value) for this sequence.

Returns:
the next value (i.e. the first unused value) for this sequence.

setNextValue

public void setNextValue(long nextValue)
Set the next value (i.e. the first unused value) for this sequence.

Parameters:
nextValue - the next value (i.e. the first unused value) for this sequence.

Cumulus4j API
(1.0.0)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.