|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines an object that will implement the data management logic for a data field. The data management component is responsible for:
IDataElement
interface.
Unlike the behavior displayed in NPM 1.x, the Process Manager engine does
not handle the loading and storage needs of the field. When the process
instance is ready to store itself to the cluster's database, the engine
will sequentially iterate through each of the custom fields defined in the
application and call their store method. Similarly, when the process
instance has been requested to load itself, each custom field will be
called to load their data values from whatever external resource they are
bound to.
Currently, global transactions are not supported in PM 6.0. It is possible for your custom fields to be accessing resources that are XA compliant, however the Process Manager engine cannot be involved in the transaction.
IDataDictionary
,
IPresentationElement
,
IProcessInstance
Field Summary | |
static java.lang.String |
NOT_YET_LOADED
Custom field marker for empty data element. |
static int |
TYPE_BOOLEAN
Storage type value for a data element that contains a boolean value. |
static int |
TYPE_DATE
Storage type value for a data element that contains a date value. |
static int |
TYPE_DATETIME
Storage type value for a data element that contains a date value. |
static int |
TYPE_ENTITY
Storage type value for a custom field. |
static int |
TYPE_FLOAT
Storage type value for a data element that contains a floating-point value. |
static int |
TYPE_INT
Storage type value for a data element that contains an integer value. |
static int |
TYPE_LONGTEXT
Storage type value for a data element that contains textual data. |
static int |
TYPE_TEXT
Storage type value for a data element that contains textual data. |
static int |
TYPE_UNDEFINED
Data element storage type value for an undefined type. |
Method Summary | |
void |
archive(IProcessInstance pi,
java.io.OutputStream os)
Writes out the data associated with the custom field to an output stream. |
boolean |
canSearch()
Returns true if this field is searchable from the Express search page. |
void |
create(IProcessInstance pi)
Initializes a newly created process instance with a default value for the custom field. |
java.lang.Object |
getDefaultValue()
Returns the default value of the data element (set by the process designer at design time) |
IPresentationElement |
getPresentationElement()
Get access to the presentation side of the field. |
int |
getSize()
Returns the size of the storage type of the data element. |
int |
getType()
Returns the storage type of the data element. |
void |
load(IProcessInstance pi)
Loads the data associated with the custom field from a persistent resource. |
void |
store(IProcessInstance pi)
Stores the data associated with the custom field to a persistent resource. |
Methods inherited from interface com.netscape.pm.model.IPMElement |
dumpState, getDescription, getName, getParent, getPrettyName, getProperty, isLocked, lockObject, postCreation, setParent, setProperties, toString |
Field Detail |
public static final int TYPE_UNDEFINED
getType()
public static final int TYPE_TEXT
getType()
public static final int TYPE_LONGTEXT
getType()
public static final int TYPE_DATE
getType()
public static final int TYPE_DATETIME
getType()
public static final int TYPE_BOOLEAN
getType()
public static final int TYPE_FLOAT
getType()
public static final int TYPE_INT
getType()
public static final int TYPE_ENTITY
store
method should be called.getType()
public static final java.lang.String NOT_YET_LOADED
getData
method is called from the
IProcessInstance
interface, the custom field's
load
method will be invoked if the current data value for
the field is NOT_YET_LOADED
. Users will never see this
value being returned via getData
.IProcessInstance.getData(java.lang.String)
Method Detail |
public int getType()
TYPE_UNDEFINED
,
TYPE_TEXT
,
TYPE_LONGTEXT
,
TYPE_DATE
,
TYPE_DATETIME
,
TYPE_BOOLEAN
,
TYPE_FLOAT
,
TYPE_INT
,
TYPE_ENTITY
public int getSize()
TYPE_TEXT
with size 100,
the resulting database column would have type
VARCHAR( 100 )
on a Sybase system.
Designers of custom fields are responsible for creating the necessary storage themselves, hence this method is may return any arbitrary value for fields of that type.
getType()
public java.lang.Object getDefaultValue()
public void create(IProcessInstance pi) throws java.lang.Exception
setData
method. This is not required for all custom fields and will depend
upon the designer's discretion. In fact, if you really do not need to
set a default value, it is best to skip implementing create and leave
it blank; the store
method for custom fields is called
only when a setData
call has been performed on the field.
The create method for all fields, built-in or custom, will be called when the user initiates a process instance from the entry point.
In the event that your create call fails, you can throw a
java.lang.Exception
at any time to signal an error. An
error message will be displayed to the user and the process instance
will not be created.
pi
- the current process instancejava.lang.Exception
- if there is a problem initializing
the field's default value.IProcessInstance
public void store(IProcessInstance pi) throws java.lang.Exception
Currently, the Process Manager engine does not support global transactions. If the external datasource your custom field serializes to is XA compliant and managed by a resource manager, your custom field could participate in a global transaction, however the transactions initiated by the Process Manager engine are not made through an XA resource manager and cannot be a part of the larger transaction.
In the event that your store call fails, you can throw a
java.lang.Exception
at any time to signal an error.
The current workitem is converted to an exception workitem and all the
data field values are reset to their values prior to the request.
The store method is only called if the field's value has been modified. This is covered in further detail below in a brief discussion of lazy loading.
load
method is only invoked if and only
if there is a request to fetch the field's data value via the
getData
method from the process instance. When the
process instance is loaded, all of the built-in data elements have
their data values loaded into the process instance since their values
come from the application specific table in the cluster database. The
custom fields store their data in systems external to the engine;
loading the data associated with a custom field could be quite
expensive, and is not even necessary if the value is not used during
the life of the request.
The storage of the custom field's data is also done lazily. The
store
method is only called if the data value has been
changed via the setData
method on the process instance.
Since the load
method on the custom field usually
performs a call to setData
, we have a side effect where
store will be called if load has been called. The custom field's
primary key, however is always available once the process instance
has been loaded.
pi
- the current process instancejava.lang.Exception
- if there is a problem storing the
field's data value to the back-end
storage.IProcessInstance.getData(java.lang.String)
,
IProcessInstance.setData(java.lang.String, java.lang.Object)
public void load(IProcessInstance pi) throws java.lang.Exception
ShoppingCartField
ItemSet
Item
ItemSet
is a container for
a series of Item
objects.
ItemSet
and
Item
objects.
The load
method is invoked whenever the data value
associated with the custom field is accessed via the
getData
method off the process instance. The built-in
fields are loaded whenever the process instance is loaded, but
custom fields are only loaded when their data value is explicitly
asked for. Since load
is invoked
whenever a getData
is performed, it is very very very
important that you do not do a getData
on the custom
field inside of your load method. This will result in an infinite
loopand obliterate any chances of you and your system administrator
becoming friends.
In the event that your load call fails, you can throw a
java.lang.Exception
at any time to signal an error. If
the current action is to display a form, an error message will be
displayed to the user. If the user has completed a workitem, an
exception workitem will be created.
pi
- the current process instancejava.lang.Exception
- if there is a problem retrieving the
field's data value to the back-end
storage.store(com.netscape.pm.model.IProcessInstance)
,
IProcessInstance.getData(java.lang.String)
public void archive(IProcessInstance pi, java.io.OutputStream os) throws java.lang.Exception
In the event that your archive call fails, you can throw a
java.lang.Exception
at any time to signal an error.
An error message will be displayed to the administrator.
pi
- the current process instanceos
- the output stream to archive the data element tojava.lang.Exception
- if there is a problem archiving the
field's data value to the output
stream.#IProcessInstance#archive
public boolean canSearch()
As of PM 6.0, a search framework for custom fields has not yet been
written. Custom fields may return either true
or
false
from this method.
true
if this field is searchable from the Express;
false
otherwise.public IPresentationElement getPresentationElement()
IPresentationElement
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |