com.bmc.mainview.nvbapi
Class View

java.lang.Object
  extended by com.bmc.mainview.nvbapi.View
Direct Known Subclasses:
DetailView, TabularView

public abstract class View
extends java.lang.Object

Defines the common code for accessing MAINCVIEW views.

Version:
2.0
Author:
F. Schneider

Field Summary
 java.lang.String localDate
           
 java.lang.String localTime
           
 
Constructor Summary
View(java.lang.String vname, Conversation conversation, java.lang.String where, ViewListener exit)
          Creates an object containing the data from a MAINVIEW view
View(ViewDefinition vdef, Conversation conversation, java.lang.String where, ViewListener exit)
          Creates an object containing the data from a MAINVIEW view
View(ViewDefinition vdef, Conversation conversation, ViewListener exit)
          Creates an object containing the data from a MAINVIEW view
 
Method Summary
 long convertTime()
          Get the host local time that this view was generated
 int fieldCount()
          The number of fields in the view
 Conversation getConversation()
          The conversation being used by this View
 Field getField(int num)
          Gets a field definition from a view
 Field getField(java.lang.String name)
          Gets a field definition from a view
 java.lang.String getQwhere()
          Retrieve the MVI QWHERE clause currently being used for this view.
abstract  java.lang.String getRawValue(int row, Field field)
          Extract a field value from a row of a data record
 int getRowMax()
           
 java.lang.String getValue(int row, Field field)
          Retrieves the value of a particular field and removes leading and trailing blanks.
 java.lang.String getValue(int row, java.lang.String name)
          Extract a field value from a row of a data record
 java.lang.String getWhere()
          Retrieve the MVI WHERE clause currently being used for this view.
abstract  void refresh()
          Discards the cached view contents and gets new data from the host.
 void setHyperlinks(boolean hyperlinks)
          Requests that hyperlink definitions be attached to each field.
 void setQwhere(java.lang.String qwhere)
          Set an MVI QWHERE clause to be used with this view.
 void setRowMax(int rowMax)
           
 void setWhere(java.lang.String where)
          Set an MVI WHERE clause to be used with this view.
 int size()
          Tells how many rows of data are available in the view
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

localTime

public java.lang.String localTime

localDate

public java.lang.String localDate
Constructor Detail

View

public View(java.lang.String vname,
            Conversation conversation,
            java.lang.String where,
            ViewListener exit)
Creates an object containing the data from a MAINVIEW view

Parameters:
vname - The name of the desired view.
conversation - A conversation produced by HostServer.ConversationFactory
where - A MAINVIEW WHERE clause used to filter the records.
exit - A ViewListener object whose eventPerformed() method is to be invoked during processing.

View

public View(ViewDefinition vdef,
            Conversation conversation,
            java.lang.String where,
            ViewListener exit)
Creates an object containing the data from a MAINVIEW view

Parameters:
vdef - The definition of the desired view. This may contain any desired parameters or filters.
conversation - A conversation produced by HostServer.ConversationFactory
where - A MAINVIEW WHERE clause used to filter the records.
exit - A ViewListener object whose eventPerformed() method is to be invoked during processing.

View

public View(ViewDefinition vdef,
            Conversation conversation,
            ViewListener exit)
Creates an object containing the data from a MAINVIEW view

Parameters:
vdef - The definition of the desired view. This may contain any desired parameters or filters.
conversation - A conversation produced by HostServer.ConversationFactory
exit - A ViewListener object whose eventPerformed() method is to be invoked during processing.
Method Detail

size

public int size()
Tells how many rows of data are available in the view

Returns:
the number of rows

getConversation

public Conversation getConversation()
The conversation being used by this View

Returns:
the Conversation object.

getWhere

public java.lang.String getWhere()
Retrieve the MVI WHERE clause currently being used for this view.

Returns:
The WHERE clause

setWhere

public void setWhere(java.lang.String where)
Set an MVI WHERE clause to be used with this view. This method is intended to be called from a ViewListener GOTFIELDS exit. A WHERE clause can also be added to a ViewDefinition

Parameters:
where -
See Also:
ViewListener, ViewDefinition.setWhere(String)

getQwhere

public java.lang.String getQwhere()
Retrieve the MVI QWHERE clause currently being used for this view.

Returns:
The QWHERE clause

setQwhere

public void setQwhere(java.lang.String qwhere)
Set an MVI QWHERE clause to be used with this view. This method is intended to be called from a ViewListener GOTFIELDS exit. A QWHERE clause can also be added to a ViewDefinition

Parameters:
qwhere -
See Also:
ViewListener, ViewDefinition.setQwhere(String)

getRawValue

public abstract java.lang.String getRawValue(int row,
                                             Field field)
                                      throws java.io.IOException,
                                             java.lang.IllegalArgumentException
Extract a field value from a row of a data record

Parameters:
row - The row number: 1 to n
field - The field
Returns:
A String with the value of the field in this row.
Throws:
java.lang.IllegalArgumentException - if row number out of range
java.io.IOException

getValue

public java.lang.String getValue(int row,
                                 Field field)
                          throws java.io.IOException,
                                 java.lang.IllegalArgumentException
Retrieves the value of a particular field and removes leading and trailing blanks.

Parameters:
row - The row number: 1 to n
field - Which field within the row
Returns:
The trimmed value of the field
Throws:
java.io.IOException - if a new row has to be fetched and there is a communication error.
java.lang.IllegalArgumentException - if row is out of range

getValue

public java.lang.String getValue(int row,
                                 java.lang.String name)
                          throws java.io.IOException,
                                 java.lang.IllegalArgumentException
Extract a field value from a row of a data record

Parameters:
row - The row number{ 1 to n
name - The name of the field
Returns:
A trimmed String with the value of the field in this row.
Throws:
java.lang.IllegalArgumentException - if row number out of range
java.io.IOException

getField

public Field getField(int num)
Gets a field definition from a view

Parameters:
num - the field number
Returns:
A Field object
See Also:
Field, fieldCount()

getField

public Field getField(java.lang.String name)
Gets a field definition from a view

Parameters:
name - the field name
Returns:
A Field object
See Also:
Field, fieldCount()

fieldCount

public int fieldCount()
The number of fields in the view

Returns:
the field count.

setHyperlinks

public void setHyperlinks(boolean hyperlinks)
Requests that hyperlink definitions be attached to each field.

Parameters:
hyperlinks - true, to request hyperlink definitions.
Throws:
java.lang.IllegalStateException - if invoked other than from the VIEWSET exit.
java.lang.IllegalArgumentException - if host server is at too low a maintenance level.
Since:
2.0.12, Server version 6.0.01
See Also:
ViewListener

refresh

public abstract void refresh()
                      throws java.io.IOException
Discards the cached view contents and gets new data from the host.

Throws:
java.io.IOException

getRowMax

public int getRowMax()
Returns:
the maximum number of rows.

setRowMax

public void setRowMax(int rowMax)
Parameters:
rowMax - the maximum number of rows. If zero, unlimited.

convertTime

public long convertTime()
Get the host local time that this view was generated

Returns:
The local time that the response was created at the host

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object