Oracle Fusion Middleware extensions for Applications Core API Reference
11g Release 1 (11.1.1.6)

E22562-05

oracle.apps.fnd.applcore.oaext.model
Class OAUtility

java.lang.Object
  extended by oracle.apps.fnd.applcore.oaext.model.OAUtility

public final class OAUtility
extends java.lang.Object

Generic (utility) constants and functions such as comparing Dates and checking if two objects are equal. Other generic utility functions should be included here. All methods are static and do not need an instance of the class to use the methods.


Field Summary
static java.lang.String OC4J_CLASS
           
static java.lang.String RCS_ID
          RCS_ID.
static java.lang.String USE_APPLICATION_DB_ENV_INFO_PROVIDER
          The name of the session-scoped property indicating whether an EnvInfoProvider that sets the data source to ApplSession.APPLICATION_DB_DS should be used in createRootApplicationModule.
static java.lang.String WLS_CLASS
           
 
Constructor Summary
OAUtility()
           
 
Method Summary
static oracle.jbo.ApplicationModule createRootApplicationModule(java.lang.String appMod, java.lang.String configName)
          Creates a Root ApplicationModule.
static int executeCustomQueryForRowCount(java.lang.String query, oracle.jbo.server.DBTransaction txn)
           
static oracle.jbo.Row[] filterRow(oracle.jbo.ViewObject vo, java.util.Map<java.lang.String,java.lang.String> attrVal)
          A utility method to query a viewObject basing on given attribute-value pairs.
static oracle.jbo.Row[] filterRow(oracle.jbo.ViewObject vo, java.lang.String attr, java.lang.String value)
          Filters rows in memory for those Vo where we only need to scan in memory rows.
static java.sql.Connection getConnection()
          Returns the connection associated with the current session.
static java.sql.Connection getConnection(java.lang.String dataSourceName)
          Returns the connection associated with the data source specified by the parameter dataSourceName.
static java.lang.Long getDocSequence(java.lang.Long appId, java.lang.String categoryCode, java.lang.Long sobId, java.lang.String methodCode, java.sql.Timestamp txnDate, java.lang.Long seqVal, java.lang.String suppressWarn, java.lang.String suppressError, oracle.jbo.server.DBTransaction dbTxn)
          Deprecated.  
static java.lang.Long[] getDocSequenceValueWithId(java.lang.Long appId, java.lang.String categoryCode, java.lang.Long sobId, java.lang.String methodCode, java.sql.Timestamp txnDate, java.lang.Long seqVal, java.lang.String suppressWarn, java.lang.String suppressError, oracle.jbo.server.DBTransaction dbTxn)
          Utility API to get/validate document sequence from the database.
static java.sql.Connection getLWSConnection()
          Deprecated.  
static ApplSession getSession()
          Deprecated.  
static java.sql.Date getSQLDate(java.util.Date d, java.util.TimeZone tz)
          Constructs a java.sql.Date based on a java.util.Date by setting the hour, minute, second and millisecond to zero in the given time zone.
static java.lang.String getXSSessionAttribute(java.lang.String attrName, java.lang.String nameSpace)
          Deprecated.  
static java.lang.String getXSSessionAttributeInGlobalNameSpace(java.lang.String attrName)
          Deprecated.  
static java.lang.String getXSSessionAttributeInXSNameSpace(java.lang.String attrName)
          Deprecated.  
static java.io.Serializable invokeMethod(java.lang.String methodName, java.lang.Object obj)
          Allow arbitrary methods to be executed remotely without generating remote stubs.
static java.io.Serializable invokeMethod(java.lang.String methodName, java.io.Serializable[] methodParams, java.lang.Class[] methodParamTypes, java.lang.Object obj)
          In developement - to allow arbitrary methods to be executed remotely without generating remote stubs.
static java.io.Serializable invokeMethod(java.lang.String methodName, java.io.Serializable[] methodParams, java.lang.Object obj)
          Allows arbitrary methods to be executed remotely without generating remote stubs.
static boolean isEqual(java.lang.Object pObject1, java.lang.Object pObject2)
          Object comparator that returns true if both arguments point to the same object or if both args are null.
static boolean isInDateRange(java.sql.Timestamp pCheckDate, java.sql.Timestamp pStartDate, java.sql.Timestamp pEndDate)
          Checks if the first Timestamp is between or equal to the other Dates.
static boolean isNotEqual(java.lang.Object pObject1, java.lang.Object pObject2)
          Object comparator that returns false if both arguments point to the same object or if both args are null.
 boolean isRunningInJ2EEMode()
           
static void raiseDocSeqException(int status, oracle.jbo.server.DBTransaction dbTxn)
           
static void releaseRootApplicationModule(oracle.jbo.ApplicationModule am, boolean remove)
          Releases an application module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RCS_ID

public static final java.lang.String RCS_ID
RCS_ID.

See Also:
Constant Field Values

USE_APPLICATION_DB_ENV_INFO_PROVIDER

public static final java.lang.String USE_APPLICATION_DB_ENV_INFO_PROVIDER
The name of the session-scoped property indicating whether an EnvInfoProvider that sets the data source to ApplSession.APPLICATION_DB_DS should be used in createRootApplicationModule.

The value must be null, "true" or "false".

See Also:
createRootApplicationModule(java.lang.String, java.lang.String), Constant Field Values

OC4J_CLASS

public static final java.lang.String OC4J_CLASS
See Also:
Constant Field Values

WLS_CLASS

public static final java.lang.String WLS_CLASS
See Also:
Constant Field Values
Constructor Detail

OAUtility

public OAUtility()
Method Detail

isEqual

public static boolean isEqual(java.lang.Object pObject1,
                              java.lang.Object pObject2)
Object comparator that returns true if both arguments point to the same object or if both args are null.

Parameters:
pObject1 - object to compare.
pObject2 - object to compare with.
Returns:
true if the objects are equal.

isNotEqual

public static boolean isNotEqual(java.lang.Object pObject1,
                                 java.lang.Object pObject2)
Object comparator that returns false if both arguments point to the same object or if both args are null.

Parameters:
pObject1 - object to compare.
pObject2 - object to compare with.
Returns:
true if the objects are not equal.

isInDateRange

public static boolean isInDateRange(java.sql.Timestamp pCheckDate,
                                    java.sql.Timestamp pStartDate,
                                    java.sql.Timestamp pEndDate)
Checks if the first Timestamp is between or equal to the other Dates. Accepts null for pStartDate and/or pEndDate.

Parameters:
pCheckDate - The date to check if it is in range.
pStartDate - The beginning of the range to check.
pEndDate - The end of the range to check.
Returns:
true if pCheckDate is between the start and end date (inclusive).

invokeMethod

public static java.io.Serializable invokeMethod(java.lang.String methodName,
                                                java.lang.Object obj)
Allow arbitrary methods to be executed remotely without generating remote stubs. This signature of invokeMethod() can be used when the method being invoked has no parameters. Note - the return type must be Serializable.

Parameters:
methodName - the name of the method being invoked.
obj - the object being invoked.
Returns:
whatever the method returns.

invokeMethod

public static java.io.Serializable invokeMethod(java.lang.String methodName,
                                                java.io.Serializable[] methodParams,
                                                java.lang.Object obj)
Allows arbitrary methods to be executed remotely without generating remote stubs. Assumes that all parameters to the method being invoked are Strings. Note - the return type must be Serializable.

Parameters:
methodName - the name of the method being invoked.
methodParams - the parameters to the method in order.
obj - the object being invoked.
Returns:
whatever the method returns.

invokeMethod

public static java.io.Serializable invokeMethod(java.lang.String methodName,
                                                java.io.Serializable[] methodParams,
                                                java.lang.Class[] methodParamTypes,
                                                java.lang.Object obj)
In developement - to allow arbitrary methods to be executed remotely without generating remote stubs. Note - the return type must be Serializable.

Parameters:
methodName - the name of the method being invoked.
methodParams - the parameters to the method in order.
methodParamTypes - the Class of the parameter.
obj - the object being invoked.
Returns:
whatever the method returns.

getSQLDate

public static java.sql.Date getSQLDate(java.util.Date d,
                                       java.util.TimeZone tz)
Constructs a java.sql.Date based on a java.util.Date by setting the hour, minute, second and millisecond to zero in the given time zone. This is to conform with SQL DATE.

When two java.sql.Date objects are compared by invoking the method equals, the two objects may not be equal if they have been "normalized" in diffrent time zones.

Parameters:
d - the instance of java.util.Date
tz - the time zone in which the hour, minute, second and millisecond should be set to zero
Returns:
an instance of java.sql.Date

getSession

public static ApplSession getSession()
Deprecated. 

returns the Session associated with the current thread of execution. Note that a previous flavor of this API returned Session object from xs package, which has been removed.

Returns:
Session instance associated with the current thread.
See Also:
ApplSessionUtil.getSession()

getLWSConnection

public static java.sql.Connection getLWSConnection()
Deprecated. 

Returns the Connection associated with the current ApplSession.

Returns:
Connection instance associated with the cuurent ApplSession.
See Also:
ApplSessionUtil.getConnection()

getConnection

public static java.sql.Connection getConnection()
Returns the connection associated with the current session.

Returns:
Connection instance associated with session.
See Also:
ApplSessionUtil.getConnection()

getConnection

public static java.sql.Connection getConnection(java.lang.String dataSourceName)
Returns the connection associated with the data source specified by the parameter dataSourceName.

Parameters:
dataSourceName - Name of the data source.
Returns:
Connection instance associated with dataSourceName.

getXSSessionAttributeInGlobalNameSpace

public static java.lang.String getXSSessionAttributeInGlobalNameSpace(java.lang.String attrName)
Deprecated. 

This method is a convenience method that returns the value associated with the requested attribute name in XS$GLOBAL_VAR namespace in the LWSession associated with the current thread of execution. This method has been deprecated as XS is no longer used, please do not use it.

Parameters:
attrName - Name of the attribute to be looked up.
Returns:
Value associated with the attrName attribute in LWSession in XS$GLOBAL_VAR namespace.
See Also:
ApplSessionUtil.getNamespaceAttribute(String namespaceName, String attrName)

getXSSessionAttributeInXSNameSpace

public static java.lang.String getXSSessionAttributeInXSNameSpace(java.lang.String attrName)
Deprecated. 

This method is a convenience method that returns the value associated with the requested attribute name in XS$SESSION namespace in the LWSession associated with the current thread of execution. This method has been deprecated as XS is no longer used, please do not use it.

Parameters:
attrName - Name of the attribute to be looked up.
Returns:
Value associated with the attrName attribute in LWSession in XS$SESSION namespace.
See Also:
ApplSessionUtil.getSessionAttribute(String name)

getXSSessionAttribute

public static java.lang.String getXSSessionAttribute(java.lang.String attrName,
                                                     java.lang.String nameSpace)
Deprecated. 

This method is a convenience method that returns the value associated with the requested attribute name in the specified name space in the LWSession associated with the current thread of execution. This method has been deprecated as XS is no longer used, please do not use it.

Parameters:
attrName - Name of the attribute to be looked up.
nameSpace - Name space in which to look up the attribute.
Returns:
Value associated with the attrName attribute in LWSession in XS$SESSION namespace.
See Also:
ApplSessionUtil.getNamespaceAttribute(String namespaceName, String attrName), ApplSessionUtil.getSessionAttribute(String name)

createRootApplicationModule

public static oracle.jbo.ApplicationModule createRootApplicationModule(java.lang.String appMod,
                                                                       java.lang.String configName)
Creates a Root ApplicationModule. It tries to create the ApplicationModule using Configuration.createRootApplicationModule(). If it cannot create one using Configuration.createRootApplicationModule(), due to the absence of a connection, it will attempt to manually connec the AM using a connection from either the global, non-app-specific DataSource or a file containing connetion properties specified by the property APPCONNFILE. Typically in J2EE scenarios, or when run using JDev, Configuration class can resolve the connection from the env, but in JUnit or J2SE like scenarios, it cannot. If the API is called by code running in a JMX thread, the java:comp/env DataSource will not resolve, so an attempt is made to use the global jdbc/ DataSource in its place. If the application is run from a command line like while running the JUnit tests as part of a build, set an enironment variable "APPCONNFILE", specifying the location of DB configuration file The DB configuration file should have the following properties set DB_NAME = Database SID DB_PORT = Database Port DB_HOST = Server Name DB_USERNAME = Database user DB_PASSWORD = password eg: DB_NAME=atgfsfwk DB_PORT=1545 DB_HOST=stbcy02-4.us.oracle.com DB_USERNAME=apps DB_PASSWORD=apps

Parameters:
appMod - the package qualified application module definition name
configName - the name ofthe configuration
Returns:
ApplicationModule instance of the root ApplicationModule

getDocSequence

public static java.lang.Long getDocSequence(java.lang.Long appId,
                                            java.lang.String categoryCode,
                                            java.lang.Long sobId,
                                            java.lang.String methodCode,
                                            java.sql.Timestamp txnDate,
                                            java.lang.Long seqVal,
                                            java.lang.String suppressWarn,
                                            java.lang.String suppressError,
                                            oracle.jbo.server.DBTransaction dbTxn)
Deprecated. 

Utility API to get/validate document sequence from the database.

Parameters:
appId - Application Id
categoryCode - Document Sequence Category Code
sobId - Ledger Id to use for this Document Sequence.
methodCode - Document sequence Method Code (Automatic ("A"), Manual ("M") or null for both modes).
txnDate - Document Transaction Date
seqVal - Document Sequence Value to use in Manual Mode
suppressWarn - Suppress warning (Y/N/null)
suppressError - Suppress Error (valid values are Y/N/null)
Returns:
Document Sequence Value
See Also:
getDocSequenceValueWithId(java.lang.Long, java.lang.String, java.lang.Long, java.lang.String, java.sql.Timestamp, java.lang.Long, java.lang.String, java.lang.String, oracle.jbo.server.DBTransaction)

getDocSequenceValueWithId

public static java.lang.Long[] getDocSequenceValueWithId(java.lang.Long appId,
                                                         java.lang.String categoryCode,
                                                         java.lang.Long sobId,
                                                         java.lang.String methodCode,
                                                         java.sql.Timestamp txnDate,
                                                         java.lang.Long seqVal,
                                                         java.lang.String suppressWarn,
                                                         java.lang.String suppressError,
                                                         oracle.jbo.server.DBTransaction dbTxn)
Utility API to get/validate document sequence from the database.

Parameters:
appId - Application Id
categoryCode - Document Sequence Category Code
sobId - Ledger Id to use for this Document Sequence.
methodCode - Document sequence Method Code (Automatic ("A"), Manual ("M") or null for both modes).
txnDate - Document Transaction Date
seqVal - Document Sequence Value to use in Manual Mode
suppressWarn - Suppress warning (Y/N/null)
suppressError - Suppress Error (valid values are Y/N/null)
Returns:
Document Sequence Value (in 0th position) and Document Sequence id (in 1st position) as an array.

raiseDocSeqException

public static void raiseDocSeqException(int status,
                                        oracle.jbo.server.DBTransaction dbTxn)

isRunningInJ2EEMode

public boolean isRunningInJ2EEMode()

releaseRootApplicationModule

public static void releaseRootApplicationModule(oracle.jbo.ApplicationModule am,
                                                boolean remove)
Releases an application module.

Parameters:
am - the application module to be released
remove - true if this application module should be removed from the pool. Applicable only if the application module was created by oracle.jbo.client.Configuration

filterRow

public static oracle.jbo.Row[] filterRow(oracle.jbo.ViewObject vo,
                                         java.lang.String attr,
                                         java.lang.String value)
Filters rows in memory for those Vo where we only need to scan in memory rows.

Parameters:
vo - viewObject
attr - an attribute of the viewObject
value - value for this attribute
Returns:
filtered rows

filterRow

public static oracle.jbo.Row[] filterRow(oracle.jbo.ViewObject vo,
                                         java.util.Map<java.lang.String,java.lang.String> attrVal)
A utility method to query a viewObject basing on given attribute-value pairs. It will create viewCriteria on the fly by using attribute-value pairs.

Parameters:
vo - viewObject
attrVal - attribute-value paires
Returns:
fitered rows

executeCustomQueryForRowCount

public static int executeCustomQueryForRowCount(java.lang.String query,
                                                oracle.jbo.server.DBTransaction txn)

Oracle Fusion Middleware extensions for Applications Core API Reference
11g Release 1 (11.1.1.6)

E22562-05

Copyright © 2012 Oracle. All Rights Reserved.