programming is an art, a form of expression only the logic side of our brain could appreciate
Tuesday, January 25, 2011
Monday, January 24, 2011
VARCHAR parameter input for SPEL
I have this PLSQL function that determines if an attribute will be readonly or not. It returns a VARCHAR2 type with value that is either TRUE or FALSE.
cursor builder
Apparently when you set 'TRUE' or 'FALSE' on a Boolean attribute type inside a ViewObject, OAF will automatically convert the String value to the corresponding Boolean object (hmm autoboxing? not quite =w=;;)
SPEL configuration for read only attribute
still working @w@;;
cursor builder
Apparently when you set 'TRUE' or 'FALSE' on a Boolean attribute type inside a ViewObject, OAF will automatically convert the String value to the corresponding Boolean object (hmm autoboxing? not quite =w=;;)
SPEL configuration for read only attribute
still working @w@;;
Getting the Alias of a View Object Attribute
there was a time that I needed to map View Object attributes' DB column names with attribute names. However when you define a transient attribute, there will be no column name defined for it - so I resorted using the alias. Even if an attribute is not mapped to SQL the alias attribute will always be accessible.
the critical thing to note is that when you use the OAViewObject.getAttributeDefs() method, you will get an AttributeDef array which doesn't outright define the alias attribute. You need to cast it back to a ViewAttributeDefImpl object in order to make the method getAliasName() available.
the critical thing to note is that when you use the OAViewObject.getAttributeDefs() method, you will get an AttributeDef array which doesn't outright define the alias attribute. You need to cast it back to a ViewAttributeDefImpl object in order to make the method getAliasName() available.
Sunday, January 23, 2011
OAF Best Practices (Error / Exception Handling)
A. Catching Exceptions
Catch exceptions within the controllers. When exceptions occur inside the application module, throw it back using
which means you also need to register your Exception messages in Oracle Apps
something like this @w@;; but I think you could do away with the catch block, unless you wanted to do something before the OAException object is finally thrown back to the controller.
B. Logging the Errors
syntax: pageContext.writeDiagnostics(String module, String messageText, int logLevel)
where the parameter module could be getClass.getName() + ".processFormRequest" (or ".processRequest"), so it will dynamically print out the class name regardless where you call it.
message could be any String I guess @w@ use it with discretion. (limited to 4000 characters according to the documentation)
logLevel value could be referenced from OAFwkConstants (just noticed Fwk = framework @w@). So in cases you want to log Excpetion details, use OAFwkConstants.EXCEPTION which is numerically equivalent to 4.
in the example syntax, I used an instance of OAPageContext which is available for controllers. If in case you want to log things inside the application module you need to use an instance of OADBTransaction which has the same method.
sources:
The Digital Space
Catch exceptions within the controllers. When exceptions occur inside the application module, throw it back using
which means you also need to register your Exception messages in Oracle Apps
something like this @w@;; but I think you could do away with the catch block, unless you wanted to do something before the OAException object is finally thrown back to the controller.
B. Logging the Errors
syntax: pageContext.writeDiagnostics(String module, String messageText, int logLevel)
where the parameter module could be getClass.getName() + ".processFormRequest" (or ".processRequest"), so it will dynamically print out the class name regardless where you call it.
message could be any String I guess @w@ use it with discretion. (limited to 4000 characters according to the documentation)
logLevel value could be referenced from OAFwkConstants (just noticed Fwk = framework @w@). So in cases you want to log Excpetion details, use OAFwkConstants.EXCEPTION which is numerically equivalent to 4.
in the example syntax, I used an instance of OAPageContext which is available for controllers. If in case you want to log things inside the application module you need to use an instance of OADBTransaction which has the same method.
sources:
The Digital Space
Thursday, January 20, 2011
Wednesday, January 19, 2011
FND_GLOBAL
SELECT FND_GLOBAL.EMPLOYEE_ID
FROM DUAL
EMPLOYEE_ID - Return employee id of current user. Employee_id is a foreign key to PER_PEOPLE_F.PERSON_ID
CREATE OR REPLACE PACKAGE "FND_GLOBAL"
"The server-side package APPS.FND_GLOBAL returns the values of system globals, such as the login/signon or "session" type of values. You should not use FND_GLOBAL routines in your forms (that is on the client side). On the client side, most of the procedures in the FND_GLOBAL package are replaced by a user profile option with the same (or a similar) name. You should use FND_PROFILE routines in your forms instead." (from package documentation)
- in a sense this package must only be used on server side context
- a facility for accessing environment / DB session variables
- global variables, profile values, security context
procedure APPS_INITIALIZE(user_id in number, resp_id in number, resp_appl_id in number);
used for applications which are not directly integrated with Oracle Applications and need to establish environment variables for it's DB session
Sets up global variables and profile values in a database session. Call this procedure to initialize the global security context for a database session.This routine should only be used when a session must be established outside of a normal form or concurrent program connection. (from package documentation)
function list:
function USER_ID return number;
function RESP_ID return number;
function RESP_APPL_ID return number;
function SECURITY_GROUP_ID return number;
function USER_NAME return varchar2;
function RESP_NAME return varchar2;
function APPLICATION_NAME return varchar2;
function APPLICATION_SHORT_NAME return varchar2;
function LOGIN_ID return number;
function CONC_LOGIN_ID return number;
function PROG_APPL_ID return number;
function CONC_PROGRAM_ID return number;
function CONC_REQUEST_ID return number;
function CONC_PRIORITY_REQUEST return number;
function PER_BUSINESS_GROUP_ID return number;
function PER_SECURITY_PROFILE_ID return number;
function LANGUAGE_COUNT return number;
function CURRENT_LANGUAGE return varchar2;
function BASE_LANGUAGE return varchar2;
function RT_TEST_ID return number;
function SECURITY_GROUP_ID_POLICY(d1 varchar2, d2 varchar2) return varchar2;
function AUDIT_ACTIVE return BOOLEAN;
function Lookup_Security_Group(lookup_type in varchar2, view_application_id in number) return number;
function Get_Session_Context return number;
function Compare_Session_Context(context_id in number) return boolean;
function Assert_No_Pool return boolean;
function EMPLOYEE_ID return number;
function CUSTOMER_ID return number;
function SUPPLIER_ID return number;
function FORM_ID return number;
function FORM_APPL_ID return number;
function CONC_PROCESS_ID return number;
function CONC_QUEUE_ID return number;
function QUEUE_APPL_ID return number;
function SESSION_ID return number;
function SERVER_ID return number;
function ORG_ID return number;
function ORG_NAME return varchar2;
function PARTY_ID return number;
function NLS_LANGUAGE return varchar2;
function NLS_NUMERIC_CHARACTERS return varchar2;
function NLS_DATE_FORMAT return varchar2;
function NLS_DATE_LANGUAGE return varchar2;
function NLS_TERRITORY return varchar2;
function NLS_SORT return varchar2;
sources:
murthy
appsbi
todo: expound v0.3
FROM DUAL
EMPLOYEE_ID - Return employee id of current user. Employee_id is a foreign key to PER_PEOPLE_F.PERSON_ID
CREATE OR REPLACE PACKAGE "FND_GLOBAL"
"The server-side package APPS.FND_GLOBAL returns the values of system globals, such as the login/signon or "session" type of values. You should not use FND_GLOBAL routines in your forms (that is on the client side). On the client side, most of the procedures in the FND_GLOBAL package are replaced by a user profile option with the same (or a similar) name. You should use FND_PROFILE routines in your forms instead." (from package documentation)
- in a sense this package must only be used on server side context
- a facility for accessing environment / DB session variables
- global variables, profile values, security context
procedure APPS_INITIALIZE(user_id in number, resp_id in number, resp_appl_id in number);
used for applications which are not directly integrated with Oracle Applications and need to establish environment variables for it's DB session
Sets up global variables and profile values in a database session. Call this procedure to initialize the global security context for a database session.This routine should only be used when a session must be established outside of a normal form or concurrent program connection. (from package documentation)
function list:
function USER_ID return number;
function RESP_ID return number;
function RESP_APPL_ID return number;
function SECURITY_GROUP_ID return number;
function USER_NAME return varchar2;
function RESP_NAME return varchar2;
function APPLICATION_NAME return varchar2;
function APPLICATION_SHORT_NAME return varchar2;
function LOGIN_ID return number;
function CONC_LOGIN_ID return number;
function PROG_APPL_ID return number;
function CONC_PROGRAM_ID return number;
function CONC_REQUEST_ID return number;
function CONC_PRIORITY_REQUEST return number;
function PER_BUSINESS_GROUP_ID return number;
function PER_SECURITY_PROFILE_ID return number;
function LANGUAGE_COUNT return number;
function CURRENT_LANGUAGE return varchar2;
function BASE_LANGUAGE return varchar2;
function RT_TEST_ID return number;
function SECURITY_GROUP_ID_POLICY(d1 varchar2, d2 varchar2) return varchar2;
function AUDIT_ACTIVE return BOOLEAN;
function Lookup_Security_Group(lookup_type in varchar2, view_application_id in number) return number;
function Get_Session_Context return number;
function Compare_Session_Context(context_id in number) return boolean;
function Assert_No_Pool return boolean;
function EMPLOYEE_ID return number;
function CUSTOMER_ID return number;
function SUPPLIER_ID return number;
function FORM_ID return number;
function FORM_APPL_ID return number;
function CONC_PROCESS_ID return number;
function CONC_QUEUE_ID return number;
function QUEUE_APPL_ID return number;
function SESSION_ID return number;
function SERVER_ID return number;
function ORG_ID return number;
function ORG_NAME return varchar2;
function PARTY_ID return number;
function NLS_LANGUAGE return varchar2;
function NLS_NUMERIC_CHARACTERS return varchar2;
function NLS_DATE_FORMAT return varchar2;
function NLS_DATE_LANGUAGE return varchar2;
function NLS_TERRITORY return varchar2;
function NLS_SORT return varchar2;
sources:
murthy
appsbi
todo: expound v0.3
Tuesday, January 18, 2011
Mapping Application Short Name to Application Name
For some reason, the APPLICATION_SHORT_NAME and APPLICATION_NAME of registered applications in R12 are stored in separate DB tables : FND_APPLICATION and FND_APPLICATION_TL
R12 Workflow Notifications Status Monitor
Most of the time it takes a longer time to receive workflow notifications from the email server - so it's better to check them using the R12 administration pages.
under the System Administrator menu, you'll find the Workflow : Administrator Workflow > Status Monitor link
search for your workflow notfication by supplying the paramters
select an entry and click on the Activity History button
on the lower part of the Activity History screen, click the Notification icon
you'll finally able to view the contents of the generated notification email
under the System Administrator menu, you'll find the Workflow : Administrator Workflow > Status Monitor link
search for your workflow notfication by supplying the paramters
select an entry and click on the Activity History button
on the lower part of the Activity History screen, click the Notification icon
you'll finally able to view the contents of the generated notification email
R12 Responsibilities (OAF)
encountering an error like this means that your user profile doesn't have the assigned responsibility needed to access the page. You can view a responsibility as R12's version of user groups that define which users can access menus, pages, etc of the application.
tbc
tbc
Sunday, January 16, 2011
Manual Implementation of Train Navbar Buttons - OAF
pointers:
- take note of OAWebBeanConstants.DESTINATION_ATTR (formerly URL - which was deprecated).
- set retainAM parameter to "true"
- take note of OAWebBeanConstants.DESTINATION_ATTR (formerly URL - which was deprecated).
- set retainAM parameter to "true"
Thursday, January 13, 2011
Wednesday, January 12, 2011
Downloading Files in OAF
OAF doesn't readily expose the Controller Servlet's HttpRequest and HttpResponse objects so you need to extract it from the OAPageContext object via:
HttpServletResponse response = (HttpServletResponse) pageContext.getRenderingContext().getServletResponse();
Once you get the response object you could already manipulate its OutputStream.
public void downloadFile(OAPageContext pageContext) {
HttpServletResponse response = (HttpServletResponse) pageContext.getRenderingContext().getServletResponse();
File fileToDownload = this.createFile();
String fileType = getMimeType("txt");
response.setContentType(fileType);
response.setContentLength((int) fileToDownload.length());
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileToDownload.getName() + "\"");
InputStream in = null;
ServletOutputStream outs = null;
try {
outs = response.getOutputStream();
in = new BufferedInputStream(new FileInputStream(fileToDownload));
int ch;
while ((ch = in.read()) != -1) {
outs.write(ch);
}
} catch (IOException e) {
// TODO
e.printStackTrace();
} finally {
try {
outs.flush();
outs.close();
if (in != null) {
in.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
However, manipulating the response object will flag OAF for back navigation so you might want to handle this - if you are actively checking this event.
HttpServletResponse response = (HttpServletResponse) pageContext.getRenderingContext().getServletResponse();
Once you get the response object you could already manipulate its OutputStream.
public void downloadFile(OAPageContext pageContext) {
HttpServletResponse response = (HttpServletResponse) pageContext.getRenderingContext().getServletResponse();
File fileToDownload = this.createFile();
String fileType = getMimeType("txt");
response.setContentType(fileType);
response.setContentLength((int) fileToDownload.length());
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileToDownload.getName() + "\"");
InputStream in = null;
ServletOutputStream outs = null;
try {
outs = response.getOutputStream();
in = new BufferedInputStream(new FileInputStream(fileToDownload));
int ch;
while ((ch = in.read()) != -1) {
outs.write(ch);
}
} catch (IOException e) {
// TODO
e.printStackTrace();
} finally {
try {
outs.flush();
outs.close();
if (in != null) {
in.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
However, manipulating the response object will flag OAF for back navigation so you might want to handle this - if you are actively checking this event.
Friday, January 7, 2011
Wednesday, January 5, 2011
Handling Navigation Events (NavBar)
GOTO_PARAM (deprecated) / GOTO_EVENT (R12)
- the default parameter name for navigation events
- Advanced Table navigation and NavBar reacts to this
SOURCE_PARAM
- used to distinguish which type of object triggered the event
VALUE_PARAM
- used to determine the destination of the
- the default parameter name for navigation events
- Advanced Table navigation and NavBar reacts to this
SOURCE_PARAM
- used to distinguish which type of object triggered the event
VALUE_PARAM
- used to determine the destination of the
Monday, January 3, 2011
Breaking the Haitus
Holidays are over ^^ There are still many things I need to test with PLSQL, so I'll be posting more soon XD
皆さまにあけましておめでと^^!!
皆さまにあけましておめでと^^!!
Subscribe to:
Posts (Atom)