// 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/Malware.java
// public class Malware
// {	
// 	private Integer id;
// 	private String malwareStrId;
// 	private Float kbDim;
// 	private Integer idFamily;
// 	private String descr; 
// 	
// 	public Integer getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public String getMalwareStrId() {
// 		return malwareStrId;
// 	}
// 	public void setMalwareStrId(String malwareStrId) {
// 		this.malwareStrId = malwareStrId;
// 	}
// 	public Float getKbDim()
// 	{
// 		return kbDim;
// 	}
// 	public void setKbDim(float kbDim) {
// 		this.kbDim = kbDim;
// 	}
// 	public Integer getIdFamily() {
// 		return idFamily;
// 	}
// 	public void setIdFamily(int idFamily) {
// 		this.idFamily = idFamily;
// 	}
// 	public String getDescr() {
// 		return descr;
// 	}
// 	public void setDescr(String descr) {
// 		this.descr = descr;
// 	}
// 	
// 	public String toString()
// 	{
// 		return "Malware [id=" + id + ", malwareStrId=" + malwareStrId
// 				+ ", kbDim=" + kbDim + ", idFamily=" + idFamily + ", descr="
// 				+ descr + "]";
// 	}
// }


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.Malware;
package com.progetto_sicurezza.dao;





public class MalwareDao
{
	/*
	 * malware: tutti i campi di malware possono essere null tranne:
	 * malwareStrId
	 */
	public int insert(Malware malware) throws SQLException
	{
		// controlli:
		// riferimento not null
		// vincoli sui campi not null
		if(malware == null || malware.getMalwareStrId() == null) throw new IllegalArgumentException();

// 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/Malware.java
// public class Malware
// {	
// 	private Integer id;
// 	private String malwareStrId;
// 	private Float kbDim;
// 	private Integer idFamily;
// 	private String descr; 
// 	
// 	public Integer getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public String getMalwareStrId() {
// 		return malwareStrId;
// 	}
// 	public void setMalwareStrId(String malwareStrId) {
// 		this.malwareStrId = malwareStrId;
// 	}
// 	public Float getKbDim()
// 	{
// 		return kbDim;
// 	}
// 	public void setKbDim(float kbDim) {
// 		this.kbDim = kbDim;
// 	}
// 	public Integer getIdFamily() {
// 		return idFamily;
// 	}
// 	public void setIdFamily(int idFamily) {
// 		this.idFamily = idFamily;
// 	}
// 	public String getDescr() {
// 		return descr;
// 	}
// 	public void setDescr(String descr) {
// 		this.descr = descr;
// 	}
// 	
// 	public String toString()
// 	{
// 		return "Malware [id=" + id + ", malwareStrId=" + malwareStrId
// 				+ ", kbDim=" + kbDim + ", idFamily=" + idFamily + ", descr="
// 				+ descr + "]";
// 	}
// }


// Path: DB_and_virustotal_submission/MalwareAnalysisDBProject/src/com/progetto_sicurezza/dao/MalwareDao.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.Malware;

package com.progetto_sicurezza.dao;





public class MalwareDao
{
	/*
	 * malware: tutti i campi di malware possono essere null tranne:
	 * malwareStrId
	 */
	public int insert(Malware malware) throws SQLException
	{
		// controlli:
		// riferimento not null
		// vincoli sui campi not null
		if(malware == null || malware.getMalwareStrId() == null) throw new IllegalArgumentException();

		Connection dbCon = DriverManager.getConnection(DBConfiguration.DB_URL,DBConfiguration.USERNAME,DBConfiguration.PASSWORD);