Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.1.0)

E17483-02

oracle.jbo.domain
Class Struct

java.lang.Object
  extended by oracle.jbo.domain.Struct
All Implemented Interfaces:
java.io.Serializable, AttributeList, BlobDomainInterface, DomainInterface, DomainOwnerInterface, LobInterface, MarshalledDomain, MutableDomainInterface, XMLDomainInterface, oracle.jdbc.internal.ObjectData, ORAData

public abstract class Struct
extends java.lang.Object
implements LobInterface, DomainOwnerInterface, XMLDomainInterface, AttributeList, ORAData, java.io.Serializable, MarshalledDomain

This class provides a lightweight wrapper for oracle.sql.STRUCT, the Java representation of the Struct database type. This wrapper allows an instance of the oracle.sql.STRUCT to be used as a domain object.

The oracle.jbo.domain.StructDomain class is the Java representation of the underlying database type that you must use if you want to exploit the domain feature of Business Components for Java.

Since:
JDeveloper 3.0
See Also:
Serialized Form

Field Summary
protected  XMLDomainFactory[] mAttrXmlFac
          Factories for each of the attibutes if they have one.
protected  java.lang.Object mConnection
          Internal: Applications should not use this field.
protected  java.util.HashMap mContext
          Internal: Applications should not use this field.
protected  java.lang.Object mData
          Internal: Applications should not use this field.
protected  int mOwnerAttrIndex
          Index of the attribute in the domain owner's container.
protected  Transaction mTxn
          Internal: Applications should not use this field.
protected  XMLDomainFactory mXmlFac
          The factory object that creates an instance of this STRUCT given an XML element.
 
Constructor Summary
protected Struct()
          Constructs an instance of this class.
protected Struct(Datum d)
          Internal: Applications should not use this constructor.
 
Method Summary
 int[] buildAttrSQLTypes()
          Returns an array of the SQL datatypes of the attributes in this StructDomain object.
 void domainToBeModified(DomainInterface d)
          Notification method that this domain calls whenever any of its attribute values are about to be modified.
 boolean equals(java.lang.Object obj)
          Tests this for equality with another object.
static void fillObjectAttributeDefs(AttributeList al, StructureDef def, java.lang.String[] attrNames, AttributeDef[] ads)
           
 java.lang.Object getAttribute(int index)
          Returns the attribute from this StructDomain object, given its index.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the attribute from this StructDomain object, given its name.
 int getAttributeCount()
          Returns the number of attributes in this StructDomain object.
 int getAttributeIndexOf(java.lang.String name)
          Returns the index of a named attribute in this StructDomain object.
 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.
abstract  ORADataFactory[] getAttrORADataFactories()
          Returns factories that oracle.sql requires to create the attributes of this structure.
abstract  int[] getAttrSQLTypes()
          Returns the SQL types for the attributes of the structure.
protected  java.lang.String getAttrXMLElementTag(AttributeDef ad)
          Returns the class name of this domain, appended with the name of the attribute as xml-element tag for this domain-attribute.
abstract  java.lang.String getColumnType()
          Returns the column type of the database column that corresponds to this STRUCT.
 java.lang.Object getData()
          Internal: Applications should not use this method.
 DomainOwnerInterface getOwner()
          Returns the reference to owner of this domain (could be the row that this domain instance belongs to.)
 int getOwnerAttributeIndex()
           
protected  DomainOwnerInterface getOwnerRow()
           
 java.lang.String getRemoteIdString()
           
 long getSize()
           
static java.lang.Object getStructAttribute(AttributeList inAttrList, StructureDef inStructDef, java.lang.String fullAttrName)
           
abstract  StructureDef getStructureDef()
          Returns the structure definition, that describes the details of the attributes, of this domain.
 Node getXMLContentNode(Document xmlDoc)
          Creates the xml node in the given xml document for this domain's data.
static XMLDomainFactory getXMLDomainFactory(java.lang.Class attrClass)
          Internal: Applications should not use this method.
protected  java.lang.String getXMLElementTag()
          Returns this class name as xml-element tag for this Struct domain object.
 int hashCode()
          Computes a hash code for this StructDomain object.
protected  void initAttrXMLDomainFactories(AttributeDef[] attrs)
          Internal: Applications should not use this method.
protected abstract  void initStructureDef()
          Initializes the structure definition of this object and its attribute definitions.
protected  boolean isAttrXMLCData(AttributeDef ad)
          Returns false always.
 void loadFromDatabase(Transaction transaction)
          Internal: Applications should not use this method.
 ResponseValues marshal()
           
 void prepareForDML(java.lang.Object context)
          Internal: Applications should not use this method.
 java.lang.String printXMLDefinition(java.util.Hashtable allDefs, java.io.PrintWriter pw, boolean bContainees)
          Prints the DTD info for this domain in the given print writer.
protected  void readAttrsFromXML(Element rowElt)
          Reads all the attribute values from the xml-element and sets them into this row.
static StructureDef resolveAndGetStructureDef(java.lang.Class objectDomainClz)
           
 void saveToDatabase(Transaction transaction)
          Internal: Applications should not use this method.
 void saveToDatabase(Transaction transaction, java.lang.Object postedSQLObject)
          Internal: Applications should not use this method.
 void setAttribute(int index, java.lang.Object value)
          Sets the value of an attribute in this StructDomain, at the given index position.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Sets the value of an attribute in this StructDomain object, given the attributes's name.
 void setAttributeNoCheck(int index, java.lang.Object value)
          Sets the value of an attribute in this StructDomain object, at the given index position.
 void setContext(DomainOwnerInterface owner, Transaction trans, java.lang.Object ctx)
          Internal: Applications should not use this method.
static void setStructAttribute(AttributeList inAttrList, StructureDef inStructDef, java.lang.String fullAttrName, java.lang.Object value)
           
 void syncClientLob(LobInterface old)
          Synchronize client-side data from the given lob
 void syncServerLob(LobInterface old)
          Synchronize the streams from an older version of this object so that this version works with the opened streams (if any).
 Datum toDatum(java.sql.Connection conn)
          Internal: Applications should not use this method.
 java.lang.String toString()
          Internal: Applications should not use this method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mData

protected java.lang.Object mData
Internal: Applications should not use this field.


mConnection

protected java.lang.Object mConnection
Internal: Applications should not use this field.


mTxn

protected Transaction mTxn
Internal: Applications should not use this field.


mContext

protected java.util.HashMap mContext
Internal: Applications should not use this field.


mOwnerAttrIndex

protected int mOwnerAttrIndex
Index of the attribute in the domain owner's container.


mXmlFac

protected XMLDomainFactory mXmlFac
The factory object that creates an instance of this STRUCT given an XML element.


mAttrXmlFac

protected XMLDomainFactory[] mAttrXmlFac
Factories for each of the attibutes if they have one.

Constructor Detail

Struct

protected Struct()
          throws java.sql.SQLException
Constructs an instance of this class.

Throws:
java.sql.SQLException

Struct

protected Struct(Datum d)
          throws java.sql.SQLException
Internal: Applications should not use this constructor.

Parameters:
d - a datum object.
Throws:
java.lang.SQLException
java.sql.SQLException
Method Detail

getColumnType

public abstract java.lang.String getColumnType()
Returns the column type of the database column that corresponds to this STRUCT.

Returns:
the column type as a String.

getStructureDef

public abstract StructureDef getStructureDef()
Returns the structure definition, that describes the details of the attributes, of this domain.

Returns:
the structure definition as a StructureDef object.

getAttrSQLTypes

public abstract int[] getAttrSQLTypes()
Returns the SQL types for the attributes of the structure.


getAttrORADataFactories

public abstract ORADataFactory[] getAttrORADataFactories()
Returns factories that oracle.sql requires to create the attributes of this structure.


initStructureDef

protected abstract void initStructureDef()
Initializes the structure definition of this object and its attribute definitions.


resolveAndGetStructureDef

public static StructureDef resolveAndGetStructureDef(java.lang.Class objectDomainClz)

getData

public java.lang.Object getData()
Internal: Applications should not use this method.

Converts this to a Struct JDBC object.

Specified by:
getData in interface DomainInterface
Returns:
the JDBC representation of this, or null, if the conversion fails.

domainToBeModified

public void domainToBeModified(DomainInterface d)
Notification method that this domain calls whenever any of its attribute values are about to be modified. This Domain should always notify its owner.

Specified by:
domainToBeModified in interface DomainOwnerInterface
Parameters:
d - the domain being modified.

setContext

public void setContext(DomainOwnerInterface owner,
                       Transaction trans,
                       java.lang.Object ctx)
Internal: Applications should not use this method.

Specified by:
setContext in interface DomainInterface

equals

public boolean equals(java.lang.Object obj)
Tests this for equality with another object.

The argument is converted to a STRUCT object, if necessary.

Overrides:
equals in class java.lang.Object
Parameters:
obj - an arbitrary Object.
Returns:
true if conversion was successful and the converted argument is identical to this.

hashCode

public int hashCode()
Computes a hash code for this StructDomain object.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this StructDomain object.

toString

public java.lang.String toString()
Internal: Applications should not use this method.

For testing purposes only. Converts this Struct object to a text representation.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this Struct object.

toDatum

public Datum toDatum(java.sql.Connection conn)
              throws java.sql.SQLException
Internal: Applications should not use this method.

Converts this Struct Domain object back into an SQL STRUCT object.

Specified by:
toDatum in interface ORAData
Parameters:
conn - OracleConnection Not used.
Returns:
A Datum containing STRUCT object.
Throws:
java.sql.SQLException - Never.

getAttribute

public java.lang.Object getAttribute(int index)
Returns the attribute from this StructDomain object, given its index.

Specified by:
getAttribute in interface AttributeList
Parameters:
index - index for the attribute in the StructDomain object.
Returns:
an attribute as an Object type.

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the attribute from this StructDomain object, given its name.

Specified by:
getAttribute in interface AttributeList
Parameters:
name - name for the attribute in the StructDomain object.
Returns:
an attribute as an Object type.

setAttribute

public void setAttribute(int index,
                         java.lang.Object value)
Sets the value of an attribute in this StructDomain, at the given index position.

Specified by:
setAttribute in interface AttributeList
Parameters:
index - index for the attribute in the StructDomain object.
value - value for the attribute.

getRemoteIdString

public java.lang.String getRemoteIdString()
Specified by:
getRemoteIdString in interface LobInterface

setAttributeNoCheck

public void setAttributeNoCheck(int index,
                                java.lang.Object value)
Sets the value of an attribute in this StructDomain object, at the given index position.

Parameters:
index - index for the attribute in the StructDomain object.
value - value for the attribute.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Sets the value of an attribute in this StructDomain object, given the attributes's name.

Specified by:
setAttribute in interface AttributeList
Parameters:
name - name of the attribute in the StructDomain object.
value - value for the attribute.

getAttributeCount

public int getAttributeCount()
Returns the number of attributes in this StructDomain object.

Specified by:
getAttributeCount in interface AttributeList
Returns:
the number of attributes as an int.

getAttributeIndexOf

public int getAttributeIndexOf(java.lang.String name)
Returns the index of a named attribute in this StructDomain object.

Specified by:
getAttributeIndexOf in interface AttributeList
Parameters:
name - name of an attribute in this StructDomain object.
Returns:
the index of the named attribute as an int.

buildAttrSQLTypes

public int[] buildAttrSQLTypes()
Returns an array of the SQL datatypes of the attributes in this StructDomain object.

Returns:
an array of SQL datatypes.

marshal

public ResponseValues marshal()
Specified by:
marshal in interface MarshalledDomain

getXMLElementTag

protected java.lang.String getXMLElementTag()
Returns this class name as xml-element tag for this Struct domain object. Override this method to return a custom xml-element tag for this domain.


getAttrXMLElementTag

protected java.lang.String getAttrXMLElementTag(AttributeDef ad)
Returns the class name of this domain, appended with the name of the attribute as xml-element tag for this domain-attribute. Override this method to return a custom xml-element tag for the given attribute.

Parameters:
ad - the name of an AttributeDef.

isAttrXMLCData

protected boolean isAttrXMLCData(AttributeDef ad)
Returns false always. Override to determine whether the given domain-attribute is to be rendered in CDATA format in xml.

Parameters:
ad - name of an AttributeDef.

getXMLContentNode

public Node getXMLContentNode(Document xmlDoc)
Creates the xml node in the given xml document for this domain's data.

Specified by:
getXMLContentNode in interface XMLDomainInterface
Parameters:
xmlDoc - name of the XML document in which the node should be created.

readAttrsFromXML

protected void readAttrsFromXML(Element rowElt)
Reads all the attribute values from the xml-element and sets them into this row. If the xml has a process instruction of the form: then, invokes remove() on this row.


printXMLDefinition

public java.lang.String printXMLDefinition(java.util.Hashtable allDefs,
                                           java.io.PrintWriter pw,
                                           boolean bContainees)
Prints the DTD info for this domain in the given print writer. Returns the DTD string to be added to this domain's container entity/domain.

The allDefs hashtable contains predefined XML definitions and is passed by whatever calls this method.

Specified by:
printXMLDefinition in interface XMLDomainInterface
Parameters:
allDefs - a hashtable of predefined XML definitions passed from whatever calls this method.
pw - print writer into which the defnition is being printed.
bContainees - if true, prints definitions of contained objects.

getXMLDomainFactory

public static XMLDomainFactory getXMLDomainFactory(java.lang.Class attrClass)
Internal: Applications should not use this method.


initAttrXMLDomainFactories

protected void initAttrXMLDomainFactories(AttributeDef[] attrs)
Internal: Applications should not use this method.


loadFromDatabase

public void loadFromDatabase(Transaction transaction)
                      throws java.lang.Exception
Internal: Applications should not use this method.

Loads the actual data of the LOB-type database attribute into memory.

The transaction argument is needed to perform an additional query into the database to extract the data.

This method does not need to be invoked for a new attribute.

Specified by:
loadFromDatabase in interface BlobDomainInterface
Parameters:
transaction - the DBTransactionImpl of the current Application Module.
Throws:
java.lang.Exception

saveToDatabase

public void saveToDatabase(Transaction transaction)
                    throws java.lang.Exception
Internal: Applications should not use this method.

Saves data in memory to a database LOB-type attribute.

The transaction argument is is needed to perform an additional query into the database to write the data.

This method does not need to be invoked if this attribute's data has not changed.

Specified by:
saveToDatabase in interface BlobDomainInterface
Parameters:
transaction - the DBTransactionImpl instance of the current Application Module.
Throws:
java.lang.Exception

saveToDatabase

public void saveToDatabase(Transaction transaction,
                           java.lang.Object postedSQLObject)
                    throws java.lang.Exception
Internal: Applications should not use this method.

Uses the given transaction context to store data back into the database using the LOB-locator which should be set before this method is invoked.

Specified by:
saveToDatabase in interface BlobDomainInterface
Throws:
java.lang.Exception

prepareForDML

public void prepareForDML(java.lang.Object context)
Description copied from interface: BlobDomainInterface
Internal: Applications should not use this method.

Specified by:
prepareForDML in interface BlobDomainInterface

syncClientLob

public void syncClientLob(LobInterface old)
Description copied from interface: LobInterface
Synchronize client-side data from the given lob

Specified by:
syncClientLob in interface LobInterface

syncServerLob

public void syncServerLob(LobInterface old)
Description copied from interface: LobInterface
Synchronize the streams from an older version of this object so that this version works with the opened streams (if any).

Specified by:
syncServerLob in interface LobInterface

getOwner

public DomainOwnerInterface getOwner()
Description copied from interface: LobInterface
Returns the reference to owner of this domain (could be the row that this domain instance belongs to.)

Specified by:
getOwner in interface LobInterface

getOwnerAttributeIndex

public int getOwnerAttributeIndex()
Specified by:
getOwnerAttributeIndex in interface LobInterface

getOwnerRow

protected DomainOwnerInterface getOwnerRow()

getSize

public long getSize()
Specified by:
getSize in interface LobInterface

setStructAttribute

public static void setStructAttribute(AttributeList inAttrList,
                                      StructureDef inStructDef,
                                      java.lang.String fullAttrName,
                                      java.lang.Object value)

getStructAttribute

public static java.lang.Object getStructAttribute(AttributeList inAttrList,
                                                  StructureDef inStructDef,
                                                  java.lang.String fullAttrName)

fillObjectAttributeDefs

public static void fillObjectAttributeDefs(AttributeList al,
                                           StructureDef def,
                                           java.lang.String[] attrNames,
                                           AttributeDef[] ads)

getAttributeNames

public java.lang.String[] getAttributeNames()
Description copied from interface: AttributeList
Returns an array of attribute names in this list.

Specified by:
getAttributeNames in interface AttributeList
Returns:
an array of attribute names.

getAttributeValues

public java.lang.Object[] getAttributeValues()
Description copied from interface: AttributeList
Returns an array of attribute values in this list.

Specified by:
getAttributeValues in interface AttributeList
Returns:
an array of attribute values.

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.1.0)

E17483-02

Copyright © 1997, 2011, Oracle. All rights reserved.