Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

oracle.jbo.server
Class ViewDefImpl

java.lang.Object
  extended byoracle.jbo.common.NamedObjectImpl
      extended byoracle.jbo.mom.DefinitionObject
          extended byoracle.jbo.server.DefObject
              extended byoracle.jbo.server.RowDef
                  extended byoracle.jbo.server.ViewDefImpl
All Implemented Interfaces:
StructureDef
Direct Known Subclasses:
EJBEntityDefImpl

public class ViewDefImpl
extends RowDef
implements StructureDef

ViewDefImpl is the meta-object for View Object instances. It describes the View Object's structure.

A View Def can be created either through XML loading or programmatically. For the former, the client is expected to generate the XML file from design-time and make the file accessible from the classpath. When the client asks MetaObjectManager for the View Def, it finds the XML file, opens it, parses it, and builds a View Def from it.

When creating a View Def programmatically, the client is expected to start with

    ViewDefImpl viewDef = new ViewDefImpl("MyViewDef");
 

where "MyViewDef" is the name by which the View Def will identified by MetaObjectManager. This is the name that the client should pass when an API requires a View Def name, e.g., the defName parameter to ApplicationModule.createViewObject(String, String).

After instantiating the View Def, the client adds entity usages, attributes, etc. Then, he must resolve the definition object through resolveDefObject() and regsiter it with MetaObjectManager through RowDef.registerDefObject(). For a View Def created from an XML file, the client does not need to call these methods, as the framework calls them itself.

Here is an example code snippet:

    ViewDefImpl viewDef = new ViewDefImpl("MyViewDef");

    viewDef.addEntityUsage("MyEmpUsage", "testp.kava.VO3.si03mt.Emp",
                           false);  // false means it's not refOnly

    viewDef.setComponentClass(null);  // take the default ViewObjectImpl
    viewDef.setRowClass(null);  // take the default ViewRowImpl
    viewDef.setSelectClause("EmpUsage.EMPNO, EmpUsage.ENAME, EmpUsage.JOB, EmpUsage.DEPTNO");
    viewDef.setFromClause("EMP EmpUsage");

    viewDef.addEntityAttribute("MyEmpNum", "MyEmpUsage", "EmpNum", true);  // true is for persistent
    viewDef.addEntityAttribute("MyEmpName", "MyEmpUsage", "EmpName", true);
    viewDef.addEntityAttribute("MyEmpJob", "MyEmpUsage", "EmpJob", true);
    viewDef.addEntityAttribute("MyEmpDeptNum", "MyEmpUsage", "EmpDeptNum", true);

    viewDef.resolveDefObject();
    viewDef.registerDefObject();
 


Field Summary
 
Fields inherited from class oracle.jbo.server.RowDef
mComponentClass
 
Fields inherited from class oracle.jbo.mom.DefinitionObject
mBaseDefObject, mExtendedDefObjects, mObjectResolved
 
Fields inherited from class oracle.jbo.common.NamedObjectImpl
mFullName, mObjName, mParent, mProperties
 
Constructor Summary
protected ViewDefImpl()
          Constructs a ViewDefImpl.
  ViewDefImpl(java.lang.String name)
          Constructs a ViewDefImpl.
 
Method Summary
 void addAllEntityAttributes(java.lang.String entityUsageName)
           
 AttributeDefImpl addEntityAttribute(java.lang.String attrName, java.lang.String entityUsageName, java.lang.String entityAttrName, boolean isPersistent)
           
 void addEntityUsage(java.lang.String usageName, java.lang.String entityDefName, boolean referenceOnly)
          Deprecated. since 9.0.3, use addEntityUsage() that takes readOnly flag as well.
 void addEntityUsage(java.lang.String usageName, java.lang.String entityDefName, boolean referenceOnly, boolean readOnly)
           
 void addEntityUsage(java.lang.String usageName, java.lang.String entityDefName, boolean referenceOnly, boolean readOnly, java.lang.String assocName, java.lang.String assocEndName, java.lang.String srcUsageName)
           
 void addEntityUsage(java.lang.String usageName, java.lang.String entityDefName, boolean referenceOnly, java.lang.String assocName, java.lang.String assocEndName, java.lang.String srcUsageName)
          Deprecated. since 9.0.3, use addEntityUsage() that takes readOnly flag as well.
 AttributeDefImpl addViewAttribute(java.lang.String attrName, java.lang.String expression, java.lang.Class javaType)
           
 AttributeDef findAttributeDef(java.lang.String attrName)
          Get an attribute definition by the attribute name.
static ViewDefImpl findDefObject(java.lang.String viewDefName)
          Finds the ViewDefImpl from the list of Meta Objects.
protected  void finishedLoading()
           
 int getAttributeCount()
          Returns the number of defined attributes.
 AttributeDef getAttributeDef(int index)
          Gets an attribute definition, given its index.
protected  AttributeDefImpl[] getAttributeDefImpls()
          Gets an array of attribute definitions in this View Def.
 AttributeDef[] getAttributeDefs()
          Gets an array of attribute definitions in this View Def.
 int getCalculatedAttributeCount()
           
 java.lang.Class getComponentClass()
           
protected  java.lang.String getEffectiveRowClientProxyClassName()
           
 java.lang.String getEJBAppProviderURL()
           
 java.lang.Object getEJBHome()
           
 java.lang.String getEJBHomeJNDIName()
           
protected  EntityReference getEntityReference(int index)
           
protected  EntityReference getEntityReference(java.lang.String name)
          Returns the EntityReference of the given name.
protected  EntityReference[] getEntityReferences()
          Returns an array of EntityReference's upon which this ViewObject is based.
 byte getFetchMode()
          Get the fetch mode for rows from the query.
 short getFetchSize()
          Get the size of the fetch.
 java.lang.String getFromClause()
           
 int getIterMode()
           
 int getMaxActiveNodes()
           
static int getMaxAttrConst(java.lang.String viewDefName)
           
 int getMaxFetchSize()
           
 int getMaxRowsPerNode()
           
 java.lang.String getOrderByClause()
           
 java.lang.String getQuery()
          Returns the query set via setQuery or via expert mode query at designtime.
 java.lang.String getQueryHint()
           
 java.lang.Class getRowClass()
           
 java.lang.String getRowClientProxyClassName()
           
 java.lang.String getRowInterfaceName()
           
 java.lang.String getSelectClause()
           
protected  StmtWithBindVars getWhereClause(int noBindVars)
           
 java.lang.String getXMLElementTag()
           
 java.lang.String getXMLRowElementTag()
           
protected  boolean hasPrimaryEntity()
           
 boolean hasQuery()
           
protected  boolean isDynamic()
           
 boolean isFinderView()
           
 boolean isFullSql()
           
 boolean isManageRowsByKey()
           
 boolean isPassivationEnabled()
           
 boolean isUseGlueCode()
           
 boolean isViewLinkAccessorRetained()
           
protected  void loadCustomDef(oracle.jbo.mom.xml.DefElementImpl xmlElement)
           
 AttributeDef lookupAttributeDef(java.lang.String attrName)
          Gets an attribute definition by name.
 void resolveDefObject()
          Resolves this View Def.
protected  void resolveReferences()
          Since this gets called from lazyload
 void setComponentClass(java.lang.Class componentClass)
           
 void setFetchMode(byte fetchMode)
          Set the fetch mode for rows from the query.
 void setFetchSize(short size)
          Set the size of the fetch.
 void setFromClause(java.lang.String fromClause)
           
 void setFullSql(boolean b)
           
 void setIterMode(int iterMode)
           
 void setMaxActiveNodes(int maxActiveNodes)
           
 void setMaxFetchSize(int size)
          Set the maximum number of rows to fetch during query processing.
 void setMaxRowsPerNode(int maxRowsPerNode)
           
 void setOrderByClause(java.lang.String orderByClause)
           
 void setQuery(java.lang.String query)
          Sets the string for a user-defined query.
 void setQueryHint(java.lang.String queryHint)
           
 void setRowClass(java.lang.Class rowClass)
           
protected  void setRowClientProxyClassName(java.lang.String name)
           
protected  void setRowInterfaceName(java.lang.String name)
           
 void setSelectClause(java.lang.String selectClause)
           
 void setUseGlueCode(boolean b)
           
 void setViewLinkAccessorRetained(boolean b)
           
 void setWhereClause(java.lang.String whereClause)
           
 
Methods inherited from class oracle.jbo.server.RowDef
discrValuesQualify, findDefForDiscrValues, getAliasName, getAttributeIndexOf, getBaseDefObject, getBindingStyle, getClientProxyClassName, getComponentInterfaceName, getDefFullName, getDefName, getDiscrColumns, getEffectiveClientProxyClassName, getEffectiveComponentInterfaceName, getMessageBundleClass, getPackageDef, getPackageName, loadProperties, registerDefObject, setAliasName, setBaseDefObject, setBindingStyle, setClientProxyClassName, setComponentInterfaceName, setDiscrColumns, setMessageBundleClass, setName, setParent
 
Methods inherited from class oracle.jbo.mom.DefinitionObject
addExtendedDefObject, getContainerDef, getContainerName, getExtendedDefObjects, hasExtendedDefObjects, isBaseDefFor, isDynamicDefinitionObject, isObjectResolved, setObjectResolved
 
Methods inherited from class oracle.jbo.common.NamedObjectImpl
getFullName, getName, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, refreshProperty, setFullName, setPropertiesMap, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.jbo.StructureDef
getAttributeIndexOf, getDefFullName, getDefName, getFullName, getName
 

Constructor Detail

ViewDefImpl

protected ViewDefImpl()
Constructs a ViewDefImpl.


ViewDefImpl

public ViewDefImpl(java.lang.String name)
Constructs a ViewDefImpl. This constructor should be used when creating a View Def programmatically. See above for further discussion.

Parameters:
name - name by which this View Def will be registered in MetaObjectManager.
Method Detail

findDefObject

public static ViewDefImpl findDefObject(java.lang.String viewDefName)
Finds the ViewDefImpl from the list of Meta Objects.

Returns:
The View definition object corresponding to the specified name.
See Also:
MetaObjectManager

getMaxAttrConst

public static int getMaxAttrConst(java.lang.String viewDefName)

getAttributeDefImpls

protected AttributeDefImpl[] getAttributeDefImpls()
Gets an array of attribute definitions in this View Def.

Specified by:
getAttributeDefImpls in class RowDef
Returns:
an array of attribute definitions.

getAttributeDefs

public AttributeDef[] getAttributeDefs()
Gets an array of attribute definitions in this View Def.

Specified by:
getAttributeDefs in interface StructureDef
Specified by:
getAttributeDefs in class RowDef
Returns:
an array of attribute definitions.

findAttributeDef

public AttributeDef findAttributeDef(java.lang.String attrName)
Get an attribute definition by the attribute name.

Specified by:
findAttributeDef in interface StructureDef
Specified by:
findAttributeDef in class RowDef
Parameters:
attrName - name of the attribute.
Returns:
the attribute definition.
Throws:
NoDefException - thrown if the named atribute is not found.

lookupAttributeDef

public AttributeDef lookupAttributeDef(java.lang.String attrName)
Gets an attribute definition by name.

Specified by:
lookupAttributeDef in interface StructureDef
Specified by:
lookupAttributeDef in class RowDef
Parameters:
attrName - the name of an AttributeDef.
Returns:
an attribute definition, or null if not found.

getEntityReferences

protected EntityReference[] getEntityReferences()
Returns an array of EntityReference's upon which this ViewObject is based. Each EntityReference refers to EntityDef that describes the Entity.

Returns:
the EntityReference array.

isManageRowsByKey

public boolean isManageRowsByKey()

getEntityReference

protected EntityReference getEntityReference(java.lang.String name)
Returns the EntityReference of the given name. name is the Entity usage name of this ViewObject's Entity base.

If no matching EntityReference is found, it returns null.

Parameters:
name - the Entity usage name.
Returns:
the EntityReference. null if no matching Entity usage is found.

getEntityReference

protected EntityReference getEntityReference(int index)
Returns:
The EntityReference of the given index.

getQuery

public java.lang.String getQuery()
Returns the query set via setQuery or via expert mode query at designtime. Returns null otherwise.


setQuery

public void setQuery(java.lang.String query)
Sets the string for a user-defined query. Note that the flag isFullSql is set to true if this call is used to set a non-null value. If the parameter is null, then the isFullSql flag is set to false, so that the component parts of the SQL can be set with the setSelectClause(), setFromClause(), and setWhereClause() methods.


setQueryHint

public void setQueryHint(java.lang.String queryHint)

getQueryHint

public java.lang.String getQueryHint()

getCalculatedAttributeCount

public int getCalculatedAttributeCount()
Returns:
Count of calculated attributes

getAttributeCount

public int getAttributeCount()
Description copied from interface: StructureDef
Returns the number of defined attributes.

Specified by:
getAttributeCount in interface StructureDef
Specified by:
getAttributeCount in class RowDef
Returns:
The number of attributes.

getAttributeDef

public AttributeDef getAttributeDef(int index)
Description copied from interface: StructureDef
Gets an attribute definition, given its index.

Specified by:
getAttributeDef in interface StructureDef
Specified by:
getAttributeDef in class RowDef
Parameters:
index - the index of an AttributeDef, where the leftmost attribute has index zero.
Returns:
an attribute definition.

setRowClass

public void setRowClass(java.lang.Class rowClass)
Parameters:
rowClass - The Class of the instance.

getRowClass

public java.lang.Class getRowClass()
Specified by:
getRowClass in class RowDef
Returns:
The Class of the instance.

getRowClientProxyClassName

public java.lang.String getRowClientProxyClassName()

setRowClientProxyClassName

protected void setRowClientProxyClassName(java.lang.String name)

getRowInterfaceName

public java.lang.String getRowInterfaceName()

setRowInterfaceName

protected void setRowInterfaceName(java.lang.String name)

getEffectiveRowClientProxyClassName

protected java.lang.String getEffectiveRowClientProxyClassName()

setComponentClass

public void setComponentClass(java.lang.Class componentClass)
Parameters:
componentClass - The Class of the instance.

getComponentClass

public java.lang.Class getComponentClass()
Returns:
the Class of the reference object.

getSelectClause

public java.lang.String getSelectClause()
Returns:
The SELECT list

setSelectClause

public void setSelectClause(java.lang.String selectClause)
Parameters:
selectClause - The SELECT list

getFromClause

public java.lang.String getFromClause()
Returns:
The FROM clause

setFromClause

public void setFromClause(java.lang.String fromClause)
Parameters:
fromClause - The FROM clause

getWhereClause

protected StmtWithBindVars getWhereClause(int noBindVars)
Returns:
The WHERE clause

setWhereClause

public void setWhereClause(java.lang.String whereClause)
Parameters:
whereClause - The WHERE clause

getOrderByClause

public java.lang.String getOrderByClause()
Returns:
The ORDER BY clause

setOrderByClause

public void setOrderByClause(java.lang.String orderByClause)
Parameters:
orderByClause - The ORDER BY clause

getFetchMode

public byte getFetchMode()
Get the fetch mode for rows from the query. The value returned will be FETCH_AS_NEEDED or FETCH_ALL.

Returns:
FETCH_AS_NEEDED or FETCH_ALL.

setFetchMode

public void setFetchMode(byte fetchMode)
Set the fetch mode for rows from the query. The valid modes are FETCH_AS_NEEDED an FETCH_ALL, or FETCH_DEFAULT. FETCH_AS_NEEDED will only fetch the number of rows requested whilst FETCH_ALL will pull all of the rows from the database and close out the cursor. Currently FETCH_DEFAULT is equivalent to FETCH_AS_NEEDED. At some point this may be changed to default to some system-level default.

Parameters:
fetchMode - is FETCH_AS_NEEDED, FETCH_ALL or FETCH_DEFAULT.

getFetchSize

public short getFetchSize()
Get the size of the fetch.

Returns:
the size, in rows, of the chunk to fetch.

setFetchSize

public void setFetchSize(short size)
Set the size of the fetch. ViewRowSets of the query are returned in chunks. This method permits the setting of the size of these chunks.

Parameters:
size - the size, in rows, of the chunk to fetch.

getMaxFetchSize

public int getMaxFetchSize()

setMaxFetchSize

public void setMaxFetchSize(int size)
Set the maximum number of rows to fetch during query processing. When the maximum number of rows has been fetched, the query is closed and no more rows are returned. Setting a value of 0 means that there is no maximum to the number of rows fetched.

Parameters:
size - the number of rows.

isUseGlueCode

public boolean isUseGlueCode()

setUseGlueCode

public void setUseGlueCode(boolean b)

setMaxRowsPerNode

public void setMaxRowsPerNode(int maxRowsPerNode)

getMaxRowsPerNode

public int getMaxRowsPerNode()

setMaxActiveNodes

public void setMaxActiveNodes(int maxActiveNodes)

getMaxActiveNodes

public int getMaxActiveNodes()

hasPrimaryEntity

protected boolean hasPrimaryEntity()
Returns:
true if the View Object has primary Entity base.

finishedLoading

protected void finishedLoading()

resolveReferences

protected void resolveReferences()
Since this gets called from lazyload


resolveDefObject

public void resolveDefObject()
Resolves this View Def. It resolves attribute definitions with its entity bases.

This method must be called after the View Def is set up and before registerDefObject().

Specified by:
resolveDefObject in class RowDef

addAllEntityAttributes

public void addAllEntityAttributes(java.lang.String entityUsageName)

addEntityAttribute

public AttributeDefImpl addEntityAttribute(java.lang.String attrName,
                                           java.lang.String entityUsageName,
                                           java.lang.String entityAttrName,
                                           boolean isPersistent)

addViewAttribute

public AttributeDefImpl addViewAttribute(java.lang.String attrName,
                                         java.lang.String expression,
                                         java.lang.Class javaType)

addEntityUsage

public void addEntityUsage(java.lang.String usageName,
                           java.lang.String entityDefName,
                           boolean referenceOnly,
                           java.lang.String assocName,
                           java.lang.String assocEndName,
                           java.lang.String srcUsageName)
Deprecated. since 9.0.3, use addEntityUsage() that takes readOnly flag as well.


addEntityUsage

public void addEntityUsage(java.lang.String usageName,
                           java.lang.String entityDefName,
                           boolean referenceOnly,
                           boolean readOnly,
                           java.lang.String assocName,
                           java.lang.String assocEndName,
                           java.lang.String srcUsageName)

addEntityUsage

public void addEntityUsage(java.lang.String usageName,
                           java.lang.String entityDefName,
                           boolean referenceOnly)
Deprecated. since 9.0.3, use addEntityUsage() that takes readOnly flag as well.


addEntityUsage

public void addEntityUsage(java.lang.String usageName,
                           java.lang.String entityDefName,
                           boolean referenceOnly,
                           boolean readOnly)

isFullSql

public boolean isFullSql()

setFullSql

public void setFullSql(boolean b)

isDynamic

protected boolean isDynamic()

isPassivationEnabled

public final boolean isPassivationEnabled()

loadCustomDef

protected void loadCustomDef(oracle.jbo.mom.xml.DefElementImpl xmlElement)
                      throws PersistenceException
Throws:
PersistenceException

hasQuery

public boolean hasQuery()

getXMLRowElementTag

public java.lang.String getXMLRowElementTag()

getXMLElementTag

public java.lang.String getXMLElementTag()

getIterMode

public int getIterMode()

setIterMode

public void setIterMode(int iterMode)

isViewLinkAccessorRetained

public boolean isViewLinkAccessorRetained()

setViewLinkAccessorRetained

public void setViewLinkAccessorRetained(boolean b)

getEJBHomeJNDIName

public java.lang.String getEJBHomeJNDIName()

getEJBAppProviderURL

public java.lang.String getEJBAppProviderURL()

isFinderView

public boolean isFinderView()

getEJBHome

public java.lang.Object getEJBHome()

Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

 

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