Business Components

oracle.jbo.server
Class RowImpl

java.lang.Object
  |
  +--oracle.jbo.common.BaseObject
        |
        +--oracle.jbo.server.RowImpl
Direct Known Subclasses:
EntityImpl, ViewRowImpl

public abstract class RowImpl
extends BaseObject
implements Row

Base class for Entity Rows and View Object Rows. This class defines common methods for Entity Row and View Object Row access. Customer application logic can use this class to access database table rows independently of the implementation of the underlying row. For example, assume that a customer application is written to perform batch style inserts into a database table. This application may reference the RowImpl class for row access instead of accessing instances of ViewRowImpl or EntityImpl directly. This design would allow changes in a row's implementation (Entity Row or View Object Row) without necessitating changes in the application logic.

Unlike the Row interface which provides tier-independent access to database table rows, this class can only be referenced by logic that executes on an application's middle tier.

Customers should not develop implementations of this abstract class. Instead, customers who need to extend/override Row behavior should extend one of the concrete Row classes: EntityImpl and ViewRowImpl.

Since:
JDeveloper 3.0
See Also:
ViewRowImpl, EntityImpl, Row

Fields inherited from class oracle.jbo.common.BaseObject
TRACE_EVERY_ALLOC, TRACE_NONE, TRACE_OCCASIONAL, TRACE_UNINITIALIZED
 
Fields inherited from interface oracle.jbo.XMLInterface
XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE
 
Constructor Summary
RowImpl()
           
 
Method Summary
protected abstract  void create(AttributeList nameValuePair)
          This method is called to let subclasses of RowImpl set programmatic default values for attributes.
 java.lang.String createXMLDefinition(int depthCount)
          Creates a StringWriter and calls printXMLDefinition to generate proper DTD for this row and all containees (if depthCount > 0)
abstract  int getAttributeCount()
          Counts the attributes in this row.
abstract  int getAttributeIndexOf(java.lang.String name)
          Finds the index of a named attribute.
protected abstract  java.lang.Object getAttributeInternal(int index)
          Gets the attribute value by index.
protected  java.lang.Object getAttributeInternal(java.lang.String name)
          Gets the attribute value by name.
abstract  Key getKey()
          Returns the row's key.
abstract  boolean isAttributeUpdateable(int index)
          Tests if an attribute is updateable.
abstract  void lock()
          Locks the row(s) in the source database table.
protected abstract  void populateAttribute(int index, java.lang.Object value)
           
protected  java.lang.String printXMLDefinition(java.util.Hashtable allDefs, java.io.PrintWriter pw, int depthCount)
          Prints DTD for this row and all its contents (including contained RowSets if depthCount is non-zero).
abstract  void readXML(org.w3c.dom.Element elem, int depthCount)
          Reads the content of the row and updates the attributes, from given XML document.
 void readXML(org.w3c.dom.Element elem, int depthCount, oracle.xml.parser.v2.XSLStylesheet xslt)
          Given the document interface, finds the rowset Element and invokes JboXMLUtil.processAndReadXML(XMLInterface, org.w3c.dom.Element, int, oracle.xml.parser.v2.XSLStylesheet) to read in the data from the XML.
abstract  void remove()
          Marks the row as removed and removes it from row iterators.
protected abstract  void setAttributeInternal(int index, java.lang.Object value)
          Sets the attribute value by index after performing declarative attribute-level validations.
protected  void setAttributeInternal(java.lang.String name, java.lang.Object value)
          Sets the attribute value by name.
abstract  void validate()
          Invokes the validate method for the validators attached to this business object.
 org.w3c.dom.Node writeXML(int depthCount, long options)
          Writes this row as XML in the given XML document.
 org.w3c.dom.Node writeXML(int depthCount, long options, oracle.xml.parser.v2.XSLStylesheet xslt)
          Writes this row as XML in the given XML document, according to the specified XSLT stylesheet.
 
Methods inherited from class oracle.jbo.common.BaseObject
dumpState, setTraceLevel, setTraceWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowImpl

public RowImpl()
Method Detail

create

protected abstract void create(AttributeList nameValuePair)
This method is called to let subclasses of RowImpl set programmatic default values for attributes.

If sub-classed, super.create should be called to let the framework setup initial states on the row.

Parameters:
nameValuePair - a name providing access to an attribute list.

getAttributeInternal

protected abstract java.lang.Object getAttributeInternal(int index)
Gets the attribute value by index.
Parameters:
index - attribute index
Returns:
attribute value

getAttributeInternal

protected final java.lang.Object getAttributeInternal(java.lang.String name)
Gets the attribute value by name. For example:

  Date startDate;
  startDate = (Date)getAttributeInternal(HIREDATE);
 

This method throws a JboException if an attribute of the given name is not found.

Parameters:
name - attribute name
Returns:
attribute value
Throws:
JboException - if the attribute is not found.

setAttributeInternal

protected abstract void setAttributeInternal(int index,
                                             java.lang.Object value)
Sets the attribute value by index after performing declarative attribute-level validations.

This method is used by code-gen facility in accessors for entity attributes.

Parameters:
index - attribute index
value - attribute value

setAttributeInternal

protected final void setAttributeInternal(java.lang.String name,
                                          java.lang.Object value)
Sets the attribute value by name. This method invokes getAttributeIndexOf as:

 setAttributeInternal(getAttributeIndexOf(name), value);
 

to get the name corresponding to the index, then set the value.

This method is used by the code generation facility in accessors for ViewRow attributes.

Parameters:
name - column name.
value - column data.
See Also:
getAttributeIndexOf(java.lang.String)

lock

public abstract void lock()
Description copied from interface: Row
Locks the row(s) in the source database table.
Specified by:
lock in interface Row
Tags copied from interface: Row
Throws:
JboException - a runtime exception, if an exception occurs during access.

getAttributeCount

public abstract int getAttributeCount()
Counts the attributes in this row.
Returns:
the number of attributes.

getAttributeIndexOf

public abstract int getAttributeIndexOf(java.lang.String name)
Finds the index of a named attribute.
Parameters:
an - attribute name.
Returns:
the index of name, or -1 if not found.

populateAttribute

protected abstract void populateAttribute(int index,
                                          java.lang.Object value)

isAttributeUpdateable

public abstract boolean isAttributeUpdateable(int index)
Tests if an attribute is updateable.
Specified by:
isAttributeUpdateable in interface Row
Parameters:
index - the index of the attribute.
Returns:
true if the row is marked UPDATEABLE, or if the row is marked UPDATEABLE_WHILE_NEW and the current row is new.

getKey

public abstract Key getKey()
Description copied from interface: Row
Returns the row's key.
Specified by:
getKey in interface Row
Tags copied from interface: Row
Returns:
the row's Key.

validate

public abstract void validate()
Invokes the validate method for the validators attached to this business object.
Specified by:
validate in interface Row
Tags copied from interface: Row
Throws:
JboException - a runtime exception, if the recipient wishes the property change to be rolled back.

remove

public abstract void remove()
Marks the row as removed and removes it from row iterators.
Specified by:
remove in interface Row
Tags copied from interface: Row
Throws:
JboException - a runtime exception, if an exception occurs during access.

createXMLDefinition

public final java.lang.String createXMLDefinition(int depthCount)
Creates a StringWriter and calls printXMLDefinition to generate proper DTD for this row and all containees (if depthCount > 0)
Parameters:
depthCount - the number of child levels deep to include in the definitions.

writeXML

public org.w3c.dom.Node writeXML(int depthCount,
                                 long options,
                                 oracle.xml.parser.v2.XSLStylesheet xslt)
Writes this row as XML in the given XML document, according to the specified XSLT stylesheet.
Parameters:
depthCount - the number of child levels deep to append the row nodes.
options - a set of bit flags that will control the writeXML behavior.
xslt - name of the XSLT stylesheet.

writeXML

public final org.w3c.dom.Node writeXML(int depthCount,
                                       long options)
Writes this row as XML in the given XML document.
Parameters:
depthCount - the number of child levels deep to append the row nodes.
options - a set of bit flags that will control the writeXML behavior.

readXML

public void readXML(org.w3c.dom.Element elem,
                    int depthCount,
                    oracle.xml.parser.v2.XSLStylesheet xslt)
Given the document interface, finds the rowset Element and invokes JboXMLUtil.processAndReadXML(XMLInterface, org.w3c.dom.Element, int, oracle.xml.parser.v2.XSLStylesheet) to read in the data from the XML.

Note that if the XML contains modifications to row-keys, other RowSets for this object may not pick those changes up unless the rows are posted to the database. Call Transaction.postChanges() to sync up all RowSets.

Parameters:
elem - name of the XML element.
depthCount - the number of child levels deep to which data should be read.
xslt - name of the XSLT stylesheet.

readXML

public abstract void readXML(org.w3c.dom.Element elem,
                             int depthCount)
Reads the content of the row and updates the attributes, from given XML document. If there's a process instruction in the row like: <?bc4j remove?> then calls remove() on this row.
Parameters:
elem - name of the XML element.
depthCount - the number of child levels deep to which data should be read.

printXMLDefinition

protected java.lang.String printXMLDefinition(java.util.Hashtable allDefs,
                                              java.io.PrintWriter pw,
                                              int depthCount)
Prints DTD for this row and all its contents (including contained RowSets if depthCount is non-zero). Returns the XML-tag for this row to be included in the rowset's declaration. Can be overridden to print a custom DTD.
Parameters:
allDefs - a hashtable of predefined XML definitions passed from whatever calls this method.
pw - print writer into which the defnition is being printed.
depthCount - the number of child levels for which the DTD definition should be generated.

Business Components