public java.net.URL getCodeBase() { if (codeBase == null) { try { java.io.File file = new java.io.File(""); codeBase = new java.net.URL( "file", "", // no host file.getAbsolutePath().toString()); } catch (java.net.MalformedURLException e) { } } return codeBase; }
/** * Creates an authorized Credential object. * * @return an authorized Credential object. * @throws IOException */ public static Credential authorize() throws IOException { // Load client secrets. InputStream in = CalendarPush.class.getResourceAsStream("/client_secret.json"); GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); // Build flow and trigger user authorization request. GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES) .setDataStoreFactory(DATA_STORE_FACTORY) .setAccessType("offline") .build(); Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user"); System.out.println("Credentials saved to " + DATA_STORE_DIR.getAbsolutePath()); return credential; }
// ---------------------------------------------------------------------------------------------------------------- // Method: authorize // Inputs: none // Outputs: Credentials // Description: Creates an authorized credential object, will throw IO exception // ---------------------------------------------------------------------------------------------------------------- private static Credential authorize() throws IOException { // Load client secrets (from JSON file) InputStream in = Main.class.getResourceAsStream("/client_secret_ecen689project1.json"); GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); // Build flow and trigger user authorization request GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, Collections.singleton(FusiontablesScopes.FUSIONTABLES)) .setDataStoreFactory(DATA_STORE_FACTORY) .build(); // Authorize and get the credential Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user"); System.out.println("Credentials saved to " + DATA_STORE_DIR.getAbsolutePath()); return credential; // Return the credential }
public static void processBrRequisitionFile( java.io.File filePortrait2Process, biz.systempartners.claims.ClaimsViewer claimsViewer, java.util.Vector invoiceVector, java.util.Vector filesVector) { biz.systempartners.claims.XMLClaimFile xmlClaimFile = new biz.systempartners.claims.XMLClaimFile(); xmlClaimFile.processFile(filePortrait2Process); javax.swing.JTable tempInvoiceTable; java.util.Vector headerInvoiceVector = new java.util.Vector(1, 1); headerInvoiceVector.addElement("Invoice No."); // claimsTable = new javax.swing.JTable(5,4); // claimsTable = claimsViewer.getInvoiceTable(); claimsTable = xmlClaimFile.xmlClaim.getInvoiceTable(); invoiceTable = claimsViewer.getInvoiceListTable(); javax.swing.JPanel claimsViewerPanel = claimsViewer.getClaimsViewerPanel(); javax.swing.JScrollPane jScrollPane11 = claimsViewer.getScrollPane(); javax.swing.JScrollPane invoiceScrollPane = claimsViewer.getInvoiceListScrollPane(); invoiceVector = claimsViewer.getInvoiceVector(); java.util.Vector invoiceChildVector = new java.util.Vector(1, 1); javax.swing.JTextField patientNo = claimsViewer.getPatientNo(); javax.swing.JTextField patientName = claimsViewer.getPatientName(); javax.swing.JTextField schemeMemberNo = claimsViewer.getSchemeMemberNo(); javax.swing.JTextField schemeName = claimsViewer.getSchemeName(); javax.swing.JTextField schemePayer = claimsViewer.getSchemePayer(); javax.swing.JTextField accountNo = claimsViewer.getAccountNo(); javax.swing.JTextField invoiceNo = claimsViewer.getInvoiceNo(); javax.swing.JTextField healthCareProvider = claimsViewer.getHealthCareProvider(); jScrollPane11.setViewportView(claimsTable); if (claimsViewer.isShowing()) { claimsViewer.validate(); } else { claimsViewer.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH); claimsViewer.setVisible(true); } claimsViewer.invalidate(); // try { // try { // java.io.FileInputStream requisFileIOStream = new // java.io.FileInputStream(filePortrait2Process); // java.io.ObjectInputStream requisObjInStream = new // java.io.ObjectInputStream(requisFileIOStream); // javax.swing.table.JTableHeader claimsTableHeader = // (javax.swing.table.JTableHeader)requisObjInStream.readObject(); // requisTable = (javax.swing.JTable)requisObjInStream.readObject(); // String invoiceNoString = (java.lang.String)requisObjInStream.readObject(); String invoiceNoString = xmlClaimFile.xmlClaim.getInvoiceNumber(); invoiceNo.setText(invoiceNoString); // patientNo.setText((java.lang.String)requisObjInStream.readObject()); patientNo.setText(xmlClaimFile.xmlClaim.getPatientNumber()); System.out.println( "PATIENT NUMBER : " + xmlClaimFile.xmlClaim.getPatientNumber() + " " + xmlClaimFile.xmlClaim.getPatientName() + " " + xmlClaimFile.xmlClaim.getSchemeName()); // patientName.setText((java.lang.String)requisObjInStream.readObject()); patientName.setText(xmlClaimFile.xmlClaim.getPatientName()); // schemeMemberNo.setText((java.lang.String)requisObjInStream.readObject()); schemeMemberNo.setText(xmlClaimFile.xmlClaim.getSchemeMemberNumber()); // schemeName.setText((java.lang.String)requisObjInStream.readObject()); schemeName.setText(xmlClaimFile.xmlClaim.getSchemeName()); // schemePayer.setText((java.lang.String)requisObjInStream.readObject()); schemePayer.setText(xmlClaimFile.xmlClaim.getSchemePayer()); // accountNo.setText((java.lang.String)requisObjInStream.readObject()); accountNo.setText(xmlClaimFile.xmlClaim.getAccountNumber()); healthCareProvider.setText(xmlClaimFile.xmlClaim.getHealthCareProvider()); tempInvoiceTable = new javax.swing.JTable(invoiceVector, headerInvoiceVector); invoiceChildVector.add(invoiceNoString); invoiceChildVector.add(filePortrait2Process.getPath()); if (filesVector == null) { filesVector = new java.util.Vector(1, 1); } filesVector.add(filePortrait2Process.getAbsolutePath()); claimsViewer.filesVector = filesVector; if (invoiceVector == null) { invoiceVector = new java.util.Vector(1, 1); } invoiceVector.add(invoiceChildVector); /* invoiceNo.setText(invoiceNoString); invoiceChildVector.add(invoiceNoString); invoiceChildVector.add(filePortrait2Process.getPath()); filesVector.add(filePortrait2Process.getAbsolutePath()); // System.out.println("Child Cector Size ="+invoiceChildVector.size()); // System.out.println("File saved in child vector ="+filePortrait2Process.getPath()); invoiceVector.add(invoiceChildVector); // for (int j = 0; j < invoiceChildVector.capacity(); j++) { // System.out.println("Child entry ["+invoiceChildVector.elementAt(j)+"]"); // } patientNo.setText((java.lang.String)requisObjInStream.readObject()); patientName.setText((java.lang.String)requisObjInStream.readObject()); schemeMemberNo.setText((java.lang.String)requisObjInStream.readObject()); schemeName.setText((java.lang.String)requisObjInStream.readObject()); schemePayer.setText((java.lang.String)requisObjInStream.readObject()); accountNo.setText((java.lang.String)requisObjInStream.readObject()); */ tempInvoiceTable = new javax.swing.JTable(invoiceVector, headerInvoiceVector); System.out.println("Starting to populate tables ..."); /** * for (int i = 0; i < requisTable.getModel().getRowCount(); i++) { * * <p>for (int j = 0; j < requisTable.getModel().getColumnCount(); j++){ * * <p>if (requisTable.getValueAt(i,0) != null) { * * <p>claimsTable.setValueAt(requisTable.getValueAt(i,j), i, j); * * <p>System.out.println(requisTable.getValueAt(i,j)); } } } */ for (int i = 0; i < tempInvoiceTable.getModel().getRowCount(); i++) { for (int j = 0; j < tempInvoiceTable.getModel().getColumnCount(); j++) { if (tempInvoiceTable.getValueAt(i, 0) != null) { invoiceTable.setValueAt(tempInvoiceTable.getValueAt(i, j), i, j); System.out.println("Invoices : " + tempInvoiceTable.getValueAt(i, j)); System.out.println(tempInvoiceTable.getValueAt(i, j)); } } } // claimsTable.setModel(requisTable.getModel()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 100.0; claimsViewerPanel.removeAll(); claimsViewerPanel.add(jScrollPane11, gridBagConstraints); invoiceScrollPane.setViewportView(invoiceTable); jScrollPane11.setViewportView(claimsTable); claimsViewerPanel.validate(); for (int i = 0; i < invoiceVector.size(); i++) { java.util.Vector childVector = (java.util.Vector) invoiceVector.elementAt(i); for (int j = 0; j < childVector.size(); j++) { // System.out.println("Child entry at ---- !!! ["+j+"] is // ["+childVector.elementAt(j)+"]"); File file2SelectedInvoice; file2SelectedInvoice = new java.io.File(childVector.elementAt(j).toString()); System.out.println("Selected File ---- !!!!! [" + file2SelectedInvoice.getPath() + "]"); } // for (int j = 0; j < childVector.size(); j++) { // if (childVector.elementAt(0).toString().equalsIgnoreCase(invoiceNo)) { // } // } } // } catch(java.lang.ClassNotFoundException cnfExec) { // javax.swing.JOptionPane.showMessageDialog(new java.awt.Frame(), cnfExec.getMessage()); // } // } catch(java.io.IOException ioExec) { // javax.swing.JOptionPane.showMessageDialog(new java.awt.Frame(), ioExec.getMessage()); // } }