6 Replies Latest reply on Apr 1, 2009 11:31 AM by Patrick Pussar

    Smooks JavaBinding

    Patrick Pussar Newbie

      Hi,
      I use the following configuration to bind my csv files:

      <csv:reader
       fields="FILE_ID,COMP_ID,ADDR_ID,CNTY_ID,ZIP_ID,CNTRY_ID,STATE_ID,LOC_ID,TWN_ID,ADDR_L1,ADDR_L2,ADDR_STR,ADDR_NUM,ADDR_BOX,DUMMY"
       separator=";" quote=""" skipLines="1" />
      
       <jb:bindings beanId="add" class="java.util.ArrayList" createOnElement="csv-set" extendLifecycle="true">
       <jb:wiring beanIdRef="addressRecord"/>
       </jb:bindings>
       <jb:bindings beanId="addressRecord" class="java.util.HashMap" createOnElement="csv-record" extendLifecycle="true">
       <jb:value property="ADDR_ID" data="ADDR_ID"/>
       <jb:value property="CNTY_ID" data="CNTY_ID"/>
       <jb:value property="ZIP_ID" data="ZIP_ID"/>
       <jb:value property="CNTRY_ID" data="CNTRY_ID"/>
       <jb:value property="CNTRY_ID" data="CNTRY_ID"/>
       <jb:value property="STATE_ID" data="STATE_ID"/>
       <jb:value property="LOC_ID" data="LOC_ID"/>
       <jb:value property="TWN_ID" data="TWN_ID"/>
       <jb:value property="ADDR_L1" data="ADDR_L1"/>
       <jb:value property="ADDR_L2" data="ADDR_L2"/>
       <jb:value property="ADDR_STR" data="ADDR_STR"/>
       <jb:value property="ADDR_NUM" data="ADDR_NUM"/>
       <jb:value property="ADDR_BOX" data="ADDR_BOX"/>
       </jb:bindings>



      The result will be a ArrayList<Map<String, Object>>. Is there a way to add an index to have this as result Map<String, Map<String, Object>>, where the Map.Key would be the index (ADDR_ID) and the Map.Value the Address entity-map?

      Thanks,
      Patrick