[opencms-dev] Content Type/ Data import

shishank.mathur at wipro.com shishank.mathur at wipro.com
Thu Oct 13 05:56:04 CEST 2005


Hi Brian,

Thanks for the information.

I tried using Java API and here is a sample code if any one interested

Get CmsObject: CmsObject cmso = cms.getCmsObject();

Then create CmsResource passing in the Asset information (XML file for
my Content Type is passed in buffer object).

 CmsResource res =
cmso.createResource("/sites/default/test2",200,buffer.getBytes(),null);

And your asset will be created in OpenCms.

Kind Regards,
Shishank
http://goshishank.blogspot.com


-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Hufford, Brian
Sent: Tuesday, October 11, 2005 10:25 PM
To: opencms-dev at opencms.org
Subject: [opencms-dev] Content Type/ Data import

there is a way to do an import of data from a legacy db into OpenCms
based on your new Xml Content Type. It is sort of a hack, but I was able
to get it to work without much trouble. Here is what you do:
1. export your data out of the db as something like a "|" delimited text
file 2. write a program that reads this file one line (record) at a time
and parses on the "|"
3. have same program take parsed values and create an xml file (for each
record) based on your My Article xsd 4. upload all these xml files using
the "file upload applet". They will be uploaded as "plain" type into
OpenCms 5. using the Administration console, perform a db export and
choose the xml files as the assets to be exported. The exported file
will be saved as a ZIP file within your tomcat OpenCms webapp at this
location "/webapps/opencms/WEB-INF/packages/yourfile.zip"
6. there should be a manifest.xml in this zip file..open it and do a
search/replace for "type=plain" and replace with "type=MyArticle". Then
save the modified manifest.xml.
7. using the Administration console, perform a db import (when doing an
import you are given a dropdown list of choices of files..your zip file
will be one of them). Choose that zip file. That's it...once the db
import is finished all the files will be converted to your My Article
type.


_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please
visit
http://mail.opencms.org/mailman/listinfo/opencms-dev



Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin at wipro.com immediately
and destroy all copies of this message and any attachments.



More information about the opencms-dev mailing list