package nasinc; import java.io.*; import java.util.*; import java.util.List; import java.util.ArrayList; // Date Comment // // 12.28.05 Returns a list of currently active Product & Category Codes & Creates Order // public class OEw01Products { private HashMap OEw01Products = new HashMap(); private String error_code; public OEw01Products(ArrayList dataList) { String toParse; ArrayList OEw01Names = new ArrayList(); //Get the first string and seperate toParse = (String) dataList.get(0); SepString sepInit = new SepString(toParse); ArrayList OEw01List = (ArrayList) sepInit.getStringVals(); if (OEw01List.size() > 0) { int cnt = 0; OEw01Products.put("id", (String) OEw01List.get(cnt++)); this.error_code = (String) OEw01List.get(cnt++); OEw01Products.put("error_code", this.error_code); OEw01Products.put("OEw01_num_products", OEw01List.get(cnt++)); OEw01Products.put("OEw01_order_number", OEw01List.get(cnt++)); for (int count = 1; count < dataList.size(); count++) { int cnt2 = 0; HashMap OEw01_Products = new HashMap(); toParse = (String) dataList.get(count); sepInit = new SepString(toParse); ArrayList tmpList = (ArrayList) sepInit.getStringVals(); // loop through the line and separate OEw01_Products.put("OEw01_line_count", tmpList.get(cnt2++)); OEw01_Products.put("OEw01_prod_code", tmpList.get(cnt2++)); OEw01_Products.put("OEw01_prod_descr", tmpList.get(cnt2++)); OEw01_Products.put("OEw01_pc_ind", tmpList.get(cnt2++)); OEw01_Products.put("OEw01_cat_code", tmpList.get(cnt2++)); OEw01_Products.put("OEw01_cat_descr", tmpList.get(cnt2++)); OEw01_Products.put("OEw01_num_items", tmpList.get(cnt2++)); OEw01Names.add( OEw01_Products ); } // Now add the list to the top level OEw01Products if (OEw01Names.size() > 0) { OEw01Products.put("names", (ArrayList) OEw01Names); } } else { OEw01Products.put("error_code", "No data returned"); } } public HashMap getOEw01Products() { return OEw01Products; } public String getErrorMsg() { return error_code; } }