OBEROn SDK

com.oberon.ooql.sdk
Class Form

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

public class Form
extends AdminBase
implements java.io.Serializable

Form Admin Object: defines a web form.

Version:
5.0
See Also:
Serialized Form

Field Summary
static int SEARCHFORM_OPTION
          The Search-Form flag index inside the Option Set
 
Fields inherited from class com.oberon.ooql.sdk.AdminBase
bsOptions, HIDDEN_OPTION
 
Constructor Summary
Form()
           
Form(java.lang.String name)
           
 
Method Summary
 Framework action(Framework framework, java.util.Vector<java.lang.Object> args)
          Execute the Action program
 void addItem(Item item)
          Appends a new Item to the Form
 void addItemAfter(Item item, java.lang.String refItem)
          Add a Item after another reference Item
 void addItemBefore(Item item, java.lang.String refItem)
          Add a Item before another reference Item
 Framework check(Framework framework, java.util.Vector<java.lang.Object> args)
          Execute the Check program
 java.lang.String compareUpdate(Form refForm, boolean checkImage, boolean overwrite, boolean force, Framework framework)
          Return/apply the OOQL command to update this Form object and let it become equals to another reference object.
 void compose(ObjectBase objlink, Selector selector, java.io.DataOutputStream outStream, Framework framework)
          Compose the Form for the current User and for a specific Object or Link instance
 java.util.Vector<java.lang.String> computeProgramRanges(java.lang.String fieldName, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Execute the range Program to compute the ranges for a specific field
 void create(boolean overwrite, boolean force, Framework framework)
          Create a new Form object on the database
 void create(Framework framework)
          Create a new Form object on the database
 java.lang.String createTextForm(ObjectBase objlink, java.lang.String language, Framework framework)
          Generates a text (generally for mail body) according to the Form definition and the object/link values
 void destroy(Framework framework)
          Remove the Form object from the database
 void fromXML(org.jdom.Element rootElement)
          Load the Form object properties from XML element tree
 void fromXML(org.jdom.Element rootElement, boolean loadItems)
          Load the Form object properties from XML element tree
 java.util.Vector<java.lang.String> getAccessItemNames(int accessType, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Get all Form Item names for which the framework User has access
 java.util.Vector<Item> getAccessItems(int accessType, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Get all Form Item for which the framework User has access
 java.lang.String getAccessItemsAsString(int accessType, java.util.Vector<java.lang.Object> filterArgs, Framework framework, java.lang.String delim)
          Get all Form Item names for which the framework User has access as a single string
 java.lang.String getActionProgram()
          Get the Form action Program
 java.lang.String getCheckProgram()
          Get the Form validation Program
 java.lang.String getCreateCommand(boolean force)
          Return the OOQL command to create this Form object with the settled properties
 java.lang.String getCreateCommand(boolean force, boolean overwrite)
          Return the OOQL command to create this Form object with the settled properties
 java.lang.String getFilterParameters()
          Get the list of parameters used by Item extraction Programs
 java.lang.String getFormat()
          Get the Form format
 Item getItem(int itemId)
          Get a Form Item with the given internal id
 Item getItem(java.lang.String itemName)
          Get a Form Item with the given name
 Item getItemAt(int index)
          Get a Form Item at given position index
 Item getItemField(java.lang.String fieldName)
          Get a Form Item field with the given name
 java.util.Vector<java.lang.String> getItemFields()
          Get all fields included in the Form
 java.util.Vector<java.lang.String> getItemIDs()
          Get all Form Item internal ids
 java.util.Vector<java.lang.String> getItemNames()
          Get all Form Item names
 int getItemPos(java.lang.String itemName)
          Get the Item position index in the Form
 java.util.Vector<Item> getItems()
          Get all Form Items
 java.lang.String getItemsAsString(java.lang.String delim)
          Get all Form Item names as a single string
 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 Form object by its OOQL identifier
 java.lang.String getRangeProgram()
          Get the range Program
 java.lang.String getSaveCommand(boolean force)
          Return the OOQL command to update this Form object with the modified properties.
 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
static java.lang.String getTranslatedValue(FormUserItem item, java.lang.String section, java.lang.String value, Framework framework)
           
 java.util.Vector<FormUserItem> getUserFieldItems(ObjectBase objlink, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Get all FormUserItem of Field type for which the framework User has the visibility
 java.util.Vector<FormUserItem> getUserItems(ObjectBase objlink, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Get all FormUserItem for which the framework User has the visibility
 java.util.Vector<FormUserItem> getUserItemsWithData(ObjectBase objlink, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Get data related to Form-Item fields
 boolean isSearchForm()
          Check if the Form is for searching objects.
 void link(Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the Form object: connect the memory instance with the database instance
 void moveItem(java.lang.String itemName, boolean after)
          Move a Form Item
static Form 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
 org.jdom.Element rangesToXML(java.lang.String fieldName, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Return Item-field Ranges as XML element tree
 void removeItem(Item item)
          Remove a Item from the Form
 void removeItem(java.lang.String itemName)
          Remove a Item from the Form
 void setActionProgram(java.lang.String programName)
          Set a method to run after the Form is committed
 void setCheckProgram(java.lang.String programName)
          Set a method to validate the Form values
 void setFilterParameters(java.lang.String parameters)
          Set a list of parameters used by Item extraction Programs
 void setFormat(java.lang.String format)
          Set the Form format.
 void setItems(java.util.Vector<Item> items)
          Set all Form Items
 void setRangeProgram(java.lang.String programName)
          Set a method to generate range values for field/basic items
 void setSearchForm(boolean searchFlag)
          Set if Form is for searching objects.
 java.lang.String toString()
          Return the Form object basic properties as a single String
 java.lang.String toString(Framework framework)
          Return the Form object extended properties as a single String
 org.jdom.Element toXML(boolean getImage, boolean fullDump, Framework framework)
          Return the Form object properties as XML element tree
 org.jdom.Element toXML(Framework framework)
          Return the Form object properties as XML element tree
 void unlink(Framework framework)
          Close the object: disconnect the memory instance from the database instance
 void updateItems(java.util.Vector<Item> items)
          Update the items on the basis of a given list
 void write(boolean force, Framework framework)
          Update the Form object to the database
 void write(Framework framework)
          Update the Form 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

SEARCHFORM_OPTION

public static final int SEARCHFORM_OPTION
The Search-Form flag index inside the Option Set

See Also:
Constant Field Values
Constructor Detail

Form

public Form()

Form

public Form(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 Form 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 Form 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 Form 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 overwrite,
                   boolean force,
                   Framework framework)
            throws OberonException
Create a new Form object on the database

Parameters:
overwrite - if true destroy and recreate the Form when it exists
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

write

public void write(Framework framework)
           throws OberonException
Update the Form 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 Form 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

check

public Framework check(Framework framework,
                       java.util.Vector<java.lang.Object> args)
                throws OberonException
Execute the Check program

Parameters:
framework - the current framework
args - vector of input arguments Form-item input values should be placed into the framework environment: Framework.setEnv(String, String)
Throws:
OberonException - due to execution errors or programmatically raised exceptions

action

public Framework action(Framework framework,
                        java.util.Vector<java.lang.Object> args)
                 throws OberonException
Execute the Action program

Parameters:
framework - the current framework
args - vector of Program input arguments Form-item committed values should be placed into the framework environment: Framework.setEnv(String, String)
Throws:
OberonException - due to execution errors or programmatically raised exceptions

compose

public void compose(ObjectBase objlink,
                    Selector selector,
                    java.io.DataOutputStream outStream,
                    Framework framework)
             throws java.io.IOException,
                    OberonException
Compose the Form for the current User and for a specific Object or Link instance

Parameters:
objlink - the ObjectObj or Link instance ( only the Class / Linktype may be specified )
selector - selection parameters and input arguments
outStream - the stream for the results (if null the result is stored into the framework)
framework - the current framework
Throws:
java.io.IOException - when the output stream return an exception
OberonException - for all other problems
Since:
4.1
See Also:
getUserItems(ObjectBase, Vector, Framework), getUserFieldItems(ObjectBase, Vector, Framework), getUserItemsWithData(ObjectBase, Vector, Framework), Framework.getResult()

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 Form 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

setSearchForm

public void setSearchForm(boolean searchFlag)
Set if Form is for searching objects.

Parameters:
searchFlag - true to define the Form for searching
Since:
4.1

isSearchForm

public boolean isSearchForm()
Check if the Form is for searching objects.

Returns:
the search form flag
Since:
4.1

addItem

public void addItem(Item item)
             throws OberonException
Appends a new Item to the Form

Throws:
OberonException

addItemBefore

public void addItemBefore(Item item,
                          java.lang.String refItem)
                   throws OberonException
Add a Item before another reference Item

Parameters:
item - the Item to add
refItem - the reference Item name
Throws:
OberonException - when the reference Item is not found

addItemAfter

public void addItemAfter(Item item,
                         java.lang.String refItem)
                  throws OberonException
Add a Item after another reference Item

Parameters:
item - the Item to add
refItem - the reference Item name
Throws:
OberonException - when the reference Item is not found

moveItem

public void moveItem(java.lang.String itemName,
                     boolean after)
Move a Form Item

Parameters:
itemName - the Item name
after - if true move the Item after else move it before the current position

removeItem

public void removeItem(Item item)
Remove a Item from the Form


removeItem

public void removeItem(java.lang.String itemName)
Remove a Item from the Form


setItems

public void setItems(java.util.Vector<Item> items)
Set all Form Items

Parameters:
items - a vector of Items

updateItems

public void updateItems(java.util.Vector<Item> items)
                 throws OberonException
Update the items on the basis of a given list

Parameters:
items - list of Items
Throws:
OberonException
Since:
4.0

getItemPos

public int getItemPos(java.lang.String itemName)
Get the Item position index in the Form

Returns:
the position index or -1 if not found

getItems

public java.util.Vector<Item> getItems()
Get all Form Items

Returns:
a Vector of Items

getItemAt

public Item getItemAt(int index)
Get a Form Item at given position index


getItem

public Item getItem(java.lang.String itemName)
Get a Form Item with the given name


getItem

public Item getItem(int itemId)
Get a Form Item with the given internal id


getItemNames

public java.util.Vector<java.lang.String> getItemNames()
Get all Form Item names

Returns:
a Vector Item names

getItemField

public Item getItemField(java.lang.String fieldName)
Get a Form Item field with the given name


getItemFields

public java.util.Vector<java.lang.String> getItemFields()
Get all fields included in the Form

Returns:
a Vector Item field names

getItemIDs

public java.util.Vector<java.lang.String> getItemIDs()
Get all Form Item internal ids

Returns:
a Vector of ids

getItemsAsString

public java.lang.String getItemsAsString(java.lang.String delim)
Get all Form Item names as a single string

Parameters:
delim - the item name separator

getAccessItems

public java.util.Vector<Item> getAccessItems(int accessType,
                                             java.util.Vector<java.lang.Object> filterArgs,
                                             Framework framework)
Get all Form Item for which the framework User has access

Parameters:
accessType - the access type ( Item.ITEMACCESS_VISIBLE / Item.ITEMACCESS_EDITABLE )
filterArgs - input arguments used by the Item access Program

getAccessItemNames

public java.util.Vector<java.lang.String> getAccessItemNames(int accessType,
                                                             java.util.Vector<java.lang.Object> filterArgs,
                                                             Framework framework)
Get all Form Item names for which the framework User has access

Parameters:
accessType - the access type ( Item.ITEMACCESS_VISIBLE / Item.ITEMACCESS_EDITABLE )
filterArgs - input arguments used by the Item access Program

getAccessItemsAsString

public java.lang.String getAccessItemsAsString(int accessType,
                                               java.util.Vector<java.lang.Object> filterArgs,
                                               Framework framework,
                                               java.lang.String delim)
Get all Form Item names for which the framework User has access as a single string

Parameters:
accessType - the access type ( Item.ITEMACCESS_VISIBLE / Item.ITEMACCESS_EDITABLE )
filterArgs - input arguments used by the Item access Program
delim - the Item name separator

getUserFieldItems

public java.util.Vector<FormUserItem> getUserFieldItems(ObjectBase objlink,
                                                        java.util.Vector<java.lang.Object> filterArgs,
                                                        Framework framework)
                                                 throws OberonException
Get all FormUserItem of Field type for which the framework User has the visibility

Parameters:
objlink - instance of ObjectObj or Link (can be null)
filterArgs - input arguments used by the Item access Program
framework - the current framework
Throws:
OberonException
Since:
4.0

getUserItems

public java.util.Vector<FormUserItem> getUserItems(ObjectBase objlink,
                                                   java.util.Vector<java.lang.Object> filterArgs,
                                                   Framework framework)
                                            throws OberonException
Get all FormUserItem for which the framework User has the visibility

Parameters:
objlink - instance of ObjectObj or Link (can be null)
filterArgs - input arguments used by the Item access Program
framework - the current framework
Throws:
OberonException
Since:
4.0

getUserItemsWithData

public java.util.Vector<FormUserItem> getUserItemsWithData(ObjectBase objlink,
                                                           java.util.Vector<java.lang.Object> filterArgs,
                                                           Framework framework)
                                                    throws OberonException
Get data related to Form-Item fields

Parameters:
objlink - instance of ObjectObj or Link
filterArgs - input arguments used by the Item access Program in addition to the form parameters
framework - the User framework
Returns:
a Vector of FormUserItem
Throws:
OberonException - usually due to DB SQL exceptions

setCheckProgram

public void setCheckProgram(java.lang.String programName)
Set a method to validate the Form values

Parameters:
programName - the Program name

getCheckProgram

public java.lang.String getCheckProgram()
Get the Form validation Program

Returns:
the Program name

setActionProgram

public void setActionProgram(java.lang.String programName)
Set a method to run after the Form is committed

Parameters:
programName - the Program name

getActionProgram

public java.lang.String getActionProgram()
Get the Form action Program

Returns:
the Program name

setRangeProgram

public void setRangeProgram(java.lang.String programName)
Set a method to generate range values for field/basic items

Parameters:
programName - the Program name

getRangeProgram

public java.lang.String getRangeProgram()
Get the range Program

Returns:
the Program name

computeProgramRanges

public java.util.Vector<java.lang.String> computeProgramRanges(java.lang.String fieldName,
                                                               java.util.Vector<java.lang.Object> filterArgs,
                                                               Framework framework)
Execute the range Program to compute the ranges for a specific field

Parameters:
fieldName - the field name
filterArgs - extra arguments
framework - the current framework
Returns:
Vector of string values

setFilterParameters

public void setFilterParameters(java.lang.String parameters)
Set a list of parameters used by Item extraction Programs

Parameters:
parameters - OOQL parameters space separated

getFilterParameters

public java.lang.String getFilterParameters()
Get the list of parameters used by Item extraction Programs


setFormat

public void setFormat(java.lang.String format)
               throws OberonException
Set the Form format. Available tags:
<F[format]> : html table format
<tS[section]> : form translation default section

Throws:
OberonException

getFormat

public java.lang.String getFormat()
Get the Form format


createTextForm

public java.lang.String createTextForm(ObjectBase objlink,
                                       java.lang.String language,
                                       Framework framework)
Generates a text (generally for mail body) according to the Form definition and the object/link values

Parameters:
objlink - the ObjectObj or Link object
language - the language for the text
framework - the user Framework

getTranslatedValue

public static java.lang.String getTranslatedValue(FormUserItem item,
                                                  java.lang.String section,
                                                  java.lang.String value,
                                                  Framework framework)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

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 Form object by its OOQL identifier

Specified by:
getProperty in class OBBase
Parameters:
propertyName - OOQL property identifier/name (example: item , program ...)
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: item , item.visible .. )
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 Form object basic properties as a single String

Overrides:
toString in class AdminBase

toString

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

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

rangesToXML

public org.jdom.Element rangesToXML(java.lang.String fieldName,
                                    java.util.Vector<java.lang.Object> filterArgs,
                                    Framework framework)
Return Item-field Ranges as XML element tree

Parameters:
fieldName - the Field name
filterArgs - extra arguments used to compute the field ranges
framework - the current framework

toXML

public org.jdom.Element toXML(Framework framework)
Return the Form 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 Form 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 Form object properties from XML element tree

Overrides:
fromXML in class AdminBase

fromXML

public void fromXML(org.jdom.Element rootElement,
                    boolean loadItems)
Load the Form object properties from XML element tree

Parameters:
loadItems - if true load the Form items

getCreateCommand

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

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

getCreateCommand

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


getSaveCommand

public java.lang.String getSaveCommand(boolean force)
Return the OOQL command to update this Form 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(Form refForm,
                                      boolean checkImage,
                                      boolean overwrite,
                                      boolean force,
                                      Framework framework)
                               throws OberonException
Return/apply the OOQL command to update this Form object and let it become equals to another reference object.
This method is useful to import objects from an XML file.

Parameters:
refForm - the reference Form 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)

OBEROn SDK

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