@Override
  public final List<Node<String>> getSampleDataRow(
    final Map<String, Object> pReqVars) throws Exception {
    String lang = (String) pReqVars.get("lang");
    List<Node<String>> result = new ArrayList<Node<String>>();
    Integer idx = 1;
    Node<String> nodeGoods = new Node<String>();
    result.add(nodeGoods);
    nodeGoods.setItsName(getSrvI18n().getMsg("goods", lang));
    nodeGoods.setItsNodes(new ArrayList<Node<String>>());
    Node<String> nodeGoodsName = new Node<String>();
    nodeGoods.getItsNodes().add(nodeGoodsName);
    nodeGoodsName.setItsName(getSrvI18n().getMsg("itsName", lang));
    nodeGoodsName.setItsValue(idx.toString() + ";itsName");
    Node<String> nodeGoodsId = new Node<String>();
    nodeGoods.getItsNodes().add(nodeGoodsId);
    nodeGoodsId.setItsName(getSrvI18n().getMsg("itsId", lang));
    nodeGoodsId.setItsValue(idx.toString() + ";itsId");
    Node<String> nodeGoodsItsCategory = new Node<String>();
    nodeGoods.getItsNodes().add(nodeGoodsItsCategory);
    nodeGoodsItsCategory.setItsName(getSrvI18n().getMsg("itsCategory", lang));
    nodeGoodsItsCategory.setItsNodes(new ArrayList<Node<String>>());
    Node<String> nodeGoodsItsCategoryName = new Node<String>();
    nodeGoodsItsCategory.getItsNodes().add(nodeGoodsItsCategoryName);
    nodeGoodsItsCategoryName.setItsName(getSrvI18n().getMsg("itsName", lang));
    nodeGoodsItsCategoryName
      .setItsValue(idx.toString() + ";itsCategory,itsName");
    Node<String> nodeGoodsItsCategoryId = new Node<String>();
    nodeGoodsItsCategory.getItsNodes().add(nodeGoodsItsCategoryId);
    nodeGoodsItsCategoryId.setItsName(getSrvI18n().getMsg("itsId", lang));
    nodeGoodsItsCategoryId.setItsValue(idx.toString() + ";itsCategory,itsId");
    Node<String> nodeGoodsDefUnitOfMeasure = new Node<String>();
    nodeGoods.getItsNodes().add(nodeGoodsDefUnitOfMeasure);
    nodeGoodsDefUnitOfMeasure.setItsName(getSrvI18n()
      .getMsg("defUnitOfMeasure", lang));
    nodeGoodsDefUnitOfMeasure.setItsNodes(new ArrayList<Node<String>>());
    Node<String> nodeGoodsDefUnitOfMeasureName = new Node<String>();
    nodeGoodsDefUnitOfMeasure.getItsNodes().add(nodeGoodsDefUnitOfMeasureName);
    nodeGoodsDefUnitOfMeasureName
      .setItsName(getSrvI18n().getMsg("itsName", lang));
    nodeGoodsDefUnitOfMeasureName
      .setItsValue(idx.toString() + ";defUnitOfMeasure,itsName");
    Node<String> nodeGoodsDefUnitOfMeasureId = new Node<String>();
    nodeGoodsDefUnitOfMeasure.getItsNodes().add(nodeGoodsDefUnitOfMeasureId);
    nodeGoodsDefUnitOfMeasureId.setItsName(getSrvI18n().getMsg("itsId", lang));
    nodeGoodsDefUnitOfMeasureId
      .setItsValue(idx.toString() + ";defUnitOfMeasure,itsId");
    idx++;
    Node<String> nodePrice = new Node<String>();
    result.add(nodePrice);
    nodePrice.setItsName(getSrvI18n().getMsg("itsPrice", lang));
    nodePrice.setItsValue(idx.toString());
    idx++;
    Node<String> nodeCost = new Node<String>();
    result.add(nodeCost);
    nodeCost.setItsName(getSrvI18n().getMsg("itsCost", lang));
    nodeCost.setItsValue(idx.toString());
    idx++;
    Node<String> nodeQuantity = new Node<String>();
    result.add(nodeQuantity);
    nodeQuantity.setItsName(getSrvI18n().getMsg("itsQuantity", lang));
    nodeQuantity.setItsValue(idx.toString());
    idx++;
    Node<String> nodeIsAvailable = new Node<String>();
    result.add(nodeIsAvailable);
    nodeIsAvailable.setItsName(getSrvI18n().getMsg("isAvailable", lang));
    nodeIsAvailable.setItsValue(idx.toString());
    idx++;
    Node<String> nodeWarehouseSite = new Node<String>();
    result.add(nodeWarehouseSite);
    nodeWarehouseSite.setItsName(getSrvI18n().getMsg("WarehouseSite", lang));
    nodeWarehouseSite.setItsNodes(new ArrayList<Node<String>>());
    Node<String> nodeWarehouseSiteName = new Node<String>();
    nodeWarehouseSite.getItsNodes().add(nodeWarehouseSiteName);
    nodeWarehouseSiteName.setItsName(getSrvI18n().getMsg("itsName", lang));
    nodeWarehouseSiteName.setItsValue(idx.toString() + ";itsName");
    Node<String> nodeWarehouseSiteId = new Node<String>();
    nodeWarehouseSite.getItsNodes().add(nodeWarehouseSiteId);
    nodeWarehouseSiteId.setItsName(getSrvI18n().getMsg("itsId", lang));
    nodeWarehouseSiteId.setItsValue(idx.toString() + ";itsId");
    Node<String> nodeWarehouseSiteWarehouse = new Node<String>();
    nodeWarehouseSite.getItsNodes().add(nodeWarehouseSiteWarehouse);
    nodeWarehouseSiteWarehouse
      .setItsName(getSrvI18n().getMsg("warehouse", lang));
    nodeWarehouseSiteWarehouse.setItsNodes(new ArrayList<Node<String>>());
    Node<String> nodeWarehouseSiteWarehouseName = new Node<String>();
    nodeWarehouseSiteWarehouse.getItsNodes()
      .add(nodeWarehouseSiteWarehouseName);
    nodeWarehouseSiteWarehouseName
      .setItsName(getSrvI18n().getMsg("itsName", lang));
    nodeWarehouseSiteWarehouseName
      .setItsValue(idx.toString() + ";warehouse,itsName");
    Node<String> nodeWarehouseSiteWarehouseId = new Node<String>();
    nodeWarehouseSiteWarehouse.getItsNodes().add(nodeWarehouseSiteWarehouseId);
    nodeWarehouseSiteWarehouseId.setItsName(getSrvI18n().getMsg("itsId", lang));
    nodeWarehouseSiteWarehouseId
      .setItsValue(idx.toString() + ";warehouse,itsId");
    Set<String> ndFlIdNm = new HashSet<String>();
    ndFlIdNm.add("itsId");
    ndFlIdNm.add("itsName");
    pReqVars.put("InvItemTaxCategoryneededFields", ndFlIdNm);
    pReqVars.put("TaxneededFields", ndFlIdNm);
    List<InvItemTaxCategoryLine> allTaxCatsLns = getSrvOrm()
      .retrieveList(pReqVars, InvItemTaxCategoryLine.class);
    pReqVars.remove("InvItemTaxCategoryneededFields");
    pReqVars.remove("TaxneededFields");
    List<Tax> usedTaxes = new ArrayList<Tax>();
    List<InvItemTaxCategory> usedTaxCats = new ArrayList<InvItemTaxCategory>();
    for (InvItemTaxCategoryLine tcl : allTaxCatsLns) {
      boolean txListed = false;
      for (Tax tx : usedTaxes) {
        if (tx.getItsId().equals(tcl.getTax().getItsId())) {
          txListed = true;
          break;
        }
      }
      if (!txListed) {
        usedTaxes.add(tcl.getTax());
      }
      int tci = -1;
      for (InvItemTaxCategory tc : usedTaxCats) {
        if (tc.getItsId().equals(tcl.getItsOwner().getItsId())) {
          tci = usedTaxCats.indexOf(tc);
          break;
        }
      }
      if (tci == -1) {
        usedTaxCats.add(tcl.getItsOwner());
        tcl.getItsOwner().setTaxes(new ArrayList<InvItemTaxCategoryLine>());
        tcl.getItsOwner().getTaxes().add(tcl);
      } else {
        usedTaxCats.get(tci).getTaxes().add(tcl);
      }
    }
    boolean isOnlyTax = true;
    for (InvItemTaxCategory txc : usedTaxCats) {
      if (txc.getTaxes().size() > 1) {
        isOnlyTax = false;
        break;
      }
    }
    if (isOnlyTax) {
      idx++;
      addTaxWr(result, idx.toString(),
        getSrvI18n().getMsg("OnlyTax", lang), lang);
    } else {
      idx++;
      addTaxCatWr(result, idx.toString(),
        getSrvI18n().getMsg("taxCategory", lang), lang);
      Collections.sort(usedTaxes, new CmprHasIdLong<Tax>());
      for (Tax tx : usedTaxes) {
        idx++;
        addTaxWr(result, idx.toString(), tx.getItsName(), lang);
      }
      Collections.sort(usedTaxCats, new CmprHasIdLong<InvItemTaxCategory>());
      for (InvItemTaxCategory txc : usedTaxCats) {
        idx++;
        addTaxCatWr(result, idx.toString(), txc.getItsName(), lang);
      }
    }
    return result;
  }
@ Override public final List < Node < String > > getSampleDataRow ( final Map < String , Object > pReqVars ) throws Exception { String lang = ( String ) pReqVars . get ( "lang" ) ; List < Node < String > > result = new ArrayList < Node < String > > ( ) ; Integer idx = 1 ; Node < String > nodeGoods = new Node < String > ( ) ; result . add ( nodeGoods ) ; nodeGoods . setItsName ( getSrvI18n ( ) . getMsg ( "goods" , lang ) ) ; nodeGoods . setItsNodes ( new ArrayList < Node < String > > ( ) ) ; Node < String > nodeGoodsName = new Node < String > ( ) ; nodeGoods . getItsNodes ( ) . add ( nodeGoodsName ) ; nodeGoodsName . setItsName ( getSrvI18n ( ) . getMsg ( "itsName" , lang ) ) ; nodeGoodsName . setItsValue ( idx . toString ( ) + ";itsName" ) ; Node < String > nodeGoodsId = new Node < String > ( ) ; nodeGoods . getItsNodes ( ) . add ( nodeGoodsId ) ; nodeGoodsId . setItsName ( getSrvI18n ( ) . getMsg ( "itsId" , lang ) ) ; nodeGoodsId . setItsValue ( idx . toString ( ) + ";itsId" ) ; Node < String > nodeGoodsItsCategory = new Node < String > ( ) ; nodeGoods . getItsNodes ( ) . add ( nodeGoodsItsCategory ) ; nodeGoodsItsCategory . setItsName ( getSrvI18n ( ) . getMsg ( "itsCategory" , lang ) ) ; nodeGoodsItsCategory . setItsNodes ( new ArrayList < Node < String > > ( ) ) ; Node < String > nodeGoodsItsCategoryName = new Node < String > ( ) ; nodeGoodsItsCategory . getItsNodes ( ) . add ( nodeGoodsItsCategoryName ) ; nodeGoodsItsCategoryName . setItsName ( getSrvI18n ( ) . getMsg ( "itsName" , lang ) ) ; nodeGoodsItsCategoryName . setItsValue ( idx . toString ( ) + ";itsCategory,itsName" ) ; Node < String > nodeGoodsItsCategoryId = new Node < String > ( ) ; nodeGoodsItsCategory . getItsNodes ( ) . add ( nodeGoodsItsCategoryId ) ; nodeGoodsItsCategoryId . setItsName ( getSrvI18n ( ) . getMsg ( "itsId" , lang ) ) ; nodeGoodsItsCategoryId . setItsValue ( idx . toString ( ) + ";itsCategory,itsId" ) ; Node < String > nodeGoodsDefUnitOfMeasure = new Node < String > ( ) ; nodeGoods . getItsNodes ( ) . add ( nodeGoodsDefUnitOfMeasure ) ; nodeGoodsDefUnitOfMeasure . setItsName ( getSrvI18n ( ) . getMsg ( "defUnitOfMeasure" , lang ) ) ; nodeGoodsDefUnitOfMeasure . setItsNodes ( new ArrayList < Node < String > > ( ) ) ; Node < String > nodeGoodsDefUnitOfMeasureName = new Node < String > ( ) ; nodeGoodsDefUnitOfMeasure . getItsNodes ( ) . add ( nodeGoodsDefUnitOfMeasureName ) ; nodeGoodsDefUnitOfMeasureName . setItsName ( getSrvI18n ( ) . getMsg ( "itsName" , lang ) ) ; nodeGoodsDefUnitOfMeasureName . setItsValue ( idx . toString ( ) + ";defUnitOfMeasure,itsName" ) ; Node < String > nodeGoodsDefUnitOfMeasureId = new Node < String > ( ) ; nodeGoodsDefUnitOfMeasure . getItsNodes ( ) . add ( nodeGoodsDefUnitOfMeasureId ) ; nodeGoodsDefUnitOfMeasureId . setItsName ( getSrvI18n ( ) . getMsg ( "itsId" , lang ) ) ; nodeGoodsDefUnitOfMeasureId . setItsValue ( idx . toString ( ) + ";defUnitOfMeasure,itsId" ) ; idx ++ ; Node < String > nodePrice = new Node < String > ( ) ; result . add ( nodePrice ) ; nodePrice . setItsName ( getSrvI18n ( ) . getMsg ( "itsPrice" , lang ) ) ; nodePrice . setItsValue ( idx . toString ( ) ) ; idx ++ ; Node < String > nodeCost = new Node < String > ( ) ; result . add ( nodeCost ) ; nodeCost . setItsName ( getSrvI18n ( ) . getMsg ( "itsCost" , lang ) ) ; nodeCost . setItsValue ( idx . toString ( ) ) ; idx ++ ; Node < String > nodeQuantity = new Node < String > ( ) ; result . add ( nodeQuantity ) ; nodeQuantity . setItsName ( getSrvI18n ( ) . getMsg ( "itsQuantity" , lang ) ) ; nodeQuantity . setItsValue ( idx . toString ( ) ) ; idx ++ ; Node < String > nodeIsAvailable = new Node < String > ( ) ; result . add ( nodeIsAvailable ) ; nodeIsAvailable . setItsName ( getSrvI18n ( ) . getMsg ( "isAvailable" , lang ) ) ; nodeIsAvailable . setItsValue ( idx . toString ( ) ) ; idx ++ ; Node < String > nodeWarehouseSite = new Node < String > ( ) ; result . add ( nodeWarehouseSite ) ; nodeWarehouseSite . setItsName ( getSrvI18n ( ) . getMsg ( "WarehouseSite" , lang ) ) ; nodeWarehouseSite . setItsNodes ( new ArrayList < Node < String > > ( ) ) ; Node < String > nodeWarehouseSiteName = new Node < String > ( ) ; nodeWarehouseSite . getItsNodes ( ) . add ( nodeWarehouseSiteName ) ; nodeWarehouseSiteName . setItsName ( getSrvI18n ( ) . getMsg ( "itsName" , lang ) ) ; nodeWarehouseSiteName . setItsValue ( idx . toString ( ) + ";itsName" ) ; Node < String > nodeWarehouseSiteId = new Node < String > ( ) ; nodeWarehouseSite . getItsNodes ( ) . add ( nodeWarehouseSiteId ) ; nodeWarehouseSiteId . setItsName ( getSrvI18n ( ) . getMsg ( "itsId" , lang ) ) ; nodeWarehouseSiteId . setItsValue ( idx . toString ( ) + ";itsId" ) ; Node < String > nodeWarehouseSiteWarehouse = new Node < String > ( ) ; nodeWarehouseSite . getItsNodes ( ) . add ( nodeWarehouseSiteWarehouse ) ; nodeWarehouseSiteWarehouse . setItsName ( getSrvI18n ( ) . getMsg ( "warehouse" , lang ) ) ; nodeWarehouseSiteWarehouse . setItsNodes ( new ArrayList < Node < String > > ( ) ) ; Node < String > nodeWarehouseSiteWarehouseName = new Node < String > ( ) ; nodeWarehouseSiteWarehouse . getItsNodes ( ) . add ( nodeWarehouseSiteWarehouseName ) ; nodeWarehouseSiteWarehouseName . setItsName ( getSrvI18n ( ) . getMsg ( "itsName" , lang ) ) ; nodeWarehouseSiteWarehouseName . setItsValue ( idx . toString ( ) + ";warehouse,itsName" ) ; Node < String > nodeWarehouseSiteWarehouseId = new Node < String > ( ) ; nodeWarehouseSiteWarehouse . getItsNodes ( ) . add ( nodeWarehouseSiteWarehouseId ) ; nodeWarehouseSiteWarehouseId . setItsName ( getSrvI18n ( ) . getMsg ( "itsId" , lang ) ) ; nodeWarehouseSiteWarehouseId . setItsValue ( idx . toString ( ) + ";warehouse,itsId" ) ; Set < String > ndFlIdNm = new HashSet < String > ( ) ; ndFlIdNm . add ( "itsId" ) ; ndFlIdNm . add ( "itsName" ) ; pReqVars . put ( "InvItemTaxCategoryneededFields" , ndFlIdNm ) ; pReqVars . put ( "TaxneededFields" , ndFlIdNm ) ; List < InvItemTaxCategoryLine > allTaxCatsLns = getSrvOrm ( ) . retrieveList ( pReqVars , InvItemTaxCategoryLine . class ) ; pReqVars . remove ( "InvItemTaxCategoryneededFields" ) ; pReqVars . remove ( "TaxneededFields" ) ; List < Tax > usedTaxes = new ArrayList < Tax > ( ) ; List < InvItemTaxCategory > usedTaxCats = new ArrayList < InvItemTaxCategory > ( ) ; for ( InvItemTaxCategoryLine tcl : allTaxCatsLns ) { boolean txListed = false ; for ( Tax tx : usedTaxes ) { if ( tx . getItsId ( ) . equals ( tcl . getTax ( ) . getItsId ( ) ) ) { txListed = true ; break ; } } if ( ! txListed ) { usedTaxes . add ( tcl . getTax ( ) ) ; } int tci = - 1 ; for ( InvItemTaxCategory tc : usedTaxCats ) { if ( tc . getItsId ( ) . equals ( tcl . getItsOwner ( ) . getItsId ( ) ) ) { tci = usedTaxCats . indexOf ( tc ) ; break ; } } if ( tci == - 1 ) { usedTaxCats . add ( tcl . getItsOwner ( ) ) ; tcl . getItsOwner ( ) . setTaxes ( new ArrayList < InvItemTaxCategoryLine > ( ) ) ; tcl . getItsOwner ( ) . getTaxes ( ) . add ( tcl ) ; } else { usedTaxCats . get ( tci ) . getTaxes ( ) . add ( tcl ) ; } } boolean isOnlyTax = true ; for ( InvItemTaxCategory txc : usedTaxCats ) { if ( txc . getTaxes ( ) . size ( ) > 1 ) { isOnlyTax = false ; break ; } } if ( isOnlyTax ) { idx ++ ; addTaxWr ( result , idx . toString ( ) , getSrvI18n ( ) . getMsg ( "OnlyTax" , lang ) , lang ) ; } else { idx ++ ; addTaxCatWr ( result , idx . toString ( ) , getSrvI18n ( ) . getMsg ( "taxCategory" , lang ) , lang ) ; Collections . sort ( usedTaxes , new CmprHasIdLong < Tax > ( ) ) ; for ( Tax tx : usedTaxes ) { idx ++ ; addTaxWr ( result , idx . toString ( ) , tx . getItsName ( ) , lang ) ; } Collections . sort ( usedTaxCats , new CmprHasIdLong < InvItemTaxCategory > ( ) ) ; for ( InvItemTaxCategory txc : usedTaxCats ) { idx ++ ; addTaxCatWr ( result , idx . toString ( ) , txc . getItsName ( ) , lang ) ; } } return result ; }
<p>Retrieves sample data row (tree) to make CSV column.</p>
@param pReqVars additional param
@return sample data row
@throws Exception an Exception