com.stc.eindex.ejb.query
Interface ResultObjectAssembler

All Known Implementing Classes:
EOSearchResultAssembler, ObjectNodeAssembler, TupleAssembler

public interface ResultObjectAssembler

The ResultObjectAssembler interface contains the methods used to assemble the JDBC objects that result from a query. The relationship of these objects is defined in the ValueMetaNode class.The methods in this interface are called by the AssemblerEngine class (the QueryManager internal engine) as it iterates through the JDBC result sets. During the iteration, when a new root object is found, the assembler engine calls createRoot(). When objects other than root are found, the assembler engine calls createObjectAttributes(). This interface is a handler and a factory that creates composite value objects using the object name and specified attributes.


Method Summary
 java.lang.Object createObjectAttributes(java.lang.Object rootObject, java.lang.Object parent, java.lang.String objectName, AttributesData attrsData)
          Creates an object and binds its attributes to the object.
 java.lang.Object createRoot(java.lang.String objectName, AttributesData attrsData)
          Creates the root object for each object returned from the Query Manager iterator (QMIterator class).
 void init()
          Initializes the resources to be used by ResultObjectAssembler.
 

Method Detail

createObjectAttributes

public java.lang.Object createObjectAttributes(java.lang.Object rootObject,
                                               java.lang.Object parent,
                                               java.lang.String objectName,
                                               AttributesData attrsData)
                                        throws VOAException
Creates an object and binds its attributes to the object. This method may create a new object, and sets the attribute values for the new object to those in the input AttributesData object. createObjectAttributes also binds the new attributes object to the input parent object.

For example, if Parent.FirstName and Parent.Address.City are retrieved in one SQL query and three rows are retrieved (for example, there are three address cities to retrieve), the AssemblerEngine class (the Query Manager's internal assembling engine) invokes createRoot for the SBR and passes the attributes of the SBR retrieved in the rows. Then the assembler engine calls createObjectAttributes and passes the object name "Person" and the attributes of the Person object as parameters. This method creates the Person object, binds the Person attributes, and returns the Person object. For the Person object, createRoot and createObjectAttributes are only called once.

The Assembler Engine then calls createObjectAttributes three times, once for each row of Address information retrieved. The Address objects are then bound to the parent object created previously (in this case, the Person object).

Parameters:
rootObject - The name of the root object.
parent - The name of the parent object (this may be the same as the root object).
objectName - The name of the object, as defined in the Object Definition configuration file in the eView Project.
attrsData - - The attribute data associated with the object.
Returns:
Object - An object containing the attributes.
Throws:
VOAException - Thrown if an error occurs while creating the object attributes.

createRoot

public java.lang.Object createRoot(java.lang.String objectName,
                                   AttributesData attrsData)
                            throws VOAException
Creates the root object for each object returned from the Query Manager iterator (QMIterator class). Inside createRoot(), you can create initialization data structures that can later be used by the createObjectAttributes method.

Parameters:
objectName - The name of the root object.
attrsData - The attribute data associated with the root object.
Returns:
Object - The root object of the fields in the SQL statement.
Throws:
VOAException - Thrown if an error occurs while creating the root object.

init

public void init()
Initializes the resources to be used by ResultObjectAssembler. Call this method only once before starting the assembly process.

Parameters:
None.
Returns:
void - None.
Throws:
None.



Copyright 2007 by Sun Microsystems, Inc. All Rights Reserved.