com.irisel.oms.olapi.beans
Class DataInstanceSet

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

public class DataInstanceSet
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
DataInstanceSet()
          Creates a new instance of DataInstanceSet
DataInstanceSet(Class c)
           
DataInstanceSet(ClassVO c)
           
DataInstanceSet(InstanceSet is)
           
DataInstanceSet(InstanceSet is, boolean copyData)
          Constructor of a DataInstanceSet from a InstanceSet (e.g.
DataInstanceSet(Model m, java.lang.String instanceType)
           
 
Method Summary
 boolean absolute(int pos)
           
 void addInstance(Instance newInstance)
           
 void addInstance(Instance[] iset)
           
 void addInstance(long key)
           
 void addInstance(long[] ls)
           
 void close()
          frees resources (closes the result set)
 void copyMetadataFrom(DataInstance di)
           
 void copyMetadataTo(DataInstance di)
           
 boolean first()
          rewinds to the first record
 long getClassId()
           
 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 valueClassNames.
 java.lang.Object[][] getValues()
           
 java.lang.Object[] getValues(int row)
           
 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 removeInstanceAt(int index)
           
 void setClassId(long classId)
           
 void setClassname(java.lang.String s)
           
 void setClassnames(java.lang.String[] classnames)
           
 void setInstanceAt(int index, Instance newInstance)
           
 void setNames(java.lang.String[] names)
           
 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[] valueClassNames)
          Setter for property valueClassNames.
 void setValues(java.lang.Object[][] objValues)
           
 void setValues(java.util.Vector values)
           
 JSONObject toJSONObject()
           
 java.lang.String toString()
           
 
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, updateFromInstance, writeToFile, writeToStream, xmlSerialize
 
Methods inherited from class com.irisel.util.BaseBean
decode64, decode64bin, encode64, encode64bin, readObject, readObject64, toBean, toByteArray, toJSON, 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
 

Constructor Detail

DataInstanceSet

public DataInstanceSet()
Creates a new instance of DataInstanceSet


DataInstanceSet

public DataInstanceSet(Model m,
                       java.lang.String instanceType)

DataInstanceSet

public DataInstanceSet(ClassVO c)

DataInstanceSet

public DataInstanceSet(Class c)

DataInstanceSet

public DataInstanceSet(InstanceSet is)

DataInstanceSet

public DataInstanceSet(InstanceSet is,
                       boolean copyData)
Constructor of a DataInstanceSet from a InstanceSet (e.g. DBInstanceSet)

Parameters:
is - InstanceSet
copyData - controls if the instances are copied or just the type info.
Method Detail

getClassname

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

Specified by:
getClassname in interface InstanceSet
Returns:

setClassname

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

getNames

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

setNames

public void setNames(java.lang.String[] 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:

getInstanceCount

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

getInstances

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

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:

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

getValues

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

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

setValues

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

addInstance

public void addInstance(Instance[] iset)

addInstance

public void addInstance(Instance newInstance)

addInstance

public void addInstance(long key)

setInstanceAt

public void setInstanceAt(int index,
                          Instance newInstance)

removeInstanceAt

public void removeInstanceAt(int index)

getValueClassNames

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

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

setValueClassNames

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

Parameters:
valueClassNames - New value of property valueClassNames.

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

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:

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)

setClassnames

public void setClassnames(java.lang.String[] classnames)

setValues

public void setValues(java.util.Vector values)

addInstance

public void addInstance(long[] ls)

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)

copyMetadataFrom

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

copyMetadataTo

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

getCurrentInstance

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

toString

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

getClassId

public long getClassId()

setClassId

public void setClassId(long classId)

toJSONObject

public JSONObject toJSONObject()
Specified by:
toJSONObject in interface InstanceSet
Overrides:
toJSONObject in class BaseBean
Returns:
JSONObject map representation of the records

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