XML Export

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XML Export

Brady GEARRING
All,
 
Is there a service in OFBIZ that exports a database query into XML?
 
I am simply looking to query a table and return the results in XML so
I can use it for further transformation in an application I am
developing.
 
Thanks in advance,
 
Brady

Reply | Threaded
Open this post in threaded view
|

Re: XML Export

cjhowe
Hi Brady,

There are several options that you can use to accomplish this depending
on what you're wanting to do with it (simple, automation,
reuse/flexible, etc)

1. Simple
Make a controller view with encoding="none" and a screen(s) that
write(s) the xml structure template using freemarker. This will output
to your browser.

2. Automation
See the example for database export in webtools and how it creates an
xml file that is written to a file.

3. reuse/flexible
Instead of writing to a file in the file system, write to an xml
database.  This would also allow ongoing retrieval and querying of the
xml using xpath/xupdate.  I've started such an endeavour with Apache
Xindice and it can be found here:

http://ofbiz-sandbox.svn.sourceforge.net/viewvc/ofbiz-sandbox/ofbiz-sandbox/trunk/hot-deploy/


--- Brady GEARRING <[hidden email]> wrote:

> All,
>  
> Is there a service in OFBIZ that exports a database query into XML?
>  
> I am simply looking to query a table and return the results in XML so
> I can use it for further transformation in an application I am
> developing.
>  
> Thanks in advance,
>  
> Brady
>
>

Reply | Threaded
Open this post in threaded view
|

Re: XML Export

Brady GEARRING
In reply to this post by Brady GEARRING
Thank you for all the options, I have decided #2 makes the most
sense for the application I am working on. I am able to run the
service & then factor into our code source and get back all the xml
files.
 
I would like to know how to run the query below, verses using what
is in place, which reads all the tables
(ModelReader reader = delegator.getModelReader())
 
My Query:
SELECT per.party_id, per.first_name, per.last_name,  pr.party_id_to,
pr.from_date, pr.thru_date,STATE_PROVINCE_GEO_ID, pa.address1,
pa.address2, pa.city, pa.postal_code, pa.postal_code_ext,
pa.country_geo_id, tn.country_code, tn.area_code, tn.contact_number ,
cm.info_string, (select description from contact_mech_purpose_type
where contact_mech_purpose_type_id=pcmp.contact_mech_purpose_type_id)
as contact_mech_purpose
FROM party_relationship pr
JOIN person per on pr.party_id_from=per.party_id
left outer JOIN party_supplemental_data psd on
per.party_id=psd.party_id
left outer JOIN party_contact_mech pcm on (per.party_id=pcm.party_id
and
(pcm.thru_date is null or pcm.thru_date > GETDATE())) left outer JOIN
party_contact_mech_purpose pcmp on
(pcm.contact_mech_id=pcmp.contact_mech_id
and (pcmp.thru_date is null or pcmp.thru_date > GETDATE()))
LEFT OUTER JOIN contact_mech cm on
pcm.contact_mech_id=cm.contact_mech_id
LEFT OUTER JOIN postal_address pa on
pcm.contact_mech_id=pa.contact_mech_id
LEFT OUTER JOIN telecom_number tn on
pcm.contact_mech_id=tn.contact_mech_id
where pr.role_type_id_from='CONTACT' and pr.party_id_to=$P{PARTY_ID_TO}
and
pcmp.contact_mech_purpose_type_id=$P{contact_mech_purpose_type_id}
and (pr.thru_date is null or pr.thru_date>GETDATE())
 
Up to this point I have used: GenericDelegator delegator for most of
the queries,
but I didnt see any options for sending in a string sql query like the
one posted
above.
 
Any ideas?
 
Thanks for all your help.
 
Brady

>>> [hidden email] 5/30/2007 1:13 PM >>>

> Hi Brady,
>
> There are several options that you can use to accomplish this
depending
> on what you're wanting to do with it (simple, automation,
> reuse/flexible, etc)
>
> 1. Simple
> Make a controller view with encoding="none" and a screen(s) that
> write(s) the xml structure template using freemarker. This will
output
> to your browser.
>
> 2. Automation
> See the example for database export in webtools and how it creates
an
> xml file that is written to a file.
>
> 3. reuse/flexible
> Instead of writing to a file in the file system, write to an xml
> database.  This would also allow ongoing retrieval and querying of
the
> xml using xpath/xupdate.  I've started such an endeavour with Apache
> Xindice and it can be found here:

>
http://ofbiz-sandbox.svn.sourceforge.net/viewvc/ofbiz-sandbox/ofbiz-sandbox/trunk/hot-deploy/

--- Brady GEARRING <[hidden email]> wrote:

> All,
>  
> Is there a service in OFBIZ that exports a database query into XML?
>  
> I am simply looking to query a table and return the results in XML
so
> I can use it for further transformation in an application I am
> developing.
>  
> Thanks in advance,
>  
> Brady