Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.ui
Class FormManager

java.lang.Object
  extended by com.ibm.etools.iseries.ui.FormManager
All Implemented Interfaces:
ContainerManagement, PropertyChangeListener, Serializable, EventListener

public class FormManager
extends Object
implements ContainerManagement, PropertyChangeListener, Serializable

The FormManager bean is used to associate a form with a record format. The form can have one or more JComponents that have single data elements, such as javax.swing.JTextField, javax.swing.JLabel, javax.swing.JTextArea, and com.ibm.etools.iseries.ui.JFormattedTextField. To associate a JComponent with a field, the JComponent bean name and the field name must match. If the JComponent bean name cannot be set to the name of the field, use addFieldMapping(String,String) or addFieldMapping(String[],String[]) to explicitly map the field. When access to multiple record formats or database files is required, FormManager can join with another instance of FormManager, then only records whose foreign keys matches the key values of the joined record format can be accessed. Foreign keys can be any fields in the record format. All the record-level access is done via RecordIOManager.

Before a FormManager can associate a JComponent to a field, following is required:

If the JComponent that has field association is a JFormattedComponent, and its data attributes do not match the data type, data length or decimal places of the database field, FormManager will automatically change the attributes of the JFormattedComponent if property autoChangeDataAttributes is set to true. The following table outlines the attributes that can be changed for the different data types:

FIELD TYPE DATA TYPE LENGTH DECIMAL PLACES
binary (B) DATATYPE_NUMERIC no change 0
character (A) DATATYPE_CHARACTER field length 0
DBCS Either (E) DATATYPE_CHARACTER field length 0
DBCS Graphic (G) DATATYPE_CHARACTER field length 0
DBCS Only (J) DATATYPE_CHARACTER field length 0
DBCS Open (O) DATATYPE_CHARACTER field length 0
date (L) DATATYPE_CHARACTER field length 0
float (F) DATATYPE_CHARACTER 20 0
hexadecimal (H) DATATYPE_CHARACTER field length x 2, FormManager will display the hexadecimal representation of the field 0
packed decimal (P) DATATYPE_NUMERIC field length field decimal places
time (T) DATATYPE_CHARACTER field length (8 bytes) 0
timestamp (Z) DATATYPE_CHARACTER field length (26 bytes) 0
zoned decimal (S) DATATYPE_NUMERIC field length field decimal places

If FormManager is used inside VisualCompositionEditor, then a RecordIOManager serialized data class will be generated to preserve the RecordIOManager bean properties and the state of the object as serialized data in a generated class. The persistent data can be restored at any time when you want to change or set the bean properties of a new FormManager object.

See Also:
RecordIOManager, ListManager, JFormattedComponent, JFormattedTextField, JFormattedLabel, JFormattedComboBox, Serialized Form

Field Summary
static String Copyright
           
protected  PropertyChangeSupport propertyChange
           
 
Fields inherited from interface com.ibm.etools.iseries.ui.ContainerManagement
copyright
 
Constructor Summary
FormManager()
          FormManager constructor.
 
Method Summary
 boolean addFieldMapping(String[] componentBeanName, String[] dataFieldName)
          To map multiple JComponents with multiple fields in a record format specified in recordIOManager object.
 boolean addFieldMapping(String componentBeanName, String dataFieldName)
          To map a single JComponent with a single field in a record format specified in recordIOManager object.
 void addPropertyChangeListener(PropertyChangeListener listener)
          The addPropertyChangeListener method was generated to support the propertyChange field.
 boolean addRecord()
          Add the data in the displayContainer to the database file as a new record.
 void clearAllData()
          To clear data of all JComponents that have associations with fields inside the displayContainer.
 void closeFile()
          Close database files including joined files, then invoke clearAllData.
 void commit()
          Invoke RecordIOManager.commit.
static String Copyright()
          Copyright notice.
 boolean deleteRecord()
          Delete the record in the displayContainer from the database file.
 void displayData(DefaultTableModel resultSetModel, int row)
          Display a particular row of data in resultSetTableModel on the form.
 boolean endJournalPhysicalFile()
          Invoke RecordIOManager.endJournalPhysicalFile.
 void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          The firePropertyChange method was generated to support the propertyChange field.
 boolean getAscendingOrder()
          Invoke RecordIOManager.getAscendingOrder.
 boolean getAutoChangeDataAttributes()
          Gets the autoChangeDataAttributes property value.
 String getDatabaseFieldValue(String libraryName, String fileName, String fieldName)
          Return the database value of a field from the result set of last file operation.
 int getDebugLevel()
          Gets the debugLevel property value.
 Container getDisplayContainer()
          Gets the displayContainer property (java.awt.Container) value.
protected  PropertyChangeSupport getPropertyChange()
          Accessor for the propertyChange field.
 RecordIOManager getRecordIOManager()
          Gets the recordIOManager property value.
 DefaultTableModel getResultSetTableModel()
          Returns the resultSetTableModel DefaultTableModel of the last file operation.
 AS400 getSystem()
          Gets the AS400 system object of the server specified in property server.
 boolean getThreadUsed()
          Gets the threadUsed property value.
protected  void handleException(String messageHeader, Throwable e)
          Print a throwable exception to the console with a message header if debug is greater than 0.
protected  void handleException(Throwable e)
          Prints the Throwable e and its backtrace to the standard error stream if debug is greater than 0.
 void joinDataBase(String[] foreignKeyNames, FormManager formMgr)
          To join the database file specified in property recordIOManager, with another database file specified in another FormManager's RecordIOManager object.
 boolean openFile()
          Opens a database file based on the property recordIOManager.
 boolean positionCursor(int recordNumber)
          Invoke RecordIOManager.positionCursor(int).
 boolean positionCursor(String[] keyValues)
          Invoke RecordIOManager.positionCursor(String[]).
 boolean positionCursorAfterLast()
          Invoke RecordIOManager.positionCursorAfterLast.
 boolean positionCursorBeforeFirst()
          Invoke RecordIOManager.positionCursorBeforeFirst.
 boolean positionCursorToFirst()
          Invoke RecordIOManager.positionCursorToFirst.
 boolean positionCursorToLast()
          Invoke RecordIOManager.positionCursorToLast.
 boolean positionCursorToNext()
          Invoke RecordIOManager.positionCursorToNext.
 boolean positionCursorToPrevious()
          Invoke RecordIOManager.positionCursorToPrevious.
 void propertyChange(PropertyChangeEvent e)
          Examine the PropertyChangeEvent and decides what to do on a particular event.
 boolean readNextRecord()
          Invoke RecordIOManager.readNextRecord and the data returned will be displayed on the JComponents that have field associations.
 boolean readPreviousRecord()
          Invoke RecordIOManager.readPreviousRecord and the data returned will be displayed on the JComponents that have field associations.
 boolean readRecord()
          Whatever values in the JComponents that have field associations to the key of a record format (key components) will be used as search key values.
 boolean readRecord(int recordNumber)
          Invoke RecordIOManager.readRecord(int) and the data returned will be displayed on the JComponents that have field associations.
 boolean readRecord(String[] keyValues)
          Invoke RecordIOManager.readRecord(String[]) and the data returned will be displayed on the JComponents that have field associations.
 boolean readRecord(String[] keyValues, int searchType)
          Invoke RecordIOManager.readRecord(String[],int) and the data returned will be displayed on the JComponents that have field associations.
 boolean removeFieldMapping(String componentBeanName, String dataFieldName)
          To remove a field mapping that was added by addFieldMapping(String,String) or addFieldMapping(String[],String[]).
 void removePropertyChangeListener(PropertyChangeListener listener)
          The removePropertyChangeListener method was generated to support the propertyChange field.
protected  String[] retrieveCurrentKeyValuesFromForm()
          Get the current value of key components from the form.
 void rollback()
          Invoke RecordIOManager.rollback.
 void setAscendingOrder(boolean order)
          Set the order of record retrieval.
 void setAutoChangeDataAttributes(boolean autoChange)
          Sets the autoChangeDataAttributes property value.
 void setDebugLevel(int value)
          Sets the debug property value.
 void setDisplayContainer(Container container)
          Sets the displayContainer property (java.awt.Component) value.
 void setRecordIOManager(RecordIOManager reciomgr)
          Sets the recordIOManager property value.
protected  void setResultSetTableModel(DefaultTableModel resultSetModel)
           
 void setSystem(AS400 as400)
          Sets the system property value.
 void setThreadUsed(boolean useThreads)
          Sets whether the bean uses threads in communication with the host servers.
 boolean startJournalPhysicalFile()
          Invoke RecordIOManager.startJournalPhysicalFile.
 boolean updateRecord()
          Update the data in the displayContainer to the database file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

propertyChange

protected transient PropertyChangeSupport propertyChange
Constructor Detail

FormManager

public FormManager()
FormManager constructor.

Method Detail

addFieldMapping

public boolean addFieldMapping(String[] componentBeanName,
                               String[] dataFieldName)
To map multiple JComponents with multiple fields in a record format specified in recordIOManager object. The first element of componentBeanName maps to the first element of dataFieldName, and the second element of componentBeanName maps to the second element of dataFieldName, and so forth. If the number of elements in the two string arrays are different, then only the lesser number of elements will be mapped.

Parameters:
componentBeanName - String array that contains the bean names of JComponents.
dataFieldName - String array that contains the names of the fields in record format.
Returns:
True if field mapping is done successfully; false otherwise.
See Also:
addFieldMapping(String,String), removeFieldMapping(String,String)

addFieldMapping

public boolean addFieldMapping(String componentBeanName,
                               String dataFieldName)
To map a single JComponent with a single field in a record format specified in recordIOManager object.

Parameters:
componentBeanName - The bean name of a JComponents.
dataFieldName - The name of a field in record format.
Returns:
True if field mapping is done successfully; false otherwise.
See Also:
addFieldMapping(String[],String[]), removeFieldMapping(String,String)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
The addPropertyChangeListener method was generated to support the propertyChange field.


addRecord

public boolean addRecord()
                  throws AS400Exception,
                         AS400SecurityException,
                         InterruptedException,
                         IOException,
                         InvalidFieldDataException
Add the data in the displayContainer to the database file as a new record. If the database file is joined, then record will be added to each database file. Any missing fields will be defaulted to the following values according to their data type:
DATA TYPE DEFAULT VALUE
binary (B) 0
character (A) ""
DBCS Either (E) ""
DBCS Graphic (G) ""
DBCS Only (J) ""
DBCS Open (O) ""
date (L) "0001-01-01"
float (F) 0
hexadecimal (H) 0x40
packed decimal (P) 0
time (T) "00.00.00"
timestamp (Z) "0001-01-01-00.00.00.000000"
zoned decimal (S) 0

Returns:
True if record is added successfully; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
InvalidFieldDataException - Invalid data in one or more fields.
AS400Exception
AS400SecurityException
InterruptedException
IOException

clearAllData

public void clearAllData()
To clear data of all JComponents that have associations with fields inside the displayContainer.


closeFile

public void closeFile()
               throws AS400Exception,
                      AS400SecurityException,
                      InterruptedException,
                      IOException
Close database files including joined files, then invoke clearAllData.

Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
openFile()

commit

public void commit()
            throws AS400Exception,
                   AS400SecurityException,
                   InterruptedException,
                   IOException
Invoke RecordIOManager.commit.

Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
rollback(), RecordIOManager.commit()

Copyright

public static String Copyright()
Copyright notice.

Returns:
java.lang.String

deleteRecord

public boolean deleteRecord()
                     throws RecordNotFoundException,
                            AS400Exception,
                            AS400SecurityException,
                            InterruptedException,
                            IOException
Delete the record in the displayContainer from the database file. If the file is joined, records in joined databases will also be deleted.

Returns:
True if record(s) is deleted successfully; false otherwise.
Throws:
RecordNotFoundException - Records of the specified row are not found.
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException

displayData

public void displayData(DefaultTableModel resultSetModel,
                        int row)
Display a particular row of data in resultSetTableModel on the form.

Parameters:
resultSetModel - com.sun.java.swing.table.DefaultTableModel
row - int

endJournalPhysicalFile

public boolean endJournalPhysicalFile()
                               throws AS400Exception,
                                      AS400SecurityException,
                                      InterruptedException,
                                      IOException,
                                      ErrorCompletingRequestException,
                                      ExtendedIllegalStateException
Invoke RecordIOManager.endJournalPhysicalFile.

Returns:
True if the journal physical file is ended successfully; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
com.ibm.as400.access.ErrorCompletingRequestException - If an error occurs before the request is completed.
com.ibm.as400.access.ExtendedIllegalStateException - An object is not in the proper state to perform the requested operation.
AS400Exception
AS400SecurityException
InterruptedException
IOException
ErrorCompletingRequestException
ExtendedIllegalStateException
See Also:
startJournalPhysicalFile(), RecordIOManager.endJournalPhysicalFile()

firePropertyChange

public void firePropertyChange(String propertyName,
                               Object oldValue,
                               Object newValue)
The firePropertyChange method was generated to support the propertyChange field.


getAscendingOrder

public boolean getAscendingOrder()
Invoke RecordIOManager.getAscendingOrder.

Returns:
boolean
See Also:
setAscendingOrder(boolean), RecordIOManager.getAscendingOrder()

getAutoChangeDataAttributes

public boolean getAutoChangeDataAttributes()
Gets the autoChangeDataAttributes property value. The default value is true. When autoChangeDataAttributes is true, and if the component is a JFormattedTableColumn, JFormattedList or JFormattedComboBox, then if the data attributes in the fieldModel of the component do not match with the database field attributes, such as the data length, data type, and decimal places, then the FormManager will automatically change the attributes for you. However, this will slightly affect the performance. If the debugLevel is 2, you can see what columns are being changed.

Returns:
boolean
See Also:
setAutoChangeDataAttributes(boolean)

getDatabaseFieldValue

public String getDatabaseFieldValue(String libraryName,
                                    String fileName,
                                    String fieldName)
Return the database value of a field from the result set of last file operation. If any of the parameter values are null, the return value will be null.

Parameters:
libraryName - java.lang.String
fileName - java.lang.String
fieldName - java.lang.String
Returns:
java.lang.String

getDebugLevel

public int getDebugLevel()
Gets the debugLevel property value. If debugLevel is 0, no exceptions, nor any messages will be displayed in the console. If debugLevel is 1, only exceptions are displayed in the console. If debugLevel is >=2, all messages including exceptions, error and informational messages are dumped on the console for debugging purpose. The default value is 1.

Returns:
int debug level

getDisplayContainer

public Container getDisplayContainer()
Gets the displayContainer property (java.awt.Container) value. displayContainer can be any java.awt.Container, thus can be any JComponents, such as JPanel, JFrame, JDialog, JTextField, JLabel, etc.

Specified by:
getDisplayContainer in interface ContainerManagement
Returns:
The displayContainer property value.
See Also:
setDisplayContainer(java.awt.Container)

getPropertyChange

protected PropertyChangeSupport getPropertyChange()
Accessor for the propertyChange field.


getRecordIOManager

public RecordIOManager getRecordIOManager()
Gets the recordIOManager property value. recordIOManager is for defining fields to work with in a record format, and attributes of a database file, and conditions in selecting records.

Specified by:
getRecordIOManager in interface ContainerManagement
Returns:
com.ibm.etools.iseries.ui.RecordIOManager object.
See Also:
setRecordIOManager(com.ibm.etools.iseries.ui.RecordIOManager)

getResultSetTableModel

public DefaultTableModel getResultSetTableModel()
Returns the resultSetTableModel DefaultTableModel of the last file operation.

Returns:
javax.swing.table.DefaultTableModel

getSystem

public AS400 getSystem()
Gets the AS400 system object of the server specified in property server.

Returns:
The com.ibm.as400.access.AS400 system object.
See Also:
setSystem(AS400)

getThreadUsed

public boolean getThreadUsed()
Gets the threadUsed property value. The default value is true. If your application needs to be compliant with the Enterprise Java Beans specification, you might want to set threadUsed to false.

Returns:
boolean
See Also:
setThreadUsed(boolean)

handleException

protected void handleException(String messageHeader,
                               Throwable e)
Print a throwable exception to the console with a message header if debug is greater than 0.

Parameters:
messageHeader - java.lang.String
e - java.lang.Throwable

handleException

protected void handleException(Throwable e)
Prints the Throwable e and its backtrace to the standard error stream if debug is greater than 0.

Parameters:
e - java.lang.Throwable

joinDataBase

public void joinDataBase(String[] foreignKeyNames,
                         FormManager formMgr)
To join the database file specified in property recordIOManager, with another database file specified in another FormManager's RecordIOManager object. Joined database files have to be in keyed file access.

Parameters:
foreignKeyNames - A string array that contains the name of the foreign keys, the field names that join the two database files together with equal values.
formMgr - FormManager object to be joined. It is actually joining the database file defined in the property recordIOManager of formMgr.
See Also:
RecordIOManager.joinDataBase(java.lang.String[], com.ibm.etools.iseries.ui.RecordIOManager)

openFile

public boolean openFile()
                 throws DisplayContainerNotFoundException,
                        AS400Exception,
                        AS400SecurityException,
                        InterruptedException,
                        IOException,
                        IllegalPathNameException
Opens a database file based on the property recordIOManager. If the database file is joined, the joined database files are also opened.

Returns:
True if file is opened successfully; false otherwise.
Throws:
DisplayContainerNotFoundException - Display container is not defined or not found.
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
com.ibm.as400.access.IllegalPathNameException - Indicates that the integrated file system path name is not valid.
AS400Exception
AS400SecurityException
InterruptedException
IOException
IllegalPathNameException
See Also:
closeFile(), RecordIOManager.openFile()

positionCursor

public boolean positionCursor(String[] keyValues)
                       throws AS400Exception,
                              AS400SecurityException,
                              InterruptedException,
                              IOException
Invoke RecordIOManager.positionCursor(String[]). If the database file is not opened, it will be opened automatically prior to positioning the cursor. This file operation does not affect resultSetTableModel.

Parameters:
keyValues - The String array that contains the string values which make up the key with which to find the record.
Returns:
True if cursor can be position to record with the specified keys; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.positionCursor(String[])

positionCursor

public boolean positionCursor(int recordNumber)
                       throws AS400Exception,
                              AS400SecurityException,
                              InterruptedException,
                              IOException
Invoke RecordIOManager.positionCursor(int). If the database file is not opened, it will be opened automatically prior to positioning the cursor. This file operation does not affect resultSetTableModel.

Parameters:
recordNumber - The record number of the record to which cursor is positioned.
Returns:
True if cursor can be position to the specified recordNumber; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.positionCursor(int)

positionCursorAfterLast

public boolean positionCursorAfterLast()
                                throws AS400Exception,
                                       AS400SecurityException,
                                       InterruptedException,
                                       IOException
Invoke RecordIOManager.positionCursorAfterLast. If the database file is not opened, it will be opened automatically prior to positioning the cursor. This file operation does not affect resultSetTableModel.

Returns:
True if the file cursor can be positioned to after the last record; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.positionCursorAfterLast()

positionCursorBeforeFirst

public boolean positionCursorBeforeFirst()
                                  throws AS400Exception,
                                         AS400SecurityException,
                                         InterruptedException,
                                         IOException
Invoke RecordIOManager.positionCursorBeforeFirst. If the database file is not opened, it will be opened automatically prior to positioning the cursor. This file operation does not affect resultSetTableModel.

Returns:
True if the file cursor can be positioned to before the first record; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.positionCursorBeforeFirst()

positionCursorToFirst

public boolean positionCursorToFirst()
                              throws AS400Exception,
                                     AS400SecurityException,
                                     InterruptedException,
                                     IOException
Invoke RecordIOManager.positionCursorToFirst. If the database file is not opened, it will be opened automatically prior to positioning the cursor. This file operation does not affect resultSetTableModel.

Returns:
True if the file cursor can be positioned to the first record; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.positionCursorToFirst()

positionCursorToLast

public boolean positionCursorToLast()
                             throws AS400Exception,
                                    AS400SecurityException,
                                    InterruptedException,
                                    IOException
Invoke RecordIOManager.positionCursorToLast. If the database file is not opened, it will be opened automatically prior to positioning the cursor. This file operation does not affect resultSetTableModel.

Returns:
True if the file cursor can be positioned to the last record; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.positionCursorToLast()

positionCursorToNext

public boolean positionCursorToNext()
                             throws AS400Exception,
                                    AS400SecurityException,
                                    InterruptedException,
                                    IOException
Invoke RecordIOManager.positionCursorToNext. If the database file is not opened, it will be opened automatically prior to positioning the cursor. This file operation does not affect resultSetTableModel.

Returns:
True if the file cursor can be positioned to the next record; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.positionCursorToNext()

positionCursorToPrevious

public boolean positionCursorToPrevious()
                                 throws AS400Exception,
                                        AS400SecurityException,
                                        InterruptedException,
                                        IOException
Invoke RecordIOManager.positionCursorToPrevious. If the database file is not opened, it will be opened automatically prior to positioning the cursor. This file operation does not affect resultSetTableModel.

Returns:
True if the file cursor can be positioned to the previous record; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.positionCursorToPrevious()

propertyChange

public void propertyChange(PropertyChangeEvent e)
Examine the PropertyChangeEvent and decides what to do on a particular event.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - PropertyChangeEvent

readNextRecord

public boolean readNextRecord()
                       throws AS400Exception,
                              AS400SecurityException,
                              InterruptedException,
                              IOException
Invoke RecordIOManager.readNextRecord and the data returned will be displayed on the JComponents that have field associations.

Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.readNextRecord()

readPreviousRecord

public boolean readPreviousRecord()
                           throws AS400Exception,
                                  AS400SecurityException,
                                  InterruptedException,
                                  IOException
Invoke RecordIOManager.readPreviousRecord and the data returned will be displayed on the JComponents that have field associations.

Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.readPreviousRecord()

readRecord

public boolean readRecord()
                   throws AS400Exception,
                          AS400SecurityException,
                          InterruptedException,
                          IOException
Whatever values in the JComponents that have field associations to the key of a record format (key components) will be used as search key values. User can type in a values in the key components and by invoking this method will display the record with that key value. Invoking this method has the same result as invoking readRecord(String[] keyValues), where keyValues is the values set in the key components. If no values are set in the key components, current record in the file is displayed.

Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
readRecord(String[])

readRecord

public boolean readRecord(String[] keyValues)
                   throws AS400Exception,
                          AS400SecurityException,
                          InterruptedException,
                          IOException
Invoke RecordIOManager.readRecord(String[]) and the data returned will be displayed on the JComponents that have field associations.

Parameters:
keyValues - The String array that contains the string values which make up the key with which to find the record. The key may be a partial key.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.readRecord(String[])

readRecord

public boolean readRecord(String[] keyValues,
                          int searchType)
                   throws AS400Exception,
                          AS400SecurityException,
                          InterruptedException,
                          IOException
Invoke RecordIOManager.readRecord(String[],int) and the data returned will be displayed on the JComponents that have field associations.

Parameters:
keyValues - The String array that contains the string values which make up the key with which to find the record. The key may be a partial key.
searchType - Valid values are:
  • RecordIOManager.SEARCHTYPE_KEY_EQ
  • RecordIOManager.SEARCHTYPE_KEY_GE
  • RecordIOManager.SEARCHTYPE_KEY_GT
  • RecordIOManager.SEARCHTYPE_KEY_LE
  • RecordIOManager.SEARCHTYPE_KEY_LT
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.readRecord(String[],int)

readRecord

public boolean readRecord(int recordNumber)
                   throws AS400Exception,
                          AS400SecurityException,
                          InterruptedException,
                          IOException
Invoke RecordIOManager.readRecord(int) and the data returned will be displayed on the JComponents that have field associations.

Parameters:
recordNumber - Record with this record number will be read.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
RecordIOManager.readRecord(int)

removeFieldMapping

public boolean removeFieldMapping(String componentBeanName,
                                  String dataFieldName)
To remove a field mapping that was added by addFieldMapping(String,String) or addFieldMapping(String[],String[]).

Parameters:
componentBeanName - The bean name of a JComponents.
dataFieldName - The name of a field in record format.
Returns:
True if field mapping is removed successfully; false otherwise.
See Also:
addFieldMapping(String[],String[]), addFieldMapping(String,String), removeFieldMapping(String,String)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
The removePropertyChangeListener method was generated to support the propertyChange field.


retrieveCurrentKeyValuesFromForm

protected String[] retrieveCurrentKeyValuesFromForm()
Get the current value of key components from the form.

Returns:
java.lang.String[]

rollback

public void rollback()
              throws AS400Exception,
                     AS400SecurityException,
                     InterruptedException,
                     IOException
Invoke RecordIOManager.rollback.

Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
AS400Exception
AS400SecurityException
InterruptedException
IOException
See Also:
commit(), RecordIOManager.rollback()

setAscendingOrder

public void setAscendingOrder(boolean order)
Set the order of record retrieval. This method will invoke RecordIOManager.setAscendingOrder.

Parameters:
ascendingOrder - True for ascending order, false for descending order.
See Also:
RecordIOManager.setAscendingOrder(boolean)

setAutoChangeDataAttributes

public void setAutoChangeDataAttributes(boolean autoChange)
Sets the autoChangeDataAttributes property value. The default value is true. When autoChangeDataAttributes is true, and if the component is a JFormattedTextField or JFormattedLabel, then if the data attributes in the fieldModel of the component do not match with the database field attributes, such as the data length, data type, and decimal places, then the FormManager will automatically change the attributes for you. However, this will slightly affect the performance. If the debugLevel is 2, you can see what columns are being changed.

Parameters:
autoChange - - true to change dataAttributes automatically; false not to change even if there is mismatch.
See Also:
getAutoChangeDataAttributes()

setDebugLevel

public void setDebugLevel(int value)
Sets the debug property value. This method will also invoke RecordIOManager.setDebugLevel.

Parameters:
value -
  • 0 - no exceptions nor messages will be dumped on the console for debugging purpose.
  • 1 - only exceptions will be dumped on the console.
  • 2 - exceptions, error and informational messages will be dumped on the console.
See Also:
getDebugLevel(), RecordIOManager.setDebugLevel(int)

setDisplayContainer

public void setDisplayContainer(Container container)
Sets the displayContainer property (java.awt.Component) value. To tell the FormManager knows which is container is the form.

Specified by:
setDisplayContainer in interface ContainerManagement
Parameters:
container - Can be any java.awt.Container, thus can be any JComponents, such as JPanel, JFrame, JDialog, JTextField, JLabel, etc.
See Also:
getDisplayContainer()

setRecordIOManager

public void setRecordIOManager(RecordIOManager reciomgr)
Sets the recordIOManager property value.

Specified by:
setRecordIOManager in interface ContainerManagement
Parameters:
reciomgr - RecordIOManager object for defining fields to work with in a record format, and attributes of a database file, and conditions in selecting records.
See Also:
getRecordIOManager()

setResultSetTableModel

protected void setResultSetTableModel(DefaultTableModel resultSetModel)
Parameters:
resultSetModel - javax.swing.table.DefaultTableModel

setSystem

public void setSystem(AS400 as400)
Sets the system property value. This method will also invoke RecordIOManager.setSystem(AS400). If system is set, system has preference over the values set for server, userid and password in RecordIOManager; and system's threadUsed will be used to determine if threading is allowed.

Parameters:
system - The com.ibm.as400.access.AS400 system object of the server specified in property server.
See Also:
getSystem(), RecordIOManager.setSystem(AS400)

setThreadUsed

public void setThreadUsed(boolean useThreads)
Sets whether the bean uses threads in communication with the host servers. The default is true. Letting the bean use threads may be beneficial to performance, turning threads off may be necessary if your application needs to be compliant with the Enterprise Java Beans specification. The thread used property cannot be changed once a connection to the AS/400 has been established. If there is a call to setSystem(AS400 as400), the threadUsed value of system as400 will be used instead, and this useThreads value will be ignored.

Parameters:
useThreads - - true to use threads; false otherwise.
See Also:
getThreadUsed()

startJournalPhysicalFile

public boolean startJournalPhysicalFile()
                                 throws AS400Exception,
                                        AS400SecurityException,
                                        InterruptedException,
                                        IOException,
                                        ErrorCompletingRequestException,
                                        ExtendedIllegalStateException
Invoke RecordIOManager.startJournalPhysicalFile.

Returns:
True if the journal physical file is started successfully; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the AS/400.
com.ibm.as400.access.ErrorCompletingRequestException - If an error occurs before the request is completed.
com.ibm.as400.access.ExtendedIllegalStateException - An object is not in the proper state to perform the requested operation.
AS400Exception
AS400SecurityException
InterruptedException
IOException
ErrorCompletingRequestException
ExtendedIllegalStateException
See Also:
endJournalPhysicalFile(), RecordIOManager.startJournalPhysicalFile()

updateRecord

public boolean updateRecord()
                     throws RecordNotFoundException,
                            AS400Exception,
                            AS400SecurityException,
                            InterruptedException,
                            IOException,
                            InvalidFieldDataException
Update the data in the displayContainer to the database file. If the database file is joined, then record will be updated to each database file. All the missing fields will retain the original value in the record.

Returns:
True if record is added successfully; false otherwise.
Throws:
com.ibm.as400.access.AS400Exception - If the AS/400 system returns an error message.
com.ibm.as400.access.AS400SecurityException - If a security or authority error occurs.
com.ibm.as400.access.InterruptedException - If this thread is interrupted.
com.ibm.as400.access.IOException - If an error occurs while communicating with the
InvalidFieldDataException - Invalid data in one or more fields. AS/400.
RecordNotFoundException
AS400Exception
AS400SecurityException
InterruptedException
IOException

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.