// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/dbconfig/DBConfiguration.java
// public class DBConfiguration
// {
// 	public static final String DB_URL = "jdbc:mysql://localhost:3306/malware_data_collection";
// 	public static final String USERNAME ="root";
// 	public static final String PASSWORD = "";
// }
// 
// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/model/ScanPreTrans.java
// public class ScanPreTrans
// {
// 	private Integer id;
// 	private Integer idMalware;
// 	private Integer idAntimalware;
// 	private String scanResultIsMalicious;
// 	private String UpdateSignaturesId;
// 
// 	public Integer getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public Integer getIdMalware() {
// 		return idMalware;
// 	}
// 	public void setIdMalware(int idMalware) {
// 		this.idMalware = idMalware;
// 	}
// 	public Integer getIdAntimalware() {
// 		return idAntimalware;
// 	}
// 	public void setIdAntimalware(int idAntimalware) {
// 		this.idAntimalware = idAntimalware;
// 	}
// 	public String getScanResultIsMalicious() {
// 		return scanResultIsMalicious;
// 	}
// 	public void setScanResultIsMalicious(String scanResult) {
// 		this.scanResultIsMalicious = scanResult;
// 	}
// 	public String getUpdateSignaturesId() {
// 		return UpdateSignaturesId;
// 	}
// 	public void setUpdateSignaturesId(String updateSignaturesId) {
// 		UpdateSignaturesId = updateSignaturesId;
// 	}
// 	
// 
// }


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.progetto_sicurezza.dbconfig.DBConfiguration;
import com.progetto_sicurezza.model.ScanPreTrans;
	    ResultSet rs = stmt.getGeneratedKeys();
        if (rs.next() )
        {	
        	int toRet = rs.getInt(1);
        	dbCon.close();
            return toRet;
        }

        // never reached
        dbCon.close();
		return -1;
	}
	
	public ScanPreTrans getScanById(int id) throws SQLException
	{
		if(id <= 0) throw new IllegalArgumentException();

		Connection dbCon = DriverManager.getConnection(DBConfiguration.DB_URL,DBConfiguration.USERNAME,DBConfiguration.PASSWORD);
		Statement stmt;
        ResultSet rs;
        
		String query = "SELECT  * " +
				       "FROM scans_pre_transformations "  +
					   "WHERE  id = " + id;
		
		stmt = dbCon.createStatement();
		rs = stmt.executeQuery(query);
		
		if(rs.next())
		{	
// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/dbconfig/DBConfiguration.java
// public class DBConfiguration
// {
// 	public static final String DB_URL = "jdbc:mysql://localhost:3306/malware_data_collection";
// 	public static final String USERNAME ="root";
// 	public static final String PASSWORD = "";
// }
// 
// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/model/ScanPreTrans.java
// public class ScanPreTrans
// {
// 	private Integer id;
// 	private Integer idMalware;
// 	private Integer idAntimalware;
// 	private String scanResultIsMalicious;
// 	private String UpdateSignaturesId;
// 
// 	public Integer getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public Integer getIdMalware() {
// 		return idMalware;
// 	}
// 	public void setIdMalware(int idMalware) {
// 		this.idMalware = idMalware;
// 	}
// 	public Integer getIdAntimalware() {
// 		return idAntimalware;
// 	}
// 	public void setIdAntimalware(int idAntimalware) {
// 		this.idAntimalware = idAntimalware;
// 	}
// 	public String getScanResultIsMalicious() {
// 		return scanResultIsMalicious;
// 	}
// 	public void setScanResultIsMalicious(String scanResult) {
// 		this.scanResultIsMalicious = scanResult;
// 	}
// 	public String getUpdateSignaturesId() {
// 		return UpdateSignaturesId;
// 	}
// 	public void setUpdateSignaturesId(String updateSignaturesId) {
// 		UpdateSignaturesId = updateSignaturesId;
// 	}
// 	
// 
// }


// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/dao/ScanPreTransDao.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.progetto_sicurezza.dbconfig.DBConfiguration;
import com.progetto_sicurezza.model.ScanPreTrans;

	    ResultSet rs = stmt.getGeneratedKeys();
        if (rs.next() )
        {	
        	int toRet = rs.getInt(1);
        	dbCon.close();
            return toRet;
        }

        // never reached
        dbCon.close();
		return -1;
	}
	
	public ScanPreTrans getScanById(int id) throws SQLException
	{
		if(id <= 0) throw new IllegalArgumentException();

		Connection dbCon = DriverManager.getConnection(DBConfiguration.DB_URL,DBConfiguration.USERNAME,DBConfiguration.PASSWORD);
		Statement stmt;
        ResultSet rs;
        
		String query = "SELECT  * " +
				       "FROM scans_pre_transformations "  +
					   "WHERE  id = " + id;
		
		stmt = dbCon.createStatement();
		rs = stmt.executeQuery(query);
		
		if(rs.next())
		{	
		 ScanPreTrans scan = new ScanPreTrans();