View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package com.rc.celeritas.impleo;
7   
8   
9   import com.rc.celeritas.db.DBHelper;
10  import com.rc.celeritas.exception.CeleritasException;
11  import com.rc.celeritas.query.QueryHelper;
12  import java.util.HashMap;
13  import java.util.Hashtable;
14  import org.apache.commons.collections.MapUtils;
15  import org.apache.log4j.Logger;
16  import org.webmacro.servlet.WebContext;
17  
18  /**
19   *
20   * @author rchoudhary
21   */
22  public class DetailImpleo implements Impleo{
23  
24      private static Logger log = Logger.getLogger(DeleteImpleo.class);
25  
26      /**
27       *
28       * @param context
29       * @return
30       * @throws java.lang.Exception
31       */
32      public String implied(WebContext context) throws Exception {
33          context.put("impleo", "detail");
34          Hashtable rMap = (Hashtable)context.get("rMap");
35          if(rMap == null || rMap.size() == 0){
36              new Exception("No Request Object Found!! Cannot proceed with Insertion...");
37          }
38          String table = MapUtils.getString(rMap, ImpleoConstants.TABLE, "table");
39          String pk = MapUtils.getString(rMap, ImpleoConstants.PK, "pk");
40          String pVal = MapUtils.getString(rMap, pk);
41          try {
42              String sql = "";
43              sql = QueryHelper.buildQuerySQLWithPKey(table, pk, pVal);
44              HashMap row = DBHelper.getRowMap(sql);
45              context.put(ImpleoConstants.ROW, row);
46          } catch (CeleritasException e) {
47              log.error("Error in Detail Impleo : " + e.toString());
48              throw new Exception(e);
49          }
50          return null;
51      }
52  
53  }