Event Handling with Java API.: Adding to a hierarchy table throws 2events

I´m having some problems with the event handling. I´ve registered a Class with extends AbstractDataListener as EventListener. When there are changes in the product hierarchy table, some extra work should be done. However if i add a new record into the hierarchy, two events are fired.
DEBUG DataEventListener.java:123 - Added:Development;PRODUCT_HIERARCHY;R17;Getra?nke, SEW
DEBUG DataEventListener.java:123 - Added:Development;PRODUCT_HIERARCHY;R17;32 Zoll, B&R
DEBUG DataEventListener.java:123 - Added:Development;PRODUCT_HIERARCHY;R18;56 Zoll, Lenze
DEBUG DataEventListener.java:123 - Added:Development;PRODUCT_HIERARCHY;R18;20 Zoll, allgemein
In this case, i added the records "32 Zoll, B&R" and then "20 Zoll, allgemein". As you can see in both cases two events are fired and the first event seems to come with wrong data. The reported id for the newly created record is R17. For the logging, i did lookup the entry in the hierarchy table by id and use the displayvalue of the record. But the first event always shows the displayvalue from some already existing entry.
How can i avoid duplicate events or if this is not possible, how i can recognize that the display value of the first event is not valid.

I have not tetsted it yet, because I'm waiting for my server to be updated, but SAP told me that the API version 5.5.42.67 should fix the problem.
Thanks for your post.

Similar Messages

  • Events problem with (Java and ActiveX)

    Hi,
    I use an ActiveX component with Java and i've got a problem with events.
    Java classes were generated with Bridge2Java (IBM).
    In order to manage events I added a listener in my application :
         javaMyActiveX = new MyActiveX();
         javaMyActiveX.add_DMyActiveXEventsListener(new _DMyActiveXEventsAdapter());
    I also added a constructor in the _DMyActiveXEventsAdapter class and I fill the body of methods.
    The ActiveX generates two types of events :
    - The ones are directly generated by methods.
    - The others are generated by a thread.
    With MS Products (VB, Visual C++, Visual J++), I catch all events.
    With java (jdk 1.4), I catch only events generated by methods.
    Can anyone help me.

    I'm not 100% sure, but the last time I used that bridge, it only worked if you ran your Java app within a Microsoft VM.

  • Attaching/Detaching libraries with Java API

    Hello,
    In my forms (Forms10g), sometimes, libraries had been attached in lower case although files are in upper case. This causes compilation errors on UNIX systems.
    I'm trying to detach these libraries with Java APIs and then reattach them in upper case.
    But I get an error when I want to save the module.
    Here is my code :
    public class UpperPll {
         public UpperPll (String formName) {
              try
                   FormModule form = FormModule.open("C:/AttachPll/" + formName);
                   System.out.println("Form Name is " + form.getName());
                   JdapiIterator AttachPll = form.getAttachedLibraries();
                   while(AttachPll.hasNext())
                        try
                             JdapiObject jo = (JdapiObject)AttachPll.next();
                             System.out.println(jo.getName());
                             if (jo.getName().toLowerCase().equals(jo.getName()))
                                  AttachedLibrary.find(form,jo.getName().toUpperCase()).detach();
                                  System.out.println(jo.getName().toUpperCase());
                                  new AttachedLibrary(form,jo.getName().toUpperCase());
                        catch (JdapiIllegalStateException jdise)
                             jdise.printStackTrace();
                   form.save("C:/AttachPll/New/" + form.getName() + ".fmb");
                   Jdapi.shutdown();
              catch (JdapiException jde)
                   jde.printStackTrace();
         public static void main (String[] args) {
              try {
                   FileReader r = new FileReader( "C:/AttachPll/listemodule.txt" );
                   BufferedReader br = new BufferedReader( r );
                   try {
                        String module;
                        while ( ( module = br.readLine() ) != null ) {
                             new UpperPll(module);
                   } finally {
                        r.close();
              } catch (FileNotFoundException fnfe) {
                   fnfe.printStackTrace();
              } catch (IOException ioe) {
                   ioe.printStackTrace();
    And here are the errors I get :
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x2FBBDCB
    Function=icobad+0xB
    Library=C:\DevSuiteHome_1\bin\frmcom.dll
    Current Java thread:
         at oracle.forms.jdapi.BaseAPI._jni_save_form(Native Method)
         at oracle.forms.jdapi.FormModule.save(Unknown Source)
         at UpperPll.<init>(UpperPll.java:39)
         at UpperPll.main(UpperPll.java:55)
    Dynamic libraries:
    0x00400000 - 0x0040B000      C:\DevSuiteHome_1\jdk\bin\javaw.exe
    0x7C910000 - 0x7C9C7000      C:\WINDOWS\system32\ntdll.dll
    0x7C800000 - 0x7C904000      C:\WINDOWS\system32\kernel32.dll
    0x77DA0000 - 0x77E4C000      C:\WINDOWS\system32\ADVAPI32.dll
    0x77E50000 - 0x77EE1000      C:\WINDOWS\system32\RPCRT4.dll
    0x77D10000 - 0x77DA0000      C:\WINDOWS\system32\USER32.dll
    0x77EF0000 - 0x77F37000      C:\WINDOWS\system32\GDI32.dll
    0x77BE0000 - 0x77C38000      C:\WINDOWS\system32\MSVCRT.dll
    0x62DC0000 - 0x62DC9000      C:\WINDOWS\system32\LPK.DLL
    0x753C0000 - 0x7542B000      C:\WINDOWS\system32\USP10.dll
    0x08000000 - 0x08139000      C:\DevSuiteHome_1\jdk\jre\bin\client\jvm.dll
    0x76AE0000 - 0x76B0F000      C:\WINDOWS\system32\WINMM.dll
    0x6BD00000 - 0x6BD0D000      C:\WINDOWS\system32\SYNCOR11.DLL
    0x10000000 - 0x10007000      C:\DevSuiteHome_1\jdk\jre\bin\hpi.dll
    0x00940000 - 0x0094E000      C:\DevSuiteHome_1\jdk\jre\bin\verify.dll
    0x00950000 - 0x00969000      C:\DevSuiteHome_1\jdk\jre\bin\java.dll
    0x00970000 - 0x0097D000      C:\DevSuiteHome_1\jdk\jre\bin\zip.dll
    0x02F60000 - 0x02F6F000      C:\DevSuiteHome_1\BIN\frmjapi.dll
    0x02F70000 - 0x02F8C000      C:\DevSuiteHome_1\bin\frmd2f.dll
    0x663D0000 - 0x66414000      C:\DevSuiteHome_1\bin\CA.dll
    0x66340000 - 0x6636A000      C:\DevSuiteHome_1\bin\mmc.dll
    0x64CA0000 - 0x64CB1000      C:\DevSuiteHome_1\bin\UTL.dll
    0x60730000 - 0x607DC000      C:\DevSuiteHome_1\bin\oracore10.dll
    0x608D0000 - 0x60963000      C:\DevSuiteHome_1\bin\oranls10.dll
    0x62B40000 - 0x62B53000      C:\DevSuiteHome_1\bin\oraunls10.dll
    0x60C40000 - 0x60C47000      C:\DevSuiteHome_1\bin\orauts.dll
    0x719F0000 - 0x71A07000      C:\WINDOWS\system32\WS2_32.dll
    0x719E0000 - 0x719E8000      C:\WINDOWS\system32\WS2HELP.dll
    0x774A0000 - 0x775DD000      C:\WINDOWS\system32\ole32.dll
    0x616B0000 - 0x61891000      C:\DevSuiteHome_1\bin\oraclient10.dll
    0x62B60000 - 0x62B66000      C:\DevSuiteHome_1\bin\oravsn10.dll
    0x60D30000 - 0x60DE8000      C:\DevSuiteHome_1\bin\oracommon10.dll
    0x60300000 - 0x60720000      C:\DevSuiteHome_1\bin\orageneric10.dll
    0x629C0000 - 0x629D2000      C:\DevSuiteHome_1\bin\orasnls10.dll
    0x62B80000 - 0x62C86000      C:\DevSuiteHome_1\bin\oraxml10.dll
    0x02F90000 - 0x02FA1000      C:\WINDOWS\system32\MSVCIRT.dll
    0x607E0000 - 0x608CC000      C:\DevSuiteHome_1\bin\oran10.dll
    0x62000000 - 0x6202C000      C:\DevSuiteHome_1\bin\oranl10.dll
    0x62030000 - 0x62042000      C:\DevSuiteHome_1\bin\oranldap10.dll
    0x62090000 - 0x62184000      C:\DevSuiteHome_1\bin\orannzsbb10.dll
    0x61E10000 - 0x61E52000      C:\DevSuiteHome_1\bin\oraldapclnt10.dll
    0x61F30000 - 0x61F47000      C:\DevSuiteHome_1\bin\orancrypt10.dll
    0x71A10000 - 0x71A1A000      C:\WINDOWS\system32\WSOCK32.dll
    0x76D10000 - 0x76D29000      C:\WINDOWS\system32\iphlpapi.dll
    0x770E0000 - 0x7716C000      C:\WINDOWS\system32\OLEAUT32.dll
    0x621A0000 - 0x621D7000      C:\DevSuiteHome_1\bin\oranro10.dll
    0x621F0000 - 0x621FC000      C:\DevSuiteHome_1\bin\orantcp10.dll
    0x61F70000 - 0x61F76000      C:\DevSuiteHome_1\bin\oranhost10.dll
    0x61F20000 - 0x61F26000      C:\DevSuiteHome_1\bin\orancds10.dll
    0x62210000 - 0x62216000      C:\DevSuiteHome_1\bin\orantns10.dll
    0x60970000 - 0x60C31000      C:\DevSuiteHome_1\bin\orapls10.dll
    0x62500000 - 0x62507000      C:\DevSuiteHome_1\bin\oraslax10.dll
    0x627B0000 - 0x628B3000      C:\DevSuiteHome_1\bin\oraplp10.dll
    0x618B0000 - 0x61905000      C:\DevSuiteHome_1\bin\orahasgen10.dll
    0x622B0000 - 0x622E6000      C:\DevSuiteHome_1\bin\oraocr10.dll
    0x622F0000 - 0x62315000      C:\DevSuiteHome_1\bin\oraocrb10.dll
    0x6FEE0000 - 0x6FF34000      C:\WINDOWS\system32\NETAPI32.dll
    0x76BA0000 - 0x76BAB000      C:\WINDOWS\system32\PSAPI.DLL
    0x62A80000 - 0x62AF6000      C:\DevSuiteHome_1\bin\orasql10.dll
    0x662F0000 - 0x66320000      C:\DevSuiteHome_1\bin\mmi.dll
    0x64F10000 - 0x64F21000      C:\DevSuiteHome_1\bin\UIIM.dll
    0x64CE0000 - 0x64DBD000      C:\DevSuiteHome_1\bin\UIW.dll
    0x64CD0000 - 0x64CD7000      C:\DevSuiteHome_1\bin\UTC.dll
    0x64CC0000 - 0x64CC9000      C:\DevSuiteHome_1\bin\UTJ.dll
    0x72F50000 - 0x72F76000      C:\WINDOWS\system32\WINSPOOL.DRV
    0x58B50000 - 0x58BE7000      C:\WINDOWS\system32\COMCTL32.dll
    0x64ED0000 - 0x64EF6000      C:\DevSuiteHome_1\bin\UIOLE.dll
    0x76340000 - 0x7638A000      C:\WINDOWS\system32\comdlg32.dll
    0x77F40000 - 0x77FB6000      C:\WINDOWS\system32\SHLWAPI.dll
    0x7C9D0000 - 0x7D1F3000      C:\WINDOWS\system32\SHELL32.dll
    0x64AD0000 - 0x64C05000      C:\DevSuiteHome_1\bin\VGS.dll
    0x64E30000 - 0x64E93000      C:\DevSuiteHome_1\bin\UIREM.dll
    0x659A0000 - 0x659EE000      C:\DevSuiteHome_1\bin\ROS.dll
    0x66250000 - 0x6627E000      C:\DevSuiteHome_1\bin\mmw.dll
    0x662A0000 - 0x662B0000      C:\DevSuiteHome_1\bin\mmv.dll
    0x73AA0000 - 0x73AB7000      C:\WINDOWS\system32\AVIFIL32.dll
    0x77BB0000 - 0x77BC5000      C:\WINDOWS\system32\MSACM32.dll
    0x75BA0000 - 0x75BC1000      C:\WINDOWS\system32\MSVFW32.dll
    0x662C0000 - 0x662DF000      C:\DevSuiteHome_1\bin\mms.dll
    0x66810000 - 0x66A2B000      C:\DevSuiteHome_1\bin\DE.dll
    0x627A0000 - 0x627AF000      C:\DevSuiteHome_1\bin\oraplc10.dll
    0x64F50000 - 0x64F66000      C:\DevSuiteHome_1\bin\UICC.dll
    0x64FB0000 - 0x64FDA000      C:\DevSuiteHome_1\bin\UCOL.dll
    0x02FB0000 - 0x030CA000      C:\DevSuiteHome_1\bin\frmcom.dll
    0x66380000 - 0x66389000      C:\DevSuiteHome_1\bin\mma.dll
    0x64FF0000 - 0x65003000      C:\DevSuiteHome_1\bin\UAT.dll
    0x66220000 - 0x6623C000      C:\DevSuiteHome_1\bin\nn.dll
    0x64F70000 - 0x64F94000      C:\DevSuiteHome_1\bin\UIA.dll
    0x64F30000 - 0x64F45000      C:\DevSuiteHome_1\bin\UIDC.dll
    0x030D0000 - 0x03194000      C:\DevSuiteHome_1\bin\frmdig.dll
    0x031A0000 - 0x0324D000      C:\DevSuiteHome_1\bin\frmdug.dll
    0x66210000 - 0x66215000      C:\DevSuiteHome_1\bin\obs.dll
    0x77390000 - 0x77492000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
    0x5B090000 - 0x5B0C8000      C:\WINDOWS\system32\uxtheme.dll
    0x74690000 - 0x746DB000      C:\WINDOWS\system32\MSCTF.dll
    0x76BE0000 - 0x76C0E000      C:\WINDOWS\system32\WINTRUST.dll
    0x779E0000 - 0x77A76000      C:\WINDOWS\system32\CRYPT32.dll
    0x77A80000 - 0x77A92000      C:\WINDOWS\system32\MSASN1.dll
    0x76C40000 - 0x76C68000      C:\WINDOWS\system32\IMAGEHLP.dll
    0x72C70000 - 0x72C79000      C:\WINDOWS\system32\wdmaud.drv
    0x72C60000 - 0x72C68000      C:\WINDOWS\system32\msacm32.drv
    0x77BA0000 - 0x77BA7000      C:\WINDOWS\system32\midimap.dll
    0x5D3F0000 - 0x5D491000      C:\WINDOWS\system32\DBGHELP.dll
    0x77BD0000 - 0x77BD8000      C:\WINDOWS\system32\VERSION.dll
    Heap at VM Abort:
    Heap
    def new generation total 576K, used 35K [0x10010000, 0x100b0000, 0x104f0000)
    eden space 512K, 6% used [0x10010000, 0x10017c90, 0x10090000)
    from space 64K, 7% used [0x10090000, 0x10091348, 0x100a0000)
    to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
    tenured generation total 1408K, used 122K [0x104f0000, 0x10650000, 0x14010000)
    the space 1408K, 8% used [0x104f0000, 0x1050e930, 0x1050ea00, 0x10650000)
    compacting perm gen total 4096K, used 1642K [0x14010000, 0x14410000, 0x18010000)
    the space 4096K, 40% used [0x14010000, 0x141aaac8, 0x141aac00, 0x14410000)
    Local Time = Wed Apr 12 10:35:49 2006
    Elapsed Time = 5
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_06-b03 mixed mode)
    # An error report file has been saved as hs_err_pid3184.log.
    # Please refer to the file for further information.
    Can anyone help me ?
    Message was edited by:
    dbouchier

    We do something very simular. We rename everything to lowercase for the same reasons. I've pasted a snippet of the code we're using at the end of this post.
    To get the full source code of our converter have a look at http://www.oratransplant.nl/2005/05/30/custom-built-forms-migration-assistant/#comment-642
    Here is the code snippet:
    while (attachedLibs.hasNext()) {
    AttachedLibrary attachedLib = (AttachedLibrary)attachedLibs.next();
    String attachedLibLocation = attachedLib.getLibraryLocation();
    out("Found attached library " + attachedLibLocation, logLevel,
    false);
    if (attachedLib.getName().equalsIgnoreCase("obsolete_forms6")) {
    obsoleteAttached = true;
    if (attachedLib.getName().equalsIgnoreCase("webreports")) {
    webReportsAttached = true;
    // converted name of attached lib to lowercase
    if ((!attachedLibLocation.equals(attachedLibLocation.toLowerCase())) &&
    lowerLib) {
    out(attachedLib,
    "Converting filename to lowercase (" + attachedLibLocation.toLowerCase() +
    ")", logLevel + 1, true);
    attachedLibLocation = attachedLibLocation.toLowerCase();
    pllChanged = true;
    // attachedLibLocation = attachedLibLocation.toUpperCase();
    pldText.append(".attach LIBRARY " + attachedLibLocation +
    " END NOCONFIRM\n");
    out("Re-attaching library " + attachedLibLocation, logLevel + 1,
    false);
    }

  • Read "Qualified Range Key Generation" with Java API.

    Hi guru,
    I use MDM 5.5 SP6.
    In MDM Console I read Qualified Range Key Generation it in "ADMIN -> Remote Systems -> Qualified Range".
    I have to get "Qualified Range Key Generation" with Java API.
    It's possible?

    Hi Rocco,
    I am also thinking  of same scenario.I thought it is possible in Java Apis by calling the webservices for MDM.there is a service of "get key mapping" where we can pass this "Qualified key range" as  parameter.In MDM we have to define a look up table for that key ranges .We will access that table through JAVA API and then link it with the key mapping service .
    If u find any solution to apply this ,please share.
    thanks and regards
    Ank

  • Bursting with JAVA APIs / MultiThreading / Errors Handling

    We are trying to use the bursting JAVA APIs 10.1.3.3.1 Standalone) to burst huge XML files and generate PDF Files from RTF templates. Here are a list of our issues with this feature:
    1. We have some problems catching the errors when bursting. We have tried to use the "oracle.apps.xdo.common.log.Logger" class, but it is not always reacting like we think it should. Could you please give us an exemple of a clean bursting error catching or a brief description of how we could do it. We have a lot of difficulties to find information about using the JAVA APIs of BIP.
    2. Is it a clean way of catching the bursting errors to use the "oracle.apps.xdo.common.log.Logger" class?
    3. When using the 10.1.3.3.1 DocumentProcessor JAVA API, the process gets killed when the RTF template is not where the control file specified it. Even when using a finally clause containing the document processor, we can't fetch the error from the "oracle.apps.xdo.common.log.Logger" class. We did not find a way to catch this error which make our program crash.
    4. How can we enable multi-threading that is included in the DocumentProcessor JAVA APIs so it can take advantage of the multi-processors environnements?

    1. Check tim d. blog, you can use the bursting listners to get the errors. It's also in the documentation.
    First, on every exception, the Bursting APIs are dumping the error in the Logger. So I can't see how we can use the listeners to catch these. We can check the hasExceptions on the Logger but still, we have some problems with this. When we deploy our application as a MDB (Message driven bean), it seems that once the hasException flag has been raised, if we call the MDB again, it is still up. Is there documentation about that Logger class? Also, I'm worried that we won't be able to call our MDB twice to run simultaneously 2 different bursting process since it seems the Logger is something static, keeping every exception in memory... That's bad.. And show me where you have found documentation about this. All I see in documentation is how to call the DocumentProcessor in a couple of lines. I don't see anything about a clean way to catch errors.
    2. Yes/No/Depends. I think it's fine. If your changing the logger options in your program that could come back to haunt you.
    I guess so, I'm not changing anything and its already haunting me...
    3. When using the 10.1.3.3.1 DocumentProcessor JAVA API, the process gets killed when the RTF template is not where the control file specified it. Even when using a finally clause containing the document processor, we can't fetch the error from the "oracle.apps.xdo.common.log.Logger" class. We did not find a way to catch this error which make our program crash.
    Even worst, when we deploy the component has an MDB, when the error happens, it kills the whole oc4j container... please correct this quick.
    4. How can we enable multi-threading that is included in the DocumentProcessor JAVA APIs so it can take advantage of the multi-processors environnements?
    We got an answer from the dev team which is to add two properties to the document processor, something like:
    enable-multithreading: true
    thread-count: >2
    We did that and what we got is that the process started and it got stuck in a dead lock at the first document processing. How nice! :)
    We got a milestone in March and I'm really worried about all those problems... Not enough documentation, a pretty bad error handling, errors making crash the whole oc4j container, Logger seems not to be handling simultaneous calls/ threads, not even handling two subsequent calls... etc.
    If anyone has the magic answer, it would be pretty welcomed!
    Thanks

  • Having an issue with event handling - sql & java

    HI all am trying to construct this hybrid of java and mysql. the data comes from a mysql database and I want it to display in the gui. this I have achieved thus far. However I have buttons that sort by surname, first name, ID tag etc....I need event handlers for these buttons but am quite unsure as to how to do it. any help would be much appreciated. Thanks in advance.
    /* Student Contact Database GUI
    * Phillip Wells
    import java.awt.BorderLayout;     
    // imports java class. All import class statements tell the compiler to use a class that is defined in the Java API.
    // Borderlayout is a layout manager that assists GUI layout.
    import javax.swing.*;               // imports java class. Swing enables the use of a GUI.
    import javax.swing.JOptionPane;     // imports java class. JOptionPane displays messages in a dialog box as opposed to a console window.
    import javax.swing.JPanel;          // imports java class. A component of a GUI.
    import javax.swing.JFrame;          // imports java class. A component of a GUI.
    import javax.swing.JButton;          // imports java class. A component of a GUI.
    import javax.swing.JScrollPane;     // imports java class. A component of a GUI.
    import javax.swing.JTable;          // imports java class. A component of a GUI.
    import java.awt.*;               // imports java class. Similar to Swing but with different components and functions.
    import java.awt.event.*;          // imports java class. Deals with events.
    import java.awt.event.ActionEvent;     // imports java class. Deals with events.
    import java.awt.event.ActionListener;     // imports java class. Deals with events.
    import java.sql.*;               // imports java class. Provides API for accessing and processing data stored in a data source.
    import java.util.*;               // imports java class. Contains miscellaneous utility classes such as strings.
    public class studentContact extends JFrame {     // public class declaration. The �public� statement enables class availability to other java elements. 
        private JPanel jContentPane;    // initialises content pane
        private JButton snam, id, fname, exit;     // initialises Jbuttons
        String firstname = "firstname"; //initialises String firstname
         String secondname = "secondname"; //initialises String
        public studentContact() {
            Vector columnNames = new Vector();      // creates new vector object. Vectors are arrays that are expandable.
            Vector data = new Vector();
            initialize();
            try {
                // Connect to the Database
                String driver = "com.mysql.jdbc.Driver"; // connect to JDBC driver
                String url = "jdbc:mysql://localhost/Studentprofiles"; //location of Database
                String userid = "root"; //user logon information for MySQL server
                String password = "";     //logon password for above
                Class.forName(driver); //reference to JDBC connector
                Connection connection = DriverManager.getConnection(url, userid,
                        password);     // initiates connection
                // Read data from a table
                String sql = "Select * from studentprofile order by "+ firstname;
                //SQL query sent to database, orders results by firstname.
                Statement stmt = connection.createStatement
                (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
                //statement to create connection.
                //Scroll sensitive allows movement forth and back through results.
                //Concur updatable allows updating of database.
                ResultSet rs = stmt.executeQuery(sql); // executes SQL query stated above and sets the results in a table
                ResultSetMetaData md = rs.getMetaData();     // used to get the properties of the columns in a ResultSet object.
                int columns = md.getColumnCount(); //
                for (int i = 1; i <= columns; i++) {
                    columnNames.addElement(md.getColumnName(i));     // Get column names
                while (rs.next()) {
                    Vector row = new Vector(columns);          // vectors data from table
                    for (int i = 1; i <= columns; i++) {     
                        row.addElement(rs.getObject(i));     // Get row data
                    data.addElement(row);     // adds row data
                rs.close();     
                stmt.close();
            } catch (Exception e) {     // catches exceptions
                System.out.println(e);     // prints exception message
            JTable table = new JTable(data, columnNames) {     //constructs JTable
                public Class getColumnClass(int column) {     
                    for (int row = 0; row < getRowCount(); row++) {
                        Object o = getValueAt(row, column);
                        if (o != null) {
                            return o.getClass();
                    return Object.class;
            JScrollPane scrollPane = new JScrollPane( table );          // constructs scrollpane 'table'
            getContentPane().add(new JScrollPane(table), BorderLayout.SOUTH);   //adds table to a scrollpane
        private void initialize() {
            this.setContentPane(getJContentPane());
            this.setTitle("Student Contact Database");     // sets title of table
            ButtonListener b1 = new ButtonListener();     // constructs button listener
            snam = new JButton ("Sort by surname");      // constructs Jbutton
            snam.addActionListener(b1);     // adds action listener
            jContentPane.add(snam);          //adds button to pane
            id = new JButton ("Sort by ID");      // constructs Jbutton
            id.addActionListener(b1);     // adds action listener
            jContentPane.add(id);          //adds button to pane
            fname = new JButton ("Sort by first name");      // constructs Jbutton
            fname.addActionListener(b1);     // adds action listener
            jContentPane.add(fname);          //adds button to pane
            exit = new JButton ("Exit");     // constructs Jbutton
            exit.addActionListener(b1);     // adds action listener
            jContentPane.add(exit);          //adds button to pane
        private JPanel getJContentPane() {
            if (jContentPane == null) {
                jContentPane = new JPanel();          // constructs new panel
                jContentPane.setLayout(new FlowLayout());     // sets new layout manager
            return jContentPane;     // returns Jcontentpane
        private class ButtonListener implements ActionListener {     // create inner class button listener that uses action listener
            public void actionPerformed (ActionEvent e)
                if (e.getSource () == exit)     // adds listener to button exit.
                   System.exit(0);     // exits the GUI
                if (e.getSource () == snam)
                if (e.getSource () == id)
                if (e.getSource () == fname)
        public static void main(String[] args) {     // declaration of main method
            studentContact frame = new studentContact();     // constructs new frame
            frame.setDefaultCloseOperation(EXIT_ON_CLOSE);     //exits frame on closing
            frame.setSize(600, 300);          // set size of frame
            frame.setVisible(true);     // displays frame
    }p.s. sorry about the untidy comments!

    OK, so you've got this code here:
    private class ButtonListener implements ActionListener {
      public void actionPerformed (ActionEvent e) {
        if (e.getSource () == exit) {
          System.exit(0); // exits the GUI
        if (e.getSource () == snam) {
        if (e.getSource () == id) {
    }Perfect fine way to do this; although I think creating anonymous would be a bit cleaner:
    snam.addActionListener(new actionListener() {
      public void actionPerformed(ActionEvent ae) {
    });But I think that the real question you have is "what do I put for logic when the JButtons are hit?", right?
    I would answer that you want to dynamically build your SQL statement changing your ordering based on the button.
    So you'd have a method that builds the SQL based on what you pass in - so it takes one argument perhaps?
    private static final int NAME = 1;
                             ID = 2;
    /* ... some code ... */
    snam.addActionListener(new actionListener() {
      public void actionPerformed(ActionEvent ae) {
        buildSQL(NAME);
    /* ... some code ... */
    private void buildSQL(int type) {
      if ( type == NAME ) {
    /* ... build SQL by name ... */
      else if ( type == ID ) {
    /* ... build SQL by id ... */
    }That kind of thing.
    Or you might choose to have several build methods with no parameter type; each building the SQL differently, and calling whichever one you need. I did not read your entire pgm, so I don't know how you'd want to organize it. You need to ask more specific questions at that point.
    ~Bill

  • Difference in event handling between Java and Java API

    could anyone list the differences between Java and java-API in event handling??
    thanks,
    cheers,
    Hiru

    the event handling mechanisms in java language
    features and API (java Application Programming
    Features)features .no library can work without a
    language and no language has event handling built in.
    I am trying to compare and contrast the event
    handling mechanisms in the language and library
    combinations such as java/ java API.
    all contributions are welcome!
    thanks
    cheersSorry, I'm still not getting it. I know what Java is, and I know what I think of when I hear API. (Application Programming Interface.) The API is the aggregation of all the classes and methods you can call in Java. If we agree on that, then the event handling mechanisms in Java and its API are one and the same.
    So what do you want to know?
    %

  • How do I resolve connection error with Java API listener?

    I have created a listener using the new Java API (see How do I implement a listener using new MDM Java API? for background). When I run it, I get this error message
    Mar 19, 2008 3:57:58 PM com.sap.mdm.internal.net.ConnectionImpl finalize
    INFO: Disconnect was not called. Cleaning up connection in finalize.
    This message is triggered whenever I generate a data event that I would otherwise expect to be captured and handled by the listener. I have tried a number of things, including setting the connection to NO_TIMEOUT and trying SimpleConnection versus ConnectionPool, but always with the same result.
    Here is some sample code for the listener:
    public class DataListenerImpl implements DataListener {
         public void recordAdded(RecordEvent evt) {          
              System.out.println("===> Record Added Event");
              System.out.println(evt.getServerName());
         public void recordCheckedIn(RecordEvent evt) {
              System.out.println("===> Record Checked In Event");
              System.out.println(evt.getServerName());          
         public void recordCheckedOut(RecordEvent evt) {
              System.out.println("===> Record Checked Out Event");
              System.out.println(evt.getServerName());               
         public void recordModified(RecordEvent evt) {
              System.out.println("===> Record Modified Event");
              System.out.println(evt.getServerName());
    And here is the code for the Event Dispatcher:
    public void execute(Repository repository) {
         DataListener listener = new DataListenerImpl();
         try {
              EventDispatcherManager edm = EventDispatcherManager.getInstance();
              EventDispatcher ed = edm.getEventDispatcher(repository.getServer().getName());
              ed.addListener(listener);
              ed.registerDataNotifications(SystemProperties.getUserName(), SystemProperties.getPassword(),
                        repository.getIdentifier(), repository.getLoginRegion());
              ed.registerRepositoryNotifications(SystemProperties.getUserName(), SystemProperties.getPassword(),
                        repository.getIdentifier());
              ed.registerGlobalNotifications();
              while (true) {
                   Thread.yield();
                   try {
                        Thread.sleep(1500);
                   } catch (InterruptedException ex) {
                        System.out.println("Interrupted Exception: " + ex.getMessage());
         } catch (ConnectionException e) {
              e.printStackTrace();
         } catch (CommandException e) {
              e.printStackTrace();
    Has anyone else encountered this message? Could it be related to a TCP configuration on the server? Or is this a bug in the Java API?
    As I mentioned in the forum posting linked to above, I have not encountered this problem with the MDM4J API.
    Any help is greatly appreciated.

    I resolved it. We are switching over to SP6, Patch 1 and the listener code works fine with this version of the Java API.
    Just one thing to note, though: make sure that you register data notifications through MetadataManager in your initialization code:
    metadataManager.registerDataNotifications(userSessionContext, repositoryPassword);
    For information on the changes to the SP6 Java API, especially with regard to connecting to MDM with the UserSessionContext, please review Richard LeBlanc's [presentation|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/20073a91-3e8b-2a10-52ae-e1b4a10add1c].

  • Insert Value(s) in Lookup Flat Multi-valued Table with Java API

    I've been looking in MDM Java API Library Reference Guide, MDM SP4 API JavaDoc, and SDN Forums for information on how to Insert/Update different values in a field in the Main Table of a given repository that belongs to a Lookup Flat Multi-valued Table using the Java API with no success.
    I also haven't been successful in adding this values in the same way that I'll add a single value, using the MDM Java API, in a single-value Lookup Table (a2iFields.Add(new A2iField(FIELD_CODE,FIELD_VALUE)) for each value I want to add, like for example:
    a2iFields.Add(new A2iField("Country","USA")
    a2iFields.Add(new A2iField("Country","Mexico")
    a2iFields.Add(new A2iField("Country","Germany")
    Can anybody point me to the correct documentation that I need to read to fulfill this task? Or, even better, if someone can post a piece of code, I'll be more thankful.
    Thanks for your help.

    HI,
    little code example, where you add existing lookup values based on there record id:
         int USA = 1;
                        int GERMANY = 2;
                        A2iValueArray countryArray = new A2iValueArray();               
                        countryArray.Add(new Value(USA));
                        countryArray.Add(new Value(GERMANY));
                        A2iFields record = new A2iFields();
                        record.Add(new A2iField("Country", new Value(countryArray)));
    Please reward points if helpful.
    Regards,
    Robert

  • C# control event handling with javascript

    How can I get javascript to execute for "onchange" / "OnSelectedIndexChanged" event instead of a CodeBehind method? I think "OnSelectedIndexChanged" event has to be handled by CodeBehind; but how can I replace that (or onchange) with
    a javascript event handler?
    I have the following in my xyz.ascx file:
    <asp:DropDownList ID="ddlTypeCar" CssClass="BatsRefAddressTypes" runat="server"
                      onchange="javascript: testAlert();"
                      OnSelectedIndexChanged="ddlTypeCar_SelectedIndexChanged"
                      AutoPostBack="True" />
    I could not get the javascript to execute, even though I removed OnSelectedIndexChanged="ddlTypeCar_SelectedIndexChanged" and/or set AutoPostBack="false".
    Additionally, I tried added the following in xyz.ascx.cs Page_Load() method.
    ddlTypeOfAddress.Attributes.Add("onchange", "javascript: testAlert();");
    which didn't help.
    Thanks for your help in advance.

    Hi,
    you can control client events instead of server events with javascript
    look this url for more information
    http://www.w3schools.com/js/js_events.asp
    Regards

  • Creating Taxonomy with Java API

    Hi all,
      I am trying to add a Taxonomy structure like the collowing with the java API. But i am unable to add the structure, only the first folder is added.
    /taxonomy/countries/us
                       /en
                       /fr
    I am using the following code:
    IClassificationIndex index = (IClassificationIndex)indexService.getIndex(indexName);
    index.addTaxonomy("countries/us", new ResourceContext(user)) ;
    Any help would be very nice.

    I'd also be interested to know how to do this.
    I found this code section to sort by date, but couldn't change it to get it to work to sort alphabetically.
    private void sortResouceListByDate(IResourceList resourceList) throws Exception {
    // create property names to index properties
    IPropertyName iPropSort = new PropertyName("http://sapportals.com/xmlns/cm", "modified");
    //create a comparator to order the resource list
    ResourcePropertyComparator rRPC = new ResourcePropertyComparator(iPropSort, false);
    //order the resource list
    resourceList.sort(rRPC);
    Link where code was found:
    https://forums.sdn.sap.com/thread.jspa?forumID=42&threadID=148468&messageID=1670970#1670970
    We are using:
    Portal 6.0.15.0.0
    KM 6.0.15.4.0
    Thanks!!

  • Event handling with button

    Hi All,
    I am trying to write an event handling on my button, but i seem dont know where to start from. My code are below:
    import java.net.*;
    import java.io.*;
    public class ReadWrite
    public static void main(String[] args) throws Exception {
    URL myLocalhost = new URL("http://localhost/Write.pl");
    URLConnection myURL = myLocalhost.openConnection();
    BufferedReader myBR = new BufferedReader(
    new InputStreamReader(
    myURL.getInputStream()));
    String inputLine;
    while ((inputLine = myBR.readLine()) != null)
    System.out.println(inputLine);
    myBR.close();
    I want to write a code with a button to run the above code.
    Could you please advise?
    Thank for any consideration you may give me.

    here's the code to read a file, modify for your url connection
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    class Testing extends JFrame implements ActionListener
      public Testing()
        setLocation(400,300);
        setSize(200,100);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JPanel panel = new JPanel();
        JButton btn = new JButton("Read/Write");
        btn.addActionListener(this);
        panel.add(btn);
        getContentPane().add(panel);
      public void actionPerformed(ActionEvent ae)
        BufferedReader myBR = null;
        try
          myBR = new BufferedReader(new FileReader("Test.txt"));
          String inputLine;
          while ((inputLine = myBR.readLine()) != null)
            System.out.println(inputLine);
          myBR.close();
        catch(Exception e){e.printStackTrace();}
      public static void main(String args[]){new Testing().setVisible(true);}
    }

  • Event Handling in C API

    Does Internet Directory C API supply the event handling like those in JNDI? Actually Netscape Directory/IBM Secuway Directory supply this features for C SDK, why Oracle Directory Server do not supply it?
    Thanks,
    Peter

    Hello Peter:
    Have you seen the "Oracle Internet Directory v2.1.1 Application Developers guide"? In chapter 2 there is a section on error handling. Let me know if this answers your question.
    Thanks,
    Jay
    null

  • Event handler if new File added in current folder

    Hi folks,
    I'm just trying to write a little jsx script for Bridge CS6.
    How can I implement an event handler that will react if the user adds a new thumbnail (new file) to the current folder in bridge.
    I've tested it with this code, but it doesn't work:
    app.document.thumbnail.watch ("children", function(id, oldVal, newVal) {
         $.writeln (oldVal + " to " + newVal);
         // some code here
    Thanks. Greetings

    Beautiful. Works as advertised. Thank you for pointing it out to me. Unfortunate that a basic subset of this extension's behaviour doesn't ship with Thunderbird out of the box, though.

  • Purge a queue with JAVA API

    Hi,
    Is it possible to purge a queue with the JAVA API ?
    I have not found anything ...
    I am also trying to browse archived messages (state 2), the "browseQueue" method does only browse the ready messages (state 0).
    Is it possible to browse archived messages ?? (in java)
    Thanks in advance.

    found it, I had to write
    "ormi://<some-ip>:12401/orabpel" for java.naming.provider.url

Maybe you are looking for