Search

Monday, April 28, 2008

Getting Married Part-VI

(Continuation of "Getting Married Part-V")
“So, when are you getting married?” asks Bhavana.
“Do I have to?” I reply.
I look at the expression of disbelief and shock in her eyes.
“How can you talk like this?” she asks, “Is it a case of love-failure?”
Now it was my turn to be shocked.
“Does it have to be a love-failure, when a person decides not to marry?” I retort back.
“Well, that’s what happens in most of the cases.”
“I don’t agree with you.”
“Then tell me the reason why you don’t want to get married,” she starts pulling my leg.
Instead of answering her, I ask, “Why do I need to give you an explanation?”


Before we could argue any further, I get a call on my extension and Bhavana gets back to her cubicle.
“Hello?” says a very familiar voice.
“Yes Radhika.”
Why do I not show my anger on her? She ditched me, her childhood mate, for her 6-months old fiancé; yet I don’t scream and shout at her. Why?

“Are you busy sweetheart?” she asks with a hesitation in her voice.
I am reminded of the time when she wanted to borrow my skirt for a fancy-dress competition, when we were in our primary school. There was the same hesitation, the same quivering in her voice. We were such close pals that everyone in our class would wonder why their friends were not that understanding. All my anger melts away and all that I remember is the shy smile of a sweet girl of five.
“I am in the office, Radhika,” I reply, “How are you?”
“I… I am fine,” she says and then words tumble out in a flood, “Could you… Could you do me a favour?”
“Of course dear!”
“There is absolutely no balance in my cell phone. I was wondering if you could go out and buy a re-charge card for me and sms me the 10-digit code number.”
“Where are you?”
“I’m in a bus traveling from my aunt’s place to home.”
“Is it that urgent?”
“Hmm… I just checked my balance; it’s just ten rupees. It’s will take me an hour to reach home. Meanwhile I thought I could talk with Siddhu…”
The mere mention of her fiancé makes me feel frustrated. I want to end the call as soon as possible.
“Why don’t you ask him to get a recharge card for you?” I ask
“No… No… How can I do that?”
“He’s after all, your fiancé.”
“I can’t do that,” she exclaims, “What will he think of me?”
“Oh come on! You are going to spend the rest of your life with him.”
“You will not understand!” she shouted and cut the connection.

I wonder what I will not understand. Radhika stopped finding time to be with me since so many days and now when I thought she had called to talk with me, all I get to hear is: Another help required! Am I a departmental store or a personal assistant to get things done for anyone? I also have feelings. Just because I don’t call her, it does not mean that I don’t have any feelings for her. It hurts not to be with her, not to share my thoughts with her, not to talk with her… But all that she is bothered about is her Siddhu!

He is going to be her husband; yet she is uncomfortable asking him for a small help. Is she mad? Why does she need to keep pretences with her closed one? She did not bat an eyelid before she called me to ask. How mean of her! Why do people take others for granted! Why do they not realize that even others need love and affection? They feel terrible when someone uses them and then forgets all about them…

A voice cuts into my thoughts.
“Back to your dreamland?” asks Bhavana giggling, “It’s lunchtime.”
“Give me a minute,” I cry, “I need to rush the restroom!”
While I hurry, she calls me back saying, “I am still eagerly waiting to know why you don’t want to marry.”

(To be continued in "Getting Married Part-VII")

Sunday, April 27, 2008

Bundled Messages in OA page, the solution

Thanks to Manoj.. Or Should I say, Lalith :-)
I found the solution to the problem.
The Solution:
1) Import the following Java classes
import com.sun.java.util.collections.ArrayList;
import oracle.apps.fnd.framework.OAException;

2) Create the following methods in the AMImpl.java file:
private void addToBundle(Exception ex)
{
ArrayList a = (ArrayList)getOADBTransaction().getTransientValue("BUNDLEDEXCEPTION");
if (a == null)
a = new ArrayList();
a.add(ex);
getOADBTransaction().putTransientValue("BUNDLEDEXCEPTION",a);
}

public void showBundledMsg()
{
ArrayList a = (ArrayList)getOADBTransaction().getTransientValue("BUNDLEDEXCEPTION");
getOADBTransaction().putTransientValue("BUNDLEDEXCEPTION",null);
if( a != null)
{
throw OAException.getBundledOAException(a);
}
}

3) Usage in AM methods:
Whenever there is a validation error, instead of doing a "throw new OAException()", do a "addToBundle(new OAException());". Also use a boolean flag say "showMsg" and set it to true whenever a validation error occurs.

if(SomeValidationError)
{
OAException msg = new OAException("XXTMG", "XXTMG_PV_VALID_FULLSKIDQTY", null,OAException.ERROR,null);
addToBundle(msg);
showMsg=true;
}

Finally when all the checking for validations is done, cheack the value of "showMsg". If it is true, call the "showBundledMsg" AM method
if(showMsg)//Some of the values entered into the OA page are incorrect
{
showBundledMsg();
showMsg=false;
}

Well, that solves our problem! :-)

Friday, April 25, 2008

Bundled Messages in OA page

Problem:
Suppose an OA page has three fields:RollNo, Name, Rank and a Submit button.
The form requires the following validations:
1) RollNo should be an integer
2) Name should be a string
3) Rank should be an integer.

When Submit button is clicked, the code in the controller is called. Here we first check the value in RollNo field, throw an Exception if it has an invalid value. Then we verify the Name field and throw an OAException, if an invalid Name is entered and lastly we validate the Rank field for invalid entry.

Suppose the user has entered wrong value into all of the fields. When he/she clicks on Submit button, then first the error message related to the RollNo field is displayed ("RollNo has to be an integer. Please enter an integer in the RollNo field.") The user enters an integer to the RollNo field and hits on Submit.

Again he sees the error related to the name field ("Name has to be a valid String. Please enter characters only into the Name field") He does accordingly and hit submit for another time.

Another error message is displayed. This time, it is related to the Rank field on the OA page.

Instead of making the user hit Submit three times, is there a way in which we can display all the error messages in one go?!

Solution:
Thanks to Manoj.. Or Should I say, Lalith :-)

I found the solution to the problem.Will post it soon! :-)

Thursday, April 24, 2008

Quoting John le Carre

Coming home from very lonely places, all of us go a little mad:
whether
from great personal success,
or just an all-night drive,
we are the sole
survivors of a world
no one else has ever seen.
- John le Carre

Wednesday, April 23, 2008

How to check if the user has entered an integer or a float value using Java?

I realized that Java does not provide any standard library method like isInteger() for the verification.
I came upon two good methods for checking if the user has entered an integer value or float value.
Solution 1:
--------------------------------------------------------------
String enteredNumber = "6.234";
double d=double.parseInt(enteredNumber);
if (Math.floor(d)==d) {
// d is an integer
}
else
{
// d's not an integer
}
--------------------------------------------------------------


Solution 2:
--------------------------------------------------------------
String enteredNumber = "6.234";
try {
int v = Integer.parseInt(enteredNumber);
valid = true;
// it's an integer
} catch(NumberFormatException e) {
valid = false;
//it's not an integer
}

--------------------------------------------------------------

To get the fractional portion of a number in Java

Problem:How do to get the fractional portion of a number in Java?
Suppose we have a number 4.56.
We need to get 0.56(fractional part) of it.
Solution:
double fraction(double d) {
if (d >= 0)
return d-Math.floor(d);
return d-Math.ceil(d);
}

Thanks to this link:
http://forum.java.sun.com/thread.jspa?threadID=752735&messageID=4301382