// Path: Client/src/main/java/Blockchain/Transaction.java
// public class Transaction implements Comparable<Transaction>
// {
//     private static Logger log = BlockchainManager.log;
// 
//     private final String TIME_SERVER = "nist1-macon.macon.ga.us";
//     private final String amazonServer = "https://s3.eu-central-1.amazonaws.com/";
//     private final String bucketName = System.getenv("BUCKET_NAME");
//     private String filePath;
//     private String fileName;
//     private Long timeStamp;
//     private String dataSummary;
//     private long dataSize;
//     private URL url;
//     private byte[] signature;
//     private int version;
// 
//     public int compareTo(Transaction t) {
//         if (t.getTimeStamp() > this.timeStamp)
//             return -1;
//         else if (this.timeStamp > t.getTimeStamp())
//             return 1;
//         else
//             return 0;
//     }
//     public Transaction(String filePath, String fileName, String dataSummary,
//                        long dataSize, URL url, byte[] signature)
//     {
//         this.filePath = filePath;
//         this.fileName = fileName;
//         this.dataSummary = dataSummary;
//         this.dataSize = dataSize;
//         this.url = url;
//         this.signature = signature;
//         // TODO will be fixed
// 
//         NTPUDPClient timeClient = new NTPUDPClient();
//         InetAddress inetAddress = null;
//         try {
//             inetAddress = InetAddress.getByName(TIME_SERVER);
//             TimeInfo timeInfo = timeClient.getTime(inetAddress);
//             long returnTime = timeInfo.getMessage().getTransmitTimeStamp().getTime();
//             log.trace("Time:" + returnTime);
//             Date time = new Date(returnTime);
// 
//             this.timeStamp = time.getTime();
//         } catch (UnknownHostException e) {
//             log.debug(e);
//         } catch (IOException e) {
//             log.debug(e);
//         }
//         version = 1;
//     }
// 
//     public Transaction(String filePath, String fileName, String dataSummary,
//                        long dataSize, URL url, byte[] signature, int version)
//     {
//         this.filePath = filePath;
//         this.fileName = fileName;
//         this.dataSummary = dataSummary + "-v" + version;
//         this.dataSize = dataSize;
//         this.url = url;
//         this.signature = signature;
//         this.version = version;
//         // TODO will be fixed
// 
//         NTPUDPClient timeClient = new NTPUDPClient();
//         InetAddress inetAddress = null;
//         try {
//             inetAddress = InetAddress.getByName(TIME_SERVER);
//             TimeInfo timeInfo = timeClient.getTime(inetAddress);
//             long returnTime = timeInfo.getMessage().getTransmitTimeStamp().getTime();
//             log.trace("Time:" + returnTime);
//             Date time = new Date(returnTime);
// 
//             this.timeStamp = time.getTime();
//         } catch (UnknownHostException e) {
//             log.debug(e);
//         } catch (IOException e) {
//             log.debug(e);
//         }
//     }
// 
//     public String getFilePath()
//     {
//         return filePath;
//     }
// 
//     public int getVersion()
//     {
//         return version;
//     }
// 
//     public void execute(ServerAccessor serverAccessor)
//     {
//         try {
//             serverAccessor.upload(url, filePath, fileName + version);
//         } catch (Exception e) {
//             log.debug(e);
//         }
//     }
// 
//     public String getStringFormat() {
//         return amazonServer + bucketName + "/" + fileName;
//     }
// 
//     public Long getTimeStamp() {
//         return timeStamp;
//     }
// 
//     public String getDataSummary()
//     {
//         return dataSummary;
//     }
// 
//     public long getDataSize()
//     {
//         return dataSize;
//     }
// 
//     public URL getUrl() {
//         return url;
//     }
// 
//     public void setUrl(URL url) {
//         this.url = url;
//     }
// 
//     public String getFileName() {
//         return fileName;
//     }
// 
//     public String getSignature() {
//         String[] credentials = Decryption.decryptGet(signature);
//         if(credentials == null){
//             return "";
//         }
//         return credentials[1];
//     }
// }


import Blockchain.Transaction;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
package GUI;



/**
 * Created by gizem on 06.04.2017.
 */
public class QueryScreen extends JPanel {

    JTextField query;
    GlossyButton run;
    GlossyButton back;
    ScreenManager controller;
    JTable results;
    DefaultTableModel resultsModel;
// Path: Client/src/main/java/Blockchain/Transaction.java
// public class Transaction implements Comparable<Transaction>
// {
//     private static Logger log = BlockchainManager.log;
// 
//     private final String TIME_SERVER = "nist1-macon.macon.ga.us";
//     private final String amazonServer = "https://s3.eu-central-1.amazonaws.com/";
//     private final String bucketName = System.getenv("BUCKET_NAME");
//     private String filePath;
//     private String fileName;
//     private Long timeStamp;
//     private String dataSummary;
//     private long dataSize;
//     private URL url;
//     private byte[] signature;
//     private int version;
// 
//     public int compareTo(Transaction t) {
//         if (t.getTimeStamp() > this.timeStamp)
//             return -1;
//         else if (this.timeStamp > t.getTimeStamp())
//             return 1;
//         else
//             return 0;
//     }
//     public Transaction(String filePath, String fileName, String dataSummary,
//                        long dataSize, URL url, byte[] signature)
//     {
//         this.filePath = filePath;
//         this.fileName = fileName;
//         this.dataSummary = dataSummary;
//         this.dataSize = dataSize;
//         this.url = url;
//         this.signature = signature;
//         // TODO will be fixed
// 
//         NTPUDPClient timeClient = new NTPUDPClient();
//         InetAddress inetAddress = null;
//         try {
//             inetAddress = InetAddress.getByName(TIME_SERVER);
//             TimeInfo timeInfo = timeClient.getTime(inetAddress);
//             long returnTime = timeInfo.getMessage().getTransmitTimeStamp().getTime();
//             log.trace("Time:" + returnTime);
//             Date time = new Date(returnTime);
// 
//             this.timeStamp = time.getTime();
//         } catch (UnknownHostException e) {
//             log.debug(e);
//         } catch (IOException e) {
//             log.debug(e);
//         }
//         version = 1;
//     }
// 
//     public Transaction(String filePath, String fileName, String dataSummary,
//                        long dataSize, URL url, byte[] signature, int version)
//     {
//         this.filePath = filePath;
//         this.fileName = fileName;
//         this.dataSummary = dataSummary + "-v" + version;
//         this.dataSize = dataSize;
//         this.url = url;
//         this.signature = signature;
//         this.version = version;
//         // TODO will be fixed
// 
//         NTPUDPClient timeClient = new NTPUDPClient();
//         InetAddress inetAddress = null;
//         try {
//             inetAddress = InetAddress.getByName(TIME_SERVER);
//             TimeInfo timeInfo = timeClient.getTime(inetAddress);
//             long returnTime = timeInfo.getMessage().getTransmitTimeStamp().getTime();
//             log.trace("Time:" + returnTime);
//             Date time = new Date(returnTime);
// 
//             this.timeStamp = time.getTime();
//         } catch (UnknownHostException e) {
//             log.debug(e);
//         } catch (IOException e) {
//             log.debug(e);
//         }
//     }
// 
//     public String getFilePath()
//     {
//         return filePath;
//     }
// 
//     public int getVersion()
//     {
//         return version;
//     }
// 
//     public void execute(ServerAccessor serverAccessor)
//     {
//         try {
//             serverAccessor.upload(url, filePath, fileName + version);
//         } catch (Exception e) {
//             log.debug(e);
//         }
//     }
// 
//     public String getStringFormat() {
//         return amazonServer + bucketName + "/" + fileName;
//     }
// 
//     public Long getTimeStamp() {
//         return timeStamp;
//     }
// 
//     public String getDataSummary()
//     {
//         return dataSummary;
//     }
// 
//     public long getDataSize()
//     {
//         return dataSize;
//     }
// 
//     public URL getUrl() {
//         return url;
//     }
// 
//     public void setUrl(URL url) {
//         this.url = url;
//     }
// 
//     public String getFileName() {
//         return fileName;
//     }
// 
//     public String getSignature() {
//         String[] credentials = Decryption.decryptGet(signature);
//         if(credentials == null){
//             return "";
//         }
//         return credentials[1];
//     }
// }


// Path: Client/src/main/java/GUI/QueryScreen.java
import Blockchain.Transaction;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

package GUI;



/**
 * Created by gizem on 06.04.2017.
 */
public class QueryScreen extends JPanel {

    JTextField query;
    GlossyButton run;
    GlossyButton back;
    ScreenManager controller;
    JTable results;
    DefaultTableModel resultsModel;
    ArrayList<Transaction> currTransactions;