[prev in list] [next in list] [prev in thread] [next in thread] 

List:       castor-user
Subject:    [castor-user] Castor XML - mapping qualified classes
From:       "Nigel Kibble" <nkibble () wesupply ! com>
Date:       2005-11-29 15:44:14
Message-ID: 007B32A75970EC4FAB4BEDE2F5A89AA109DAFFCB () eh6 ! hosted ! lanlogic ! net
[Download RAW message or body]

Hi,

I'm trying to use Castor to unmarshall XML purchase orders, via a number
of different scemas.

One of the complex elements contained within the purchase order is
"Party", containing name and address information. I'm expecting to
receive about four of these party elements within each PO; for buyer,
supplier, delivery point, etc.  

Each party has a qualifier code ("role" attribute) such as
"DeliveryPoint". This qualifier code will vary across schemas, so I want
to adopt my own qualifier code within my bean that will be generic from
the schema (ie 1 for Delivery point).  

My questions are:  
1)  Can I do something within the XML mapper to convert a value of
"DeliveryPoint" to a value of say 1?  I'd obviously rather do this
within the mapper than within the bean.
2)  Do I HAVE to use a collection of Party objects within my
PurchaseOrder, or could I have 4 specific variables of buyerParty,
supplierParty, etc within my PurchaseOrder, and have some way of
populating these specific variables depending upon the value of the
"role" attribute?

Sample XML:
<Orders>
    <Order>
        <OrderHeader>
            <Party role="DeliveryPoint">
                <PartyIdentity type="EAN">1234</PartyIdentity>
                <PartyIdentity type="Buyer">MY_BUYER</PartyIdentity>
                <Name>BUYER 1</Name>
                <Address>
                    <AddressLine>Buyer Address 1</AddressLine>
                    <AddressLine>Buyer Address 2</AddressLine>
                    <City>Buyer City</City>
                    <StateOrProvince/>
                    <PostCode>AB1 2NT</PostCode>
                </Address>
            </Party>
            <Party role="OrderOffice">
                <PartyIdentity type="EAN">4567</PartyIdentity>
                <PartyIdentity type="Buyer">MY_OFFICE</PartyIdentity>
                <Name>BUYER</Name>
                <Address>
                    <AddressLine>Buyer Address 1</AddressLine>
                    <AddressLine>Buyer Address 2</AddressLine>
                    <City>Buyer City</City>
                    <StateOrProvince/>
                    <PostCode>XY1 2AB</PostCode>
                </Address>
            </Party>
            <Party role="Seller">
                <PartyIdentity type="EAN">891011</PartyIdentity>
                <PartyIdentity type="Buyer">MY_SELLER</PartyIdentity>
                <Name>SELLER</Name>
                <Address>
                    <AddressLine>Seller Address 1</AddressLine>
                    <AddressLine>Sller Address 2</AddressLine>
                    <City>Seller City</City>
                    <StateOrProvince/>
                    <PostCode>NT1 2XY</PostCode>
                </Address>
            </Party>
        </OrderHeader>
    </Order>
</Orders>


Thanks in advance,

Nigel Kibble.

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

user-unsubscribe@castor.codehaus.org
-------------------------------------------------


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic