/** * This Method returns the 2D Array which is the list of the Items for the selected WorkOrder of * the Customer. * * @param workorderId - WorkOrder Id Foreign Key of WRK_ORDR_DETS table * @return Object[][] - 2D Array which is List of the Items for the WorkOrder */ public Object[][] getWorkOrderItems(long workorderId) throws RemoteException { WrkOrdrDets wrkordrdts_obj = new WrkOrdrDets(conn); RHCCBlgKeys blgkeys_obj = new RHCCBlgKeys(conn); Vector workorderdetList = wrkordrdts_obj.getProductList(workorderId); // Hashtable BSysList = (Hashtable) USFEnv.getBillSystems(); BlgSys blgsys = new BlgSys(); Hashtable BSysList = (Hashtable) blgsys.searchBlgSys(); Enumeration BSys = BSysList.keys(); // The 2-Dimensional array to hold the Items Billing System wise. Object[][] prodList = new Object[BSysList.size()][workorderdetList.size() + 1]; // The Number of Billing Systems are assumed to be equal to the // Static Load Billing Systems Hashtable size. The Billing Systems will // be in order starting from 1 and incrementing by one. for (int i = 0; i < BSysList.size(); i++) { // Set the 2D array to store the Billing System as the first element // of each row. prodList[i][0] = String.valueOf(i + 1); } // Loop throught the WorkOrder Items List and place them in the appropriate // positions in the 2D array. for (int j = 0; j < workorderdetList.size(); j++) { // Determine the Billing System of the Product Vector tmpVector = new Vector(); WrkOrdrDets workorderObj = (WrkOrdrDets) workorderdetList.elementAt(j); RHCCBlgKeys bkObj = blgkeys_obj.searchRHCCBlgKeys(((WrkOrdrDets) workorderdetList.elementAt(j)).getRBKID()); int bsid = (new Long(bkObj.getBsId())).intValue(); tmpVector.addElement(bkObj); tmpVector.addElement(workorderObj); // Based on the Billing System Id retreived place the Product Object // in the 2D array. int k = 1; while (prodList[bsid - 1][k] != null) { k = k + 1; } prodList[bsid - 1][k] = tmpVector; } // Return the 2D array return prodList; }
// ------------------------------------------- public static String[] mergeArrays(String[] sa1, String[] sa2) { if (sa1 == null) { sa1 = new String[0]; } if (sa2 == null) { sa2 = new String[0]; } int sa1Len = sa1.length; int sa2Len = sa2.length; Hashtable tab = new Hashtable(sa1Len + sa2Len); for (int i = 0; i < sa1Len; i++) { tab.put(sa1[i], sa1[i]); } for (int i = 0; i < sa2Len; i++) { tab.put(sa2[i], sa2[i]); } int len = tab.size(); String[] res = new String[len]; int i = 0; for (Enumeration e = tab.keys(); e.hasMoreElements(); ) { String s = (String) e.nextElement(); res[i++] = s; } return res; }