When you retrieve objects from the BI Beans Catalog, a default object factory instantiates an object and applies the XML from the Catalog to that object. By default, this object factory creates Java-client presentation beans.
In order to retrieve thin presentation beans from the Catalog, you must specify the class that the object factory should use when instantiating objects. To do this, you call the setObjectInstanceClassName
method of the ObjectFactory
object that the InitialPersistenceManager
or the MetadataManager
uses. To get the ObjectFactory
, you call the getObjectFactory
of the InitialPersistenceManager
or of the MetadataManager
.
The following code shows how to instruct the ObjectFactory to create thin presentation beans.
// manager is either the InitialPersistenceManager or the MetadataManager ObjectFactory factory = manager.getObjectFactory(false); // Register the ThinGraph, ThinCrosstab and ThinTable classes factory.setObjectInstanceClassName(PersistableConstants.GRAPH, "oracle.dss.thin.beans.graph.ThinGraph"); factory.setObjectInstanceClassName(PersistableConstants.CROSSTAB, "oracle.dss.thin.beans.crosstab.ThinCrosstab"); factory.setObjectInstanceClassName(PersistableConstants.TABLE, "oracle.dss.thin.beans.table.ThinTable");
To be able to save itself into the BI Beans Catalog, a thin presentation bean needs to fetch the root folder of the BI Beans Catalog. The folder is a BIContext
object. The view gets this folder from the value of the BIConstants.BICONTEXT_ATTR
property of the current HttpSession
, before the view's event handler is called.
The following code shows how to specify the root folder for a thin presentation bean, in the HttpSession
:
httpSession.putValue(BIConstants.BICONTEXT_ATTR, biContext);