11 May, 2013

Set Sequence Number by Groovy Expression

Before I posted how to set Sequence Number using Code Get Sequence Next Value in ADF

Today I will illustrate how to set sequence number using groovy language.
You can do it by setting default value expression at primary key 

(new oracle.jbo.server.SequenceImpl("My_seq_name",adf.object.getDBTransaction())).getSequenceNumber()

Thanks

07 May, 2013

OAF : Bounce Appache Server

Connect to server using putty and execute the following commands

1- Enter commands folder
cd $ADMIN_SCRIPTS_HOME

2- execute the following commands to stop Apache
adapcctl.sh stop
adoacorectl.sh stop

3- Execute the following commands to start Apache
adapcctl.sh start
adoacorectl.sh start

Thanks

03 May, 2013

Compare JBO Date Programatically

To compare two jbo date programatically, l convert jbo date to sql date and then compare sql dates

oracle.jbo.domain.Date jboDate1 = new oracle.jbo.domain.Date();
oracle.jbo.domain.Date jboDate2 = new oracle.jbo.domain.Date();

java.sql.Date sqlDate1 =jboDate1.dateValue();
java.sql.Date sqlDate2 =jboDate2.dateValue(); 

//Compare sql Date
if (sqlDate1.before(sqlDate2 )) {     
  //Write Your Code
}

Thanks

30 April, 2013

Get All PLSQL Errors


I developed a function to get all PLSQL errors in schema.
This function should be used after calling program units so that can get PLSQL errors and you can use for logging and tracing.


Function Code


CREATE OR REPLACE FUNCTION GET_PLSQL_ERROS
   RETURN VARCHAR2
IS
   LC$RETVALUE   VARCHAR2 (4000);

   CURSOR LCUR$ERRORS
   IS
        SELECT DISTINCT NAME, TYPE
          FROM USER_ERRORS
      ORDER BY 1, 2;

   PROCEDURE ADD_LINE (IN_LINE IN VARCHAR2)
   IS
   BEGIN
      LC$RETVALUE := SUBSTR (LC$RETVALUE || IN_LINE || CHR (10), 1, 4000);
   END ADD_LINE;
BEGIN
   FOR LREC$ERRORS IN LCUR$ERRORS
   LOOP
      ADD_LINE (LREC$ERRORS.NAME || ' ' || LREC$ERRORS.TYPE);

      ADD_LINE (
         RPAD ('-', LENGTH (LREC$ERRORS.NAME || LREC$ERRORS.TYPE) + 1, '-'));

      FOR LREC$ERROR_DET
         IN (  SELECT LINE, POSITION, SUBSTR (TEXT, 1, 128) TEXT
                 FROM USER_ERRORS
                WHERE NAME = LREC$ERRORS.NAME AND TYPE = LREC$ERRORS.TYPE
             ORDER BY SEQUENCE)
      LOOP
         ADD_LINE (
               LPAD (LREC$ERROR_DET.LINE, 4)
            || ' '
            || LPAD (LREC$ERROR_DET.POSITION, 3)
            || ' '
            || LREC$ERROR_DET.TEXT);
      END LOOP;

      ADD_LINE ('*******************' || CHR (10));
   END LOOP;

   IF LENGTH (LC$RETVALUE) = 4000
   THEN
      LC$RETVALUE := SUBSTR (LC$RETVALUE, 1, 3996) || CHR (10) || '...';
   END IF;

   RETURN NVL (LC$RETVALUE, 'No Errors');
END;
/

24 April, 2013

OAF : Get Current Row in Table

Sometimes you want to get current row in table. To apply this you can use the following code in controller and write it inside processFormRequest method.

     public void processFormRequest(OAPageContext pageContext, 
                                   OAWebBean webBean) {
        super.processFormRequest(pageContext, webBean);
        //Get application Module
        OAApplicationModule am = pageContext.getApplicationModule(webBean);
        
        //Get Row Refrence
        String rowReference = 
            pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
            
        //Get current Row using Row Reference    
        OARow currRow = (OARow)am.findRowByRef(rowReference);
        
        //Get attribute value from current row
        String attrValue = (String)currRow.getAttribute("AttrName");
    }



Thanks

01 April, 2013

Oracle OAF MDS Repository

MDS repository stores all pages and regions used in OAF pages and contain personalization and extensions.

All MDS data stores in the following 4 tables.
1. JDR_PATHS: Stores the path of the documents, OA Framework pages and their parent child relationship.
2. JDR_COMPONENTS: Stores components on documents and OA Framework pages.
3. JDR_ATTRIBUTES: Stores attributes of components on documents and OA Framework pages.
4. JDR_ATTRIBUTES_TRANS: Stores translated attribute values of document components or OA framework pages.

JDR_UTILS PL/SQL package supports the MDS repository and can be used to query and maintain the repository.

Thanks