Difference between revisions of "CSV2XMLTransformation"

From GreenVulcano Wiki
Jump to: navigation, search
(How To)
 
Line 21: Line 21:
 
The attribute's value cannot be null.
 
The attribute's value cannot be null.
 
|-
 
|-
| UseCDATA || required || Defines if the fields values must be enclosed in a CDATA section.
+
| UseCDATA || required || Defines if the fields value must be enclosed in a CDATA section.
 
The attribute's admitted values are:
 
The attribute's admitted values are:
 
* True
 
* True

Latest revision as of 10:37, 3 April 2012

Description

CSV2XMLTransformation element defines a CSV to XML transformation.

GreenVulcano® ESB Configuration

CSV2XMLTransformation with VulCon

CSV2XMLTransformation is used by element Transformations.

The following table shows its attributes:

Attribute Type Description
type fixed This attribute must assume the value transformation.
class fixed This attribute must assume the value it.greenvulcano.gvesb.gvdte.transformers.bin.bin2xml.CSVToXMLTransformer
name required Transformation name.

The attribute's value cannot be null.

FieldDelimiter required CSV field delimiter. Default ','.

The attribute's value cannot be null.

UseCDATA required Defines if the fields value must be enclosed in a CDATA section.

The attribute's admitted values are:

  • True
  • False

CSV2XMLTransformation might contain the following sub-elements:


How To

To add a new CSV2XMLTransformation go to the VulCon® Core view. Expand the GVDataTransformation element and right clicking Transformation -> Insert after or Insert before -> CSV2XMLTransformation.

The following example shows the use of CSV2XMLTransformation to transform CDR data, passed in input as CSV files, into an XML.

There have been defined two Transformations and a SequenceTransformation which performs both CSV2XMLTransformation and XSLTransformation in this order:

<CSV2XMLTransformation FieldDelimiter="," UseCDATA="False"
          class="it.greenvulcano.gvesb.gvdte.transformers.bin.bin2xml.CSVToXMLTransformer"
          name="ERICSSON_cdrToXml" type="transformation"/>
<XSLTransformation DataSourceSet="Default"
          XSLMapName="DataHandler/Ericsson/CaMa/InsertCDRDataBis.xsl"
          class="it.greenvulcano.gvesb.gvdte.transformers.xslt.XSLTransformer"
          name="InsertCDRData" type="transformation"/>
<SequenceTransformation DumpInOut="true" Output="OUT2"
          class="it.greenvulcano.gvesb.gvdte.controller.SequenceTransformer"
          name="UpdateCDRData" type="transformation">
     <SequenceElement Input="IN" Output="OUT1" Transformer="ERICSSON_cdrToXml"/>
     <SequenceElement Input="OUT1" Output="OUT2" Transformer="InsertCDRData"/>
</SequenceTransformation>

The following dh-call operation has been defined in order to convert the input as CSV data into a XML that will be successively transformed for inserting or updating the read data into the database.

<dh-call class="it.greenvulcano.gvesb.virtual.datahandler.DataHandlerCallOperation"
         name="ChangeCDRToXML" type="call">
     <DBOBuilder class="it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder"
                 jdbc-connection-name="ds.gv_cama" make-dump="text"
                 name="ChangeCDRToXML" output-data="InsertOrUpdate"
                 type="dbobuilder">
          <DHVariables>
                 <DHVariable name="decimal-separator" value="."/>
                 <DHVariable name="grouping-separator" value=","/>
                 <DHVariable name="format" value="#0.00"/>
          </DHVariables>
          <DBOInsertOrUpdate class="it.greenvulcano.gvesb.datahandling.dbo.DBOInsertOrUpdate"
                  input-data="csv_param"
                  name="InsertAndUpdate"
                  output-data="xml_param"
                  transformation="UpdateCDRData"
                  type="dbo">
                 <statement id="0" type="insert">insert into CAMA.CDR_EVENT
                      (MSG_ID, MSISDN, EVENT, EVENT_TIME, NOTE, INS_DATE)
                      values((select ID from MESSAGES where MMS_ID = ?),?,?,?,'',sysdate)
                 </statement>
                 <statement id="1" type="update">UPDATE cama.cdr_event
                      SET EVENT = ?, EVENT_TIME = ?
                      WHERE MSG_ID = (select ID from CAMA.MESSAGES where MSG_ID = ?) and MSISDN = ?
                 </statement>
          </DBOInsertOrUpdate>
     </DBOBuilder>
</dh-call>