OBEROn SDK

com.oberon.ooql.sdk
Class AutoNumber

java.lang.Object
  extended by com.oberon.ooql.sdk.OBBase
      extended by com.oberon.ooql.sdk.AdminBase
          extended by com.oberon.ooql.sdk.AutoNumber
All Implemented Interfaces:
java.io.Serializable

public class AutoNumber
extends AdminBase
implements java.io.Serializable

AutoNumber Admin Object: generates progressive names with a given format.

Version:
5.0
See Also:
Serialized Form

Field Summary
static java.lang.String separators
          Set of separator characters for the AutoNumber format
static java.lang.String symbolTypes
          Set of symbolic incremental digits for the AutoNumber format.
 
Fields inherited from class com.oberon.ooql.sdk.AdminBase
bsOptions, HIDDEN_OPTION
 
Constructor Summary
AutoNumber()
           
AutoNumber(java.lang.String name)
           
 
Method Summary
static java.lang.String checkSequence(java.lang.String sequence, java.lang.String value)
          Check if a value is valid for the given sequence
static java.lang.String checkSequence(java.lang.String sequence, java.lang.String value, boolean reset)
          Check if a value is valid for the given sequence
 java.lang.String compareUpdate(AutoNumber refAutoNumber, boolean checkImage, boolean overwrite, boolean force, Framework framework)
          Return/apply the OOQL command to update this AutoNumber object and let it become equals to another reference object.
 void create(boolean force, Framework framework)
          Create a new AutoNumber object on the database
 void create(Framework framework)
          Create a new AutoNumber object on the database
 void destroy(Framework framework)
          Remove the AutoNumber object from the database
 void fromXML(org.jdom.Element rootElement)
          Load the AutoNumber object properties from XML element tree
 java.lang.String getCreateCommand(boolean force)
          Return the OOQL command to create this AutoNumber object with the settled properties
 java.lang.String getFormat()
          Get the AutoNumber global format
 java.lang.String getLifecycle()
          Get the associated Lifecycle
 java.lang.String getNextValue()
          Get the AutoNumber next counter value
static java.lang.String getNextValue(java.lang.String sequence, java.lang.String currentValue)
          Return the next value for the given sequence
static java.lang.String getNextValue(java.lang.String sequence, java.lang.String currentValue, int increment)
          Return the incremented value for the given sequence
 java.lang.String getObjectSpace()
          Get the associated ObjectSpace
 java.lang.String getProgram()
          Get the sequence generator method
 java.lang.String getProperty(java.lang.String propertyName, java.util.Vector<java.lang.Object> filterArgs, java.lang.String token, Framework framework)
          Get a property for this AutoNumber object by its OOQL identifier
 java.lang.String getSaveCommand(boolean force)
          Return the OOQL command to update this AutoNumber object with the modified properties.
 java.lang.String getSequence()
          Get the AutoNumber sequence format
 java.lang.String getTargetClass()
          Get the associated Class
 java.util.Vector<?> getTargetNames(java.lang.String composedName, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Return a Vector of administrative object names extracted by using an OOQL selector
 void increment(int increment, Framework framework)
          Increment the current AutoNumber value
 void link(Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the AutoNumber object: connect the memory instance with the database instance
static AutoNumber open(java.lang.String name, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open an administrative object and read properties from the database or retrieve them from memory
static java.lang.String resetValue(java.lang.String sequence)
          Return the first value for the given sequence
 void setFormat(java.lang.String format)
          Set the AutoNumber global format
 void setLifecycle(java.lang.String lifecycleName)
          Set an associated Lifecycle; it's used to auto-generate new ObjectObj instances with this Lifecycle
 void setNextValue(java.lang.String nextValue)
          Fix the AutoNumber next counter value
 void setObjectSpace(java.lang.String objectSpaceName)
          Set an associated ObjectSpace; it's used to auto-generate new ObjectObj instances inside this ObjectSpace
 void setProgram(java.lang.String programName)
          Set a method to generate the counter sequence values instead of using the sequence rule
 void setSequence(java.lang.String sequence)
          Set the AutoNumber counter sequence format
 void setTargetClass(java.lang.String className)
          Set an associated Class; it's used to auto-generate new ObjectObj instances of this class with progressive names
 java.lang.String toString()
          Return the AutoNumber object basic properties as a single String
 java.lang.String toString(Framework framework)
          Return the AutoNumber object extended properties as a single String
 org.jdom.Element toXML(boolean getImage, boolean fullDump, Framework framework)
          Return the AutoNumber object properties as XML element tree
 org.jdom.Element toXML(Framework framework)
          Return the AutoNumber object properties as XML element tree
 void unlink(Framework framework)
          Close the object: disconnect the memory instance from the database instance
 void write(boolean force, Framework framework)
          Update the AutoNumber object to the database.
 void write(Framework framework)
          Update the AutoNumber object to the database
 
Methods inherited from class com.oberon.ooql.sdk.AdminBase
addFeature, changedApplication, checkChangeName, checkCounters, checkCounters, getAdminType, getApplication, getCommonProperty, getCommonTargetNames, getCounters, getCreateBasicCommand, getCreateCommand, getCrtDate, getDescription, getEditBasicCommand, getFeature, getFeatures, getFeaturesAsString, getImage, getImage, getImage, getImageData, getImageFile, getModDate, getModUser, getName, getOldName, getPlainFeatures, getSaveCommand, getSVNRevision, getXMLFeatureList, hasImage, isHidden, setApplication, setCounters, setCrtDate, setDescription, setHidden, setImage, setImageData, setImageFile, setModDate, setModUser, setName, setSVNRevision, show, show, toCommonXML, toXML
 
Methods inherited from class com.oberon.ooql.sdk.OBBase
addChange, addUniqueChange, ChangesFromXML, ChangesToXML, getChanges, getChangesAsString, getId, isLinked, removeChange, resetChanges, setId, setLinked
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

separators

public static final java.lang.String separators
Set of separator characters for the AutoNumber format

See Also:
Constant Field Values

symbolTypes

public static final java.lang.String symbolTypes
Set of symbolic incremental digits for the AutoNumber format.
1,2,3,4,5,6,7,8,9: digits from 0 to N [example: 7 = (0,1,2,3,4,5,6,7) octal]
x: hex digits with lower case letters (0,..9,a,b,c,d,e,f)
X: hex digits with upper case letters (0,..9,A,B,C,D,E,F)
a: lower case alphabetic characters (a,b,c,d,....,x,y,w,z)
A: upper case alphabetic characters (A,B,C,D,....,X,Y,W,Z)
z: lower case alphanumeric characters (0,1,..,9,a,b,c,d,....,x,y,w,z)
Z: upper case alphanumeric characters (0,1,..,9,A,B,C,D,....,X,Y,W,Z)
o: unlimited lower case english letteral numbers (one,two,three,four,..........)
O: unlimited upper case english letteral numbers (ONE,TWO,THREE,FOUR,..........)
l: limited lower case english letteral numbers (one,two,three,four,...,nine,ten)
L: limited upper case english letteral numbers (ONE,TWO,THREE,FOUR,...,NINE,TEN)
i: unlimited lower case roman numbers (i,ii,iii,iv,v,vi,vii,viii,ix,x,xi...)
I: unlimited upper case roman numbers (I,II,III,IV,V,VI,VII,VIII,IX,X,XI...)
r: limited lower case roman numbers (i,ii,iii,iv,v,vi,vii,viii,ix,x)
R: limited upper case roman numbers (I,II,III,IV,V,VI,VII,VIII,IX,X)

See Also:
Constant Field Values
Constructor Detail

AutoNumber

public AutoNumber()

AutoNumber

public AutoNumber(java.lang.String name)
           throws OberonException
Parameters:
name - the name of the administrative object
Throws:
OberonException - if the name contains invalid characters
Method Detail

open

public static AutoNumber open(java.lang.String name,
                              Framework framework,
                              java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                       throws OberonException
Open an administrative object and read properties from the database or retrieve them from memory

Parameters:
name - the object name
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions

link

public void link(Framework framework,
                 java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          throws OberonException
Open the AutoNumber object: connect the memory instance with the database instance

Specified by:
link in class AdminBase
Parameters:
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions

create

public void create(Framework framework)
            throws OberonException
Create a new AutoNumber object on the database

Specified by:
create in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

create

public void create(boolean force,
                   Framework framework)
            throws OberonException
Create a new AutoNumber object on the database

Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
1.6

increment

public void increment(int increment,
                      Framework framework)
               throws OberonException
Increment the current AutoNumber value

Parameters:
increment - the increment value
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

write

public void write(Framework framework)
           throws OberonException
Update the AutoNumber object to the database

Specified by:
write in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

write

public void write(boolean force,
                  Framework framework)
           throws OberonException
Update the AutoNumber object to the database.

Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
1.6

unlink

public void unlink(Framework framework)
            throws OberonException
Close the object: disconnect the memory instance from the database instance

Specified by:
unlink in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

destroy

public void destroy(Framework framework)
             throws OberonException
Remove the AutoNumber object from the database

Specified by:
destroy in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

setSequence

public void setSequence(java.lang.String sequence)
                 throws OberonException
Set the AutoNumber counter sequence format

Parameters:
sequence - the sequence format: can contain only separators or symbolTypes characters
example: sequence-format = aX(r-99) sample counter-value = tE(ix-67)
Throws:
OberonException - when the input format includes not allowed characters

getSequence

public java.lang.String getSequence()
Get the AutoNumber sequence format

Returns:
the sequence format

setFormat

public void setFormat(java.lang.String format)
               throws OberonException
Set the AutoNumber global format

Parameters:
format - the global number format: must contain the <COUNTER> tag inside to specify the counter position
example: format = Prefix <COUNTER>/Suffix sample number-value = Prefix tE(ix-67)/Suffix
Throws:
OberonException - when the input format doesn't include the counter tag

getFormat

public java.lang.String getFormat()
Get the AutoNumber global format

Returns:
the global format

setNextValue

public void setNextValue(java.lang.String nextValue)
Fix the AutoNumber next counter value

Parameters:
nextValue - the value; must be compatible with the sequence format

getNextValue

public java.lang.String getNextValue()
Get the AutoNumber next counter value

Returns:
the next counter value

setTargetClass

public void setTargetClass(java.lang.String className)
Set an associated Class; it's used to auto-generate new ObjectObj instances of this class with progressive names

Parameters:
className - the Class name

getTargetClass

public java.lang.String getTargetClass()
Get the associated Class

Returns:
the Class name

setLifecycle

public void setLifecycle(java.lang.String lifecycleName)
Set an associated Lifecycle; it's used to auto-generate new ObjectObj instances with this Lifecycle

Parameters:
lifecycleName - the Lifecycle name

getLifecycle

public java.lang.String getLifecycle()
Get the associated Lifecycle

Returns:
the Lifecycle name

setObjectSpace

public void setObjectSpace(java.lang.String objectSpaceName)
Set an associated ObjectSpace; it's used to auto-generate new ObjectObj instances inside this ObjectSpace

Parameters:
objectSpaceName - the ObjectSpace name

getObjectSpace

public java.lang.String getObjectSpace()
Get the associated ObjectSpace

Returns:
the ObjectSpace name

setProgram

public void setProgram(java.lang.String programName)
Set a method to generate the counter sequence values instead of using the sequence rule

Parameters:
programName - the Program name

getProgram

public java.lang.String getProgram()
Get the sequence generator method

Returns:
the Program name

getProperty

public java.lang.String getProperty(java.lang.String propertyName,
                                    java.util.Vector<java.lang.Object> filterArgs,
                                    java.lang.String token,
                                    Framework framework)
Get a property for this AutoNumber object by its OOQL identifier

Specified by:
getProperty in class OBBase
Parameters:
propertyName - OOQL property identifier/name (example: sequence , format ...)
filterArgs - extra arguments used to compute properties
token - separator token for complex properties
framework - the current framework
Returns:
the property value

getTargetNames

public java.util.Vector<?> getTargetNames(java.lang.String composedName,
                                          java.util.Vector<java.lang.Object> filterArgs,
                                          Framework framework)
Return a Vector of administrative object names extracted by using an OOQL selector

Specified by:
getTargetNames in class OBBase
Parameters:
composedName - OOQL property identifier/name (example: class , lifecycle .. )
filterArgs - extra arguments used to compute properties
framework - the current framework
Returns:
a Vector of target names, used to extract their (sub)properties values

toString

public java.lang.String toString()
Return the AutoNumber object basic properties as a single String

Overrides:
toString in class AdminBase

toString

public java.lang.String toString(Framework framework)
Return the AutoNumber object extended properties as a single String

Overrides:
toString in class AdminBase
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(Framework framework)
Return the AutoNumber object properties as XML element tree

Specified by:
toXML in class AdminBase
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(boolean getImage,
                              boolean fullDump,
                              Framework framework)
Return the AutoNumber object properties as XML element tree

Specified by:
toXML in class AdminBase
Parameters:
getImage - true to include "imagedata" element with the base64 encoded image data
fullDump - true to include detailed information
framework - the current framework

fromXML

public void fromXML(org.jdom.Element rootElement)
Load the AutoNumber object properties from XML element tree

Overrides:
fromXML in class AdminBase

getCreateCommand

public java.lang.String getCreateCommand(boolean force)
Return the OOQL command to create this AutoNumber object with the settled properties

Specified by:
getCreateCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

getSaveCommand

public java.lang.String getSaveCommand(boolean force)
Return the OOQL command to update this AutoNumber object with the modified properties.
If the object is new, it returns the create command.

Specified by:
getSaveCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

compareUpdate

public java.lang.String compareUpdate(AutoNumber refAutoNumber,
                                      boolean checkImage,
                                      boolean overwrite,
                                      boolean force,
                                      Framework framework)
                               throws OberonException
Return/apply the OOQL command to update this AutoNumber object and let it become equals to another reference object.
This method is useful to import objects from an XML file.

Parameters:
refAutoNumber - the reference AutoNumber object
checkImage - if true compare also the image icon
overwrite - if true update the database object instance
force - if true ignores optional properties
framework - the current framework
Throws:
OberonException
See Also:
fromXML(Element)

checkSequence

public static java.lang.String checkSequence(java.lang.String sequence,
                                             java.lang.String value)
                                      throws OberonException
Check if a value is valid for the given sequence

Parameters:
sequence - the counter sequence format
value - the value to check
Returns:
the value if correct or the sequence first value otherwise
Throws:
OberonException

checkSequence

public static java.lang.String checkSequence(java.lang.String sequence,
                                             java.lang.String value,
                                             boolean reset)
                                      throws OberonException
Check if a value is valid for the given sequence

Parameters:
sequence - the counter sequence format
value - the value to check
reset - if true, return the sequence first value instead of raise the exception
Throws:
OberonException - if the value is not valid

getNextValue

public static java.lang.String getNextValue(java.lang.String sequence,
                                            java.lang.String currentValue)
                                     throws OberonException
Return the next value for the given sequence

Parameters:
sequence - the counter sequence format
currentValue - the current value
Throws:
OberonException - if the current value is not valid

getNextValue

public static java.lang.String getNextValue(java.lang.String sequence,
                                            java.lang.String currentValue,
                                            int increment)
                                     throws OberonException
Return the incremented value for the given sequence

Parameters:
sequence - the counter sequence format
currentValue - the current value
increment - the increment respect current value
Throws:
OberonException - if the current value is not valid

resetValue

public static java.lang.String resetValue(java.lang.String sequence)
                                   throws OberonException
Return the first value for the given sequence

Parameters:
sequence - the counter sequence format
Throws:
OberonException

OBEROn SDK

Copyright © 2008-2014 Mirko Solazzi. All Rights Reserved.