public class CSSinglePageForm extends CSSkeletonBasedItem
ACCESS_GRANTED, DOES_NOT_EXIST, EMPTY, EXISTS, SECURE_ACCESS_DENIED, SECURE_ACCESS_GRANTED, UPDATE_ACTION_INSERTED, UPDATE_ACTION_UPDATED
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSSinglePageForm()
Creates an empty
CSSinglePageForm object. |
CSSinglePageForm(java.lang.String strPropertyFile)
Creates a new
CSSinglePageForm , specifying a property file that contains all of the database connection
details. |
Modifier and Type | Method and Description |
---|---|
void |
addUserContextVar(java.lang.String name,
java.lang.String value)
Adds a user context variable.
|
java.lang.String[] |
availableUserContextVar()
Returns an array of strings containing the available variables.
|
java.lang.String |
buildHTML()
Builds the HTML to display a complete form including Javascript validation, as defined
within iCM.
|
java.lang.String |
buildHTMLWithErrorInfo()
Builds the HTML to display a complete form including Javascript validation, as defined
within iCM.
|
java.lang.Object |
clone()
Creates a duplicate of this
CSSinglePageForm object. |
void |
delete()
Not currently implemented for
CSSinglePageForm . |
boolean |
equals(java.lang.Object obj)
Checks whether this item is equal to another item.
|
boolean |
exist()
Not currently implemented for
CSSinglePageForm . |
void |
get()
Retrieves the details of an iCM form from the database.
|
java.util.Hashtable |
getCapturedData()
Gets the
Hashtable object which holds the name-value pairs of captured data. |
CSObject |
getDataObject()
Gets the
CSObject instance which holds the data associated with this form. |
java.util.Date |
getDateLastPublished()
Gets the Date upon which this object was last updated.
|
java.lang.String |
getFormDesc()
Gets the description of the form
|
int |
getFormID()
Gets the unique ID of the form specified as key information.
|
java.lang.String |
getFormName()
Gets the name of the form specified as key information.
|
boolean |
getPrivateForm()
Gets whether or not this form is private.
|
boolean |
getReadOnly()
Gets whether this form is to be displayed as read-only.
|
boolean |
getRenderAsXHTML()
Gets whether controls on this form are to be displayed as XHTML.
|
boolean |
getShowControls()
Gets whether the items on this form are to be displayed using the appropriate input controls whilst in read-only
mode - see
setReadOnly . |
java.lang.String |
getTypeName()
Gets the name of the Object Type used by this form
|
int |
hashCode() |
boolean |
isExternalType()
Indicates that the form uses an external Object Type definition
rather than one that matches the form name
|
void |
loadCapturedValues()
Loads captured data values from the specified
Hashtable or HttpServletRequest
object into this form. |
void |
loadData()
Loads the data from the
CSObject (s) associated with this form. |
void |
overrideFormProperty(java.lang.String name,
java.lang.String value)
Overrides a form property with a new value.
|
java.lang.String |
readFormProperty(java.lang.String name) |
java.util.Map<java.lang.String,java.lang.String> |
readFormPropertyMultiple(java.util.List<java.lang.String> propertyNames) |
java.lang.Object |
readTypedUserContextVar(java.lang.String name)
Returns the current value of a named context variable, preserving original type.
|
java.lang.String |
readUserContextVar(java.lang.String name)
Returns the current value of a named context variable as a string.
|
void |
removeUserContextVar(java.lang.String name)
Removes a user context variable.
|
void |
resetFormProperty(java.lang.String name)
Resets a form property to the value defined in the form definition.
|
void |
setCapturedData(java.util.Hashtable objCapturedDataHt)
Sets the
Hashtable object containing the captured data for the form. |
void |
setCapturedData(HttpServletRequest objJSPRequest)
Sets the
HttpServletRequest object containing the captured data for the form (JSP only). |
void |
setDataObject(CSObject objDataObject)
Specifies the
CSObject instance which contains the existing data to be updated using this form, or which
will be used to store new data captured via this form. |
void |
setDateLastPublished(java.util.Date dDateLastPublished)
Sets the Date upon which the object was last updated.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setFormDesc(java.lang.String strFormDesc)
Sets the description of the form
|
void |
setFormID(int nFormID)
Sets the unique ID of the form to be used as key information.
|
void |
setFormName(java.lang.String strFormName)
Sets the name of the form to be used as key information.
|
void |
setPrivateForm(boolean bPrivate)
Sets whether or not this form is private.
|
void |
setReadOnly(boolean bReadOnly)
Sets whether this form is to be displayed as read-only.
|
void |
setRenderAsXHTML(boolean RenderAsXHTML)
Sets whether controls on this form are to be displayed as XHTML or HTML.
|
void |
setShowControls(boolean bShowControls)
Sets whether the items on this form are to be displayed using the appropriate input controls whilst in read-only
mode - this option will be ignored unless the form is being displayed in read-only mode via the
setReadOnly method. |
void |
setTypeName(java.lang.String strTypeName)
Sets the name of the Object Type used by this form
setTypeName followed by a call to get will return details of the form. |
void |
storeData()
Transfers the captured data values from this form into the
CSObject (s)
Use the loadCapturedValues method to insert captured values into the form, and use
the setDataObject method to specify the CSObject(s) which is to receive the
captured values, before calling this method. |
java.lang.String |
toString()
Provides debug information on the contents of the
CSForm object
|
void |
update()
Not currently implemented for
CSSinglePageForm . |
boolean |
validate()
Validates the data which has been captured using the form.
|
doOptionDataRead, getSkelErrorCount, getSkeletonProcessorURL, resetSkelErrorCount, setExceptionOnSkelError, setSkeletonProcessorURL, skeletonError
getID, getStatus, jsonString, serialiseWithTypes, setID, setStatus, unset
clearRecordedGatewayMessages, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSSinglePageForm()
CSSinglePageForm
object.
Use the various set methods provided to initialise the CSSinglePageForm
object prior to invoking any of its
query or form manipulation methods. The datasource information should be specified using these set
methods.
public CSSinglePageForm(java.lang.String strPropertyFile)
CSSinglePageForm
, specifying a property file that contains all of the database connection
details.
Use the various set methods provided to initialise the CSSinglePageForm
object prior to invoking any of its
query manipulation methods.
strPropertyFile
- the property file that contains the connection details.public void setReadOnly(boolean bReadOnly)
If set to true
, the buildHTML
method will display the form as read-only or
disabled.
bReadOnly
- true
if this is a read-only form, otherwise false
.public boolean getReadOnly()
true
if this form is read-only; otherwise returns false
.public void setShowControls(boolean bShowControls)
setReadOnly
method.
If set to true
, the buildHTML
method will display the form with all the
relevant input controls disabled or set to read-only. If set to false
, the form labels and
current values will be displayed as simple text.
bShowControls
- true
if the form's controls are to be displayed, otherwise false
.public boolean getShowControls()
setReadOnly
.
true
if the form's controls are to be displayed, otherwise returns
false
.public void setRenderAsXHTML(boolean RenderAsXHTML)
If set to true
, the buildHTML
method will display the form as XHTML. A
false
setting will render the form as HTML.
RenderAsXHTML
- true
if this should be rendered as XHTML, otherwise false
.public boolean getRenderAsXHTML()
true
if this form is to be rendered as XHTML; otherwise returns false
(HTML).public void setFormID(int nFormID)
setFormID
followed by a call to get
will return details of the form.
nFormID
- the unique form IDpublic int getFormID()
public void setFormName(java.lang.String strFormName)
setFormName
followed by a call to get
will return details of the form.
strFormName
- the name of the form.public java.lang.String getFormName()
public void setTypeName(java.lang.String strTypeName)
setTypeName
followed by a call to get
will return details of the form.
strTypeName
- the type name used by the form.public java.lang.String getTypeName()
public boolean isExternalType()
public void setFormDesc(java.lang.String strFormDesc)
strFormDesc
- the description of the form.public java.lang.String getFormDesc()
public void setPrivateForm(boolean bPrivate)
Used in conjunction with setFormName
to identify the type of form to be returned by
a call to get
.
bPrivate
- true
if this form is Private, or false
if it is Public.public boolean getPrivateForm()
Used in conjunction with setFormName
to identify the type of form to be returned by
a call to get
.
true
if this form is Private, or false
if it is Public.public void setDateLastPublished(java.util.Date dDateLastPublished)
This is normally set automatically by the update
method when updating an existing object and
will be set to the current server's time.
dDateLastPublished
- The date upon which this object was last updatedpublic java.util.Date getDateLastPublished()
public void setDataObject(CSObject objDataObject) throws CSException
CSObject
instance which contains the existing data to be updated using this form, or which
will be used to store new data captured via this form. The setting is of this data object is cascaded to all the
constituent form sections and form items.
This will verify that the type of supplied object matches type name supported by the form.
A CSObject
should only be associated with this CSForm
object if all the form
sections use data from the same CSObject
. If the form sections use data from different
CSObject
s, then the different CSObject
s should be associated with the form
sections using the setDataObject
method on the individual CSFormSection
objects.
If the form is being used to update data held on an existing CSObject
, then after the
CSObject
has been specified using this method, the loadData
method should be
called to actually load the data from the CSObject
into this CSForm
object.
objDataObject
- the CSObject
object holding the data to be updated or newly captured using this form.CSNotFoundException
- if the supplied data object could not be retrievedCSException
- the base class for exceptions thrown by this method.public CSObject getDataObject()
CSObject
instance which holds the data associated with this form.
CSObject
instance holding the data to be updated or newly captured using this form.public void setCapturedData(java.util.Hashtable objCapturedDataHt)
Hashtable
object containing the captured data for the form. The setting is cascaded to
all the constituent form sections and form items. (Note for JSP : use the
setCapturedData(HttpServletRequest)
method instead.)
This Hashtable
should contain the name-value pairs of the data submitted via the HTML form. It
does not matter if the Hashtable
contains data which is irrelevant to this CSForm
object. Any irrelevant data will simply be ignored.
After the Hashtable
object has been specified using this method, the
loadCapturedValues
method should be called to actually load the captured values
from the Hashtable
into this CSForm
object.
objCapturedDataHt
- the Hashtable
object containing the name-value pairs of the captured data.public void setCapturedData(HttpServletRequest objJSPRequest)
HttpServletRequest
object containing the captured data for the form (JSP only). The
setting is cascaded to all the constituent form sections and form items.
This HttpServletRequest
should contain the data submitted via the HTML form. It does not matter if
the HttpServletRequest
contains data which is irrelevant to this CSForm
object. Any
irrelevant data will simply be ignored.
After the HttpServletRequest
object has been specified using this method, the
loadCapturedValues
method should be called to actually load the captured values
from the Hashtable
into this CSForm
object.
objJSPRequest
- the HttpServletRequest
object containing the captured data.public java.util.Hashtable getCapturedData()
Hashtable
object which holds the name-value pairs of captured data.
Hashtable
object holding the name-value pairs of captured data, which was specified as
key information.public void overrideFormProperty(java.lang.String name, java.lang.String value) throws CSParameterException
name
- Namevalue
- ValueCSParameterException
- CSParameterExceptionpublic void resetFormProperty(java.lang.String name) throws CSParameterException
name
- NameCSParameterException
- CSParameterExceptionpublic void addUserContextVar(java.lang.String name, java.lang.String value) throws CSParameterException
name
- Namevalue
- ValueCSParameterException
- CSParameterExceptionpublic void removeUserContextVar(java.lang.String name) throws CSParameterException
name
- NameCSParameterException
- CSParameterExceptionpublic java.lang.String readUserContextVar(java.lang.String name) throws CSParameterException
name
- NameCSParameterException
- CSParameterExceptionpublic java.lang.Object readTypedUserContextVar(java.lang.String name) throws CSParameterException
name
- NameCSParameterException
- CSParameterExceptionpublic java.lang.String[] availableUserContextVar()
public void setDetailLevel(int nDetailLevel) throws CSParameterException
get
method. Default is LEVEL_ALL.
Valid detail levels for a form are :
LEVEL_ID
Retrieves Form ID and Name only.
LEVEL_SUMMARY
Retrieves Form ID, Form Name and an array of Section ID, Section Name
information.
LEVEL_ALL
Retrieves the above plus the full section and form item information.
setDetailLevel
in class CSDatabaseItem
nDetailLevel
- the detail level to be used.CSParameterException
- if an invalid detail level is specified.public void get() throws CSException
Use setFormID
followed by get
to populate this CSSinglePageForm
object with the details of the form with the specified ID.
Use setFormName
followed by get
to populate this CSSinglePageForm
object with the details of the form with the specified name.
get
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified item cannot be found on the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public boolean equals(java.lang.Object obj)
CSItem
CSItemContent
object will be compared and the objects deemed to be equal if this matches - key information specified via the
set
methods is ignored and so may be different. Note that the key data used for searching is not
tested for equality.
public boolean exist() throws CSException
CSSinglePageForm
.
exist
in class CSItem
true
if this form section exists on the database.CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
CSSinglePageForm
.
delete
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified attributes cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void update() throws CSException
CSSinglePageForm
.
update
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified attributes cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void loadData() throws CSException
CSObject
(s) associated with this form.
Use to initialise the starting (default) values for the form items, with existing data from the CSObject
(s)
which have been associated with this form with the setDataObject
method.
CSDatabaseException
- if there are problems accessing the database.CSParameterException
- if the supplied key information is invalid. For example, if the object holding the data is not a
CSObject of the expected type.CSNotFoundException
- if the form cannot be found on the database.CSSecurityException
- if there is a security violation.CSException
- the base class for exceptions thrown by this method.public void storeData() throws CSException
CSObject
(s)
Use the loadCapturedValues
method to insert captured values into the form, and use
the setDataObject
method to specify the CSObject(s) which is to receive the
captured values, before calling this method. This method can be called even if different form sections have
different data objects associated with them, as the data objects will have been cascaded to the appropriate form
items.
CSDatabaseException
- if there are problems accessing the database.CSParameterException
- if the supplied key information is invalid. For example, if the object holding the data is not a
CSObject of the expected type.CSNotFoundException
- if the form cannot be found on the database.CSSecurityException
- if there is a security violation.CSException
- the base class for exceptions thrown by this method.public void loadCapturedValues() throws CSException
Hashtable
or HttpServletRequest
object into this form.
Before calling this method, use the setCapturedData
method to specify the
Hashtable
containing the name-value pairs of the data submitted via the HTML form. It does not
matter if the Hashtable
contains data which is irrelevant to this CSForm
object.
Any irrelevant data will simply be ignored.
CSDatabaseException
- if there are problems accessing the database.CSParameterException
- if the supplied key information is invalid.CSNotFoundException
- if the form cannot be found on the database.CSSecurityException
- if there is a security violation.CSException
- the base class for exceptions thrown by this method.public java.lang.String buildHTML() throws CSException
String
containing the HTML that will display the form/form section.CSException
- if the DetailLevel is less than LEVEL_ALL
public java.lang.String buildHTMLWithErrorInfo() throws CSException
String
containing the HTML that will display the form/form section.CSException
- if the DetailLevel is less than LEVEL_ALL
public boolean validate() throws CSValidationException
Use the loadCapturedValues
method to load the captured values into the
form before calling this method.
Any form items which are found to be invalid will be indicated by this method - it will return false if there are errors.
CSValidationException
- if unable to perform any required javascript validationpublic java.lang.Object clone() throws java.lang.CloneNotSupportedException, java.lang.OutOfMemoryError
CSSinglePageForm
object.
clone
in class CSDatabaseItem
CSSinglePageForm
object.java.lang.CloneNotSupportedException
- if cloning is not supported/allowed.java.lang.OutOfMemoryError
- if there are any problems allocating memory.public java.lang.String toString()
CSForm
object
public java.lang.String readFormProperty(java.lang.String name) throws CSParameterException
CSParameterException
public java.util.Map<java.lang.String,java.lang.String> readFormPropertyMultiple(java.util.List<java.lang.String> propertyNames) throws CSParameterException
CSParameterException
Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.