Practical Guide to Develop Openbravo callout

callout make your openbravo window form more responsible. openbravo callout implement ajax like feature. this openbravo’s wiki page show you how to develop a basic callout. however, retrieving openbravo input parameter from current field value of your active window, is not easy enough. this practical guide help you.

all input parameter from current field value of your active window retrieved as string, from a key-pair hashmap object, those you need to state a string key, to be used to retrieve value from that hashmap object. the difficulties come from how to determine the key.

here some tips:

  1. open in text editor: org.openbravo.base.VariablesBase
  2. add extra line on method getStringParameter(String parameter, boolean required, String defaultValue, RequestFilter requestFilter): Enumeration params = httpRequest.getParameterNames();
  3. using eclipse/netbean IDE, put a break point on the code line that you put on the step #2.
  4. when break point reached, debug what is inside variable params that you put on the step #2. it will show you list of available param.

when you refer back to openbravo’s wiki page that show you how to develop a basic callout, this is 1st code snippet shown on that wiki page:

</pre>
<pre class="java">@Override
 protected void execute(CalloutInfo info) throws ServletException { 
     <a href="http://www.google.com/search?q=allinurl%3ABigDecimal+java.sun.com&bntl=1">BigDecimal</a> serviceSerCost = info.getBigDecimalParameter("inpservsercost");
     <a href="http://www.google.com/search?q=allinurl%3ABigDecimal+java.sun.com&bntl=1">BigDecimal</a> serviceOutCost = info.getBigDecimalParameter("inpservoutcost"); 
     <a href="http://www.google.com/search?q=allinurl%3ABigDecimal+java.sun.com&bntl=1">BigDecimal</a> serviceTotalCost = serviceSerCost.add(serviceOutCost);
     info.addResult("inpservcost", serviceTotalCost);
 }</pre>
<pre>

the key point is, this code snippet use key inpservsercost, how developer know this key? the answer is the 4 step above.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s