Hi Sandeep,
why don't you walk the object tree after unmarshalling to set the
GUID's. For me this seams to be the simplest solution or do I miss anything?
Regards
Ralf
Sandeep Khanna schrieb:
Hi All,
Given the following visual representation of Object relationships & the
relevant Castor mapping:
ClientDcl
|-ClientGUID
|-FirstName
|-LastName
|-...
|-AddressRoleDcl
|-AddressRoleGUID
|-ClientGUID
|-AddressGUID
|-...
|-AddressDcl
|-AddressGUID
|-...
I would like to unmarshall the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<AsClient>
<ClientGUID/>
<FirstName>Sandeep</FirstName>
<LastName>Khanna</LastName>
<Fields>
<AsClientField>
<ClientGUID/>
<FieldName>ExtraFieldName</FieldName>
<FieldTypeCode>02</FieldTypeCode>
<TextValue>ExtraFieldValue</TextValue>
</AsClientField>
</Fields>
<AddressRoles> <!-- Map -->
<AsAddressRole> <!-- value -->
<AddressRoleGUID/>
<AddressGUID/>
<ClientGUID/>
<AddressRoleCode>2</AddressRoleCode> <!-- key -->
<AsAddress>
<AddressGUID/>
<AddressLine1>81 ALEXANDRA DRIVE</AddressLine1>
<AddressLine2/>
<AddressLine3/>
<addressLine4/>
<City>NEW BRITIAN</City>
<StateCode>07</StateCode>
<CountryCode/>
<PostalID>06789</PostalID>
<Fields>
<AsAddressField>
<ClientGUID/>
<FieldName/>
<FieldTypeCode>02</FieldTypeCode>
<TextValue/>
</AsAddressField>
</Fields>
</AsAddress>
</AsAddressRole>
</AddressRoles>
</AsClient>
We have a GUIDGeneratorUtl class that creates unique GUIDs. We would
like to use it from within the Castor framework to generate the GUID and
set it in the above Object relationships.
Questions:
1) How do I setup/use a GUID generator class from within the Castor
mapping file.
2) As per the above visual Object relationship, we would require the
ClientGUID that was generated and set on the ClientDcl object to be used
while setting the ClientGUID attribute on the AddressRoleDcl object
contained in the ClientDcl instance.
3) As per the above visual Object relationship,
AddressRoleDcl.AddressGUID needs to be set from the
AddressDcl.AddressGUID which would be generated only after we unmarshall
or parse the AddressDcl element/node. One way would be to unmarshall the
AddressDcl element/node first to have the AddressGUID ready before
unmarshalling AddressRoleDcl element/node.
Any comments, suggestions, pointers would be helpful.
--Sandeep Khanna
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------