|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jbo.server.NamedObjectImpl
oracle.jbo.server.ComponentObjectImpl
oracle.jbo.server.ContainerObjectImpl
oracle.jbo.server.ApplicationModuleImpl
public class ApplicationModuleImpl
An ApplicationModule is a logical container for coordinated objects related to a particular task, with optional programming logic
Field Summary | |
---|---|
static java.lang.Class |
CLASS_INSTANCE
|
static java.lang.String |
DEFAULT_DEF_NAME
Default Def name for Application Module. |
Fields inherited from class oracle.jbo.server.ContainerObjectImpl |
---|
mComponentList, mComponents |
Fields inherited from class oracle.jbo.server.NamedObjectImpl |
---|
mObjName, mParent, mProperties, mUserData, RES_ID_SUFFIX |
Constructor Summary | |
---|---|
ApplicationModuleImpl()
|
Method Summary | |
---|---|
byte[] |
activateState(int id,
SessionData info,
int flags)
|
byte[] |
activateStateForUndo(java.lang.String id,
int flags)
|
protected void |
addChild(ComponentObjectImpl object)
Internal: Applications should not use this method. |
void |
addWarning(JboWarning warn)
Specifies the name of the handler that will perform special processing of warnings on the client. |
void |
afterCommit(TransactionEvent e)
Called to report that a Commit operation has occurred. |
protected void |
afterConnect()
Invoked after the application module database connection has been established. |
void |
afterRemove(TransactionEvent e)
A cleanup routine to be invoked by transaction manager when this transaction listener is removed from the manager's list. |
void |
afterRollback(TransactionEvent e)
Called to report that a Rollback operation has occurred. |
protected void |
afterValidate(TransactionEvent te)
Callback from the transaction after completing a validation iteration. |
void |
beforeCommit(TransactionEvent e)
Called to report that a Commit operation is imminent. |
protected void |
beforeDisconnect()
Invoked before the application module database connection has been released. |
void |
beforeRollback(TransactionEvent e)
Called to report that a Rollback operation is imminent. |
void |
beforeSyncStart(SyncSession session)
|
protected void |
beforeValidate(TransactionEvent te)
Callback from the transaction before starting a validation iteration. |
void |
clearVOCaches(java.lang.String entityName,
boolean recurse)
Clears the caches of all View Objects that use the specified entity. |
static ApplicationModuleImpl |
createRootApplicationModule(java.lang.String defName)
|
ViewLink |
createViewLink(java.lang.String viewLinkName,
ViewLinkDefImpl info,
ViewObject master,
ViewObject detail,
boolean checkName)
Internal: Applications should not call this method. |
ViewObject |
createViewObject(java.lang.String voName,
java.lang.String vDefName)
Creates an updateable View Object. |
protected ViewObject |
createViewObject(java.lang.String voName,
ViewDefImpl viewDef)
|
ViewObject |
createViewObjectFromQueryClauses(java.lang.String voName,
java.lang.String eoName,
java.lang.String selectClause,
java.lang.String fromClause,
java.lang.String whereClause,
java.lang.String orderByClause)
Creates an updateable View Object. |
ViewObject |
createViewObjectOnEntity(java.lang.String voName,
java.lang.String eoName)
|
ApplicationModule |
findApplicationModule(java.lang.String amName)
Finds the named Application Module. |
static ApplicationModuleImpl |
findOrCreateAppModule(java.lang.String defName)
|
ViewLink |
findViewLink(java.lang.String vlName)
Finds the named View Link. |
ViewObject |
findViewObject(java.lang.String voName)
Finds the named View Object. |
ViewObject |
findViewObjectUsingEntity(ViewObject[] vos,
java.lang.String eoName,
java.lang.String[] attrNames)
|
void |
findVOsWithEntityUsage(java.lang.String entityName,
boolean recurse,
java.util.Vector vos)
|
java.lang.String[] |
getAllViewObjectNames()
Returns an array of the names of all the view objects this app module knows about, including ones that have not been loaded. |
ApplicationModuleDefImpl |
getApplicationModuleDef()
|
ApplicationModuleImpl[] |
getApplicationModuleImpls()
Internal: Applications should not use this method. |
DBTransaction |
getDBTransaction()
Gets this ApplicationModule's database transaction |
Row |
getEntityRowFromHandle(int eRowHandle)
Internal: Applications should not use this method. |
RowSetIterator |
getListBindingRSI(RowSetIterator rsi,
Key rowKey,
java.lang.String attrName,
java.lang.String lbName)
|
java.lang.String[] |
getLoadedViewObjectNames()
Returns an array of the names of all the view objects that have been loaded into this app module thus far. |
Session |
getSession()
Returns the session information. |
java.lang.Object |
getSyncLock()
Gets the locking object for this application module. |
Transaction |
getTransaction()
Gets this application module's database transaction. |
ViewLinkImpl[] |
getViewLinks()
|
ViewObject[] |
getViewObjects()
Constructs an array of this Application Module's View Objects. |
boolean |
isForRemote()
|
boolean |
isLoadComponentsLazily()
|
boolean |
isNameGenerated()
|
boolean |
isRoot()
|
boolean |
isTransientTransactionListener()
Tests whether this transaction listener is transient or permanent. |
java.lang.String |
passivateStateForUndo(java.lang.String id,
byte[] clientData,
int flags)
|
void |
remove()
Deletes this component. |
protected void |
removeChild(ComponentObjectImpl object)
Internal: Applications should not use this method. |
protected void |
reset()
BC4J invokes this method when a ApplicationModule is being reset for potential reuse by another client session. |
void |
resetState(boolean reload)
|
void |
resetState(int flags)
|
void |
setExceptionHandler(JboExceptionHandler hndlr)
Specifies the name of the handler which will perform special processing of the exceptions on the client. |
void |
setLoadComponentsLazily(boolean value)
|
void |
setRemoteAdapter(ApplicationModuleRemoteAdapter adapter)
|
void |
sync(SyncOptions options)
Synchronize local database(s) on device with remote database(s) on server. |
java.lang.Object[] |
transformExceptionParams(ViewObject[] inVOs,
java.lang.String entityDefName,
java.lang.String className,
java.lang.Object[] params)
Internal: Applications should not use this method. This method uses findViewObjectUsingEntity() to get the first view object that this entity is used in and then transforms the parameters from a given JboException from their entity layer equivalents to the view object equivalents. |
protected java.lang.Object[] |
transformExceptionParams(ViewObject vo,
java.lang.String entityDefName,
java.lang.String className,
java.lang.Object[] params)
Internal: Applications should not call this method. |
Methods inherited from class oracle.jbo.server.ContainerObjectImpl |
---|
addContainerListener, createComponentObject, findComponentObject, removeContainerListener |
Methods inherited from class oracle.jbo.server.ComponentObjectImpl |
---|
addListener, applyPersonalization, create, createRef, ensureVariableManager, getAllProperties, getApplicationModule, getCompListeners, getCompListenersList, getDefFullName, getDefName, getMessageBundleClass, getResourceBundleDef, getRootApplicationModule, getVariableManager, hasVariables, isDead, resolvePropertyRaw |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface oracle.jbo.ApplicationModule |
---|
createComponentObject, findComponentObject |
Methods inherited from interface oracle.jbo.ComponentObject |
---|
getDefFullName, getDefName, getFullName, getName |
Methods inherited from interface oracle.jbo.Properties |
---|
getProperties, getProperty, getProperty, refreshProperty |
Methods inherited from interface oracle.jbo.VariableManagerOwner |
---|
getName |
Field Detail |
---|
public static final java.lang.Class CLASS_INSTANCE
public static final java.lang.String DEFAULT_DEF_NAME
Constructor Detail |
---|
public ApplicationModuleImpl()
Method Detail |
---|
public static ApplicationModuleImpl findOrCreateAppModule(java.lang.String defName)
public static ApplicationModuleImpl createRootApplicationModule(java.lang.String defName)
public ApplicationModuleDefImpl getApplicationModuleDef()
public ViewObject createViewObject(java.lang.String voName, java.lang.String vDefName)
This method is useful for instantiating View Objects within a generic Application Module, but you can use it with any Application Module. The code calls createViewObject, passing in the name of the View Object metadata (that is, the name you provided for the View Object at design time) that defines the View Object and a View instance name to identify this instance. You can use this View instance name to find the View Object later, if needed.
// Specify the Java file that defines the View Object. // Format: package.filename String voDefFile = "d2e.DeptView"; // Identify the View Object. Must be a valid Java identifier. String voName = "demoDeptVO"; // Create the View Object within the context defined by the // Application Module. ViewObject vo = appMod.createViewObject(voName, voDefFile);
createViewObject
in interface ApplicationModule
voName
- the name to be given to the View Object. If empty, a name is generated.vDefName
- a view definition.
InvalidObjNameException
- if voName
is invalid.
NoObjException
- if voName
does not exist.protected ViewObject createViewObject(java.lang.String voName, ViewDefImpl viewDef)
public ViewObject findViewObject(java.lang.String voName)
voName
) may or may not be qualified
with the name of the containing Application Module. If it is, the View Object name is said to be
an AM-qualified View Object name. If not, the name is said to be
an unqualified View Object name.
An AM-qualified name is a multi-part name (separated by dots). The last part of the name is the View Object name (View Object
part of the name).
All preceding parts consistitute the name of the Application Module that contains the View Object. For an
AM-qualified name, findViewObject() first locates the containing Application Module using the
Application Module name. In fact, it uses findApplicationModule(String)
to find the Application Module.
Thus, the Application Module name in an AM-qualified View Object name may be relative or absolute Application
Module name. See findApplicationModule() discussions on absolute and relative Application Module names.
Once the Application Module is found, the View Object part is used to find the View Object in that Application
Module.
If the View Object name is unqualified, the search for the View Object is made on this Application Module.
For example, suppose we have the following containership of nested Application Modules and View Objects:
Root (root Application Module) ChildAM1 ViewObjectA GrandChildAM1_1 ViewObjectB GrandChildAM1_2 GreatGrandChildAM1_2_1 ViewObjectC ChildAM2 GrandChildAM2_1 ViewObjectD
ChildAM1.findViewObject("GrandChildAM1_2.GreatGrandChildAM1_2_1.ViewObjectC") will succeed (using relative Application Module name).
ChildAM2.findViewObject("Root.ChildAM1.GrandChildAM1_2.GreatGrandChildAM1_2_1.ViewObjectC") will succeed (using absolute Application Module name) and return the same View Object as ChildAM1.findViewObject("GrandChildAM1_2.GreatGrandChildAM1_2_1.ViewObjectC").
Both these are AM-qualified name cases.
GrandChildAM2_1.findViewObject("ViewObjectD") will succeed. This is is an unqualified name case.
For View Object searching, findViewObject() makes no distinction between View Objects included the Application Module during design time and those created programmatically during runtime.
Example code:
ViewObject vo = am.findViewObject("MyVO");
findViewObject
in interface ApplicationModule
voName
- the name of the View Object.
null
if the View Object is not found.
NoObjException
- if an AM-qualified name was specified and the containing Application Module could not be found.
InvalidObjNameException
- if voName
is an invalid name. voName
must be a vaild Java name.findApplicationModule(String)
,
findViewLink(String)
public java.lang.String[] getAllViewObjectNames()
ApplicationModule
getAllViewObjectNames
in interface ApplicationModule
public java.lang.String[] getLoadedViewObjectNames()
ApplicationModule
getLoadedViewObjectNames
in interface ApplicationModule
public DBTransaction getDBTransaction()
ApplicationModule
getDBTransaction
in interface ApplicationModule
public Transaction getTransaction()
ApplicationModule
If the user creates two root application modules, they normally do not share the transaction. To share a transaction acroos root application modules, the user would need to define a global transaction through JTA and have both application modules participate in it.
getTransaction
in interface ApplicationModule
public void remove()
ComponentObjectImpl
remove
in interface ComponentObject
remove
in class ComponentObjectImpl
public boolean isRoot()
public boolean isLoadComponentsLazily()
public void setLoadComponentsLazily(boolean value)
public Session getSession()
activate
call.
getSession
in interface ApplicationModule
java.lang.IllegalStateException
- if the session information cannot be found.#activate(Session)
public final java.lang.Object getSyncLock()
ApplicationModule
This locking object should be used to synchronize multiple calls into BC4J. The client application code rarely needs to worry about synchronization. It is the middle tier (the server) code that needs to synchronize calls into the middle tier to serialize updates to shared middle tier objects.
Here is an example of how to synchronize access using this method:
synchronized (am.getSyncLock()) { // Code that needs to execute serially. }
getSyncLock
in interface ApplicationModule
public ViewObject createViewObjectOnEntity(java.lang.String voName, java.lang.String eoName)
protected java.lang.Object[] transformExceptionParams(ViewObject vo, java.lang.String entityDefName, java.lang.String className, java.lang.Object[] params)
public void setExceptionHandler(JboExceptionHandler hndlr)
In typical use in three tier mode, a user enters values at the client. A user response, such as pressing the Return key or a Submit button, pushes the values to the server. The values are applied to the Entities and validated. Any exceptions that are thrown, are collected and shipped back to the client. Typically, exceptions are given, one-by-one, to the client. Instead, a handler can be specified to perform special processing of the exceptions.
hndlr
- an exception handler.public void addWarning(JboWarning warn)
addWarning
in interface WarningContainer
warn
- a warning.public java.lang.Object[] transformExceptionParams(ViewObject[] inVOs, java.lang.String entityDefName, java.lang.String className, java.lang.Object[] params)
ApplicationModule
transformExceptionParams
in interface ApplicationModule
inVOs
- an array of possible view objects.entityDefName
- fully qualified name of the entity object. Should not be null
.className
- Qualified classname for the Exception which is being mappedparams
- Parameters from the Exception that is to be transformed into view object equivalents.public ViewObject findViewObjectUsingEntity(ViewObject[] vos, java.lang.String eoName, java.lang.String[] attrNames)
public byte[] activateStateForUndo(java.lang.String id, int flags)
public byte[] activateState(int id, SessionData info, int flags)
public void findVOsWithEntityUsage(java.lang.String entityName, boolean recurse, java.util.Vector vos)
public ViewObject[] getViewObjects()
ViewObject[] vos = yourAM.getViewObjects(); for (j = 0; j < vos.length; j++) { vos[j].remove(); }
public ViewObject createViewObjectFromQueryClauses(java.lang.String voName, java.lang.String eoName, java.lang.String selectClause, java.lang.String fromClause, java.lang.String whereClause, java.lang.String orderByClause)
Use this method to build a View Object from SQL clauses. The View Object can be based on an Entity Object. For example, the following statement creates a View Object from attributes of the EMP Entity Object. Attributes related to EMP (such as E.ENAME) are updateable.
ViewObject v = appMod.createViewObjectFromQueryClauses("xyz", "demo.hr.EMP", // The one updateable Entity Object Name "E.ENAME, E.EMPNO", // select clause "EMP E", // from clause "E.DEPTNO = 10", // where clause null); // order by clause
voName
- the name to be given to the View Object.
If empty, a name is generated.eoName
- the name of the Entity Object from which the
View Object is to be derived.selectClause
- a SQL statement SELECT clause.fromClause
- a SQL statement FROM clause.whereClause
- a SQL statement WHERE clause.orderByClause
- a SQL statement ORDERBY clause.
InvalidParamException
- if voName
is invalid.
NameClashException
- if voName
already exists.public ApplicationModuleImpl[] getApplicationModuleImpls()
Creates an array of Application Modules.
public boolean isForRemote()
public void setRemoteAdapter(ApplicationModuleRemoteAdapter adapter)
public java.lang.String passivateStateForUndo(java.lang.String id, byte[] clientData, int flags)
protected void beforeValidate(TransactionEvent te)
te
- a transaction event.protected void afterValidate(TransactionEvent te)
te
- a transaction event.public ApplicationModule findApplicationModule(java.lang.String amName)
amName
) may be a single
part name or a multi-part name. If it is multi-part (separated by dots), each part from left represents the
containing (parent) Application Module.
Based on the name, findApplicationModule first tries to find the nested Application Module starting with this Application Module. If it finds a match, it returns it. In this case, the name is said to be relative.
If it does not find a match, it starts searching for the Application Module from the root Application Module. If it finds a match, it returns it. In this case, the name is said to be absolute.
For example, suppose we have the following containership of nested Application Modules:
Root (root Application Module) ChildAM1 GrandChildAM1_1 GrandChildAM1_2 GreatGrandChildAM1_2_1 ChildAM2 GrandChildAM2_1
If one calls findApplicationModule("GrandChildAM1_2") on ChildAM1, it will find it from ChildAM1 and return it.
If one calls findApplicationModule("GrandChildAM1_2.GreatGrandChildAM1_2_1") on ChildAM1, it will find it from ChildAM1 and return it.
Both these are relative name cases.
If one calls findApplicationModule("Root.ChildAM2.GrandChildAM2_1") on ChildAM1, it will first try to find it from ChildAM1. This will fail because ChildAM1 does not have a nested Application Module named Root. After that, the search begins from the root Application Module. This will succeed because Root has a nested Application Module named ChildAM2 and ChildAM2 in turn has a nested nested Application Module named GrandChildAM2_1. This is an absolute name case.
For Application Module searching, findApplicationModule() makes no distinction between nested Application Modules included in other Application Modules during design time and those created programmatically during runtime.
Example code:
ApplicationModule nestedAM = parentAM.findApplicationModule("MyNestedAM");
amName
- the name of the nested Application Module. It may be a relative name or an absolute name. If
null
, the root Application Module is returned.
null
if the Application Module is not found.
InvalidObjNameException
- if amName
is an invalid name. amName
must be a vaild Java name.public ViewLink findViewLink(java.lang.String vlName)
vlName
) may or may not be qualified with the name
of the containing Application Module. If it is, the View Link
name is said to be an AM-qualified View Link name. If not, the name
is said to be an unqualified View Link name.
An AM-qualified name is a multi-part name (separated by dots).
The last part of the name is the View Link name (View Link
part of the name). All preceding parts consistitute the name of
the Application Module that contains the View Link. For an AM-qualified
name, findViewLink() first locates the containing Application
Module using the Application Module name. In fact, it uses
findApplicationModule(String)
to find the Application
Module. Thus, the Application Module name in an AM-qualified View Link
name may be relative or absolute Application Module name.
See findApplicationModule() discussions on absolute
and relative Application Module names. Once
the Application Module is found, the View Link part is used to
find the View Link in that Application Module.
If the View Link name is unqualified, the search for the View Link is made on this Application Module.
For example, suppose we have the following containership of nested Application Modules and View Links:
Root (root Application Module) ChildAM1 ViewLinkA GrandChildAM1_1 ViewLinkB GrandChildAM1_2 GreatGrandChildAM1_2_1 ViewLinkC ChildAM2 GrandChildAM2_1 ViewLinkD
ChildAM1.findViewLink("GrandChildAM1_2.GreatGrandChildAM1_2_1.ViewLinkC") will succeed (using relative Application Module name).
ChildAM2.findViewLink("Root.ChildAM1.GrandChildAM1_2.GreatGrandChildAM1_2_1.ViewLinkC") will succeed (using absolute Application Module name) and return the same View Link as ChildAM1.findViewLink("GrandChildAM1_2.GreatGrandChildAM1_2_1.ViewLinkC").
Both these are AM-qualified name cases.
GrandChildAM2_1.findViewLink("ViewLinkD") will succeed. This is is an unqualified name case.
For View Link searching, findViewLink() makes no distinction between View Links included the Application Module during design time and those created programmatically during runtime.
Example code:
ViewLink vl = am.findViewLink("MyVL");
findViewLink
in interface ApplicationModule
vlName
- the name of the View Link.
null
if the View Link
is not found.
NoObjException
- if an AM-qualified name was specified and the
containing Application Module could not be found.
InvalidObjNameException
- if vlName
is an invalid name.
vlName
must be a vaild Java name.findApplicationModule(String)
,
findViewObject(String)
public Row getEntityRowFromHandle(int eRowHandle)
protected void addChild(ComponentObjectImpl object)
Adds names to this Application Module's own list of child components.
The child components can be View Objects, View Links,
or other Application Modules. This method overrides an internal
addChild method in
NamedObjectImpl
.
object
- an object to add to the component list.NamedObjectImpl
public void beforeCommit(TransactionEvent e)
TransactionListener
beforeCommit
in interface TransactionListener
e
- a transaction event.public void beforeRollback(TransactionEvent e)
TransactionListener
beforeRollback
in interface TransactionListener
e
- a transaction event.public void afterCommit(TransactionEvent e)
TransactionListener
afterCommit
in interface TransactionListener
e
- a transaction event.public void afterRollback(TransactionEvent e)
TransactionListener
afterRollback
in interface TransactionListener
e
- a transaction event.public void afterRemove(TransactionEvent e)
TransactionListener
afterRemove
in interface TransactionListener
e
- a transaction event.public boolean isTransientTransactionListener()
TransactionListener
Transient listeners are automatically removed at the end of a transaction commit or rollback cycle; permanent listeners remain across these cycles.
isTransientTransactionListener
in interface TransactionListener
true
if the listener is transient.protected void afterConnect()
public RowSetIterator getListBindingRSI(RowSetIterator rsi, Key rowKey, java.lang.String attrName, java.lang.String lbName)
protected void removeChild(ComponentObjectImpl object)
Removes names from this Application Module's own list of child components. The child components can be View
Objects, View Links, or other Application Modules. This method overrides an internal removeChild method in
NamedObjectImpl
.
object
- an object to remove from the component list.NamedObjectImpl
public ViewLink createViewLink(java.lang.String viewLinkName, ViewLinkDefImpl info, ViewObject master, ViewObject detail, boolean checkName)
Creates a View Link, given the View Link name, the Def name, and the names of the master and detail View Objects. You can use this method to dynamically create View Links.
For example, assume that during design time, you used the Design-Time View Object Wizard to create two View Objects, DeptVO and EmpVO inside of a package named package1. Then, assume that you invoked the View Link Wizard from the package node to create a View Link Definition named MyViewLinkDef, that links DeptVO and EmpVO in a master-detail relationship.
Given that you have the names of the View Link Definition and the master and detail View Objects, you can provide code such as the following that executes during runtime and creates a View Link named MyLink1:
ViewObject voDept = myAM.createViewObject("MyDept", "package1.DeptVO"); ViewObject voEmp = myAM.createViewObject("MyEmp", "package1.EmpVO"); ViewLink vl = myAM.createViewLink("MyLink1", "package1.MyViewLinkDef", voDept, voEmp);
This will set up a master-detail relationship between the voDept and the voEmp.
viewLinkName
- the name to be given to the View Link.
If empty, a name is generated.info
- the definition to be used to create the link.master
- the link's source View Object.detail
- the link's destination View Object.checkName
- whether to verify uniqueness of viewLinkName.
InvalidParamException
- if master
or detail
are invalid.
InvalidObjNameException
- if viewLinkName
is invalid.
NameClashException
- if viewLinkName
already exists.protected void beforeDisconnect()
protected void reset()
Examples of session ApplicationModule state include custom instance variables.
resetState(boolean)
public void resetState(boolean reload)
public void resetState(int flags)
public void clearVOCaches(java.lang.String entityName, boolean recurse)
clearCache()
on each View Object.
If entityName is null, then the caches of all View Objects in the Application Module are cleared. If recurse is true, it recurses into nested (child) Application Modules.
entityName
- name of the Entity Object that the View Objects use. Can be null.recurse
- true recurses to (child) Application Modules; false applies this method only to the
top-level Application Module.oracle.jbo.ViewObject#clearCache()
public ViewLinkImpl[] getViewLinks()
public final boolean isNameGenerated()
public void sync(SyncOptions options)
ApplicationModule
sync
in interface ApplicationModule
public void beforeSyncStart(SyncSession session)
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |