JAXB: Marshalling complex nested data structures?

Hello!
I am dealing with complex data structures:
Map< A, Set< B > >
Set< Map< A, B > >
Map< A, Map< B, Set< C > > >
Map< A, Set< Map< B, C > > >
[and so on](NOTE: In my case it doesn't matters if I use Set<?> or List<?>)
I wanted to write wrappers for JAXB for these data structures, but I have no idea how.
My idea was: write XmlAdapter with generics for Map, Set and List, but it failed:
"[javax.xml.bind.JAXBException: class java.util.LinkedList nor any of its super class is known to this context.]"
because I was using LinkedList<T> inside the XmlAdapter (it seems that from the point of view of JAXB,
LinkedList<T> is same as LinkedList<Object>)
Any ideas?

According to sec 4.4 "By default if xml schema component for which java content interface is to be generated is scoped within a complex type then the java content interface should appear nested within the content interface representing the complex type. ".
So I doubt that worked with beta and you may have to represent this anonymous complex type as a named complex type to avoid the nesting.
Regards,
Bhakti

Similar Messages

  • Input for nested data structure service

    I plan to use a service which require some header-information and additional 1...n item-information.
    The data structure of this service is nested, means there is only one input-port for the header AND the nested items.
    Is it somehow possible to create a UI consists of two inputs like one input form for the header and one input table for the items on the inputport??
    The main problem is that either the header or the item information is transported to the input port of the service, never both as required by the service. Tried to solve it using a data bridge (or as it called in Ehp1 for 7.1 "data share") without any success.
    Solved it by myself Just forgot to check "Control Buttons" in the Configure tab of the table.
    Edited by: Stefan Witschel on Nov 18, 2008 1:47 PM

    Yes, I still used it.
    In Ehp1 is a feature that automatically add a data share if you drag and drop the input port of your servce with nested structure anywhere on the screen. On this data share you can add another input form or table for the nested elements. Both forms/tables than are connected at the input with the share.
    Finally you do the data mapping for the nested structure and define an action to call this connection.
    Actually my problem was that I couldn't input data in rows of a table for the nested structure. I solved it by enabling the table controls which allows you to add an delete rows.

  • Flex not marshalling a nested structure correctly

    <complexType name="A">
    <sequence>
    <element name="attrs" type="string" nillable="true"
    minOccurs="0" maxOccurs="unbounded"/>
    <element name="rels" type="tns:A" nillable="true"
    minOccurs="0" maxOccurs="unbounded"/>
    <element name="relName" type="string" />
    </sequence>
    </complexType>
    Above is the xsd snippet of my webService operation.
    Operation has one of the parameters of type A (above). On the flex
    side, I have an action script class B that has get/set functions
    for attrs, rels and relName. When I use an instance of this type as
    a parameter to the webService operation in flex, it sends only
    attrs and relName in the SOAPBody.
    I also tried adding following function in class B and using
    generic object one gets from extractObject function.
    B
    public function extractObject()
    Object obj = new Object();
    obj.attrs = attrs;
    obj.relName = relName;
    var relsArray:Array = relsArray = new Array();
    for each(rel in rels)
    relsArray.push(rel.extractObject());
    obj.rels = relsArray;
    Just one other weird behavior is following: Instead of
    programatically getting the generic object
    if I hardcode the steps to generate the Object instance,
    webservice call works fine.
    Something like
    var o:Object = new Object();
    o.attrs = attrs;
    o.relName = "xyz";
    var relsArray:Array = new Array();
    var rel:Object = new Object();
    rel.attrs = relAttrs;
    rel.relName = "A";
    relsArray.push(rel);
    o.rels = relsArray;
    Strangely enough, this works perfectly fine. The same when we
    do it using the method function extractObject, doesnt work.
    Can anyone please suggest a good way of handling nested data
    structures in a webservice call?

    I had a similar problem. I've tried using ObjectProxy instead
    of Object. It helped in some cases. Also, here is a livedocs
    chapter that describes a couple of other options:
    Using custom web service serialization
    http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_6.html
    - Mykola

  • OC4J: marshalling does not recreate the same data structure onthe client

    Hi guys,
    I am trying to use OC4J as an EJB container and have come across the following problem, which looks like a bug.
    I have a value object method that returns an instance of ArrayList with references to other value objects of the same class. The value objects have references to other value objects. When this structure is marshalled across the network, we expect it to be recreated as is but that does not happen and instead objects get duplicated.
    Suppose we have 2 value objects: ValueObject1 and ValueObject2. ValueObject1 references ValueObject2 via its private field and the ValueObject2 references ValueObject1. Both value objects are returned by our method in an ArrayList structure. Here is how it will look like (number after @ represents an address in memory):
    Object[0] = com.cramer.test.SomeVO@1
    Object[0].getValueObject[0] = com.cramer.test.SomeVO@2
    Object[1] = com.cramer.test.SomeVO@2
    Object[1].getValueObject[0] = com.cramer.test.SomeVO@1
    We would expect to see the same (except exact addresses) after marshalling. Here is what we get instead:
    Object[0] = com.cramer.test.SomeVO@1
    Object[0].getValueObject[0] = com.cramer.test.SomeVO@2
    Object[1] = com.cramer.test.SomeVO@3
    Object[1].getValueObject[0] = com.cramer.test.SomeVO@4
    It can be seen that objects get unnecessarily duplicated – the instance of the ValueObject1 referenced by the ValueObject2 is not the same now as the instance that is referenced by the ArrayList instance.
    This does not only break referential integrity, structure and consistency of the data but dramatically increases the amount of information sent across the network. The problem was discovered when we found that a relatively small but complicated structure that gets serialized into a 142kb file requires about 20Mb of network communication. All this extra info is duplicated object instances.
    I have created a small test case to demonstrate the problem and let you reproduce it.
    Here is RMITestBean.java:
    package com.cramer.test;
    import javax.ejb.EJBObject;
    import java.util.*;
    public interface RMITestBean extends EJBObject
    public ArrayList getSomeData(int testSize) throws java.rmi.RemoteException;
    public byte[] getSomeDataInBytes(int testSize) throws java.rmi.RemoteException;
    Here is RMITestBeanBean.java:
    package com.cramer.test;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import java.util.*;
    public class RMITestBeanBean implements SessionBean
    private SessionContext context;
    SomeVO someVO;
    public void ejbCreate()
    someVO = new SomeVO(0);
    public void ejbActivate()
    public void ejbPassivate()
    public void ejbRemove()
    public void setSessionContext(SessionContext ctx)
    this.context = ctx;
    public byte[] getSomeDataInBytes(int testSize)
    ArrayList someData = getSomeData(testSize);
    try {
    java.io.ByteArrayOutputStream byteOutputStream = new java.io.ByteArrayOutputStream();
    java.io.ObjectOutputStream objectOutputStream = new java.io.ObjectOutputStream(byteOutputStream);
    objectOutputStream.writeObject(someData);
    objectOutputStream.flush();
    System.out.println(" serialised output size: "+byteOutputStream.size());
    byte[] bytes = byteOutputStream.toByteArray();
    objectOutputStream.close();
    byteOutputStream.close();
    return bytes;
    } catch (Exception e) {
    System.out.println("Serialisation failed: "+e.getMessage());
    return null;
    public ArrayList getSomeData(int testSize)
    // Create array of objects
    ArrayList someData = new ArrayList();
    for (int i=0; i<testSize; i++)
    someData.add(new SomeVO(i));
    // Interlink all the objects
    for (int i=0; i<someData.size()-1; i++)
    for (int j=i+1; j<someData.size(); j++)
    ((SomeVO)someData.get(i)).addValueObject((SomeVO)someData.get(j));
    ((SomeVO)someData.get(j)).addValueObject((SomeVO)someData.get(i));
    // print out the data structure
    System.out.println("Data:");
    for (int i = 0; i<someData.size(); i++)
    SomeVO tmp = (SomeVO)someData.get(i);
    System.out.println("Object["+Integer.toString(i)+"] = "+tmp);
    System.out.println("Object["+Integer.toString(i)+"]'s some number = "+tmp.getSomeNumber());
    for (int j = 0; j<tmp.getValueObjectCount(); j++)
    SomeVO tmp2 = tmp.getValueObject(j);
    System.out.println(" getValueObject["+Integer.toString(j)+"] = "+tmp2);
    System.out.println(" getValueObject["+Integer.toString(j)+"]'s some number = "+tmp2.getSomeNumber());
    // Check the serialised size of the structure
    try {
    java.io.ByteArrayOutputStream byteOutputStream = new java.io.ByteArrayOutputStream();
    java.io.ObjectOutputStream objectOutputStream = new java.io.ObjectOutputStream(byteOutputStream);
    objectOutputStream.writeObject(someData);
    objectOutputStream.flush();
    System.out.println("Serialised output size: "+byteOutputStream.size());
    objectOutputStream.close();
    byteOutputStream.close();
    } catch (Exception e) {
    System.out.println("Serialisation failed: "+e.getMessage());
    return someData;
    Here is RMITestBeanHome:
    package com.cramer.test;
    import javax.ejb.EJBHome;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    public interface RMITestBeanHome extends EJBHome
    RMITestBean create() throws RemoteException, CreateException;
    Here is ejb-jar.xml:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <session>
    <description>Session Bean ( Stateful )</description>
    <display-name>RMITestBean</display-name>
    <ejb-name>RMITestBean</ejb-name>
    <home>com.cramer.test.RMITestBeanHome</home>
    <remote>com.cramer.test.RMITestBean</remote>
    <ejb-class>com.cramer.test.RMITestBeanBean</ejb-class>
    <session-type>Stateful</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    And finally the application that tests the bean:
    package com.cramer.test;
    import java.util.*;
    import javax.rmi.*;
    import javax.naming.*;
    public class RMITestApplication
    final static boolean HARDCODE_SERIALISATION = false;
    final static int TEST_SIZE = 2;
    public static void main(String[] args)
    Hashtable props = new Hashtable();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    props.put(Context.PROVIDER_URL, "ormi://lil8m:23792/alexei");
    props.put(Context.SECURITY_PRINCIPAL, "admin");
    props.put(Context.SECURITY_CREDENTIALS, "admin");
    try {
    // Get the JNDI initial context
    InitialContext ctx = new InitialContext(props);
    NamingEnumeration list = ctx.list("comp/env/ejb");
    // Get a reference to the Home Object which we use to create the EJB Object
    Object objJNDI = ctx.lookup("comp/env/ejb/RMITestBean");
    // Now cast it to an InventoryHome object
    RMITestBeanHome testBeanHome = (RMITestBeanHome)PortableRemoteObject.narrow(objJNDI,RMITestBeanHome.class);
    // Create the Inventory remote interface
    RMITestBean testBean = testBeanHome.create();
    ArrayList someData = null;
    if (!HARDCODE_SERIALISATION)
    // ############################### Alternative 1 ##############################
    // ## This relies on marshalling serialisation ##
    someData = testBean.getSomeData(TEST_SIZE);
    // ############################ End of Alternative 1 ##########################
    } else
    // ############################### Alternative 2 ##############################
    // ## This gets a serialised byte stream and de-serialises it ##
    byte[] bytes = testBean.getSomeDataInBytes(TEST_SIZE);
    try {
    java.io.ByteArrayInputStream byteInputStream = new java.io.ByteArrayInputStream(bytes);
    java.io.ObjectInputStream objectInputStream = new java.io.ObjectInputStream(byteInputStream);
    someData = (ArrayList)objectInputStream.readObject();
    objectInputStream.close();
    byteInputStream.close();
    } catch (Exception e) {
    System.out.println("Serialisation failed: "+e.getMessage());
    // ############################ End of Alternative 2 ##########################
    // Print out the data structure
    System.out.println("Data:");
    for (int i = 0; i<someData.size(); i++)
    SomeVO tmp = (SomeVO)someData.get(i);
    System.out.println("Object["+Integer.toString(i)+"] = "+tmp);
    System.out.println("Object["+Integer.toString(i)+"]'s some number = "+tmp.getSomeNumber());
    for (int j = 0; j<tmp.getValueObjectCount(); j++)
    SomeVO tmp2 = tmp.getValueObject(j);
    System.out.println(" getValueObject["+Integer.toString(j)+"] = "+tmp2);
    System.out.println(" getValueObject["+Integer.toString(j)+"]'s some number = "+tmp2.getSomeNumber());
    // Print out the size of the serialised structure
    try {
    java.io.ByteArrayOutputStream byteOutputStream = new java.io.ByteArrayOutputStream();
    java.io.ObjectOutputStream objectOutputStream = new java.io.ObjectOutputStream(byteOutputStream);
    objectOutputStream.writeObject(someData);
    objectOutputStream.flush();
    System.out.println("Serialised output size: "+byteOutputStream.size());
    objectOutputStream.close();
    byteOutputStream.close();
    } catch (Exception e) {
    System.out.println("Serialisation failed: "+e.getMessage());
    catch(Exception ex){
    ex.printStackTrace(System.out);
    The parameters you might be interested in playing with are HARDCODE_SERIALISATION and TEST_SIZE defined at the beginning of RMITestApplication.java. The HARDCODE_SERIALISATION is a flag that specifies whether Java serialisation should be used to pass the data across or we should rely on OC4J marshalling. TEST_SIZE defines the size of the object graph and the ArrayList structure. The bigger this size is the more dramatic effect you get from data duplication.
    The test case outputs the structure both on the server and on the client and prints out the size of the serialised structure. That gives us sufficient comparison, as both structure and its size should be the same on the client and on the server.
    The test case also demonstrates that the problem is specific to OC4J. The standard Java serialisation does not suffer the same flaw. However using the standard serialisation the way I did in the test case code is generally unacceptable as it breaks the transparency benefit and complicates interfaces.
    To run the test case:
    1) Modify provider URL parameter value on line 15 of the RMITestApplication.java for your environment.
    2) Deploy the bean to the server.
    4) Run RMITestApplication on a client PC.
    5) Compare the outputs on the server and on the client.
    I hope someone can reproduce the problem and give their opinion, and possibly point to the solution if there is one at the moment.
    Cheers,
    Alexei

    Hi,
    Eugene, wrong end user recovery.  Alexey is referring to client desktop end user recovery which is entirely different.
    Alexy - As noted in the previous post:
    http://social.technet.microsoft.com/Forums/en-US/bc67c597-4379-4a8d-a5e0-cd4b26c85d91/dpm-2012-still-requires-put-end-users-into-local-admin-groups-for-the-purpose-of-end-user-data?forum=dataprotectionmanager
    Each recovery point has users permisions tied to it, so it's not possible to retroacively give the users permissions.  Implement the below and going forward all users can restore their own files.
    This is a hands off solution to allow all users that use a machine to be able to restore their own files.
     1) Make these two cmd files and save them in c:\temp
     2) Using windows scheduler – schedule addperms.cmd to run daily – any new users that log onto the machine will automatically be able to restore their own files.
    <addperms.cmd>
     Cmd.exe /v /c c:\temp\addreg.cmd
    <addreg.cmd>
     set users=
     echo Windows Registry Editor Version 5.00>c:\temp\perms.reg
     echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Data Protection Manager\Agent\ClientProtection]>>c:\temp\perms.reg
     FOR /F "Tokens=*" %%n IN ('dir c:\users\*. /b') do set users=!users!%Userdomain%\\%%n,
     echo "ClientOwners"=^"%users%%Userdomain%\\bogususer^">>c:\temp\perms.reg
     REG IMPORT c:\temp\perms.reg
     Del c:\temp\perms.reg
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT]
    This posting is provided "AS IS" with no warranties, and confers no rights.

  • How to create a reference instead of complex type for record in data structure type in BizTalk schema

    I have created the record in BizTalk schema but i will give to Data Structure Type as reference For eg:Recordname(Reference) instead of recordname(Complex type).
    Please help me to sort this out
     

    You can add a reference to an existing type only.
    You might have to manually edit the XSD file to change the xmlns definiton to xmlns:tns and then after you define the record type, set the datatype to tns:.... this creates the XML Type. Then later in your schema you can instantiate this with a name and
    then set type to tns:.... (Reference)
    Regards.

  • Complex data structure.

    Hi,
    This is a design issue that I have run into many times and I was wondering how you all solve it. When using complex data structures (such as array of clusters, or clusters containg arrays and/or other clusters), I have found that there are many situations where you need to wire either an "empty" stucture or the type of the structure as an input. For example, when building up the data structure, I often use shift registers, and need an empty data structure to initialize the shift register. Also when bundling a cluster by name you need the type of the cluster. My question is - what do you use in these situations? Of course, I always typedef my complex structures, and I know that there is a default value for them, because other language featu
    res depend on there being a default. Is there anyway to get the default value for a typedef? Not seeing one, I have taken to creating a Global or Dummy VI for each typedef that returns a default data structure, which is what I use in all these situations. What other approaches have you seen?

    > of the cluster. My question is - what do you use in these situations?
    > Of course, I always typedef my complex structures, and I know that
    > there is a default value for them, because other language features
    > depend on there being a default. Is there anyway to get the default
    > value for a typedef? Not seeing one, I have taken to creating a Global
    > or Dummy VI for each typedef that returns a default data structure,
    > which is what I use in all these situations. What other approaches
    > have you seen?
    You can right click on a wire or terminal and create a constant for the
    type already there. This will sometimes fool you if you are wanting the
    input to a shift register since the types flow downstream and you want
    upstream. Just click somewhere whe
    re the type is known, create the
    const and move it where you want it.
    The BIG downside to this is that typedef constants tend to be BIG. My
    favorite solution is to make a subVI that returns the default for the
    typedef. Put it in user.lib and it is readily accessible. You can
    think of it as a constructor for your datatype, if you want. In fact
    you can make several of these or parameterize it to return different
    flavors. Being the size of all other icons, it fits nicely into the
    diagram and adapts to typedef changes.
    Greg McKaskle

  • Modelling complex data structures

    Hello all,
    I'm trying to understand how to model and design a scenario where the data is non-flat (specifically purchase orders).  As far as I understand Duet Enterprise does not handle non-flat structures (without custom coding in SharePoint).
    What are some options that other people have used to address this?
    The two that I thought of are:
    1.  Model the header and line item data structures separately and then somehow link them in SharePoint
    2.  Don't use the external list external content type in SharePoint and develop something custom
    Does anybody else have any other ideas?  Do you have any examples or starting points?
    Thank you.

    You should avoided passing complex data structure across the JNI boundary. It is slow and it is very difficult to get right. Either make your JNI code so simple that its parameters are primitives or very simple objects, or make your Java code so simple ditto.

  • How do I pass large XML Data structure into an Oracle 8.1.7 Database

    I need to pass a complex nested (10 levels) XML structure into an Oracle 8.1.7 database - Does any one have any idea how I can do this? Because it is an 8.1.7 database we cannot use nested sql objects or CLOB objects to pass data into the database.
    This is an urgent request for any knowledge

    Possible Solution:
    Create from your dehydration store, that's a Oracle 9.2 or later database, a database link to query the table from this database. In BPEL create a DBAdapter to query this table.
    Marc

  • Little help with complex XML data as data provider for chart and adg

    Hi all,
    I've been trying to think through a problem and Im hoping for
    a little help. Here's the scenario:
    I have complex nested XML data that is wrapped by subsequent
    groupings for efficiency, but I need to determine if each inner
    item belongs in the data collection for view in a data grid and
    charts.
    I've posted an example at the bottom.
    So the goal here is to first be able to select a single
    inspector and then chart out their reports. I can get the data to
    filter from the XMLListCollection using a filter on the first layer
    (ie the name of the inspector) but then can't get a filter to go
    deeper into the structure in order to determine if the individual
    item should be contained inside the collection. In other words, I
    want to filter by inspector, then time and then tag name in order
    to be able to use this data as the basis for individual series
    inside my advanced data grid and column chart.
    I've made it work with creating a new collection and then
    looping through each time there is a change to the original
    collection and updating the new collection, but that just feels so
    bloated and inefficient. The user is going to have some buttons to
    allow them to change their view. I'm wondering if there is a
    cleaner way to approach this? I even tried chaining filter
    functions together, but that didn't work cause the collection is
    reset whenever the .refresh() is called.
    If anyone has experience in efficiently dealing with complex
    XML for charting purposes and tabular display purposes, I would
    greatly appreciate your assistance. I know I can get this to work
    with a bunch of overhead, but I'm seeking something elegant.
    Thank you.

    Hi,
    Please use the code similar to below:
    SELECT * FROM DO_NOT_LOAD INTO TABLE IT_DO_NOT_LOAD.
    SORT IT_DO_NOT_LOAD by WBS_Key.
        IF SOURCE_PACKAGE IS NOT INITIAL.
          IT_SOURCE_PACKAGE[] = SOURCE_PACKAGE[].
    LOOP AT IT_SOURCE_PACKAGE INTO WA_SOURCE_PACKAGE.
            V_SYTABIX = SY-TABIX.
            READ TABLE IT_DO_NOT_LOAD into WA_DO_NOT_LOAD
            WITH KEY WBS_Key = WA_SOURCE_PACKAGE-WBS_Key
            BINARY SEARCH.
            IF SY-SUBRC = 0.
              IF ( WA_DO_NOT_LOAD-WBS_EXT = 'A' or WA_DO_NOT_LOAD-WBS_EXT = 'B' )     
              DELETE IT_SOURCE_PACKAGE INDEX V_SYTABIX.
            ENDIF.
    ENDIF.
          ENDLOOP.
          SOURCE_PACKAGE[] = IT_SOURCE_PACKAGE[].
        ENDIF.
    -Vikram

  • Hierarchical data structure

    I am trying to represent the following data structure in hierarchical format ---- but I am not going to use any swing components, so jtree and such are out, and xml is probably out. I was hoping some form of collection would work but I can't seem to get it!
    Example Scenario
    Football League --- Football Team -- Player Name
    West
    ------------------------------Chiefs
    -------------------------------------------------------------xyz
    -------------------------------------------------------------abc
    -------------------------------------------------------------mno
    ------------------------------Broncos
    ------------------------------------------------------------asq
    ------------------------------------------------------------daff
    This hierarchical structure has a couple of layers, so I don't know how I can feasibly do it. I have tried to look at making hashmaps on top of each other so that as I iterate thru the data, I can check for the existence of a key, and if it exists, get the key and add to it.
    Does anyone know a good way to do this? Code samples would be appreciated!!!
    Thank you!

    Hi Jason,
    I guess you wouldn't want to use Swing components or JTree unless your app has some GUI and even then you would want to look for some other structure than say JTree to represent your data.
    You have got plenty options one is that of using nested HashMaps. You could just as well use nested Lists or Arrays or custom objects that represent your data structure.
    I don't know why you should exclude XML. There is the question anyway how you get your data in your application. Is a database the source or a text file? Why not use XML since your data seems to have a tree structure anyway and XML seems to fit the bill.
    An issue to consider in that case is the amount of data. Large XML files have performance problems associated with them.
    In terms of a nice design I would probably do something like this (assuming the structure of your data is fixed):
    public class Leagues {
        private List leagues = new ArrayList();
        public FootballLeague getLeagueByIndex(int index) {
            return (FootballLeague)leagues.get(index);
        public FootballLeague getLeagueByName(String name) {
            // code that runs through the league list picking out the league with the given name
        public void addLeague(FootballLeague l) {
            leagues.add( l );
    }Next you define a class called FootballLeague:
    public class FootballLeague {
        private List teams = new ArrayList();
        private String leagueName;
        public FootballTeam getTeamByIndex(int index) {
            return (FootballTeam)teams.get( index );
        public FootballTeam getTeamByName(String name) {
            // code that runs through the team list picking out the team with the given name
        public void addTeam(FootballTeam t) {
            teams.add( t );
        public void setTeamName(String newName) {
            this.name = newName;
        public String getTeamName() {
            return this.name;
    }Obviously you will continue defining classes for Players next following that pattern. I usually apply that kind of structure for complex hierarchical data. Nested lists would be just as fine, but dealing with nested lists rather than a simple API for you data structures can be a pain (especially if you have many levels in your hierarchy);
    Hope that helps.
    The Dude

  • Urgent! Need help in deciding data structure to use

    Hi all,
    I need to implement a restaurant system by which a customer can make a reservation.
    I was wondering whether vector would be able to be store such an object, The thing is I don't want a complex data structure. just sumthin simple cos i hardly have anytime left to my submission. sighz...
    The thing is I need to able to search based on 2 properties of an object. Eg. I need to search for a reservation based on the customer name and the date he reserved a table.
    But I am totally clueless how to search thru a vector based on 2 properties of the object... Would really appreciate some help. Like an example how to so so based on my program. Feelin so lost...This is all I have so far:
    class AddReservation
         static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
         //Main Method
         public static void main (String[]args)throws IOException
              String custName, comments;
              int covers, date, startTime, endTime;
              int count = 0;
              //User can only add one reservation at a time
              do
                   //Create a new reservation
                   Reservation oneReservation=new Reservation();                         
                   System.out.println("Please enter customer's name:");
                   System.out.flush();
                   custName = stdin.readLine();
                   oneReservation.setcustName(custName);
                   System.out.println("Please enter number of covers:");
                   System.out.flush();
                   covers = Integer.parseInt(stdin.readLine());
                   oneReservation.setCovers(covers);
                   System.out.println("Please enter date:");
                   System.out.flush();
                   date = Integer.parseInt(stdin.readLine());
                   oneReservation.setDate(date);
                   System.out.println("Please enter start time:");
                   System.out.flush();
                   startTime = Integer.parseInt(stdin.readLine());
                   oneReservation.setstartTime(startTime);
                   System.out.println("Please enter end time:");
                   System.out.flush();
                   endTime = Integer.parseInt(stdin.readLine());
                   oneReservation.setendTime(endTime);
                   System.out.println("Please enter comments, if any:");
                   System.out.flush();
                   comments = stdin.readLine();
                   oneReservation.setComments(comments);
                   count++;
              while (count<1);
              class Reservation
              private Reservation oneReservation;
              private String custName, comments;
              private int covers, startTime, endTime, date;
              //Default constructor
              public Reservation()
              public Reservation(String custName, int covers, int date, int startTime, int endTime, String comments)
                   this.custName=custName;
                   this.covers=covers;
                   this.date=date;
                   this.startTime=startTime;
                   this.endTime=endTime;
                   this.comments=comments;
              //Setter methods
              public void setcustName(String custName)
                   this.custName=custName;
              public void setCovers(int covers)
                   this.covers=covers;;
              public void setDate(int date)
                   this.date=date;
              public void setstartTime(int startTime)
                   this.startTime=startTime;
              public void setendTime(int endTime)
                   this.endTime=endTime;
              public void setComments(String comments)
                   this.comments=comments;
              //Getter methods
              public String getcustName()
                   return custName;
              public int getCovers()
                   return covers;
              public int getDate()
                   return date;
              public int getstartTime()
                   return startTime;
              public int getendTime()
                   return endTime;
              public String getComments()
                   return comments;
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    class searchBooking
         static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
         public static void main (String[]args)throws IOException
              int choice, date, startTime;
              String custName;
                   //Search Menu
                   System.out.println("Search By: ");
                   System.out.println("1. Date");
                   System.out.println("2. Name of Customer");
                   System.out.println("3. Date & Name of Customer");
                   System.out.println("4. Date & Start time of reservation");
                   System.out.println("5. Date, Name of customer & Start time of reservation");
                   System.out.println("Please make a selection: ");          
                   //User keys in choice
                   System.out.flush();
                   choice = Integer.parseInt(stdin.readLine());
                   if (choice==1)
                        System.out.println("Please key in Date (DDMMYY):");
                        System.out.flush();
                        date = Integer.parseInt(stdin.readLine());
                   else if (choice==2)
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                   else if (choice==3)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                   else if (choice==4)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Start time:");
                             System.out.flush();
                             startTime = Integer.parseInt(stdin.readLine());
                   else if (choice==5)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                             System.out.println("Please key in Start time:");
                             System.out.flush();
                             startTime = Integer.parseInt(stdin.readLine());
                        }

    Please stop calling your questions urgent. Everybody's question is urgent to them. Nobody's are urgent to the people who are going to answer them. Calling your questions urgent suggests that you think they are more important than others' (They're not.) and will only serve to irritate those who would help you. It won't get your questions answered any sooner.

  • Looking for suitable and robust data structure?

    I have an application where i have to give user an option to correlate the
    response returned by a method call with other methods arguments.
    I have provided a jtree struture where user can see methods and their
    responses and can correlate them by selecting appropriate arguments
    where these values could be used.
    I used a data structure to store such relations like
    A hashmap where every key is a unique number representing method number
    and value ia a matrix.
    In each matrix, the first element of every row would be the Response object and
    all remaining elments in the row would be Argument objects. :)
    Now maybe someone would ask, for every method there is always only one return type
    then why such a matrix with Reponse object as first element of each row.
    The reason is that i gave user an option to not only relate response as a whole Object to
    different arguments of different methods but user can select a field of this response object if this
    is a complex type or user can select any element if the response is a Collection object to relate
    with arguments.
    I am not sure whether this structure is more appropriate or i can use more robust
    and memory efficient structure.
    Please give me your useful suggestions.

    J2EER wrote:
    I have an application where i have to give user an option to correlate the
    response returned by a method call with other methods arguments.I really don't understand you.
    I have provided a jtree struture where user can see methods and their
    responses and can correlate them by selecting appropriate arguments
    where these values could be used.Huh?
    I used a data structure to store such relations likeErr, what happened to the rest of your sentence? Or is the next part the rest of it?
    A hashmap where every key is a unique number representing method number
    and value ia a matrix.Where does this matrix come from? In my book, a matrix is a 2 dimensional structure. What do you mean by it?
    In each matrix, the first element of every row would be the Response object and
    all remaining elments in the row would be Argument objects. :)
    Now maybe someone would ask, for every method there is always only one return type
    then why such a matrix with Reponse object as first element of each row.You're still talking about methods? If so, don't all methods have just one return type?
    The reason is that i gave user an option to not only relate response as a whole Object to
    different arguments of different methods but user can select a field of this response object if this
    is a complex type or user can select any element if the response is a Collection object to relate
    with arguments.
    I am not sure whether this structure is more appropriate or i can use more robust
    and memory efficient structure.
    Please give me your useful suggestions.Perhaps you could give a more detailed explanation and more importantly, provide some examples of what you mean.

  • CRMXIF_ORDER_SAVE Data structure information

    The BAPI CRMXIF_ORDER_SAVE has one input Parameter of type CRMXIF_BUSTRANS. This paramter is quite a complex data structure made upof many data structures; which themselves are complex and contain more data structures.
    I am a first time user of this BAPI and I calling this BAPI (exposed as an RFC web service) via .net 2.0. I am not able to find an documentation for this BAPI and it data structures. I am looking for an explanation of the data structures and what and how they relate to/in SAP.
    Where can I find such information.
    Any help is appreciated.
    -Jawahar

    hi Jawahar,
    how are you doing ?
    here is a discussion on sdn on the same bapi
    CRMXIF_ORDER_SAVE to create orders
    i am not aware of the internal data structure, but am interested to know the results you get, please update the thread when possible
    with respect,
    amit

  • Data structure similar to database table

    i have the need for a data structure that will essentially be the same as a database table. this "table" can be queried against and sorted.
    currently, i am using an interface to abstract this "table" datastructure, and implementing the interface via jdbc calls.
    may someone point me in the right direction?
    in .NET, they have the DataTable and DataSet data structures, which do exactly as i require. These are objects essentially correspond to a database table and database, respectively. They are used as in-memory database.
    i have already tried using HSQL, but was wondering if there was a "better" way (i.e. more light-weight, intuitive, easier to use).
    thanks.

    Use an array and put your records in it.
    Efficient querying (simple queries) requires you to build indices for each element you wish to query on. The type of index depends on the kind on search you want to perform. Exact matches can use Hashes. Sorting, prefix or postfix matching can be performed using various tree indices.
    Complex queries (i.e. those that query on multiple parameters generally require query optimisers to figure out how to use the indies you have in the most efficient manner possible (well as close as the optimizer can get to it).
    cheers
    matfud

  • Trees Data Structures in Java

    Hi all !
    Currently I�m developing a Java software that requires a Tree data structure. Searching through Java API I�ve found classes like TreeMap and TreeSet, but although these classes seens to use tree structure behind what they really provide are linear data structure, not a tree data structure. My question is if there is a public and free Java tree data structure that permits to do activities such as:
    - Search for a particular node (efficiently)
    - Insert children to any node
    - Maintain one Object in each node
    Simple like this ! It must have something like this in Java, but I just can�t find it and I�m just too lazy to implement it :) ! Anyone can help me ?
    Thanks in advance !

    Mel,
    I�ve seen javax.swing.tree.TreeModel and its seens more like an implementation of Control in swing MVC (Model Vision Control) swing paradigm for JTree. It has listeners generated for manipulation events for example. It uses javax.swing.tree.DefaultMutableTreeNode for its nodes, and maybe I could use this class for the nodes of my tree since it has many useful operations. However still I miss a node searching operation that this class doesn�t have.
    Yes my problem is a simple Tree, but it is simple now and it might become much more complex, demanding more operations on the tree and specially efficient searching algorithms. Thats why I�m looking for a complete solution and I prefer something that is already done and well tested :) !
    Thanks for your tip !

Maybe you are looking for

  • Question about writing out different types...

    hi, i have a need to write out records that correspond to the following format: String, 25 bytes long, 8 bytes long, 8 bytes int, 4 bytes. for the long and int types i need to write out the actual bytes of these numbers, NOT their string representati

  • System Landscape in Solution Manager

    Hi, I wonder if in Solution Manager, one can produce a single report/transaction containing all the SAP System configured in SolMan and also the details of System Datas. For example. Client in each system, Hardware info and Support Packages installed

  • My Time preference is screwed up

    I have to set it to the Eastern TZ to get it to display the correct time. It then displays the time zone as being COT time, whatever that is. iCal then displays a totally hosed time zone that bears no relation to reality. What's going on with this pr

  • Why, after using Firefox for some years ,can I get on to the Virgin Media site but not the Virgin Media e-mail or anypart of My Virgin Media.

    I have used Firefox for a few years with great success but now I cannot receive my email from the Virgin Media site. The rest of the site is fine but as soon as I click on "Check your e-mail" I get an error message. This is very frustrating.

  • Garbage collector question

    I have a question about the garbage collection. You cant activate the garbage collector when you want but in JProbe tool you can request it pushing a button. Can i do this in my application?. I tried using System.gc() and Runtime.getRuntime.gc() but