Thursday, February 26, 2015

Auto-Repeating Layout (ARL) - in OAF

One of the very good feature to display a region multiple times.

As most of them aware of Table/ HGrid to display multiple records, but there is also a container to show the data repeatedly based on the VO applied.

Please find the below screenshot for same.
















PG.xml Properties





Monday, February 23, 2015

Attribute Level Validations in OAF

You Can use the below method in EOImpl

    protected void doDML(int operation, TransactionEvent e) {
        super.doDML(operation, e);
        String value= getEmail();
       
        if (value==null)
        {
           throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
           getEntityDef().getFullName(), // entity         name
           getPrimaryKey(), // entity primary key
           "Email", // attribute Name
           value, // bad attribute value
           "FND", // message application short name
           "XXCUS_EMAIL_REQ"); //
       
        }

    }


Invoking Workflow From OAF Page


Use the below method in the processFormRequest , on based on the button event.

    if(pageContext.getParameter("submit")!=null)
     {
              String PItemType = "XXHRWF";
            String PProcess = "XXPROC";
            oracle.jbo.domain.Number pitekKeyNo =
                pageContext.getApplicationModule(webBean).getSequenceValue("XX_TEST_SEQ");

            String PItemKey = pitekKeyNo.toString(); // This can be a random item key generated

            OANavigation wf = new OANavigation();

            // Now create Workflow Process
            wf.createProcess(pageContext, PItemType, PProcess, PItemKey);

            // Set Sales Order Number
            wf.setItemAttrText(pageContext, PItemType, PItemKey,"XXATTRIB", "OPERATIONS");

            // Start Workflow Process
            wf.startProcess(pageContext, PItemType, PProcess, PItemKey);
     }

Sunday, February 15, 2015

Playing with conversion of dates

Frequently required script


Following code is used for the purpose of converting :  Date Input in : String format into : java.sql.Date


    private java.sql.Date stringToDate(String dateS) {

        java.sql.Date sqlStartDate = null;
        if (dateS != null && !"".equals(dateS)) {
            String dateFormat = "yyyy-MM-dd";
            SimpleDateFormat df = new SimpleDateFormat(dateFormat);
            java.util.Date parsedDate1 = null;
              {
                try {
                    parsedDate1 = df.parse(dateS);
                } catch (ParseException e) {
                    // TODO
                }
                sqlStartDate = new java.sql.Date(parsedDate1.getTime());

            }
        }
        return sqlStartDate;
    }



Following scrip tis used to convert String into  oracle.jbo.domain.Date

        private Date stringToDate(String dateS)
          {
         Date date=null;
           
          if(dateS!=null &&  !"".equals(dateS)   )
           {
           String dateFormat = "dd-MMM-yyyy";
           SimpleDateFormat df = new SimpleDateFormat(dateFormat);
               java.util.Date parsedDate1=null;
       
            try
             {
              parsedDate1 =  df.parse(dateS);
       
             }
             catch(ParseException e)
             {
              e.printStackTrace();
               
             }
             date = new Date(new Timestamp(parsedDate1.getTime()));  
             }
          return date;
          }