diff --git a/src/com/blueseer/edi/EDI.java b/src/com/blueseer/edi/EDI.java index f04953001..3a8e21bae 100644 --- a/src/com/blueseer/edi/EDI.java +++ b/src/com/blueseer/edi/EDI.java @@ -968,8 +968,28 @@ public static String[] processFile(String infile, String map, String outfile, St GlobalDebug = true; } - if (GlobalDebug) + if (GlobalDebug) { System.out.println("processFile: entering function with file :" + infile); + } + + // always need a site + if (site.isBlank()) { + site = OVData.getDefaultSite(); + if (GlobalDebug) { + System.out.println("Site parameter blank...using default :" + site); + } + } + + // lets check to see if outfile contains a directory path...as if called from EDIbs with -of qualf + Path outdirpath = null; + Path path = Paths.get(outfile); + if (path.getParent() != null) { + outdirpath = path.getParent(); + outfile = path.getFileName().toString(); + } + + + String[] m = new String[]{"0",""}; String[] c = null; // control values to pass to map and log @@ -1009,6 +1029,11 @@ public static String[] processFile(String infile, String map, String outfile, St c[13] = ""; c[16] = "0"; // initial idxnbr c[22] = String.valueOf(comkey); + + if (outdirpath != null && Files.exists(outdirpath)) { + c[27] = cleanDirString(outdirpath.toString()); // set outdir if called from EDIbs with -of + } + c[26] = file.getParent(); // indir c[28] = editype[0]; c[30] = String.valueOf(isDebug); @@ -1301,7 +1326,6 @@ public static Map<Integer, Object[]> createMAPUNE(char[] cbuf, String[] c, Strin c[11] = String.valueOf((int) u); c[12] = isOverride; c[13] = String.join("+", unb); - c[15] = "0"; // inbound } // UNG may not be there...needs revisiting @@ -1420,16 +1444,15 @@ public static Map<Integer, Object[]> createIMAP(char[] cbuf, String[] c, String c[0] = isa[6].trim(); // senderid c[21] = isa[8].trim(); // receiverid - c[2] = map; - c[3] = infile; + // c[2] = map; + // c[3] = infile; c[4] = isa[13]; //isactrlnbr - c[8] = outfile; + // c[8] = outfile; c[9] = String.valueOf((int) s); c[10] = String.valueOf((int) e); c[11] = String.valueOf((int) u); - c[12] = isOverride; + // c[12] = isOverride; c[13] = new String(cbuf,i,105); - c[15] = "0"; // inbound } if (i > 1 && cbuf[i-1] == s && cbuf[i] == 'G' && cbuf[i+1] == 'S') { @@ -2845,6 +2868,8 @@ public static void processX12(Map<Integer, Object[]> ISAmap, char[] cbuf, String String[] c = (String[]) isa.getValue()[6]; + + // ArrayList d = (ArrayList) isa.getValue()[5]; Map<Integer, ArrayList> d = (HashMap<Integer, ArrayList>)isa.getValue()[5]; @@ -2979,12 +3004,15 @@ public static void processX12(Map<Integer, Object[]> ISAmap, char[] cbuf, String String[] defaults = EDData.getEDITPDefaultsX(c[1], gs02, gs03, c[2]); c[29] = defaults[15]; // defines outputfiletype - if (GlobalDebug) + if (GlobalDebug) { System.out.println("Entering Map " + map + " with: " + c[1] + "/" + gs02 + "/" + gs03); - + } + messages.add(new String[]{"info","Found Map: " + map + " with " + c[1] + "/" + gs02 + "/" + gs03}); messages.add(new String[]{"info","Using Map: " + map + " for docID: " + c[6]}); + + // at this point I should have a doc set (ST to SE) and a map ...now call map to operate on doc URLClassLoader cl = null; try { @@ -3441,7 +3469,7 @@ public static String[] createVoucherFrom810i(edi810i e, String[] control) { if (m[0].isBlank()) { // if not error m = VoucherTransaction("receipt", list, ap, false); } - System.out.println("HERE: " + m[0] + "/" + m[1]); + return m; } @@ -3727,7 +3755,7 @@ public static String[] createCFOFrom204(edi204 e, String[] control) { if (m[0].isBlank()) { // if not error m = addCFOTransaction(list, x, null, null); } - System.out.println("HERE: " + m[0] + "/" + m[1]); + return m; } diff --git a/src/com/blueseer/edi/EDIMap.java b/src/com/blueseer/edi/EDIMap.java index b6074805a..02833b8d6 100644 --- a/src/com/blueseer/edi/EDIMap.java +++ b/src/com/blueseer/edi/EDIMap.java @@ -306,6 +306,7 @@ public void setControl(String[] c) throws UserDefinedException { stctrl = c[6]; ref = c[7]; outfile = c[8]; + outdir = c[27]; // in case edibs uses -of with embedded file/path directory sd = delimConvertIntToStr(c[9]); ed = delimConvertIntToStr(c[10]); ud = delimConvertIntToStr(c[11]); @@ -325,15 +326,24 @@ public void setControl(String[] c) throws UserDefinedException { - if (c[0].equals("MapTester")) { + if (c[0].equals("MapTester") || ! c[12].isBlank()) { // throw new UserDefinedException("Houston...we have a problem"); // c values override lookup below for map tester ediData.map_mstr x = getMapMstr(new String[]{c[2]}); outsender = c[0]; outreceiver = c[21]; - outputdoctype = c[15]; - outputfiletype = c[29]; + if (! c[15].isBlank()) { + outputdoctype = c[15]; + } else { + outputdoctype = x.map_outdoctype(); + } + if (! c[29].isBlank()) { + outputfiletype = c[29]; + } else { + outputfiletype = x.map_outfiletype(); + c[29] = x.map_outfiletype(); + } if (outsender.isBlank()) { throw new UserDefinedException("Missing outsender in c[0]"); @@ -405,7 +415,7 @@ public static String delimConvertIntToStr(String intdelim) { public void setOutPutEnvelopeStrings(String[] c) { if ( ! isOverride) { // if not override...use internal partner / doc lookup for envelope info - + if (c[29].toUpperCase().equals("X12")) { if (c[0].equals("MapTester")) { envelope = EDI.generateEnvelope(c[1], c[13], c[21], c[14], c[2]); //override use of c[13] from mapper ddsenderenvelope @@ -429,7 +439,9 @@ public void setOutPutEnvelopeStrings(String[] c) { GE = envelope[2]; IEA = envelope[3]; filename = envelope[4]; - outfile = filename; + if (outfile.isBlank()) { // if ran from edibs with -of...outfile will already be set as complete path + outfile = filename; + } isactrl = envelope[5]; gsctrl = envelope[6]; stctrl = String.format("%04d", 1); @@ -462,6 +474,7 @@ public void setOutPutEnvelopeStrings(String[] c) { } + if (c[29].toUpperCase().equals("X12")) { ST = "ST" + ed + EDData.getEDIDocTypeFromBSDoc(outputdoctype) + ed + stctrl ; SE = "SE" + ed + String.valueOf(segcount) + ed + stctrl; @@ -491,11 +504,12 @@ public void setOutPutEnvelopeStrings(String[] c) { xsetISA(9,""); // set date to now xsetISA(10,""); // set time to now - + /* header = ""; detail = ""; trailer = ""; content = ""; + */ } } @@ -780,14 +794,28 @@ public String[] packagePayLoad(String[] c) { // get TP/Doc defaults String[] tp = EDData.getEDITPDefaultsX(doctype, outsender, outreceiver, map ); + // override + if (! c[12].isBlank()) { + tp = EDData.getEDITPDefaults(doctype, outsender, outreceiver ); + } + + if (tp == null || tp.length < 18) { setError("tp defaults is null or empty for: " + doctype + "/" + outsender + "/" + outreceiver); return error; } if (GlobalDebug) { - System.out.println("Getting tp defaults for: " + doctype + "/" + outsender + "/" + outreceiver); - System.out.println("Value of tp defaults found: " + String.join(",", tp)); + int j = 0; + for (String g : c) { + System.out.println("Control c array values (packagePayLoad): " + j + " " + g); + j++; + } + if (! c[12].isBlank()) { + System.out.println("override detected in c[12]...using 3 (indoc,snd,rcv) key TP entry instead of 4 (indoc,snd,rcv,map"); + } + System.out.println("Getting tp defaults for: " + doctype + "/" + outsender + "/" + outreceiver + "/" + map); + System.out.println("Value of tp defaults found: " + String.join(",", tp)); } @@ -798,10 +826,12 @@ public String[] packagePayLoad(String[] c) { int filenumber = OVData.getNextNbr("edifile"); String batchfile = "X" + String.format("%07d", filenumber); String outfilemulti = ""; - if (outfile.isEmpty()) { + if (outfile.isBlank()) { outfile = tp[10] + String.format("%07d", filenumber) + "." + tp[11]; } + + if (c[29].toUpperCase().equals("X12") || c[29].toUpperCase().equals("UNE")) { setOutPutEnvelopeStrings(c); @@ -858,12 +888,18 @@ public String[] packagePayLoad(String[] c) { c[7] = ref; c[15] = tp[14]; c[25] = batchfile; - if (tp[20].equals("0")) { // if single package - c[8] = outfile; - } else { - c[8] = outfilemulti; + if (c[8].isBlank()) { // may not be blank if ran from edibs with -of qual + if (tp[20].equals("0")) { // if single package + c[8] = outfile; + } else { + c[8] = outfilemulti; + } } - c[27] = outdir; + + if (c[27].isBlank()) { // outdir may not be blank if ran from edibs with -of qual + c[27] = outdir; + } + // c[29] ...(outboundfiletype) should be defined at first available getTPDefaults prior to mapping c[6] = stctrl; c[5] = gsctrl; @@ -876,9 +912,7 @@ public String[] packagePayLoad(String[] c) { c[36] = tp[6]; c[37] = tp[8]; - if (GlobalDebug) - System.out.println("Value of c within EDIMap class: " + String.join(",", c)); - + // error handling if (batchfile.isEmpty()) { setError("batch file is empty"); @@ -888,10 +922,12 @@ public String[] packagePayLoad(String[] c) { setError("out file is empty"); return error; } - if (tp[15].isEmpty()) { + if (outputfiletype.isEmpty()) { setError("out file type is unknown"); return error; } + + try { // Write output batch file EDI.writeFile(content, cleanDirString(EDData.getEDIBatchDir()), batchfile); @@ -936,8 +972,13 @@ public void isDBWrite(String[] c) { c[36] = "0"; c[37] = "0"; - if (GlobalDebug) - System.out.println("Value of c within EDIMap class: " + String.join(",", c)); + if (GlobalDebug) { + int j = 0; + for (String g : c) { + System.out.println("Control c array values (isDBWrite): " + j + " " + g); + j++; + } + } } @@ -1179,7 +1220,7 @@ public static segRecord getSegmentInISF(String rawSegmentLM, String rawGroupHead if (x[5].equals("groupend")) { continue; } - // System.out.println("HERE: " + rawSegmentLM + "/" + rawGroupHeadLM + "/" + x[0] + "/" + x[1]); + if (rawSegmentLM.equals(x[0]) && rawGroupHeadLM.equals(x[1])) { segment = x; break; diff --git a/src/com/blueseer/edi/EDIbs.java b/src/com/blueseer/edi/EDIbs.java index 085a35d8d..960db4b81 100644 --- a/src/com/blueseer/edi/EDIbs.java +++ b/src/com/blueseer/edi/EDIbs.java @@ -75,23 +75,23 @@ public static void main(String args[]) throws IOException { tags = ResourceBundle.getBundle("resources.bs", Locale.getDefault()); // lets process the arguments String[] vs = checkargs(args); - String infile = vs[0].toString(); - String outfile = vs[1].toString(); - String indir = vs[2].toString(); - String outdir = vs[3].toString(); - String map = vs[4].toString(); - String isOverride = vs[5].toString(); + String infile = vs[0]; + String outfile = vs[1]; + String indir = vs[2]; + String outdir = vs[3]; + String map = vs[4]; + String isOverride = vs[5]; String[] doctypes = vs[6].split(","); - String prog = vs[7].toString(); - String archdir = vs[8].toString(); - + String prog = vs[7]; + String archdir = vs[8]; + String site = vs[9]; String myargs = String.join(",", args); switch (prog) { case "single" : - processSingle(infile, outfile, map, isOverride); + processSingle(infile, outfile, map, isOverride, site); break; case "multiple" : processMultiple(indir, outdir, map, isOverride); @@ -130,9 +130,9 @@ public static void main(String args[]) throws IOException { public static String[] checkargs(String[] args) { - List<String> legitargs = Arrays.asList("-if", "-of", "-id", "-od", "-m", "-x", "-ff", "-fd", "-ad", "-td", "-tf", "-e", "-debug", "-ftp", "-pd", "-pdr" ); + List<String> legitargs = Arrays.asList("-if", "-of", "-id", "-od", "-m", "-x", "-ff", "-fd", "-ad", "-td", "-tf", "-e", "-debug", "-ftp", "-pd", "-pdr", "-site" ); - String[] vals = new String[9]; // last element is the program type (single or mulitiple) + String[] vals = new String[10]; // last element is now 'site' Arrays.fill(vals, ""); String myargs = String.join(",", args); @@ -174,7 +174,7 @@ public static String[] checkargs(String[] args) { - if ( (args.length > i+1 && args[i+1] != null) || (args[i].toString().equals("-x")) || (args[i].toString().equals("-ff") || (args[i].toString().equals("-fd"))) ) { + if ( (args.length > i+1 && args[i+1] != null) || (args[i].toString().equals("-x")) || (args[i].toString().equals("-debug")) || (args[i].toString().equals("-ff") || (args[i].toString().equals("-fd"))) ) { switch (args[i].toString().toLowerCase()) { @@ -233,6 +233,9 @@ public static String[] checkargs(String[] args) { case "-debug" : isDebug = true; break; + case "-site" : + vals[9] = args[i+1]; + break; case "-ftp" : vals[4] = args[i+1]; vals[7] = "ftpClient"; @@ -253,11 +256,11 @@ public static String[] checkargs(String[] args) { return vals; } - public static void processSingle(String infile, String outfile, String map, String isOverride) { + public static void processSingle(String infile, String outfile, String map, String isOverride, String thissite) { // case of single input and output file if (! infile.isEmpty() && ! outfile.isEmpty() ) { try { - EDI.processFile(infile, map, outfile, isOverride, isDebug, false, 0, 0, ""); + EDI.processFile(infile, map, outfile, isOverride, isDebug, false, 0, 0, thissite); } catch (IOException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { diff --git a/src/com/blueseer/edi/ediData.java b/src/com/blueseer/edi/ediData.java index 08bbfb4a2..52921b521 100644 --- a/src/com/blueseer/edi/ediData.java +++ b/src/com/blueseer/edi/ediData.java @@ -4181,7 +4181,7 @@ public static String[] wkfaction_as2ToTranslate(wkf_mstr wkf, wkf_det wkfd, Arra for (String s : as2list) { as2_mstr as2 = getAS2Mstr(new String[]{s}); if (as2.as2_inwkf().equals(wkf.wkf_id)) { // if as2 ID is assigned this executing workflow id then fire - File folder = new File(as2.as2_outdir()); + File folder = new File(as2.as2_indir()); File[] listOfFiles = folder.listFiles(); if (listOfFiles != null) { messg = runEDIForSite(null, wkf.wkf_site(), listOfFiles); diff --git a/src/com/blueseer/srv/webServ.java b/src/com/blueseer/srv/webServ.java index 390b280ad..7bab416e7 100644 --- a/src/com/blueseer/srv/webServ.java +++ b/src/com/blueseer/srv/webServ.java @@ -56,6 +56,7 @@ of this software and associated documentation files (the "Software"), to deal import static com.blueseer.utl.BlueSeerUtils.confirmServerLogin; import static com.blueseer.utl.BlueSeerUtils.confirmServerSession; import static com.blueseer.utl.BlueSeerUtils.createMessageJSON; +import static com.blueseer.utl.BlueSeerUtils.getSiteFromSessionCookie; import static com.blueseer.utl.BlueSeerUtils.killServerSession; import com.blueseer.utl.EDData; import com.blueseer.utl.OVData; @@ -70,6 +71,7 @@ of this software and associated documentation files (the "Software"), to deal import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; +import java.util.Date; import java.util.Enumeration; import java.util.LinkedHashMap; import java.util.List; @@ -154,7 +156,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) } } } else { - String cookiecontent = request.getHeader("User") + ":" + sessionid + ":" + request.getRemoteAddr(); + String cookiecontent = request.getHeader("User") + "," + sessionid + "," + request.getRemoteAddr() + "," + OVData.getDefaultSiteForUserid(request.getHeader("User")); Cookie c = new Cookie("bscookie", Base64.toBase64String(cookiecontent.getBytes())); c.setHttpOnly(true); response.addCookie(c); @@ -176,7 +178,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) } } else { response.setStatus(HttpServletResponse.SC_OK); - response.getWriter().println(getData(prog)); + response.getWriter().println(getData(prog, request)); } } } @@ -200,8 +202,10 @@ private String getHeaders(HttpServletRequest request) { return requestHeaders.toString(); } - private String getData(String prog) { + private String getData(String prog, HttpServletRequest request) { String r = "bad request: " + prog; + String site = getSiteFromSessionCookie(request); + switch (prog) { case "getPartnerCount" : ArrayList<String> list = EDData.getEDIPartners(); @@ -209,6 +213,10 @@ private String getData(String prog) { r = r +",,,"; break; + case "getEDIDocTrans" : + r = h_getEDIDocTrans(request, site); + break; + default: r = "Unknown Data Request"; } @@ -217,4 +225,20 @@ private String getData(String prog) { return r; } + private String h_getEDIDocTrans(HttpServletRequest request, String site) { + String fromdate = ""; + String todate = ""; + String today = BlueSeerUtils.bsdate.format(new Date()); + if (request.getHeader("fromdate") != null && ! request.getHeader("fromdate").isBlank()) { + fromdate = BlueSeerUtils.convertDateFormat("yyyyMMdd", request.getHeader("fromdate")); + } else { + fromdate = today; + } + if (request.getHeader("todate") != null && ! request.getHeader("todate").isBlank()) { + todate = BlueSeerUtils.convertDateFormat("yyyyMMdd", request.getHeader("todate")); + } else { + todate = today; + } + return EDData.get_edi_idx_JSON(site, fromdate, todate); + } } diff --git a/src/com/blueseer/utl/BlueSeerUtils.java b/src/com/blueseer/utl/BlueSeerUtils.java index fadd724b8..d7c1c9163 100644 --- a/src/com/blueseer/utl/BlueSeerUtils.java +++ b/src/com/blueseer/utl/BlueSeerUtils.java @@ -2554,8 +2554,9 @@ public static boolean confirmServerSession(HttpServletRequest httpRequest) { } Base64 b = new Base64(); String credentials = new String(b.decode(cookievalue), Charset.forName("UTF-8")); - final String[] v = credentials.split(":", 3); // user:sessionid:sessionIP - if (v != null && v.length == 3) { + System.out.println("credentials: -- > " + credentials); + final String[] v = credentials.split(",", 4); // user:sessionid:sessionIP:site + if (v != null && v.length == 4) { if (! ip.equals(v[2])) { // if cookie IP does not match current Request Session ID...bail return false; } else { @@ -2566,6 +2567,29 @@ public static boolean confirmServerSession(HttpServletRequest httpRequest) { return false; } + public static String getSiteFromSessionCookie(HttpServletRequest httpRequest) { + String cookievalue = ""; + String site = ""; + Cookie[] cookies = httpRequest.getCookies(); + if (cookies != null) { + for (Cookie c : cookies) { + if (c.getName().equals("bscookie")) { + cookievalue = c.getValue(); + break; + } + } + } + Base64 b = new Base64(); + String credentials = new String(b.decode(cookievalue), Charset.forName("UTF-8")); + final String[] v = credentials.split(",", 4); // user:sessionid:sessionIP:site + if (v != null && v.length == 4) { + site = v[3]; + } + + return site; + } + + public static boolean killServerSession(HttpServletRequest httpRequest) { String cookievalue = ""; String ip = httpRequest.getRemoteAddr(); @@ -2580,8 +2604,8 @@ public static boolean killServerSession(HttpServletRequest httpRequest) { } Base64 b = new Base64(); String credentials = new String(b.decode(cookievalue), Charset.forName("UTF-8")); - final String[] v = credentials.split(":", 3); // user:sessionid:sessionIP - if (v != null && v.length == 3) { + final String[] v = credentials.split(",", 4); // user:sessionid:sessionIP:site + if (v != null && v.length == 4) { if (! ip.equals(v[2])) { // if cookie IP does not match current Request Session ID...bail return false; } else { diff --git a/src/com/blueseer/utl/EDData.java b/src/com/blueseer/utl/EDData.java index 40d522229..bcce9ee30 100644 --- a/src/com/blueseer/utl/EDData.java +++ b/src/com/blueseer/utl/EDData.java @@ -55,11 +55,13 @@ of this software and associated documentation files (the "Software"), to deal import java.sql.Statement; import java.sql.Connection; import java.sql.PreparedStatement; +import java.sql.ResultSetMetaData; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -740,7 +742,7 @@ public static String[] getEDIFileTypeDocType(String id) { public static String[] getEDITPDefaults(String doctype, String gssndid, String gsrcvid) { - String[] mystring = new String[]{"","","","","","","0","0","0","","","","","","","","","","","","","","","",""}; + String[] mystring = new String[]{"","","","","","","0","0","0","","","","","","","","","","","","0","","","",""}; try{ Class.forName(driver); Connection con = null; @@ -806,7 +808,7 @@ public static String[] getEDITPDefaults(String doctype, String gssndid, String g public static String[] getEDITPDefaults(String doctype, String gssndid, String gsrcvid, String outdoctype) { - String[] mystring = new String[]{"","","","","","","0","0","0","","","","","","","","","","","","","","","",""}; + String[] mystring = new String[]{"","","","","","","0","0","0","","","","","","","","","","","","0","","","",""}; try{ Class.forName(driver); Connection con = null; @@ -874,7 +876,7 @@ public static String[] getEDITPDefaults(String doctype, String gssndid, String g public static String[] getEDITPDefaultsMapTester(String gssndid, String gsrcvid, String outdoctype) { - String[] mystring = new String[]{"","","","","","","0","0","0","","","","","","","","","","","","","","","",""}; + String[] mystring = new String[]{"","","","","","","0","0","0","","","","","","","","","","","","0","","","",""}; try{ Class.forName(driver); Connection con = null; @@ -940,7 +942,7 @@ public static String[] getEDITPDefaultsMapTester(String gssndid, String gsrcvid, public static String[] getEDITPDefaultsX(String doctype, String gssndid, String gsrcvid, String map) { - String[] mystring = new String[]{"","","","","","","0","0","0","","","","","","","","","","","","","","","",""}; + String[] mystring = new String[]{"","","","","","","0","0","0","","","","","","","","","","","","0","","","",""}; try{ Class.forName(driver); Connection con = null; @@ -5496,6 +5498,62 @@ public static String GetBlanketOrderLine(String[] control, String shipto, String return myreturn; } - + // JSON return data + public static String get_edi_idx_JSON(String site, String fromdate, String todate) { + + String x = ""; + + try{ + Connection con = null; + if (ds != null) { + con = ds.getConnection(); + } else { + con = DriverManager.getConnection(url + db, user, pass); + } + Statement st = con.createStatement(); + ResultSet res = null; + try { + + res = st.executeQuery("SELECT edx_id, edx_sender, edx_receiver, edx_ts, edx_indoctype, edx_outdoctype, edx_infile, " + + " coalesce(elg_severity,'success') as detstatus " + + " FROM edi_idx " + + " left outer join edi_log on elg_comkey = edx_comkey and elg_severity = 'error' " + + " where edx_site = " + "'" + site + "'" + + " AND edx_ts >= " + "'" + fromdate + " 00:00:00" + "'" + + " AND edx_ts <= " + "'" + todate + " 23:59:59" + "'" + " order by edx_id desc ;" ) ; + + org.json.simple.JsonArray json = new org.json.simple.JsonArray(); + ResultSetMetaData rsmd = res.getMetaData(); + while (res.next()) { + int numColumns = rsmd.getColumnCount(); + LinkedHashMap<String, Object> jsonOrderedMap = new LinkedHashMap<String, Object>(); + for (int i=1; i<=numColumns; i++) { + String column_name = OVData.ediColumnLabels.get(rsmd.getColumnName(i)); + jsonOrderedMap.put(column_name, res.getObject(rsmd.getColumnName(i))); + } + json.add(jsonOrderedMap); + } + x = json.toJson(); + + + + } + catch (SQLException s){ + MainFrame.bslog(s); + } finally { + if (res != null) res.close(); + if (st != null) st.close(); + if (con != null) con.close(); + } + } + catch (Exception e){ + MainFrame.bslog(e); + + } + return x; + + } + + } diff --git a/src/com/blueseer/utl/OVData.java b/src/com/blueseer/utl/OVData.java index 23ad7a718..8c6a09d8f 100644 --- a/src/com/blueseer/utl/OVData.java +++ b/src/com/blueseer/utl/OVData.java @@ -178,12 +178,22 @@ of this software and associated documentation files (the "Software"), to deal public class OVData { public static String major = "7.0"; - public static String minor = "16"; + public static String minor = "17"; public static String[] states = {"AB","AL","AK","AZ","AR","BC","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","MB","ME","MD","MA","MI","MN","MS","MO","MT","NE","NL","NV","NH","NJ","NL","NM","NY","NC","ND","NS","OH","OK","ON","OR","PA","PE","QC","RI","SC","SD","SE","TN","TX","UT","VT","VA","WA","WV","WI","WY" }; public static String[] countries = {"Afghanistan","Albania","Algeria","Andorra","Angola","Antigua & Deps","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Rep","Chad","Chile","China","Colombia","Comoros","Congo","Congo {Democratic Rep}","Costa Rica","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","East Timor","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland {Republic}","Israel","Italy","Ivory Coast","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea North","Korea South","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique","Myanmar, {Burma}","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russian Federation","Rwanda","St Kitts & Nevis","St Lucia","Saint Vincent & the Grenadines","Samoa","San Marino","Sao Tome & Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","Spain","Sri Lanka","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad & Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom", "USA","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe" }; - + static final Map<String, String> ediColumnLabels = Map.of( + "edx_id", "Index", + "edx_comkey", "CommIndex", + "edx_indoctype", "Source Type", + "edx_sender", "Sender ID", + "edx_receiver", "Receiver ID", + "edx_ts", "TimeStamp", + "edx_outdoctype", "Result Type", + "edx_infile", "File", + "detstatus", "Status" +); public static void updatecounter(String countername, int counterid) { try{ @@ -8897,9 +8907,9 @@ public static String getDefaultSiteForUserid(String myuser) { Statement st = con.createStatement(); ResultSet res = null; try { - res = st.executeQuery("select siteu_site from siteu_mstr where siteu_userid = " + "'" + myuser.toString() + "';" ); + res = st.executeQuery("select user_site from user_mstr where user_id = " + "'" + myuser + "';" ); while (res.next()) { - myitem = res.getString("siteu_site"); + myitem = res.getString("user_site"); } }