Friday 29 November 2013

Java Data Structure Examples

http://www.tutorialspoint.com/java/java_data_structures.htm

The data structures provided by the Java utility package are very powerful and perform a wide range of functions. These data structures consist of the following interface and classes:
  • Enumeration
  • BitSet
  • Vector
  • Stack
  • Dictionary
  • Hashtable
  • Properties

Thursday 28 November 2013

Using Lookups in OAF

Fetching values from Lookup


//returns lookup description
  public String getLookupDescription(String paramString1, String paramString2)
  {
    HashMap localHashMap = getLookupData(paramString1, paramString2);
    if (null != localHashMap) {
      return (String)localHashMap.get("DESCRIPTION");
    }
    return "";
  }

//returns lookup meaning
 public String getLookupMeaning(String paramString1, String paramString2)
 {
   HashMap localHashMap = getLookupData(paramString1, paramString2);
   if (null != localHashMap) {
     return (String)localHashMap.get("MEANING");
   }
   return "";
 }


//returns HashMap for meaning and Description

   public HashMap getLookupData(String paramString1, String paramString2)
   {
     if ((null == paramString1) || (null == paramString2)) {
       return null;
     }
     ViewObject localViewObject1 = findViewObject("LookupDataVO");
     if (null != localViewObject1) {
       localViewObject1.remove();
     }
     OADBTransactionImpl localOADBTransactionImpl = (OADBTransactionImpl)getOADBTransaction();
     String str1 = localOADBTransactionImpl.getCurrentLanguage();

     String str2 = "select meaning, description from fnd_lookup_values where lookup_type = :1 and lookup_code = :2 and language = :3 ";

   ViewObject localViewObject2 = createViewObjectFromQueryStmt("LookupDataVO", str2);
   localViewObject2.setWhereClauseParam(0, paramString1);
   localViewObject2.setWhereClauseParam(1, paramString2);
   localViewObject2.setWhereClauseParam(2, str1);

   Row localRow = localViewObject2.first();
   HashMap localHashMap = new HashMap();

   if (null != localRow)
   {
     localHashMap.put("MEANING", (String)localRow.getAttribute("MEANING"));
     localHashMap.put("DESCRIPTION", (String)localRow.getAttribute("DESCRIPTION"));
   }
   else
   {
     localHashMap.put("MEANING", "");
     localHashMap.put("DESCRIPTION", "");
   }
   localViewObject2.remove();
   return localHashMap;
 }

Wednesday 27 November 2013

wf_engine.completeactivity

CREATE PROCEDURE xx_continue_activity (
   errbuf            IN OUT NOCOPY   VARCHAR2,
   errcode           IN OUT NOCOPY   INTEGER,
   p_itemtype        IN              VARCHAR2,
   p_activity_name   IN              VARCHAR2
)
AS
   v_errorname      VARCHAR2 (30);
   v_errormsg       VARCHAR2 (2000);
   v_errorstack     VARCHAR2 (32000);
   invalid_action   EXCEPTION;
   PRAGMA EXCEPTION_INIT (invalid_action, -20002);

   CURSOR c1
   IS
      SELECT item_key
        FROM wf_item_activity_statuses
       WHERE item_type = p_itemtype
         AND activity_status = 'NOTIFIED'
         AND process_activity IN (
                SELECT MAX (instance_id)
                  FROM wf_process_activities
                 WHERE activity_item_type = p_itemtype
                   AND activity_name = p_activity_name);
--AND item_key = 1228692;
BEGIN
   FOR c1_rec IN c1
   LOOP
      BEGIN
         fnd_file.put_line (fnd_file.output,
                            'EXECUTING FOR ITEM-KEY: ' || c1_rec.item_key
                           );
         wf_engine.completeactivity (itemtype      => p_itemtype,
                                     itemkey       => c1_rec.item_key,
                                     activity      => p_activity_name,
                                     --'xx_INSUFF_RESPON_BLOCK',
                                     RESULT        => wf_engine.eng_null
                                    );
         COMMIT;
      EXCEPTION
         WHEN invalid_action
         THEN
            wf_core.get_error (v_errorname, v_errormsg, v_errorstack);
            fnd_file.put_line (fnd_file.LOG, 'ITEM-KEY: ' || c1_rec.item_key);
            fnd_file.put_line (fnd_file.LOG, 'ERROR NAME: ' || v_errorname);
            fnd_file.put_line (fnd_file.LOG, 'ERROR MESSAGE: ' || v_errormsg);
            fnd_file.put_line (fnd_file.LOG, 'ERROR STACK: ' || v_errorstack);
      END;
   END LOOP;
END xx_continue_activity;