الأربعاء، 29 أبريل 2020

Position popup with javascript. - JDeveloper and ADF

<af:panelBorderLayout id="pbl1">

  <af:commandButton text="commandButton 1" id="cb1" partialSubmit="true">
    <af:clientListener method="showPopup" type="click"/>
  </af:commandButton>
  <af:spacer inlineStyle="border: 1px solid red; position: relative; left: 100px; right: 100px;" id="s1" clientComponent="true"/>
</af:panelBorderLayout>
<af:popup autoCancel="disabled" id="popup">
  <af:dialog id="d2" title="Test!" clientComponent="true"/>
</af:popup>
 
        <af:resource type="javascript">
          function showPopup(event) {
              event.cancel();
              var source = event.getSource();
              var popup = source.findComponent("popup");
              var spacer = source.findComponent("s1");
              alert(spacer);
              popup.show( {
                  align : "after_end", alignId : spacer.getClientId()
              });
          }
        </af:resource>

Oracle ADF - Performance Testing Tools



Oracle ADF - Performance Testing Tools


Following post list some to

ols that can be used for Oracle ADF application performance testing, along with other available tools.
  
JMeter

JMeter is required in order to make multiple calls to the application. A test plan should be created which specifies the steps to be replicated by the JMeter. 
Test plan configured for sample application is attached here

Following are the changes that are required to be done in order to use this test plan with sample application. 

1)  Open the test plan file in JMeter.

2)  Replace the <Server Name or IP> and <Port Number> field corresponding to five HTTP requests that exist in the test plan as shown below, with the details of the server where  ADF application is running. This is not required if the application is running on local host


3) Now click on Thread Group – Sample App in order to specify the number of users, loop count per user and the ramp-up time in which the threads should start sending the request to the application.



JDeveloper Memory Profiler

JDeveloper memory profiler is required in order to see the number of objects that are getting created in each request and the number of objects that are getting garbage collected. It also displays the number of objects and their size that’s left in the memory after application finishes the requests.


Following are the steps to use JDeveloper memory profiler.

1)  Open JDeveloper.
2)  Browse the application that is to be analyzed.
3)  Start the memory profiler from the JDeveloper Run menu as shown below.




4)  This will start/restart the integrated weblogic server. Once the server is up, the application will start at local host and JDeveloper weblogic port.
5)  In order to access the application, either we can directly hit the application from browser or we can use JMeter to hit the application.
6)  Following is a sample report generated using JDeveloper which is showing the total number of instances created and total number of instance collected during garbage collection.


JVisualVM

JVisualVM is required to create the heap dump of the JVM on which the ADF application is deployed and running. The heap dump file generated using JVisualVM can be used to analyze the memory usage, objects count and any suspect for memory leak.

Following are the steps to create the heap dump using JVisualVM

1)  Open JVisualVM from the JDK directory like 

…/jdk160_29/bin/jvisualvm.exe

2)  Select the weblogic server instance on which ADF application is running.


3)  Now open the JMeter and click start button to initiate the requests to <ADF application>
4)  Analyze the heap allocation and garbage collection activities in JVisualVM.


5)  Once the threads started from JMeter complete, click on Heap Dump button to generate the heap dump file.


Eclipse Memory Analyzer

Eclipse memory analyzer is required to analyze the heap dump created using JVisualVM. It helps in identifying the possible issues that might have been reported while running the application.

Following are the steps required to analyze the heap dumps file using Eclipse Memory Analyzer

1)  Start the eclipse memory analyzer standalone application or eclipse IDE if it has eclipse memory analyzer plug-in installed.
2)  Browse for the heap dump file created above using JVisualVM.
3)  Click finish when prompted to generate the Leak suspect report.


4)  Click on various other options provided in the IDE to analyze the dump file.


Sample Report

The below screenshot shows the problem suspects in the application.


الثلاثاء، 28 أبريل 2020

Using rollback depreciation api before override depreciation

The Rollback Depreciation API FA_DEPRN_ROLLBACK_PUB.DO_ROLLBACK was introduced with Release 12.

In prior releases, FADRB - Rollback Depreciation program was available in order to rollback the depreciation calculation after it was run for a book without closing the period.
In Release 12, this program is no longer available because a new feature was introduced - automatic depreciation rollback.

With this new feature, after running depreciation for a book without closing the period, if additional transactions are needed on particular assets (adjustment, retirement etc.), the user can update those assets with whatever transaction is needed. For those particular assets, the depreciation data is automatically rolled back and the transactions can be performed on them. After this, the user can run depreciation again to depreciate these particular assets.

*Note that the rollback is also completed for asset description changes per Note 1463816.1.

Instead of entering additional transactions, in case it is not needed, you can manually rollback depreciation for an asset by running the Rollback Depreciation API which restores the asset to its state prior to running depreciation. This may be useful for the purpose of testing some setup behavior.

You can find details about this API in Oracle Assets Users' Guide Release 12.

A sample script is provided below.

The ASSET_HDR_REC_TYPE asset structure contains unique identification information for a given asset, such as the asset ID and book type code. Both variables are required when running the API.

Steps

1) Run depreciation without closing the period

2) Run the Rollback Depreciation API procedure FA_DEPRN_ROLLBACK_PUB.DO_ROLLBACK for an asset/book

Code (SQL):
SET serveroutput ON
    DECLARE
    l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
    l_return_status VARCHAR2(1);
    l_mesg_count NUMBER;
    l_mesg varchar2(4000);
    BEGIN
    dbms_output.enable(1000000);
    FA_SRVR_MSG.Init_Server_Message;
    -- asset header info
    l_asset_hdr_rec.asset_id := &asset_id;
    l_asset_hdr_rec.book_type_code := '&book';
    --call the api
    FA_DEPRN_ROLLBACK_PUB.do_rollback
    (p_api_version => 1.0,
    p_init_msg_list => FND_API.G_FALSE,
    p_commit => FND_API.G_FALSE,
    p_validation_level => FND_API.G_VALID_LEVEL_FULL,
    p_calling_fn => NULL,
    x_return_status => l_return_status,
    x_msg_count => l_mesg_count,
    x_msg_data => l_mesg,
    px_asset_hdr_rec => l_asset_hdr_rec);
    --dump messages
    l_mesg_count := fnd_msg_pub.count_msg;
    IF l_mesg_count > 0 THEN
    l_mesg := chr(10) || substr(fnd_msg_pub.GET
    (fnd_msg_pub.G_FIRST,
    fnd_api.G_FALSE),
    1, 250);
    dbms_output.put_line(l_mesg);
    FOR i IN 1..(l_mesg_count - 1) loop
    l_mesg :=
    substr(fnd_msg_pub.GET
    (fnd_msg_pub.G_NEXT,
    fnd_api.G_FALSE), 1, 250);
    dbms_output.put_line(l_mesg);
    END loop;
    fnd_msg_pub.delete_msg();
    END IF;
    IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
    dbms_output.put_line('FAILURE');
    ELSE
    dbms_output.put_line('SUCCESS');
    END IF;
    END;
    /
3) If the script returns SUCCESS, issue a commit.


Code (SQL):
COMMIT;

API to Load Arabic Values in HR Lookups



DECLARE
   CURSOR get_lookup_details
   IS
      SELECT ltype.application_id,
             ltype.customization_level,
             ltype.creation_date,
             ltype.created_by,
             ltype.last_update_date,
             ltype.last_updated_by,
             ltype.last_update_login,
             tl.lookup_type,
             tl.security_group_id,
             tl.view_application_id,
             tl.description,
             tl.meaning
        FROM fnd_lookup_types_tl tl, fnd_lookup_types ltype
       WHERE     ltype.lookup_type = 'XX POSITIONS'
             AND ltype.lookup_type = tl.lookup_type
             AND language = 'US';

   CURSOR get_value
   IS
      SELECT DISTINCT
             hl.lookup_code, pos.position_name_arabic, position_name_english
        FROM xxhr_position_t pos, hr_lookups hl
       WHERE     hl.meaning = pos.position_name_english
             AND hl.lookup_type = 'XX POSITIONS'
--             AND lookup_code= '321'
             AND lkp_process_flag_ar = 'N';


   l_err_msg   VARCHAR2 (1000) := NULL;
   l_db_nls_language       VARCHAR2 (500) := NULL;
BEGIN
   FOR i IN get_lookup_details
   LOOP
      FOR j IN get_value
      LOOP
         -- Set NLS_LANG to Arabic to insert  Arabic Values
         fnd_global.set_nls (
            p_nls_language                => 'ARABIC',
            p_nls_date_format             => NULL,
            p_nls_date_language           => NULL,
            p_nls_numeric_characters      => NULL,
            p_nls_sort                    => NULL,
            p_nls_territory               => NULL,
            p_db_nls_language             => l_db_nls_language,
            p_db_nls_date_format          => l_db_nls_language,
            p_db_nls_date_language        => l_db_nls_language,
            p_db_nls_numeric_characters   => l_db_nls_language,
            p_db_nls_sort                 => l_db_nls_language,
            p_db_nls_territory            => l_db_nls_language,
            p_db_nls_charset              => l_db_nls_language);

         l_err_msg := NULL;
        
        dbms_output.put_line('l_db_nls_language: ' || l_db_nls_language);


         BEGIN
            fnd_lookup_values_pkg.translate_row (
               x_lookup_type           => i.lookup_type,
               x_security_group_id     => i.security_group_id,
               x_view_application_id   => i.view_application_id,
               x_owner                 => 49431, --> User ID
               x_meaning               => j.position_name_arabic,
               x_description           => j.position_name_arabic,
               x_lookup_code           => j.lookup_code);

            UPDATE xxhr_position_t --> Stagging Table to Log Status
               SET lkp_process_flag_ar = 'Y', lkp_err_msg = NULL
             WHERE UPPER (position_name_english) =
                      UPPER (j.position_name_english);

            COMMIT;
         EXCEPTION
            WHEN OTHERS
            THEN
               l_err_msg := SQLERRM;

               UPDATE xxhr_position_t
                  SET lkp_process_flag_ar = 'N', lkp_err_msg = l_err_msg
                WHERE UPPER (position_name_english) =
                         UPPER (j.position_name_english);

               COMMIT;
         END;
      END LOOP;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);
END;


ADF: Programmatic View Object Using Ref Cursor.

ADF: Programmatic View Object Using Ref Cursor. Posted by:  Manish Pandey   April 25, 2013   in  ADF   Leave a comment   3758 Views Sometime...