How to implement an audit system to track ADF applications DML activity?

We have implemented a complete audit system for one of our databases in order to keep history for every table and every value that has been modified.
The solution that we currently have can be split into two discrete parts:
1. Keeping a record of all connections to the db account
This is achieved via a table ‘user_sessions’ into which we record data for every session in the database with the help of on-logon and on-logoff triggers and some PL/SQL procedures:
Column name        |  Explanation
-------------------|-------------------------------------------
US_ID              | PK, based on a sequence
SESSION_ID         | sys_context('USERENV' ,'SESSIONID')  
USER_NAME          | sys_context('USERENV' ,'OS_USER')
LOGON_TIME         | when the on-logon trigger fires
LOGOFF_TIME        | when the on-logoff trigger fires
USER_SCHEMA        | sys_context('USERENV' ,'SESSION_USER')
IP_ADDRESS         | sys_context('USERENV' ,'IP_ADDRESS')
us_id |session_id |user_name|user_sschema|ip_address|logon_time               |logoff_time     
560066|8498062       |BOB      |ABD         |1.1.1.2   |14-SEP-06 03.51.52.000000|14-SEP-06 03.52.30.000000
560065|8498061       |ALICE    |ABC         |1.1.1.1   |14-SEP-06 02.45.31.000000|14-SEP-06 04.22.43.0000002. Keeping the history of every change of data made by a given user
For every table in the account there is a corresponding history table with all of the columns of the original table plus columns to denote the type of the operation (Insert, Delete, Update), start and end time of validity for this record (createtime, retiretime) and us_id (which points to the user_sessions table).
The original table has triggers, which fire if there is an insert, update or delete and they insert the data into the corresponding history table. For every record inserted into a history table the us_id taken from the user_sessions table is recorded as well, allowing us to determine who has modified what data via the combination of these two tables.
Below is an example of a table TASKS, the history related triggers and the history table TASKS_HIST.
At the moment we are developing new applications by using ADF. Since there is an Application Module Pool and Database Connection Pool implemented for the ADF, one connection to the database could be used by several users at different moments of time. In that case the history records will point to a database session logged into the user_sessions table, but we will not know who actually modified the data.
Could you, please, give us a suggestion, how we can know at any moment of time who (which of our users currently making use of an ADF application) is using a given database connection?
By way of an example of the problem we are facing, here is how we solved the same problem posed by the use of Oracle Forms applications.
When the user starts to work with a given Forms application, user_sessions table would attempt to record the relevant information about he user, but since the db session was created by the application server, would in actual fact record the username and ip address of the application server itself.
The problem was easy to solve due to the fact that there is no connection pooling and when a user opens their browser to work with Forms applications, a db connection is opened for the duration of their session (until they close their browser window).
In that case, the moment when the user is authenticated (they log in), there is a PL/SQL procedure called from the login Form, which updates the record in the user_sessions table with the real login name and ip address of the user.
Example of a table and its ‘shadow’ history table
CREATE TABLE TASKS (
     TASKNAME     VARCHAR2(40),
     DESCRIPTION  VARCHAR2(80)
ALTER TABLE TASKS ADD (
     CONSTRAINT TASKS_PK PRIMARY KEY (TASKNAME));
CREATE OR REPLACE TRIGGER TASKS_HISTSTMP
BEFORE INSERT OR UPDATE OR DELETE ON TASKS
   BEGIN
     HISTORY.SET_OPERATION_TIME('TASKS');
   EXCEPTION
     WHEN OTHERS THEN
       ERROR.REPORT_AND_GO;
END TASKS_HISTSTMP;
CREATE OR REPLACE TRIGGER TASKS_WHIST
  AFTER INSERT OR UPDATE OR DELETE ON TASKS
  FOR EACH ROW
  BEGIN
CASE
      WHEN INSERTING THEN
        UPDATE TASKS_HIST
           SET retiretime = HISTORY.GET_OPERATION_TIME
         WHERE createtime = (SELECT MAX(createtime)
                               FROM TASKS_HIST
                              WHERE retiretime IS NULL AND TASKNAME=:NEW.TASKNAME)
           AND retiretime IS NULL AND TASKNAME=:NEW.TASKNAME;
        INSERT INTO TASKS_HIST (TASKNAME      ,DESCRIPTION      ,optype
                                ,createtime                    
                                ,us_id)
               VALUES          (:NEW.TASKNAME ,:NEW.DESCRIPTION ,'I'
                                ,HISTORY.GET_OPERATION_TIME    
                                ,USER_SESSION.GET_USER_SESSIONS_ID);
      WHEN UPDATING THEN
        UPDATE TASKS_HIST
           SET retiretime = HISTORY.GET_OPERATION_TIME
         WHERE createtime = (SELECT MAX(createtime)
                               FROM TASKS_HIST
                              WHERE TASKNAME=:OLD.TASKNAME) 
           AND TASKNAME=:OLD.TASKNAME;
        INSERT INTO TASKS_HIST (TASKNAME      ,DESCRIPTION      ,optype
                                ,createtime
                                ,us_id)
               VALUES          (:NEW.TASKNAME ,:NEW.DESCRIPTION ,'U'
                                ,HISTORY.GET_OPERATION_TIME
                                ,USER_SESSION.GET_USER_SESSIONS_ID);
      ELSE
        UPDATE TASKS_HIST
           SET retiretime = HISTORY.GET_OPERATION_TIME
         WHERE createtime = (SELECT MAX(createtime)
                               FROM TASKS_HIST
                              WHERE TASKNAME=:OLD.TASKNAME) 
           AND TASKNAME=:OLD.TASKNAME;
        INSERT INTO TASKS_HIST (TASKNAME      ,DESCRIPTION      ,optype
                                ,createtime
                                ,us_id)
               VALUES          (:OLD.TASKNAME ,:OLD.DESCRIPTION ,'D'
                                ,HISTORY.GET_OPERATION_TIME
                                ,USER_SESSION.GET_USER_SESSIONS_ID);
    END CASE;
  EXCEPTION
    WHEN OTHERS THEN
      ERROR.REPORT_AND_GO;
END TASKS_WHIST;
CREATE TABLE TASKS_HIST (
     TASKNAME       VARCHAR2(40),
     DESCRIPTION    VARCHAR2(80),
     OPTYPE         VARCHAR2(1),
     CREATETIME     TIMESTAMP(6),
     RETIRETIME     TIMESTAMP(6),
     US_ID          NUMBER
ALTER TABLE TASKS_HIST ADD (
     CONSTRAINT TASKS_HIST_PK PRIMARY KEY (TASKNAME, CREATETIME)
       );

Frank,
Thanks for your reply.
I checked the site that you mentioned.
I try the sample “demo with bundle. The sample worked.
But it needed to start separately with the application.
I do not know how to build a help system with the existed web application developed with Jdeveloper (It has two projects: model and user-view-control. It is deployed on Oracle Application server).
Could you help me step by step to build the help system?

Similar Messages

  • How to implement a file system in my app?

    How to implement a file system in my app? So that we can connect to my iPhone via Finder->Go->Connect to Server. And my iPhone will show as a shared disk. Any ideas about it? Thanks.

    Hi Rain--
    From webdav.org:
    DAV-E is a WebDAV client for iPhone, with free and full versions. It provides remote file browsing via WebDAV, and can be used to upload pictures taken with the iPhone.
    http://greenbytes.de/dav-e.html
    http://www.greenbytes.de/tech/webdav/
    Hope this helps.

  • How to implement C2 Audit in Oracle 10g Express Edition?

    Hi,
    I am developing a database using 10g Express Edition in which I need to implement c2 audit. I am planning to use triggers for this. Does anyone have a better method to implement audit in Express Edition?
    Thanks.

    I don't know what C2 audit exactly is, but before programming anything read this Security Guide chapters on Database Auditing http://download.oracle.com/docs/cd/B19306_01/network.102/b14266/auditing.htm#i1011984 and http://download.oracle.com/docs/cd/B19306_01/network.102/b14266/cfgaudit.htm#i1014788.
    All this should be available in XE also, except for Fine Grained Auditing, which is in Enterprise Edition only.
    If you are only interested in knowing when, who, did what command, including failed attempts than you don't have to program anything - you just define what activities you want to audit and set AUDIT_TRAIL initialization parameter to start auditing.
    You only need to write triggers if you need to catch column values before/after the change.

  • How to implement multiple Value Helps within the same Application ??

    Dear Experts,
    I want to implement multiple value helps in the same view.For that I have declared exporting parameters of type 'wdy_key_value_table.' within the component controller for each of the value helps.While I do activate and test the application I get the following error :
    The following error text was processed in the system HE6 : A row with the same key already exists.
    The error occurred on the application server hsdnt24s11_HE6_00 and in the work process 4 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: VALUESET_BSART of program /1BCWDY/9VSHJWRNR0EZPKFT3ZKC==CP
    Method: IF_PO_VIEW1~VALUESET_BSART of program /1BCWDY/9VSHJWRNR0EZPKFT3ZKC==CP
    Method: WDDOINIT of program /1BCWDY/9VSHJWRNR0EZPKFT3ZKC==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_DO_INIT of program /1BCWDY/9VSHJWRNR0EZPKFT3ZKC==CP
    Method: DO_INIT of program CL_WDR_DELEGATING_VIEW========CP
    Method: INIT_CONTROLLER of program CL_WDR_CONTROLLER=============CP
    Method: INIT_CONTROLLER of program CL_WDR_VIEW===================CP
    Method: INIT of program CL_WDR_CONTROLLER=============CP
    Method: GET_VIEW of program CL_WDR_VIEW_MANAGER===========CP
    Method: BIND_ROOT of program CL_WDR_VIEW_MANAGER===========CP
    I dont know how to implement multiple value helps.Need your help on this.
    Regards,
    Mamai.

    Hi
    Hint is : A row with the same key already exists it means , It is assigning the same value/Key to row and you are calling it at WDDOINIT  so it giving error at the time of initialization .
    Better way to do the coding at some event in view OR if not possible than just execute the first value help in wddoinit later clear all the value before gettig the other Value help. Code it at WdDoModify View to get its run time behaviour.
    BR
    Satish Kumar

  • How to access to a resource in the ADF application?

    Hi
    I have a jasper report file named report.jrxml in the following path in my ADF application named “app”:
    app\ViewController\src\org\nmp\app\view\report
    I wanna access to this file inside a java file located in the ViewController project as follows:
    InputStreaminSt = new FileInputStream(new File(“app\ViewController\src\org\nmp\app\view\report\report.jrxml”));
    But I get the following exception:
    java.io.FileNotFoundException: app\ViewController\src\org\nmp\app\view\report\report.jrxml (The system cannot find the path specified)
    How could I access to this resource in my application? I am using JDev 11.1.2.3
    Cheers,
    Ferez

    Timo,
    I made a test case named fileaccess and uploaded it here:
    http://rapidshare.com/files/2200118787/fileaccess.zip
    Just open the project in JDev 11.1.2.3, the Model project is empty and in the viewController project there is a single page named home.jsf in which contains a commandButton. Clicking the button executes the #{fileAccess.readFile} method. The fileAccess bean is located in org.company.fileaccess.view.beans and introduced in faces-config.xml. Body of readFile method is as the following:
    FileInputStream fis = new FileInputStream(new File("/org/company/fileaccess/view/resources/file.txt")); file.txt is located in org.company.fileaccess.view.resources and viewController project is set to copy .txt files into output directory. Clicking the button causes FileNotFoundException.
    Thank you in advance,
    Ferez

  • How Can implement the audit function using toplink?

    My system must record all the modification, how can I use toplink to implement it.
    I know when toplink modify some object, the toplink will check how many attribute
    have been modified, and then update it to database, Can I implement the record when
    the toplink check modification?
    PS: I dont want to use database trigger.
    Thank first!!

    This thread has been inactive for a while, so perhaps I'm missing something. I am attempting to create audit events on domain objects using a TopLink 10.1.3 DescriptorEventAdapter.
    These audit events mutate or create a snapshot collection on the domain object. Based on what I understand from the above thread, do I still need to create another UoW to commit these in my preInsert()/preCreate() handler methods?
    Is there a way to get in the game before the IDs are assigned to the objects and the change set is computed?
    I certainly don't claim to fully understand the historical client session docs. However, one of our requirements is to show object-attribute-level deltas (list chronologically, grouped by transaction, the attributes that have changed, who changed them, etc. with their before and after values). So my first-blush reaction is that it's easier to utilize the change set to create a collection of transactionally-grouped audit objects on the domain.
    Thanks much,
    --Todd Fredrich                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to implement for sap system use HADR

    hi expert ,
           i am a newbie to sap basis, we have a requirement that do HA for our sap using HADR,i want know if there are some good sulotion for my scenario。
       our scenaro is we have two window 2008 sever host,one host  has a sap system and we want the sap db2 database as a primary,and the other host also has a same the system which is restore from the previous sap system which we implement by system copy using database restore not migration。i want know as our secanrio could i achive SAP application HA by HADR,if we donu2018t have  HA  software  like MSCS。whether we must manual monitor the primary sap   when it stop because any issue like hardware failed and then manual start the other sap system in the other host?
      our two sap system have different sap profile beacause the hostname are different.
    our aim is when one of our host can't use we can immediate start the other sap system in the other host, the less the change the better the solution .
    is it possible?
    thanx very much,
    best regards.

    hi paul ,
        thanx for your information,i have already read the inforamtion about sg247363 once-over and SAMP。 but unfortunately we have a different situation,we only have two windows servers and must installed windows server 2008 OS because some reasons。we also don't have have other host to install sap。as this situation,how could we implement HA beacuse we also don't have shared disk。the window server are isolation。
    i  also read some pdf which download from sdn , in the book the HA is  implemneted as the sap application has a separate host and has two host for DB2 database using HADR,the HA is rely the cluster software 。in this situation the sap application also need HA to avoid single point failure。
        as the limited i have said above, is it possible to do HA by MSCS ,can any body tell me if the MSCS is free to install in OS windows 2008? if we can't use it  free,have any other solution?in the worst , we must manual monitor the application and when a sap application or database can't work ,we want to restart the other sap which in the other host,we need the database synchronization between two database which using HADR。is it possible ?if it do, whether there are some additional setup for sap application because the two sap application have different sap profile name(a sap is a system copy from the other by database restore)。
        any reply will be appreciated。

  • How to implement a "plugin system" in JSF?

    Hi!
    I would like to make a system with can be extended using JAR (or WAR?) plugins...I know how to do using Swing but I'm new in JSF and I have a lot of doubts, I'm trying to find something on the net, I know I can force the navigation to go to a specific page (I can put the entry page of every plugin in a database) but can I mix 2 war and connect one to another (like for example with an entry page from the first one to the second one)?
    if not what can I do? Am I have to rethink the thing?
    thanks a lot!!
    Demetrio Filocamo

    Swing is a desktop tecnology.
    JSF is a Web tecnology.
    If the 2 Wars are deployed as two different web sites, then you can do navigation bettween them, like you do on Html.

  • How to implement Automatic Quotation System using JDeveloper?

    Can you point us in the right direction?
    Starting from ER diagrams!
    null

    Hi Marc,
    The best way to add rows automatically are to do 4 things:
    1. Add a row after refreshing the grid's data source if the form is editable to the user. This could be either in OK mode (refreshing an existing record) or for new records (replace key of 123 with -1 or some value you know will never exist and always return zero records).
         form.DataSources.DataTables.Item(0).ExecuteQuery("SELECT * FROM [@TABLE] WHERE Code = 123");
         grid.DataTable.Rows.Add(1);
    2. Add a row if the user has entered a value into the key column(s) on the grid's last row.
    if(itemValue.ItemUID == "GridUID" && itemValue.ColUID == "Col1UID" && itemValue.EventType == SAPbouiCOM.BoEventTypes.et_VALIDATE && itemValue.BeforeAction == false)
         if (this.grid.DataTable.GetValue("Col1UID", itemValue.Row).ToString() != "" && itemValue.Row == this.grid.Rows.Count - 1)
              this.AddRow();
              // Set any default values you want to
              grid.DataTable.SetValue("Col1UID", this.grid.DataTable.Rows.Count - 1, "-1");
    3. Handle the Add Row menu event and add a new row.
    4. Handle the Delete Row menu event and if the row being deleted is the last row, add a new row.
    And you will have to loop through each row upon saving to save the data back to the database using SAP's recordset object and an INSERT, UPDATE or DELETE statement.  Typically I have a global variable to store the keys of any rows deleted if they are not new (unsaved) rows. Upon saving, I loop through that array and delete them from the database.
    I hope this helps.
    David

  • How to implement custom Model Class in Oracle ADF?

    I am using Oracle ADF for one of my project and i am using Query component of ADF. For given tables the query component creates view objects and maps the relations. ADF uses its own custom model class for this component and it should understand the DB tables. But for my project i have no access to database. All i can do is pass a string or object/query to the existing (custom) Java class/object, and this model class formulates query and queries the database and returns the value to my Java class. I have to display these results using ADF to the front end. Is There a way to achieve this? Can i replace/override the existing Model class of ADF. If so how?
    Thanks in advance for your help.

    Hi, there:
    Best thing to do is to start with the default login.html page, and then modify it. The login screen is fairly complex and it's easy to just miss a JS function you need to call. To get to default page, you would need to do one deploy (to simulator or whatever), and then look for login.html page in the temporary Xcode or Android project generated from the deployment. It should be under the "deploy" directory in your JDev workspace.
    You can also see all the framework JS files and CSS files that way as well.
    We have had customers implementing custom login screen so we know it can work, but they all had to start with the default login screen and then modify it.
    Thanks,
    Joe Huang

  • How to implement the Seibel response in the ADF ?

    Hi All,
    JDev ver : 11.1.1.5
    I have integrated the Fusion middle ware with Seibel using the 'REST' services(The URI based service).
    I followed this link to integrate : http://siebel-essentials.blogspot.com/2011/02/first-encounter-with-sai-ofm.html
    I want to know how to use the response and how can I implement the URI response in my java/ADF code ?
    How to send the request ? and how to receive the response ?
    If anyone worked on this, please share me the implementation process..
    Regards,
    Gopinath

    Hi,
    JDeveloper 11.1.1.5 supports REST get requests from the URL Data Control (if you wanted to use ADF). Note however that this release expects an XML or CSV payload. Alternatively you build a REST client using Jersey libraries in which case the client is a Java object that then you use to provide the data for display
    Frank

  • How to implement enter and execute query in ADF

    I am new to ADF and I am trying to create a simple data entry screen in ADF 11g based on a database table. I am looking to implement the equivalent of the Enter Query and Execute Query feature in Oracle Forms. I tried the default operations that are available with the data controls. But they don't seem to have this feature. Can someone help me / point me to how this can be implemented.
    Thanks,
    Srini.

    Thanks Shay. As per your suggestion I have included the Find and Execute buttons for the VO Object and ran the page. I first clicked the Find button and entered by query condition and then clicked the Execute button. At this point I get an error popup asking me to enter values for all the mandatory fields. Am I missing something?
    Regards,
    Srini.

  • How to implement the documentation help function for webdynpro application

    We have implemented SAP Travelmanagement ESS services which uses ABAP Webdynpro. In each of the screen there is a "help" link on the top right corner. I would like to know how to use this function to link a help file that explains what needs to be done on each screen.
    My requirement is to provide screen specific help information as a document for each of the screen in my webdynpro application.
    Any suggestions, options, samples from the experts would be most appreciated.
    Regards
    Vivek

    Hi Vivek,
    seems to be your WDA are built by FPM, thats how by default you will be getting help link in top corner.
    when you click on help link it has to display the help related data.
    for this sap calls the standard wdc: WDHC_COMPONENT and the view:WDHC_APPL_HELP in this view you will see the element as: TEXT to fill some text which is your help data.
    there might be some way to fill this TEXT (text view) try this.
    or else i will check and upate you soon.
    all the best.
    Regards,
    Mahesh.Gattu

  • How to implement a time-limited trial version of application?

    Hello
    I am working on a trial version of my application for Windows Phone 8.1 Runtime.
    I based my code on this MSDN tutorial:
    https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn532253.aspx
    It clearly mentions here about a trial-period of an application.
    However, when I launched the Store Dashboard, I didn't see any places in which I could set the trial-time period. There's only one checkbox turning on or off an ability for users to download a trial version.
    Is it possible for Windows Phone Runtime to make a time-limited trial version of an application? For example - after 48 hours it would block itself from using it.
    The important thing is to make sure the trial does not restart when user reinstalls the application (as if it could be done if I used AppSettings for validating a first-app run time).
    Thanks in advance

    For windows phone you have to implement your own way to check if the trial is over and apply the action yourself. Although on windows 8.1 store does what you want automatically.

  • How to decode and display the PDF in ADF application

    Hi All,
    I newbie to Oracle ADF,my requirement is like, In DB table encoded pdf data is available I am able to view the the encodes data in ADF app but I want to decoded pdf. In my app I decoded the encoded data but it comes as text format like' %PDF-1.4
    2 0 obj
    <<
    /CreationDate (D:20121017234301)
    /Keywords <>
    /Author ()' I looking for actual pdf format. Any help.
    Thanks
    Mani

    It would be helpful if you describe what did not work with the sample. The sample reads the pdf from a file whereas you need to load it from a blob in the DB.
    You can use my sample, which need some setup, so don't run it as is, http://tompeez.wordpress.com/2013/05/16/handling-imagesfiles-in-adf-part-4/ which shows how to do this with blobs read from the db.
    Timo

Maybe you are looking for

  • Physical standby

    Good day. Assume I open the pyhsical standby in two seconds and closed Probably no chekpoint will occur in this interval and checkpoint SCN of the datafiles and control file will not change. So what makes recovering it anymore impossible?

  • Contents to be displayed on portal

    hello.. i am trying to work on a scenario wherein say, data from any legacy system needs to be published/displayed on Enterprise portal via xi... how can the above be done??? ofcous, i can directly use JDBC adapter and write java code and fetch the d

  • Why can't I view my photos on my iphone 4s

    When I take pictures with my iphone 4s they do not show up under photos.  When I try and open photos it just shuts down.  When I click the tab on the bottom left of the Camera application that shows the picture I just took, It takes me to photos, but

  • WRTP54G Performance Poor

    I recently began having trouble with the performance of my wireless WRTP54G router. When it is  connected to my desktop, through the router, it is extremely slow. When I am connecting through my wirelesss (Macbook), it is slow and intermittent. Often

  • Compiling with two CPU cores

    Is it possible to compile with two or more CPU cores or just with one? As it seems, javac uses only one core when I compile with the Ant tasc "javac".