com.irisel.oms.olapi.internal
Class DBInstanceSet

java.lang.Object
  extended by com.irisel.util.BaseBean
      extended by com.irisel.oms.olapi.beans.XMLBean
          extended by com.irisel.oms.olapi.internal.DBInstanceSet
All Implemented Interfaces:
InstanceSet, XMLBean, java.io.Serializable

public class DBInstanceSet
extends XMLBean
implements InstanceSet

Author:
jmgomez
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.irisel.oms.olapi.beans.XMLBean
CLASSNAME, CLASSTYPE, DEFAULT_VISIBILITY, NOT_VISIBLE, VISIBLE
 
Fields inherited from interface com.irisel.util.XMLBean
CSV
 
Constructor Summary
DBInstanceSet(ClassVO c, java.sql.ResultSet rs)
           
DBInstanceSet(java.sql.ResultSet rs)
          Constructor when Class is unknown Limitations: -
 
Method Summary
 boolean absolute(int pos)
           
 void close()
          frees resources (closes the result set)
 void copyMetadata(DataInstance di)
           
 void copyMetadataFrom(DataInstance di)
           
 void copyMetadataTo(DataInstance di)
           
 boolean first()
          rewinds to the first record
 java.lang.String getClassname()
          Returns the classname
 java.lang.String[] getClassnames()
          Returns the classname for each field If implemented, useful for views.
 Instance getCurrentInstance()
           
 java.sql.Date getDate(int i)
           
 java.sql.Date getDate(java.lang.String field)
           
 Instance getInstance(int index)
          Returns row by index.
 int getInstanceCount()
           
 Instance[] getInstances()
           
 int getInteger(int i)
           
 int getInteger(java.lang.String field)
           
 long getLong(int i)
           
 long getLong(java.lang.String field)
           
 java.lang.String[] getNames()
           
 java.lang.String[] getOriginalPropertyNames()
          For views, where the original name can be aliased
 int getRow()
          Getter for property row.
 java.lang.String getString(int i)
           
 java.lang.String getString(java.lang.String field)
           
 java.lang.String getType()
           
 java.lang.Object getValue(int column)
           
 java.lang.Object getValue(int row, int col)
          Obtain the value for a row and column index
 java.lang.Class getValueClass(int column)
          The class for a given column
 java.lang.Class[] getValueClasses()
           
 java.lang.String getValueClassName(int i)
          The class name for a given column
 java.lang.String[] getValueClassNames()
          Getter for property valuesClassNames.
 java.lang.Object[][] getValues()
           
 java.lang.Object[] getValues(int index)
           
 java.lang.Object[] getValuesByColumn(int col)
           
 java.lang.Object[] getValuesByColumn(java.lang.String colname)
           
 boolean last()
          rewinds to the last record
 int name2index(java.lang.String name)
           
 boolean next()
          moves one position down the resultset
 void setClassname(java.lang.String classname)
           
 void setOriginalPropertyNames(java.lang.String[] originalPropertyNames)
           
 void setRow(int row)
          Setter for property row.
 void setType(java.lang.String type)
           
 void setValueClassNames(java.lang.String[] valuesClassNames)
          Setter for property valuesClassNames.
 void setValues(java.lang.Object[][] data)
           
 
Methods inherited from class com.irisel.oms.olapi.beans.XMLBean
copyToInstance, export2csv, getDescId, getGeneratedAt, getGenericAttr, getIcon, getIconName, getId, getLabel, getName, getO, getOrd, getVisibility, isDirty, isEnabled, isErased, isMandatory, isReadOnly, readFromFile, readFromStream, setDescId, setDirty, setEnabled, setErased, setGeneratedAt, setGenericAttr, setIcon, setIconName, setId, setLabel, setName, setO, setOrd, setVisibility, toString, updateFromInstance, writeToFile, writeToStream, xmlSerialize
 
Methods inherited from class com.irisel.util.BaseBean
decode64, decode64bin, encode64, encode64bin, readObject, readObject64, toBean, toByteArray, toJSON, toJSONObject, toXML
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.irisel.oms.olapi.beans.InstanceSet
toJSON, toJSONObject
 

Constructor Detail

DBInstanceSet

public DBInstanceSet(java.sql.ResultSet rs)
Constructor when Class is unknown Limitations: -

Parameters:
rs -

DBInstanceSet

public DBInstanceSet(ClassVO c,
                     java.sql.ResultSet rs)
Method Detail

getNames

public java.lang.String[] getNames()
Specified by:
getNames in interface InstanceSet
Returns:
Array of strings of the field names

getInstance

public Instance getInstance(int index)
Description copied from interface: InstanceSet
Returns row by index. First row is 0.

Specified by:
getInstance in interface InstanceSet
Parameters:
index - index of the record to get
Returns:

getInstances

public Instance[] getInstances()
Specified by:
getInstances in interface InstanceSet
Returns:
all instances as array

getInstanceCount

public int getInstanceCount()
Specified by:
getInstanceCount in interface InstanceSet
Returns:
the size of the resultset

getClassname

public java.lang.String getClassname()
Description copied from interface: InstanceSet
Returns the classname

Specified by:
getClassname in interface InstanceSet
Returns:

getClassnames

public java.lang.String[] getClassnames()
Description copied from interface: InstanceSet
Returns the classname for each field If implemented, useful for views.

Specified by:
getClassnames in interface InstanceSet
Returns:

getValues

public java.lang.Object[] getValues(int index)
Specified by:
getValues in interface InstanceSet
Parameters:
index - index of the row
Returns:

getValueClassNames

public java.lang.String[] getValueClassNames()
Getter for property valuesClassNames.

Specified by:
getValueClassNames in interface InstanceSet
Returns:
Value of property valuesClassNames.

setValueClassNames

public void setValueClassNames(java.lang.String[] valuesClassNames)
Setter for property valuesClassNames.

Parameters:
valuesClassNames - New value of property valuesClassNames.

getValueClassName

public java.lang.String getValueClassName(int i)
Description copied from interface: InstanceSet
The class name for a given column

Specified by:
getValueClassName in interface InstanceSet
Parameters:
i - index of the column
Returns:

first

public boolean first()
Description copied from interface: InstanceSet
rewinds to the first record

Specified by:
first in interface InstanceSet
Returns:
true if success

last

public boolean last()
Description copied from interface: InstanceSet
rewinds to the last record

Specified by:
last in interface InstanceSet
Returns:
true if success

next

public boolean next()
Description copied from interface: InstanceSet
moves one position down the resultset

Specified by:
next in interface InstanceSet
Returns:
true if not at the end of the resultset

getRow

public int getRow()
Getter for property row.

Specified by:
getRow in interface InstanceSet
Returns:
Value of property row.

setRow

public void setRow(int row)
Setter for property row.

Parameters:
row - New value of property row.

absolute

public boolean absolute(int pos)
Specified by:
absolute in interface InstanceSet
Returns:

getValue

public java.lang.Object getValue(int row,
                                 int col)
Description copied from interface: InstanceSet
Obtain the value for a row and column index

Specified by:
getValue in interface InstanceSet
Returns:
the value for a row and column index

getValue

public java.lang.Object getValue(int column)
Specified by:
getValue in interface InstanceSet
Parameters:
column - index to get value for
Returns:
value for the column index

getValuesByColumn

public java.lang.Object[] getValuesByColumn(int col)
Specified by:
getValuesByColumn in interface InstanceSet
Parameters:
col - index of the column
Returns:

name2index

public int name2index(java.lang.String name)

getValuesByColumn

public java.lang.Object[] getValuesByColumn(java.lang.String colname)
Specified by:
getValuesByColumn in interface InstanceSet
Returns:
the values for a column

getValues

public java.lang.Object[][] getValues()
Specified by:
getValues in interface InstanceSet
Returns:
all values as a bidimensional array

close

public void close()
Description copied from interface: InstanceSet
frees resources (closes the result set)

Specified by:
close in interface InstanceSet

getType

public java.lang.String getType()
Specified by:
getType in interface InstanceSet
Returns:
the type (DM.TYPE_TABLE, DM.TYPE_VIEW)

setType

public void setType(java.lang.String type)

getValueClass

public java.lang.Class getValueClass(int column)
Description copied from interface: InstanceSet
The class for a given column

Specified by:
getValueClass in interface InstanceSet
Parameters:
column - index of the column
Returns:

getValueClasses

public java.lang.Class[] getValueClasses()
Specified by:
getValueClasses in interface InstanceSet
Returns:
the Java classes for the values

getOriginalPropertyNames

public java.lang.String[] getOriginalPropertyNames()
Description copied from interface: InstanceSet
For views, where the original name can be aliased

Specified by:
getOriginalPropertyNames in interface InstanceSet
Returns:
Array of original names of fields

setOriginalPropertyNames

public void setOriginalPropertyNames(java.lang.String[] originalPropertyNames)

copyMetadata

public void copyMetadata(DataInstance di)

setValues

public void setValues(java.lang.Object[][] data)
Specified by:
setValues in interface InstanceSet
Parameters:
data - values to set

copyMetadataTo

public void copyMetadataTo(DataInstance di)
Specified by:
copyMetadataTo in interface InstanceSet
Parameters:
di - destination to copy metadata to.

copyMetadataFrom

public void copyMetadataFrom(DataInstance di)
Specified by:
copyMetadataFrom in interface InstanceSet
Parameters:
di - source to copy data from

getCurrentInstance

public Instance getCurrentInstance()
Specified by:
getCurrentInstance in interface InstanceSet
Returns:
the current instance

setClassname

public void setClassname(java.lang.String classname)
Specified by:
setClassname in interface InstanceSet
Parameters:
classname - name of the class

getString

public java.lang.String getString(int i)
Specified by:
getString in interface InstanceSet

getInteger

public int getInteger(int i)
Specified by:
getInteger in interface InstanceSet

getLong

public long getLong(int i)
Specified by:
getLong in interface InstanceSet

getDate

public java.sql.Date getDate(int i)
Specified by:
getDate in interface InstanceSet

getString

public java.lang.String getString(java.lang.String field)
Specified by:
getString in interface InstanceSet

getInteger

public int getInteger(java.lang.String field)
Specified by:
getInteger in interface InstanceSet

getLong

public long getLong(java.lang.String field)
Specified by:
getLong in interface InstanceSet

getDate

public java.sql.Date getDate(java.lang.String field)
Specified by:
getDate in interface InstanceSet