|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.jbo.server.RowImpl oracle.jbo.server.ViewRowImpl
A View Object Row. This class provides access to a View Object Row. The View Object Row can contain one or more Entity Object Rows in addition to derived attributes such as calculated columns.
The Business Components for Java framework instantiates an object of this class for each record that is returned by the row's View Object query. This class can be referred to by middle-tier customer application logic in order to access View Object Row data.
Customers can extend this class with custom View Object Row implementations. For example, the Business Components for Java View Object wizard can be used to generate sub-classes of this class that define type-safe accessors/mutators for the attributes of a row. Custom sub-classes should be declard to the Business Components for Java framework through the View Object wizard.
Customer applications should not access this class on the client-tier of an
application. Instead, the Row
interface should be
used for client tier access.
RowImpl
,
Row
Field Summary | |
static java.lang.String |
XML_POSTSTATE_REMOVE
|
static java.lang.String |
XML_POSTSTATE_TAG
|
Fields inherited from interface oracle.jbo.Row |
REFRESH_CONTAINEES, REFRESH_FORGET_NEW_ROWS, REFRESH_REMOVE_NEW_ROWS, REFRESH_UNDO_CHANGES, REFRESH_WITH_DB_FORGET_CHANGES, REFRESH_WITH_DB_ONLY_IF_UNCHANGED, STATUS_INITIALIZED |
Fields inherited from interface oracle.jbo.XMLInterface |
XML_IGNORE_DEPTH_COUNT, XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE |
Constructor Summary | |
ViewRowImpl()
Public constructor for this class. |
Method Summary | |
protected void |
appendXMLElementNodes(Document xmlDoc,
Node node,
int depthCount,
long options,
AttributeDefImpl[] attrs)
Writes XML-element nodes for each attribute in this row and appends it to the given row-node. |
protected void |
appendXMLElementNodes(Document xmlDoc,
Node node,
int depthCount,
long options,
com.sun.java.util.collections.HashMap voAttrMap,
AttributeDef[] attrs)
Writes XML-element nodes for each attribute in this row and appends it to the given row-node. |
protected void |
clearAttributeException(int index)
Cleans any exception of an attribute of the given name was set earlier and threw an exception which was cached as the transaction is in deferred mode. |
protected void |
clearAttributeException(java.lang.String name)
Cleans any exception of an attribute of the given name was set earlier and threw an exception which was cached as the transaction is in deferred mode. |
protected void |
create(AttributeList nvp)
Initialization method to be over-ridden in generated code for custom defaulting. |
protected EntityImpl[] |
createEntities()
Creates blank instances of the Entity Objects that this row is composed of. |
void |
entityCacheAdd()
Populate the caches from the values of the rows. |
boolean |
equals(java.lang.Object other)
Tests if the specified value is equal to this ViewRowImpl object. |
protected RowSet |
findAssociatedObjects(java.lang.String name)
Finds Objects in a ViewRowSetImpl that follow the given association. |
ViewRowSetImpl |
findRowSetForRow(java.lang.Object accessKey)
|
ApplicationModule |
getApplicationModule()
Gets the Application Module to which the containing View Object belongs. |
java.lang.Object |
getAttribute(int ix)
Selects the attribute at the given index. |
java.lang.Object |
getAttribute(java.lang.String name)
Gets the value of an attribute by name. |
int |
getAttributeCount()
Gets the attribute count in this ViewRow. |
int |
getAttributeIndexOf(java.lang.String attrName)
Gets the index of the attribute, given it's name. |
protected java.lang.Object |
getAttributeInternal(int index)
Gets the value of the attribute by index. |
java.lang.String[] |
getAttributeNames()
Returns an array of attribute names in this list. |
java.lang.Object[] |
getAttributeValues()
Returns an array of attribute values in this list. |
protected java.lang.Object |
getAttrInvokeAccessor(int ix,
AttributeDefImpl attrRef)
|
java.lang.String |
getElementTagName()
|
EntityImpl[] |
getEntities()
Gets an array of Entity objects. |
EntityImpl |
getEntity(int index)
Gets the Entity at the given index. |
AttributeDefImpl |
getEntityAttrForAttribute(java.lang.String attrName)
|
int |
getEntityCount()
Counts the number of Entity Objects in this row. |
Entity |
getEntityForAttribute(java.lang.String attrName)
Gets an entity object that contains the given attribute name. |
java.lang.Object |
getHandle()
Creates a row identifier that is unique in the query collection. |
Key |
getKey()
Returns the identifier object for this row. |
byte |
getNewRowState()
|
QueryCollection |
getQueryCollection(java.lang.Object accessKey)
Gets the QueryCollection this row exists in. |
StructureDef |
getStructureDef()
Returns the structure of the row. |
ViewDefImpl |
getViewDef()
Get the ViewDefImpl associated with this View Row. |
ViewObject |
getViewObject()
Gets the View Object to which this row belongs. |
java.lang.String |
getXMLElementTag()
Returns the XML-element tag for this row. |
protected boolean |
hasAttributeException(int index)
Returns true if an attribute at the given index was set earlier and threw an exception which was cached as the transaction is in deferred mode. |
boolean |
hasDeferredExceptions()
|
boolean |
hasExtendedViewDef()
|
int |
hashCode()
Computes an integer hash code for this ViewRowImpl object |
protected void |
initDefaults()
|
boolean |
isAttributeUpdateable(int index)
Tests if an attribute is updateable. |
void |
lock()
Locks the referenced Entity Rows. |
protected void |
populate(java.sql.ResultSet resultSet)
Internal: Applications should not use this method. |
protected void |
populateAttribute(int index,
java.lang.Object value)
|
protected void |
populateAttributeAsChanged(int index,
java.lang.Object value)
|
protected void |
readAttributeFromXMLElement(Node rowElt,
AttributeDefImpl ad)
|
void |
readXML(Element rowElt,
int depthCount)
Reads the content of the row and updates the attributes, from given XML document. |
void |
refresh(int refreshMode)
Refreshes the row's attributes with values from database. |
protected void |
registerAttributeException(AttributeDef attrDef,
java.lang.Object val,
JboException dce)
|
void |
remove()
Deletes the row. |
void |
removeAndRetain()
Removes the row from the collection and then retain it for insertion into another location. |
void |
removeFromCollection()
Removes the row from the collection. |
protected Element |
renderAttributeInXMLElement(Document xmlDoc,
AttributeDefImpl ad,
boolean explicitNull)
|
protected Element |
renderAttributeInXMLElement(Document xmlDoc,
AttributeDefImpl ad,
boolean explicitNull,
byte version)
|
void |
revert()
Reverts this row back to its initial state. |
void |
setAttribute(int index,
java.lang.Object val)
Sets an attribute. |
void |
setAttribute(java.lang.String name,
java.lang.Object val)
Sets the value of an attribute by name. |
protected void |
setAttributeInternal(int index,
java.lang.Object val)
This is an "inner" accessor for an attribute and does not call out to the getXXX() method. |
protected void |
setAttrInvokeAccessor(int index,
java.lang.Object val,
AttributeDefImpl attrRef)
|
protected void |
setEntities(EntityImpl[] rows)
Sets the entities that this view row is composed of. |
protected void |
setEntity(int index,
EntityImpl row)
Sets the entity (at index ) for this view row. |
void |
setNewRowState(byte state)
void setIterator(ViewRowSetIteratorImpl rsi) { mRSI = rsi; } public ViewRowSetIteratorImpl getIterator() { return mRSI; } |
void |
validate()
Calls validate on each this view row's Entity Objects. |
void |
writeAsXml(oracle.jbo.common.xml.XmlOutput out,
Node node,
oracle.jbo.common.xml.Criteria rules)
|
void |
writeAsXml(oracle.jbo.common.xml.XmlOutput output,
Node node,
oracle.jbo.common.xml.Criteria rules,
byte version)
|
Node |
writeXML(long options,
com.sun.java.util.collections.HashMap voAttrRules)
Writes this row as XML in the given XML document. |
Methods inherited from class oracle.jbo.server.RowImpl |
clearAllExceptions, clearRowExceptions, createXMLDefinition, findAttrAndGetIndex, getAllExceptions, getAttributeInternal, getRowExceptions, hasAttributeException, printXMLDefinition, readXML, registerRowException, setAttributeInternal, writeXML, writeXML, writeXML |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface oracle.jbo.XMLInterface |
readXML, writeXML, writeXML, writeXML |
Field Detail |
public static final java.lang.String XML_POSTSTATE_TAG
public static final java.lang.String XML_POSTSTATE_REMOVE
Constructor Detail |
public ViewRowImpl()
Method Detail |
protected void initDefaults()
protected void create(AttributeList nvp)
This method invokes create(AttributeList)
on each of the "new" entities
that make up this View Row.
The attribute list nvp is simply passed to the new entity rows that make up this View Row.
Note: the names in the attribute list are not transformed into entity-relative names hoping that the caller has done so already. If not, the entity's create() method might fail.
nvp
- the list of attributtes.public QueryCollection getQueryCollection(java.lang.Object accessKey)
public ViewRowSetImpl findRowSetForRow(java.lang.Object accessKey)
public java.lang.Object getHandle()
Each row in a collection can be identified by either its Java object reference or by its row handle. The row handle, together with the collection name, forms an identifier that can be stored externally, in order to identify the row in future operations.
Applications should not rely on indentifier having a specific format: it is subject to change.
A row handle can be converted to a string using toString()
methods, and compared using equals
public Key getKey()
getKey
in interface Row
getKey
in class RowImpl
public void validate()
validate
in interface Row
validate
in class RowImpl
JboException
- if validation fails.protected java.lang.Object getAttributeInternal(int index)
Note that this is an "inner" accessor for an attribute and does
not callout to the generated getXXX() method
on a subclass of a
ViewRowImpl. getAttribute()
methods are the "outer"
methods that callout to a subclass's getXXX() method where
XXX is the name of the attribute.
getAttributeInternal
in class RowImpl
index
- the index of the attribute.
public java.lang.Object getAttribute(int ix)
AttributeList
getAttribute
in interface AttributeList
ix
- an integer in the range 0
to getAttributeCount() - 1
.
index
.protected java.lang.Object getAttrInvokeAccessor(int ix, AttributeDefImpl attrRef) throws java.lang.Exception
java.lang.Exception
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface AttributeList
name
- the name of the attribute.
public void setAttribute(java.lang.String name, java.lang.Object val)
setAttribute
in interface AttributeList
name
- the name of the attribute.val
- the value of the attribute.public void setAttribute(int index, java.lang.Object val)
This method performs a type-check on the value, so that it matches the Java type of the attribute.
setAttribute
in interface AttributeList
index
- the index of the attribute.val
- the new value.
ReadOnlyAttrException
- if the attribute is not updateable.
InvalidOperException
- if this row
belongs is to a forward-only View Object.
DataCreationException
- if the given value is not
convertible to the Java type of the attribute.
AttrSetValException
- if any validation logic fails
while setting this attribute to the mapped Entity Object attribute.protected boolean hasAttributeException(int index)
RowImpl
hasAttributeException
in class RowImpl
public boolean hasDeferredExceptions()
hasDeferredExceptions
in class RowImpl
protected void clearAttributeException(java.lang.String name)
clearAttributeException
in class RowImpl
protected void clearAttributeException(int index)
clearAttributeException
in class RowImpl
protected void registerAttributeException(AttributeDef attrDef, java.lang.Object val, JboException dce)
registerAttributeException
in class RowImpl
protected void setAttrInvokeAccessor(int index, java.lang.Object val, AttributeDefImpl attrRef) throws java.lang.Exception
java.lang.Exception
protected void setAttributeInternal(int index, java.lang.Object val)
This method also does not perform any type-check for the value's java type and assumes that the value-type is same as the java-type for this attribute.
setAttributeInternal
in class RowImpl
index
- The index of the attribute.val
- The value.
ReadOnlyAttrException
- if the attribute is not updateable.
AttrSetValException
- if any validation logic fails while setting this attribute to the mapped Entity attribute.public final ViewObject getViewObject()
public final ApplicationModule getApplicationModule()
public final ViewDefImpl getViewDef()
public final boolean hasExtendedViewDef()
public int getAttributeIndexOf(java.lang.String attrName)
getAttributeIndexOf
in interface AttributeList
getAttributeIndexOf
in class RowImpl
public java.lang.String[] getAttributeNames()
AttributeList
getAttributeNames
in interface AttributeList
public java.lang.Object[] getAttributeValues()
AttributeList
getAttributeValues
in interface AttributeList
protected EntityImpl[] createEntities()
public void lock()
lock
in interface Row
lock
in class RowImpl
public void revert()
public void refresh(int refreshMode)
Row
refreshMode
should be a combination of REFRESH_...
.
See REFRESH_...
constants for further information.
refresh
in interface Row
refreshMode
- the refresh mode.public void remove()
remove
on the updateable Entity Rows that are referenced by this View Object Row.
After the referenced, updateable entity rows have been removed this method
will remove the View Object Row from the View Object's RowSet.
remove
in interface Row
remove
in class RowImpl
public void removeFromCollection()
Row
This method differs from
in that
it just removes the row from the collection. It does not
remove the underlying Entity row(s) or database row(s).
However, once the row is removed, it cannot be used any more.
If you want to remove the row from the collection and insert it elsewhere,
call Row.remove()
.
Row.removeAndRetain()
removeFromCollection
in interface Row
public void removeAndRetain()
Row
This method differs from
in that
it just removes the row from the collection. It does not
remove the underlying Entity row(s) or database row(s).
Row.remove()
This method also differs from
in that after the row is removed from the collection, it can be inserted
back into the collection at another location.
Row.removeFromCollection()
removeAndRetain
in interface Row
public int getEntityCount()
public final EntityImpl getEntity(int index)
index
- the index of the Entity.public final Entity getEntityForAttribute(java.lang.String attrName)
attrName
- name of an attribute
public final AttributeDefImpl getEntityAttrForAttribute(java.lang.String attrName)
public EntityImpl[] getEntities()
This method makes a copy of the internal list of Entity rows and returns that copy to the caller.
protected final void setEntities(EntityImpl[] rows)
This method is called by framework, after entites are created for this row. This must be protected because subclasses can create their own entity instances and have the viewrow manage them.
For example, assume there is a ViewRow on the Doc Entity where Doc has subclasses PO and Req, the ViewRow subclass can create PO/Req instances of entities based on some logic and have ViewRow manage them as an entity of type Doc.
protected final void setEntity(int index, EntityImpl row)
index
) for this view row.
A view row is based on entity rows. This method can be used
to set the entity row for the specified entity index. For
example, a view row may consist of two entity rows, Emp
and Dept. To set the entity row for the Dept part, one
can call this method with index
of 1.
index
- index of the entitypublic final int getAttributeCount()
getAttributeCount
in interface AttributeList
getAttributeCount
in class RowImpl
public boolean isAttributeUpdateable(int index)
Row
false
if the attribute is read-only and true
if it is updateable.
The following logic is used for determining if the attribute is updateable. If this attribute for a View row and is one which is mapped to an Entity Attribute, and if the Entity base is marked as read-only in the View Object, the attribute is read-only.
If the Entity base is marked updateable, a check is made to see if the the current user has updateable privilege on the underlying Entity row. If not, the attribute is read-only.
After this, we check the View Object's Attribute Definition.
If the Attribute Definition indicates that it is READONLY
, this
method returns false
(read-only). If the Attribute
Definition says UPDATEABLE
, it drops to the Entity level
to determine if the Entity level Attribute Definition says it is
updateable. If the attribute is UPDATEABLE_WHILE_NEW
We check to see if the 'row' is new or not. (If this attribute comes
from an Entity Row, the 'row' is the Entity Row. Otherwise, the 'row'
is the View Row.) If the row is new, the attribute is updateable.
isAttributeUpdateable
in interface Row
isAttributeUpdateable
in class RowImpl
index
- the index of the attribute.
public StructureDef getStructureDef()
Row
getStructureDef
in interface Row
getStructureDef
in class RowImpl
public void entityCacheAdd()
protected void populate(java.sql.ResultSet resultSet)
Populate this row from the ResultSet.
This is a Framework-internal method. This method is used to fill in entity-attributes from a JDBC ResultSet that is returned by executeQuery().
Note that the method works on the current row of the result set and any currecy change on the ResultSet could throw it off. This method is protected to let sub-ViewRows fill in custom-entities created based on data.
For example, if fax is a subtype of doc and based on a column value, either doc is created or a fax is created for a given entity type, this method may be used to create entities based on the data values. Note that the developer needs to know exact position of values in the JDBC ResultSet.
resultSet
- the JDBC ResultSet containing the row data.protected void populateAttribute(int index, java.lang.Object value)
populateAttribute
in class RowImpl
protected void populateAttributeAsChanged(int index, java.lang.Object value)
public byte getNewRowState()
protected RowSet findAssociatedObjects(java.lang.String name)
name
- that defines the association
public int hashCode()
public boolean equals(java.lang.Object other)
other
- the object to which the ViewRowImpl should be compared.
public java.lang.String getXMLElementTag()
public final Node writeXML(long options, com.sun.java.util.collections.HashMap voAttrRules)
writeXML
in interface XMLInterface
writeXML
in class RowImpl
options
- a set of bit flags that will control the writeXML behavior.protected void appendXMLElementNodes(Document xmlDoc, Node node, int depthCount, long options, com.sun.java.util.collections.HashMap voAttrMap, AttributeDef[] attrs)
Override this method to perform custom XML-rendering on a Row.
xmlDoc
- name of the XML document where the node resides.node
- the name of the Row object node where new nodes will be appended.depthCount
- number of child levels deep to appendrow nodes.options
- a set of bit flags that will control the writeXML behavior.attrs
- an array of AttriubuteDefImpls.protected void appendXMLElementNodes(Document xmlDoc, Node node, int depthCount, long options, AttributeDefImpl[] attrs)
Override this method to perform custom XML-rendering on a Row.
xmlDoc
- name of the XML document where the node resides.node
- the name of the Row object node where new nodes will be appended.depthCount
- number of child levels deep to appendrow nodes.options
- a set of bit flags that will control the writeXML behavior.attrs
- an array of AttriubuteDefImpls.protected Element renderAttributeInXMLElement(Document xmlDoc, AttributeDefImpl ad, boolean explicitNull, byte version)
protected Element renderAttributeInXMLElement(Document xmlDoc, AttributeDefImpl ad, boolean explicitNull)
protected void readAttributeFromXMLElement(Node rowElt, AttributeDefImpl ad)
public final void readXML(Element rowElt, int depthCount)
remove()
on this row.
readXML
in interface XMLInterface
readXML
in class RowImpl
rowElt
- name of the XML element.depthCount
- the number of child levels deep to which data should be read.public void setNewRowState(byte state)
setNewRowState
in interface Row
setNewRowState
in class RowImpl
public java.lang.String getElementTagName()
getElementTagName
in interface oracle.jbo.common.xml.XmlSerializable
public void writeAsXml(oracle.jbo.common.xml.XmlOutput out, Node node, oracle.jbo.common.xml.Criteria rules)
writeAsXml
in interface oracle.jbo.common.xml.XmlSerializable
public void writeAsXml(oracle.jbo.common.xml.XmlOutput output, Node node, oracle.jbo.common.xml.Criteria rules, byte version)
|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.