diff --git a/pom.xml b/pom.xml index b9888a1..b929849 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ edu.pitt.dbmi tetrad-db - 0.0.1-SNAPSHOT + 0.0.1 jar tetrad-db @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.2.RELEASE + 1.4.5.RELEASE diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/TetradDatabaseApplication.java b/src/main/java/edu/pitt/dbmi/tetrad/db/TetradDatabaseApplication.java index 308a314..37a0dd3 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/TetradDatabaseApplication.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/TetradDatabaseApplication.java @@ -1,82 +1,80 @@ package edu.pitt.dbmi.tetrad.db; -import java.util.Date; - -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.boot.registry.StandardServiceRegistryBuilder; -import org.hibernate.cfg.Configuration; -import org.hibernate.service.ServiceRegistry; - import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParameter; -import edu.pitt.dbmi.tetrad.db.entity.HpcAccount; import edu.pitt.dbmi.tetrad.db.entity.DataValidation; +import edu.pitt.dbmi.tetrad.db.entity.HpcAccount; import edu.pitt.dbmi.tetrad.db.entity.HpcJobInfo; import edu.pitt.dbmi.tetrad.db.entity.HpcJobLog; import edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail; import edu.pitt.dbmi.tetrad.db.entity.HpcParameter; import edu.pitt.dbmi.tetrad.db.entity.JvmOption; +import java.util.Date; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.cfg.Configuration; +import org.hibernate.service.ServiceRegistry; /** - * + * * Oct 24, 2016 5:21:16 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class TetradDatabaseApplication { private static final SessionFactory sessionFactory; static { - try { - Configuration configuration = new Configuration(); - // Mapping - configuration.addAnnotatedClass(AlgorithmParameter.class); - configuration.addAnnotatedClass(AlgorithmParamRequest.class); - configuration.addAnnotatedClass(DataValidation.class); - configuration.addAnnotatedClass(HpcAccount.class); - configuration.addAnnotatedClass(HpcJobInfo.class); - configuration.addAnnotatedClass(HpcJobLog.class); - configuration.addAnnotatedClass(HpcJobLogDetail.class); - configuration.addAnnotatedClass(JvmOption.class); - configuration.addAnnotatedClass(HpcParameter.class); - - ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().build(); - sessionFactory = configuration.buildSessionFactory(serviceRegistry); - } catch (Throwable e) { - System.err.println(e.getMessage()); - throw new ExceptionInInitializerError(e); - } + try { + Configuration configuration = new Configuration(); + // Mapping + configuration.addAnnotatedClass(AlgorithmParameter.class); + configuration.addAnnotatedClass(AlgorithmParamRequest.class); + configuration.addAnnotatedClass(DataValidation.class); + configuration.addAnnotatedClass(HpcAccount.class); + configuration.addAnnotatedClass(HpcJobInfo.class); + configuration.addAnnotatedClass(HpcJobLog.class); + configuration.addAnnotatedClass(HpcJobLogDetail.class); + configuration.addAnnotatedClass(JvmOption.class); + configuration.addAnnotatedClass(HpcParameter.class); + + ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().build(); + sessionFactory = configuration.buildSessionFactory(serviceRegistry); + } catch (Throwable e) { + System.err.println(e.getMessage()); + throw new ExceptionInInitializerError(e); + } } public static SessionFactory getSessionFactory() { - return sessionFactory; + return sessionFactory; } public static void shutdown() { - sessionFactory.close(); + sessionFactory.close(); } - public static void main(String[] args) { - Session session = TetradDatabaseApplication.getSessionFactory() - .openSession(); - session.beginTransaction(); + public static void main(String[] args) { + Session session = TetradDatabaseApplication.getSessionFactory() + .openSession(); + session.beginTransaction(); - HpcAccount computingAccount = new HpcAccount(); - computingAccount.setConnectionName("psc"); - computingAccount.setUsername(""); - computingAccount.setPassword(""); - computingAccount.setScheme("https"); - computingAccount.setHostname(""); - computingAccount.setPort(443); - computingAccount.setCreatedDate(new Date()); - session.save(computingAccount); + HpcAccount computingAccount = new HpcAccount(); + computingAccount.setConnectionName("psc"); + computingAccount.setUsername(""); + computingAccount.setPassword(""); + computingAccount.setScheme("https"); + computingAccount.setHostname(""); + computingAccount.setPort(443); + computingAccount.setCreatedDate(new Date()); + session.save(computingAccount); - session.getTransaction().commit(); - session.close(); - TetradDatabaseApplication.shutdown(); + session.getTransaction().commit(); + session.close(); + TetradDatabaseApplication.shutdown(); } - + } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/AlgorithmParamRequest.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/AlgorithmParamRequest.java index 57e260c..43d3b8d 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/AlgorithmParamRequest.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/AlgorithmParamRequest.java @@ -3,7 +3,6 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -16,151 +15,151 @@ import javax.persistence.OneToOne; /** - * + * * Oct 25, 2016 9:25:46 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ @Entity public class AlgorithmParamRequest implements Serializable { - private static final long serialVersionUID = 4951671667628471413L; + private static final long serialVersionUID = 4951671667628471413L; - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", unique = true, nullable = false) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", unique = true, nullable = false) + private Long id; - @Column(name = "datasetPath", nullable = false) - private String datasetPath; + @Column(name = "datasetPath", nullable = false) + private String datasetPath; - @Column(name = "datasetMd5", nullable = false) - private String datasetMd5; + @Column(name = "datasetMd5", nullable = false) + private String datasetMd5; - @Column(name = "priorKnowledgePath") - private String priorKnowledgePath = null; + @Column(name = "priorKnowledgePath") + private String priorKnowledgePath = null; - @Column(name = "priorKnowledgeMd5") - private String priorKnowledgeMd5 = null; + @Column(name = "priorKnowledgeMd5") + private String priorKnowledgeMd5 = null; - @Column(name = "variableType", nullable = false) - private String variableType; + @Column(name = "variableType", nullable = false) + private String variableType; - @Column(name = "fileDelimiter", nullable = false) - private String fileDelimiter; + @Column(name = "fileDelimiter", nullable = false) + private String fileDelimiter; - @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) - @JoinColumn(name = "dataValidationId", nullable = false, updatable = false) - private DataValidation dataValidation; + @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @JoinColumn(name = "dataValidationId", nullable = false, updatable = false) + private DataValidation dataValidation; - @OneToMany(cascade = CascadeType.ALL, mappedBy = "algorithmParamRequest") - private List algorithmParameters = new ArrayList<>(); + @OneToMany(cascade = CascadeType.ALL, mappedBy = "algorithmParamRequest") + private List algorithmParameters = new ArrayList<>(); - @OneToMany(cascade = CascadeType.ALL, mappedBy = "algorithmParamRequest") - private List jvmOptions = new ArrayList<>(); + @OneToMany(cascade = CascadeType.ALL, mappedBy = "algorithmParamRequest") + private List jvmOptions = new ArrayList<>(); - @OneToMany(cascade = CascadeType.ALL, mappedBy = "algorithmParamRequest") - private List hpcParameters = new ArrayList<>(); + @OneToMany(cascade = CascadeType.ALL, mappedBy = "algorithmParamRequest") + private List hpcParameters = new ArrayList<>(); - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public String getDatasetPath() { - return datasetPath; - } + public String getDatasetPath() { + return datasetPath; + } - public void setDatasetPath(String datasetPath) { - this.datasetPath = datasetPath; - } + public void setDatasetPath(String datasetPath) { + this.datasetPath = datasetPath; + } - public String getDatasetMd5() { - return datasetMd5; - } + public String getDatasetMd5() { + return datasetMd5; + } - public void setDatasetMd5(String datasetMd5) { - this.datasetMd5 = datasetMd5; - } + public void setDatasetMd5(String datasetMd5) { + this.datasetMd5 = datasetMd5; + } - public String getPriorKnowledgePath() { - return priorKnowledgePath; - } + public String getPriorKnowledgePath() { + return priorKnowledgePath; + } - public void setPriorKnowledgePath(String priorKnowledgePath) { - this.priorKnowledgePath = priorKnowledgePath; - } + public void setPriorKnowledgePath(String priorKnowledgePath) { + this.priorKnowledgePath = priorKnowledgePath; + } - public String getPriorKnowledgeMd5() { - return priorKnowledgeMd5; - } + public String getPriorKnowledgeMd5() { + return priorKnowledgeMd5; + } - public void setPriorKnowledgeMd5(String priorKnowledgeMd5) { - this.priorKnowledgeMd5 = priorKnowledgeMd5; - } + public void setPriorKnowledgeMd5(String priorKnowledgeMd5) { + this.priorKnowledgeMd5 = priorKnowledgeMd5; + } - public String getVariableType() { - return variableType; - } + public String getVariableType() { + return variableType; + } - public void setVariableType(String variableType) { - this.variableType = variableType; - } + public void setVariableType(String variableType) { + this.variableType = variableType; + } - public String getFileDelimiter() { - return fileDelimiter; - } + public String getFileDelimiter() { + return fileDelimiter; + } - public void setFileDelimiter(String fileDelimiter) { - this.fileDelimiter = fileDelimiter; - } + public void setFileDelimiter(String fileDelimiter) { + this.fileDelimiter = fileDelimiter; + } - public DataValidation getDataValidation() { - return dataValidation; - } + public DataValidation getDataValidation() { + return dataValidation; + } - public void setDataValidation(DataValidation dataValidation) { - this.dataValidation = dataValidation; - } - - public List getAlgorithmParameters() { - return algorithmParameters; - } - - public void setAlgorithmParameters(List algorithmParameters) { - if (algorithmParameters != null) { - for (AlgorithmParameter algorithmParameter : algorithmParameters) { - this.algorithmParameters.add(algorithmParameter); - } - } - } - - public List getJvmOptions() { - return jvmOptions; - } - - public void setJvmOptions(List jvmOptions) { - if (jvmOptions != null) { - for (JvmOption jvmOption : jvmOptions) { - this.jvmOptions.add(jvmOption); - } - } - } - - public List getHpcParameters() { - return hpcParameters; - } - - public void setHpcParameters(List hpcParameters) { - if(hpcParameters != null){ - for(HpcParameter hpcParameter : hpcParameters){ - this.hpcParameters.add(hpcParameter); - } - } - } + public void setDataValidation(DataValidation dataValidation) { + this.dataValidation = dataValidation; + } + + public List getAlgorithmParameters() { + return algorithmParameters; + } + + public void setAlgorithmParameters(List algorithmParameters) { + if (algorithmParameters != null) { + for (AlgorithmParameter algorithmParameter : algorithmParameters) { + this.algorithmParameters.add(algorithmParameter); + } + } + } + + public List getJvmOptions() { + return jvmOptions; + } + + public void setJvmOptions(List jvmOptions) { + if (jvmOptions != null) { + for (JvmOption jvmOption : jvmOptions) { + this.jvmOptions.add(jvmOption); + } + } + } + + public List getHpcParameters() { + return hpcParameters; + } + + public void setHpcParameters(List hpcParameters) { + if (hpcParameters != null) { + for (HpcParameter hpcParameter : hpcParameters) { + this.hpcParameters.add(hpcParameter); + } + } + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/AlgorithmParameter.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/AlgorithmParameter.java index fb565e4..80f6359 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/AlgorithmParameter.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/AlgorithmParameter.java @@ -1,7 +1,6 @@ package edu.pitt.dbmi.tetrad.db.entity; import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -12,11 +11,11 @@ import javax.persistence.ManyToOne; /** - * + * * Oct 25, 2016 9:51:19 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ @Entity public class AlgorithmParameter implements Serializable { @@ -31,10 +30,10 @@ public class AlgorithmParameter implements Serializable { @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "algorithmParamRequestId") private AlgorithmParamRequest algorithmParamRequest; - + @Column(name = "parameter", nullable = false) private String parameter; - + @Column(name = "value", nullable = false) private String value; @@ -69,5 +68,5 @@ public String getValue() { public void setValue(String value) { this.value = value; } - + } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/DataValidation.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/DataValidation.java index 2e6a587..6ed66ba 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/DataValidation.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/DataValidation.java @@ -1,7 +1,6 @@ package edu.pitt.dbmi.tetrad.db.entity; import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -11,72 +10,72 @@ import javax.persistence.OneToOne; /** - * + * * Oct 25, 2016 7:57:56 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ @Entity public class DataValidation implements Serializable { - private static final long serialVersionUID = 8674106444920091695L; + private static final long serialVersionUID = 8674106444920091695L; - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", unique = true, nullable = false) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", unique = true, nullable = false) + private Long id; - @OneToOne(fetch = FetchType.EAGER, mappedBy = "dataValidation") - private AlgorithmParamRequest algorithmParamRequest; + @OneToOne(fetch = FetchType.EAGER, mappedBy = "dataValidation") + private AlgorithmParamRequest algorithmParamRequest; - @Column(name = "uniqueVarName", nullable = false) - private boolean uniqueVarName; + @Column(name = "uniqueVarName", nullable = false) + private boolean uniqueVarName; - @Column(name = "nonZeroVariance") - private boolean nonZeroVariance; + @Column(name = "nonZeroVariance") + private boolean nonZeroVariance; - @Column(name = "categoryLimit") - private boolean categoryLimit; + @Column(name = "categoryLimit") + private boolean categoryLimit; - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public AlgorithmParamRequest getAlgorithmParamRequest() { - return algorithmParamRequest; - } + public AlgorithmParamRequest getAlgorithmParamRequest() { + return algorithmParamRequest; + } - public void setAlgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { - this.algorithmParamRequest = algorithmParamRequest; - } + public void setAlgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { + this.algorithmParamRequest = algorithmParamRequest; + } - public boolean isUniqueVarName() { - return uniqueVarName; - } + public boolean isUniqueVarName() { + return uniqueVarName; + } - public void setUniqueVarName(boolean uniqueVarName) { - this.uniqueVarName = uniqueVarName; - } + public void setUniqueVarName(boolean uniqueVarName) { + this.uniqueVarName = uniqueVarName; + } - public boolean isNonZeroVariance() { - return nonZeroVariance; - } + public boolean isNonZeroVariance() { + return nonZeroVariance; + } - public void setNonZeroVariance(boolean nonZeroVariance) { - this.nonZeroVariance = nonZeroVariance; - } + public void setNonZeroVariance(boolean nonZeroVariance) { + this.nonZeroVariance = nonZeroVariance; + } - public boolean isCategoryLimit() { - return categoryLimit; - } + public boolean isCategoryLimit() { + return categoryLimit; + } - public void setCategoryLimit(boolean categoryLimit) { - this.categoryLimit = categoryLimit; - } + public void setCategoryLimit(boolean categoryLimit) { + this.categoryLimit = categoryLimit; + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcAccount.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcAccount.java index 7376663..4c1dd7c 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcAccount.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcAccount.java @@ -2,7 +2,6 @@ import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -12,132 +11,132 @@ import javax.persistence.TemporalType; /** - * + * * Oct 24, 2016 1:01:06 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ @Entity public class HpcAccount implements Serializable { - private static final long serialVersionUID = -3821022006234039451L; + private static final long serialVersionUID = -3821022006234039451L; - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", nullable = false, unique = true) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false, unique = true) + private Long id; - @Column(name = "connectionName", unique = true, nullable = false) - private String connectionName; + @Column(name = "connectionName", unique = true, nullable = false) + private String connectionName; - @Column(name = "username", nullable = false) - private String username; + @Column(name = "username", nullable = false) + private String username; - @Column(name = "password", nullable = false) - private String password; + @Column(name = "password", nullable = false) + private String password; - @Column(name = "scheme", nullable = false) - private String scheme; + @Column(name = "scheme", nullable = false) + private String scheme; - @Column(name = "hostname", nullable = false) - private String hostname; + @Column(name = "hostname", nullable = false) + private String hostname; - @Column(name = "port", nullable = false) - private int port; + @Column(name = "port", nullable = false) + private int port; - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "createdDate", nullable = false, length = 19) - private Date createdDate; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "createdDate", nullable = false, length = 19) + private Date createdDate; - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "lastLoginDate", length = 19) - private Date lastLoginDate; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "lastLoginDate", length = 19) + private Date lastLoginDate; - public HpcAccount() { - connectionName = ""; - username = ""; - password = ""; - scheme = "http"; - hostname = ""; - port = 0; - createdDate = new Date(System.currentTimeMillis()); - } + public HpcAccount() { + connectionName = ""; + username = ""; + password = ""; + scheme = "http"; + hostname = ""; + port = 0; + createdDate = new Date(System.currentTimeMillis()); + } - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public String getConnectionName() { - return connectionName; - } + public String getConnectionName() { + return connectionName; + } - public void setConnectionName(String connectionName) { - this.connectionName = connectionName; - } + public void setConnectionName(String connectionName) { + this.connectionName = connectionName; + } - public String getUsername() { - return username; - } + public String getUsername() { + return username; + } - public void setUsername(String username) { - this.username = username; - } + public void setUsername(String username) { + this.username = username; + } - public String getPassword() { - return password; - } + public String getPassword() { + return password; + } - public void setPassword(String password) { - this.password = password; - } + public void setPassword(String password) { + this.password = password; + } - public String getScheme() { - return scheme; - } + public String getScheme() { + return scheme; + } - public void setScheme(String scheme) { - this.scheme = scheme; - } + public void setScheme(String scheme) { + this.scheme = scheme; + } - public String getHostname() { - return hostname; - } + public String getHostname() { + return hostname; + } - public void setHostname(String hostname) { - this.hostname = hostname; - } + public void setHostname(String hostname) { + this.hostname = hostname; + } - public int getPort() { - return port; - } + public int getPort() { + return port; + } - public void setPort(int port) { - this.port = port; - } + public void setPort(int port) { + this.port = port; + } - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } - public Date getLastLoginDate() { - return lastLoginDate; - } - - public void setLastLoginDate(Date lastLoginDate) { - this.lastLoginDate = lastLoginDate; - } - - public String toString() { - return connectionName; - } + public Date getLastLoginDate() { + return lastLoginDate; + } + + public void setLastLoginDate(Date lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } + + public String toString() { + return connectionName; + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobInfo.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobInfo.java index ae9f20a..2e5d13c 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobInfo.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobInfo.java @@ -2,7 +2,6 @@ import java.io.Serializable; import java.util.Date; - import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -15,154 +14,154 @@ import javax.persistence.OneToOne; /** - * + * * Oct 24, 2016 1:32:10 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ @Entity public class HpcJobInfo implements Serializable { - private static final long serialVersionUID = -3402084901576572432L; + private static final long serialVersionUID = -3402084901576572432L; - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", unique = true, nullable = false) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", unique = true, nullable = false) + private Long id; - @Column(name = "pid") - private Long pid; + @Column(name = "pid") + private Long pid; - @Column(name = "algorithmName", nullable = false) - private String algorithmName; + @Column(name = "algorithmName", nullable = false) + private String algorithmName; - @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) - @JoinColumn(name = "algorithmParamRequestId", nullable = false) - private AlgorithmParamRequest algorithmParamRequest; + @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @JoinColumn(name = "algorithmParamRequestId", nullable = false) + private AlgorithmParamRequest algorithmParamRequest; - @Column(name = "submittedTime") - private Date submittedTime; + @Column(name = "submittedTime") + private Date submittedTime; - @Column(name = "resultFileName") - private String resultFileName; + @Column(name = "resultFileName") + private String resultFileName; - @Column(name = "resultJsonFileName") - private String resultJsonFileName; + @Column(name = "resultJsonFileName") + private String resultJsonFileName; - @Column(name = "errorResultFileName") - private String errorResultFileName; + @Column(name = "errorResultFileName") + private String errorResultFileName; - @Column(name = "status") - private int status = -1; + @Column(name = "status") + private int status = -1; - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "hpcAccountId", nullable = false) - private HpcAccount hpcAccount; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "hpcAccountId", nullable = false) + private HpcAccount hpcAccount; - public HpcJobInfo() { + public HpcJobInfo() { - } + } - public HpcJobInfo(String algorithmName, Date submittedTime, String resultFileName, String resultJsonFileName, - String errorResultFileName, int status) { - this.algorithmName = algorithmName; - this.submittedTime = submittedTime; - this.resultFileName = resultFileName; - this.resultJsonFileName = resultJsonFileName; - this.errorResultFileName = errorResultFileName; - this.status = status; - } + public HpcJobInfo(String algorithmName, Date submittedTime, String resultFileName, String resultJsonFileName, + String errorResultFileName, int status) { + this.algorithmName = algorithmName; + this.submittedTime = submittedTime; + this.resultFileName = resultFileName; + this.resultJsonFileName = resultJsonFileName; + this.errorResultFileName = errorResultFileName; + this.status = status; + } - public HpcJobInfo(Long pid, String algorithmName, Date submittedTime, String resultFileName, - String resultJsonFileName, String errorResultFileName, int status) { - this.pid = pid; - this.algorithmName = algorithmName; - this.submittedTime = submittedTime; - this.resultFileName = resultFileName; - this.resultJsonFileName = resultJsonFileName; - this.errorResultFileName = errorResultFileName; - this.status = status; - } + public HpcJobInfo(Long pid, String algorithmName, Date submittedTime, String resultFileName, + String resultJsonFileName, String errorResultFileName, int status) { + this.pid = pid; + this.algorithmName = algorithmName; + this.submittedTime = submittedTime; + this.resultFileName = resultFileName; + this.resultJsonFileName = resultJsonFileName; + this.errorResultFileName = errorResultFileName; + this.status = status; + } - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public Long getPid() { - return pid; - } + public Long getPid() { + return pid; + } - public void setPid(Long pid) { - this.pid = pid; - } + public void setPid(Long pid) { + this.pid = pid; + } - public String getAlgorithmName() { - return algorithmName; - } + public String getAlgorithmName() { + return algorithmName; + } - public void setAlgorithmName(String algorithmName) { - this.algorithmName = algorithmName; - } + public void setAlgorithmName(String algorithmName) { + this.algorithmName = algorithmName; + } - public AlgorithmParamRequest getAlgorithmParamRequest() { - return algorithmParamRequest; - } + public AlgorithmParamRequest getAlgorithmParamRequest() { + return algorithmParamRequest; + } - public void setAlgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { - this.algorithmParamRequest = algorithmParamRequest; - } + public void setAlgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { + this.algorithmParamRequest = algorithmParamRequest; + } - public Date getSubmittedTime() { - return submittedTime; - } + public Date getSubmittedTime() { + return submittedTime; + } - public void setSubmittedTime(Date submittedTime) { - this.submittedTime = submittedTime; - } - - public String getResultFileName() { - return resultFileName; - } - - public void setResultFileName(String resultFileName) { - this.resultFileName = resultFileName; - } - - public String getResultJsonFileName() { - return resultJsonFileName; - } - - public void setResultJsonFileName(String resultJsonFileName) { - this.resultJsonFileName = resultJsonFileName; - } - - public String getErrorResultFileName() { - return errorResultFileName; - } - - public void setErrorResultFileName(String errorResultFileName) { - this.errorResultFileName = errorResultFileName; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public HpcAccount getHpcAccount() { - return hpcAccount; - } - - public void setHpcAccount(HpcAccount hpcAccount) { - this.hpcAccount = hpcAccount; - } + public void setSubmittedTime(Date submittedTime) { + this.submittedTime = submittedTime; + } + + public String getResultFileName() { + return resultFileName; + } + + public void setResultFileName(String resultFileName) { + this.resultFileName = resultFileName; + } + + public String getResultJsonFileName() { + return resultJsonFileName; + } + + public void setResultJsonFileName(String resultJsonFileName) { + this.resultJsonFileName = resultJsonFileName; + } + + public String getErrorResultFileName() { + return errorResultFileName; + } + + public void setErrorResultFileName(String errorResultFileName) { + this.errorResultFileName = errorResultFileName; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public HpcAccount getHpcAccount() { + return hpcAccount; + } + + public void setHpcAccount(HpcAccount hpcAccount) { + this.hpcAccount = hpcAccount; + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobLog.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobLog.java index 7b6ddda..9b0bde1 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobLog.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobLog.java @@ -1,7 +1,6 @@ package edu.pitt.dbmi.tetrad.db.entity; import java.util.Date; - import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -13,82 +12,82 @@ import javax.persistence.OneToOne; /** - * + * * Dec 15, 2016 1:22:22 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ @Entity public class HpcJobLog { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", unique = true, nullable = false) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", unique = true, nullable = false) + private Long id; - @Column(name = "addedTime", nullable = false) - private Date addedTime; + @Column(name = "addedTime", nullable = false) + private Date addedTime; - @Column(name = "endedTime") - private Date endedTime; + @Column(name = "endedTime") + private Date endedTime; - @Column(name = "canceledTime") - private Date canceledTime; + @Column(name = "canceledTime") + private Date canceledTime; - @Column(name = "lastUpdatedTime") - private Date lastUpdatedTime; + @Column(name = "lastUpdatedTime") + private Date lastUpdatedTime; - @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) - @JoinColumn(name = "hpcJobInfoId", nullable = false) - private HpcJobInfo hpcJobInfo; + @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @JoinColumn(name = "hpcJobInfoId", nullable = false) + private HpcJobInfo hpcJobInfo; - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public Date getAddedTime() { - return addedTime; - } + public Date getAddedTime() { + return addedTime; + } - public void setAddedTime(Date addedTime) { - this.addedTime = addedTime; - } + public void setAddedTime(Date addedTime) { + this.addedTime = addedTime; + } - public Date getEndedTime() { - return endedTime; - } + public Date getEndedTime() { + return endedTime; + } - public void setEndedTime(Date endedTime) { - this.endedTime = endedTime; - } + public void setEndedTime(Date endedTime) { + this.endedTime = endedTime; + } - public Date getCanceledTime() { - return canceledTime; - } + public Date getCanceledTime() { + return canceledTime; + } - public void setCanceledTime(Date canceledTime) { - this.canceledTime = canceledTime; - } + public void setCanceledTime(Date canceledTime) { + this.canceledTime = canceledTime; + } - public Date getLastUpdatedTime() { - return lastUpdatedTime; - } + public Date getLastUpdatedTime() { + return lastUpdatedTime; + } - public void setLastUpdatedTime(Date lastUpdatedTime) { - this.lastUpdatedTime = lastUpdatedTime; - } + public void setLastUpdatedTime(Date lastUpdatedTime) { + this.lastUpdatedTime = lastUpdatedTime; + } - public HpcJobInfo getHpcJobInfo() { - return hpcJobInfo; - } + public HpcJobInfo getHpcJobInfo() { + return hpcJobInfo; + } - public void setHpcJobInfo(HpcJobInfo hpcJobInfo) { - this.hpcJobInfo = hpcJobInfo; - } + public void setHpcJobInfo(HpcJobInfo hpcJobInfo) { + this.hpcJobInfo = hpcJobInfo; + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobLogDetail.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobLogDetail.java index a04b960..a4e0b8a 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobLogDetail.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcJobLogDetail.java @@ -1,7 +1,6 @@ package edu.pitt.dbmi.tetrad.db.entity; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -12,71 +11,71 @@ import javax.persistence.ManyToOne; /** - * + * * Dec 16, 2016 1:35:27 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ @Entity public class HpcJobLogDetail { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", unique = true, nullable = false) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", unique = true, nullable = false) + private Long id; - @Column(name = "jobState", nullable = false) - private int jobState = -1; // -1 = Pending; 0 = Submitted; + @Column(name = "jobState", nullable = false) + private int jobState = -1; // -1 = Pending; 0 = Submitted; - @Column(name = "progress") - private String progress; + @Column(name = "progress") + private String progress; - @Column(name = "addedTime", nullable = false) - private Date addedTime; + @Column(name = "addedTime", nullable = false) + private Date addedTime; - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "hpcJobLogId", nullable = false) - private HpcJobLog hpcJobLog; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "hpcJobLogId", nullable = false) + private HpcJobLog hpcJobLog; - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public int getJobState() { - return jobState; - } + public int getJobState() { + return jobState; + } - public void setJobState(int jobState) { - this.jobState = jobState; - } + public void setJobState(int jobState) { + this.jobState = jobState; + } - public String getProgress() { - return progress; - } + public String getProgress() { + return progress; + } - public void setProgress(String progress) { - this.progress = progress; - } + public void setProgress(String progress) { + this.progress = progress; + } - public Date getAddedTime() { - return addedTime; - } + public Date getAddedTime() { + return addedTime; + } - public void setAddedTime(Date addedTime) { - this.addedTime = addedTime; - } + public void setAddedTime(Date addedTime) { + this.addedTime = addedTime; + } - public HpcJobLog getHpcJobLog() { - return hpcJobLog; - } + public HpcJobLog getHpcJobLog() { + return hpcJobLog; + } - public void setHpcJobLog(HpcJobLog hpcJobLog) { - this.hpcJobLog = hpcJobLog; - } + public void setHpcJobLog(HpcJobLog hpcJobLog) { + this.hpcJobLog = hpcJobLog; + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcParameter.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcParameter.java index af11ff0..542c858 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcParameter.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/HpcParameter.java @@ -19,7 +19,6 @@ package edu.pitt.dbmi.tetrad.db.entity; import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -31,64 +30,64 @@ import javax.validation.constraints.NotNull; /** - * + * * Feb 20, 2017 6:05:41 PM - * + * * @author Chirayu Kong Wongchokprasitti, PhD (chw20@pitt.edu) * */ @Entity public class HpcParameter implements Serializable { - private static final long serialVersionUID = -6268316192973727066L; + private static final long serialVersionUID = -6268316192973727066L; - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", unique = true, nullable = false) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", unique = true, nullable = false) + private Long id; - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "algorithmParamRequestId") - private AlgorithmParamRequest algorithmParamRequest; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "algorithmParamRequestId") + private AlgorithmParamRequest algorithmParamRequest; - @NotNull - @Column(nullable = false) - private String key; + @NotNull + @Column(nullable = false) + private String key; - @NotNull - @Column(nullable = false) - private String value; + @NotNull + @Column(nullable = false) + private String value; - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public AlgorithmParamRequest getAlgorithmParamRequest() { - return algorithmParamRequest; - } + public AlgorithmParamRequest getAlgorithmParamRequest() { + return algorithmParamRequest; + } - public void setAlgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { - this.algorithmParamRequest = algorithmParamRequest; - } + public void setAlgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { + this.algorithmParamRequest = algorithmParamRequest; + } - public String getKey() { - return key; - } + public String getKey() { + return key; + } - public void setKey(String key) { - this.key = key; - } + public void setKey(String key) { + this.key = key; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/JvmOption.java b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/JvmOption.java index 50c23d3..045340e 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/entity/JvmOption.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/entity/JvmOption.java @@ -1,7 +1,6 @@ package edu.pitt.dbmi.tetrad.db.entity; import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -12,62 +11,62 @@ import javax.persistence.ManyToOne; /** - * + * * Oct 25, 2016 10:16:29 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ @Entity public class JvmOption implements Serializable { - private static final long serialVersionUID = 496329543903669880L; + private static final long serialVersionUID = 496329543903669880L; - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", unique = true, nullable = false) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", unique = true, nullable = false) + private Long id; - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "algorithmParamRequestId") - private AlgorithmParamRequest algorithmParamRequest; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "algorithmParamRequestId") + private AlgorithmParamRequest algorithmParamRequest; - @Column(name = "parameter", nullable = false) - private String parameter; + @Column(name = "parameter", nullable = false) + private String parameter; - @Column(name = "value", nullable = false) - private String value; + @Column(name = "value", nullable = false) + private String value; - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public AlgorithmParamRequest getAlgorithmParamRequest() { - return algorithmParamRequest; - } + public AlgorithmParamRequest getAlgorithmParamRequest() { + return algorithmParamRequest; + } - public void setAlgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { - this.algorithmParamRequest = algorithmParamRequest; - } + public void setAlgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { + this.algorithmParamRequest = algorithmParamRequest; + } - public String getParameter() { - return parameter; - } + public String getParameter() { + return parameter; + } - public void setParameter(String parameter) { - this.parameter = parameter; - } + public void setParameter(String parameter) { + this.parameter = parameter; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/AlgorithmParamRequestRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/AlgorithmParamRequestRepository.java index a891a30..a94d492 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/AlgorithmParamRequestRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/AlgorithmParamRequestRepository.java @@ -3,19 +3,19 @@ import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; /** - * + * * Oct 26, 2016 2:47:55 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public interface AlgorithmParamRequestRepository { - + public void add(AlgorithmParamRequest algorithmParamRequest); - + public void update(AlgorithmParamRequest algorithmParamRequest); - + public void remove(AlgorithmParamRequest algorithmParamRequest); - + public AlgorithmParamRequest findById(long id); } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/AlgorithmParameterRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/AlgorithmParameterRepository.java index 96a9036..a5b96e1 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/AlgorithmParameterRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/AlgorithmParameterRepository.java @@ -1,27 +1,26 @@ package edu.pitt.dbmi.tetrad.db.repository; -import java.util.List; - import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParameter; +import java.util.List; /** - * + * * Oct 26, 2016 2:41:43 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public interface AlgorithmParameterRepository { - + public void add(AlgorithmParameter algorithmParameters); - + public void update(AlgorithmParameter algorithmParameters); - + public void remove(AlgorithmParameter algorithmParameters); - + public AlgorithmParameter findById(long id); - + public List findByalgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest); - + } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/DataValidationRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/DataValidationRepository.java index 12ac026..abe0e53 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/DataValidationRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/DataValidationRepository.java @@ -3,19 +3,19 @@ import edu.pitt.dbmi.tetrad.db.entity.DataValidation; /** - * + * * Oct 26, 2016 2:54:00 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public interface DataValidationRepository { public void add(DataValidation dataValidation); - + public void update(DataValidation dataValidation); - + public void remove(DataValidation dataValidation); - + public DataValidation findById(long id); } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcAccountRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcAccountRepository.java index e01db3e..4874c0f 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcAccountRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcAccountRepository.java @@ -1,18 +1,17 @@ package edu.pitt.dbmi.tetrad.db.repository; -import java.util.List; - import edu.pitt.dbmi.tetrad.db.entity.HpcAccount; +import java.util.List; /** - * + * * Oct 25, 2016 3:01:35 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public interface HpcAccountRepository { - + public void add(HpcAccount hpcAccount); public void update(HpcAccount hpcAccount); @@ -20,9 +19,9 @@ public interface HpcAccountRepository { public void remove(HpcAccount hpcAccount); public HpcAccount findByConnectionName(String connectionName); - + public HpcAccount findById(long id); - + public List get(); - + } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobInfoRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobInfoRepository.java index 2d55a2b..73d545a 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobInfoRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobInfoRepository.java @@ -1,29 +1,28 @@ package edu.pitt.dbmi.tetrad.db.repository; -import java.util.List; - import edu.pitt.dbmi.tetrad.db.entity.HpcAccount; import edu.pitt.dbmi.tetrad.db.entity.HpcJobInfo; +import java.util.List; /** - * + * * Oct 25, 2016 3:10:07 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public interface HpcJobInfoRepository { public void add(HpcJobInfo hpcJobInfo); - + public void update(HpcJobInfo hpcJobInfo); - + public void remove(HpcJobInfo hpcJobInfo); - + public HpcJobInfo findById(long id); - + public List findByHpcAccount(HpcAccount hpcAccount); - + public List findByStatus(int status); - + } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobLogDetailRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobLogDetailRepository.java index 331aaee..053e436 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobLogDetailRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobLogDetailRepository.java @@ -1,27 +1,26 @@ package edu.pitt.dbmi.tetrad.db.repository; -import java.util.List; - import edu.pitt.dbmi.tetrad.db.entity.HpcJobLog; import edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail; +import java.util.List; /** - * + * * Jan 6, 2017 3:20:20 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public interface HpcJobLogDetailRepository { - + public void add(HpcJobLogDetail hpcJobLogDetail); - + public void update(HpcJobLogDetail hpcJobLogDetail); public void remove(HpcJobLogDetail hpcJobLogDetail); - + public HpcJobLogDetail findById(long id); - + public List findByHpcJobLog(HpcJobLog hpcJobLog); - + } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobLogRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobLogRepository.java index 56bb8d7..a8b5727 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobLogRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcJobLogRepository.java @@ -1,30 +1,29 @@ package edu.pitt.dbmi.tetrad.db.repository; -import java.util.List; - import edu.pitt.dbmi.tetrad.db.entity.HpcAccount; import edu.pitt.dbmi.tetrad.db.entity.HpcJobInfo; import edu.pitt.dbmi.tetrad.db.entity.HpcJobLog; +import java.util.List; /** - * + * * Jan 6, 2017 3:07:42 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public interface HpcJobLogRepository { public void add(HpcJobLog hpcJobLog); - + public void update(HpcJobLog hpcJobLog); - + public void remove(HpcJobLog hpcJobLog); - + public HpcJobLog findById(long id); - + public HpcJobLog findByHpcJobInfo(HpcJobInfo hpcJobInfo); - + public List findByHpcAccount(HpcAccount hpcAccount); - + } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcParameterRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcParameterRepository.java index 569f9c6..dd79c03 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcParameterRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/HpcParameterRepository.java @@ -18,28 +18,27 @@ */ package edu.pitt.dbmi.tetrad.db.repository; -import java.util.List; - import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; import edu.pitt.dbmi.tetrad.db.entity.HpcParameter; +import java.util.List; /** - * + * * Mar 14, 2017 7:22:45 PM - * + * * @author Chirayu Kong Wongchokprasitti, PhD (chw20@pitt.edu) * */ public interface HpcParameterRepository { - - public void add(HpcParameter hpcParameter); - - public void update(HpcParameter hpcParameter); - - public void remove(HpcParameter hpcParameter); - - public HpcParameter findById(long id); - - public List findByAlgorithmParamRequest(AlgorithmParamRequest AlgorithmParamRequest); + + public void add(HpcParameter hpcParameter); + + public void update(HpcParameter hpcParameter); + + public void remove(HpcParameter hpcParameter); + + public HpcParameter findById(long id); + + public List findByAlgorithmParamRequest(AlgorithmParamRequest AlgorithmParamRequest); } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/JvmOptionRepository.java b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/JvmOptionRepository.java index b086590..61b6839 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/repository/JvmOptionRepository.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/repository/JvmOptionRepository.java @@ -1,27 +1,26 @@ package edu.pitt.dbmi.tetrad.db.repository; -import java.util.List; - import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; import edu.pitt.dbmi.tetrad.db.entity.JvmOption; +import java.util.List; /** - * + * * Oct 26, 2016 2:56:03 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public interface JvmOptionRepository { public void add(JvmOption jvmOptions); - + public void update(JvmOption jvmOptions); - + public void remove(JvmOption jvmOptions); - + public JvmOption findById(long id); - + public List findByAlgorithmParamRequest(AlgorithmParamRequest AlgorithmParamRequest); - + } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/AlgorithmParamRequestService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/AlgorithmParamRequestService.java index 29375fa..7b7d3c0 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/AlgorithmParamRequestService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/AlgorithmParamRequestService.java @@ -1,50 +1,49 @@ package edu.pitt.dbmi.tetrad.db.service; -import org.hibernate.Session; -import org.hibernate.Transaction; - import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; import edu.pitt.dbmi.tetrad.db.repository.AlgorithmParamRequestRepository; +import org.hibernate.Session; +import org.hibernate.Transaction; /** - * + * * Oct 26, 2016 4:16:24 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class AlgorithmParamRequestService implements AlgorithmParamRequestRepository { private final Session session; - + public AlgorithmParamRequestService(final Session session) { - this.session = session; + this.session = session; } - + @Override public void add(AlgorithmParamRequest algorithmParamRequest) { - Transaction transaction = session.beginTransaction(); - session.save(algorithmParamRequest); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.save(algorithmParamRequest); + transaction.commit(); } @Override public void update(AlgorithmParamRequest algorithmParamRequest) { - Transaction transaction = session.beginTransaction(); - session.saveOrUpdate(algorithmParamRequest); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.saveOrUpdate(algorithmParamRequest); + transaction.commit(); } @Override public void remove(AlgorithmParamRequest algorithmParamRequest) { - Transaction transaction = session.beginTransaction(); - session.delete(algorithmParamRequest); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.delete(algorithmParamRequest); + transaction.commit(); } @Override public AlgorithmParamRequest findById(long id) { - return session.load(AlgorithmParamRequest.class, id); + return session.load(AlgorithmParamRequest.class, id); } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/AlgorithmParameterService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/AlgorithmParameterService.java index 955da06..50f1946 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/AlgorithmParameterService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/AlgorithmParameterService.java @@ -1,61 +1,59 @@ package edu.pitt.dbmi.tetrad.db.service; +import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; +import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParameter; +import edu.pitt.dbmi.tetrad.db.repository.AlgorithmParameterRepository; import java.util.List; - import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; -import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; -import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParameter; -import edu.pitt.dbmi.tetrad.db.repository.AlgorithmParameterRepository; - /** - * + * * Oct 26, 2016 3:06:36 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class AlgorithmParameterService implements AlgorithmParameterRepository { - private final Session session; - - public AlgorithmParameterService(final Session session) { - this.session = session; - } - - @Override - public void add(AlgorithmParameter algorithmParameter) { - Transaction transaction = session.beginTransaction(); - session.save(algorithmParameter); - transaction.commit(); - } - - @Override - public void update(AlgorithmParameter algorithmParameter) { - Transaction transaction = session.beginTransaction(); - session.saveOrUpdate(algorithmParameter); - transaction.commit(); - } - - @Override - public void remove(AlgorithmParameter algorithmParameter) { - Transaction transaction = session.beginTransaction(); - session.delete(algorithmParameter); - transaction.commit(); - } - - @Override - public AlgorithmParameter findById(long id) { - return session.load(AlgorithmParameter.class, id); - } - - @Override - public List findByalgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { - Query query = session.createQuery("FROM AlgorithmParameters WHERE algorithmParamRequestId = ?"); - query.setLong(0, algorithmParamRequest.getId()); - return query.list(); - } + private final Session session; + + public AlgorithmParameterService(final Session session) { + this.session = session; + } + + @Override + public void add(AlgorithmParameter algorithmParameter) { + Transaction transaction = session.beginTransaction(); + session.save(algorithmParameter); + transaction.commit(); + } + + @Override + public void update(AlgorithmParameter algorithmParameter) { + Transaction transaction = session.beginTransaction(); + session.saveOrUpdate(algorithmParameter); + transaction.commit(); + } + + @Override + public void remove(AlgorithmParameter algorithmParameter) { + Transaction transaction = session.beginTransaction(); + session.delete(algorithmParameter); + transaction.commit(); + } + + @Override + public AlgorithmParameter findById(long id) { + return session.load(AlgorithmParameter.class, id); + } + + @Override + public List findByalgorithmParamRequest(AlgorithmParamRequest algorithmParamRequest) { + Query query = session.createQuery("FROM AlgorithmParameters WHERE algorithmParamRequestId = ?"); + query.setLong(0, algorithmParamRequest.getId()); + return query.list(); + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/DataValidationService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/DataValidationService.java index 95ea025..ef74406 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/DataValidationService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/DataValidationService.java @@ -1,50 +1,49 @@ package edu.pitt.dbmi.tetrad.db.service; -import org.hibernate.Session; -import org.hibernate.Transaction; - import edu.pitt.dbmi.tetrad.db.entity.DataValidation; import edu.pitt.dbmi.tetrad.db.repository.DataValidationRepository; +import org.hibernate.Session; +import org.hibernate.Transaction; /** - * + * * Oct 26, 2016 4:24:27 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class DataValidationService implements DataValidationRepository { private final Session session; - + public DataValidationService(final Session session) { - this.session = session; + this.session = session; } - + @Override public void add(DataValidation dataValidation) { - Transaction transaction = session.beginTransaction(); - session.save(dataValidation); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.save(dataValidation); + transaction.commit(); } @Override public void update(DataValidation dataValidation) { - Transaction transaction = session.beginTransaction(); - session.saveOrUpdate(dataValidation); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.saveOrUpdate(dataValidation); + transaction.commit(); } @Override public DataValidation findById(long id) { - return session.load(DataValidation.class, id); + return session.load(DataValidation.class, id); } @Override public void remove(DataValidation dataValidation) { - Transaction transaction = session.beginTransaction(); - session.delete(dataValidation); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.delete(dataValidation); + transaction.commit(); } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcAccountService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcAccountService.java index 0f8a7b9..0209e4f 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcAccountService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcAccountService.java @@ -1,69 +1,68 @@ package edu.pitt.dbmi.tetrad.db.service; +import edu.pitt.dbmi.tetrad.db.entity.HpcAccount; +import edu.pitt.dbmi.tetrad.db.repository.HpcAccountRepository; import java.util.List; - import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; -import edu.pitt.dbmi.tetrad.db.entity.HpcAccount; -import edu.pitt.dbmi.tetrad.db.repository.HpcAccountRepository; - /** - * + * * Oct 26, 2016 12:22:49 AM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class HpcAccountService implements HpcAccountRepository { - private final Session session; + private final Session session; - public HpcAccountService(final Session session) { - this.session = session; - } + public HpcAccountService(final Session session) { + this.session = session; + } - @Override - public void add(HpcAccount hpcAccount) { - Transaction transaction = session.beginTransaction(); - session.save(hpcAccount); - transaction.commit(); - } + @Override + public void add(HpcAccount hpcAccount) { + Transaction transaction = session.beginTransaction(); + session.save(hpcAccount); + transaction.commit(); + } - @Override - public void update(HpcAccount hpcAccount) { - Transaction transaction = session.beginTransaction(); - session.saveOrUpdate(hpcAccount); - transaction.commit(); - } + @Override + public void update(HpcAccount hpcAccount) { + Transaction transaction = session.beginTransaction(); + session.saveOrUpdate(hpcAccount); + transaction.commit(); + } - @Override - public void remove(HpcAccount hpcAccount) { - Transaction transaction = session.beginTransaction(); - session.delete(hpcAccount); - transaction.commit(); - } + @Override + public void remove(HpcAccount hpcAccount) { + Transaction transaction = session.beginTransaction(); + session.delete(hpcAccount); + transaction.commit(); + } - @Override - public HpcAccount findByConnectionName(String connectionName) { - Query query = session.createQuery("FROM HpcAccount WHERE connectionName = ?"); - query.setString(0, connectionName); - List result = query.list(); - if (result.isEmpty()) - return null; - return (HpcAccount) query.list().get(0); - } + @Override + public HpcAccount findByConnectionName(String connectionName) { + Query query = session.createQuery("FROM HpcAccount WHERE connectionName = ?"); + query.setString(0, connectionName); + List result = query.list(); + if (result.isEmpty()) { + return null; + } + return (HpcAccount) query.list().get(0); + } - @Override - public HpcAccount findById(long id) { - return session.load(HpcAccount.class, id); - } + @Override + public HpcAccount findById(long id) { + return session.load(HpcAccount.class, id); + } - @Override - public List get() { - Query query = session.createQuery("FROM HpcAccount"); - return query.list(); - } + @Override + public List get() { + Query query = session.createQuery("FROM HpcAccount"); + return query.list(); + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobInfoService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobInfoService.java index b82f7de..5386da3 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobInfoService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobInfoService.java @@ -1,7 +1,6 @@ package edu.pitt.dbmi.tetrad.db.service; import java.util.List; -import java.util.Set; import org.hibernate.Query; import org.hibernate.Session; @@ -17,92 +16,92 @@ import edu.pitt.dbmi.tetrad.db.repository.HpcJobInfoRepository; /** - * + * * Oct 26, 2016 4:55:15 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class HpcJobInfoService implements HpcJobInfoRepository { - private final Session session; + private final Session session; - public HpcJobInfoService(final Session session) { - this.session = session; - } + public HpcJobInfoService(final Session session) { + this.session = session; + } - @Override - public void add(HpcJobInfo hpcJobInfo) { - Transaction transaction = session.beginTransaction(); - AlgorithmParamRequest algorithmParamRequest = hpcJobInfo.getAlgorithmParamRequest(); - List algorithmParameters = algorithmParamRequest.getAlgorithmParameters(); - for (AlgorithmParameter algorithmParameter : algorithmParameters) { - System.out.println("HpcJobInfoService: add: AlgorithmParameter: " + algorithmParameter.getParameter() + ":" - + algorithmParameter.getValue()); - session.save(algorithmParameter); - } - DataValidation dataValidation = algorithmParamRequest.getDataValidation(); - session.save(dataValidation); - List jvmOptions = algorithmParamRequest.getJvmOptions(); - for (JvmOption jvmOption : jvmOptions) { - System.out.println( - "HpcJobInfoService: add: JvmOption: " + jvmOption.getParameter() + ":" + jvmOption.getValue()); - session.save(jvmOption); - } - List hpcParameters = algorithmParamRequest.getHpcParameters(); - if (hpcParameters != null) { - for (HpcParameter param : hpcParameters) { - System.out.println("HpcJobInfoService: add: HpcParameter: " + param.getKey() + ":" + param.getValue()); - session.save(param); - } - } - session.save(algorithmParamRequest); - session.save(hpcJobInfo); - transaction.commit(); - } + @Override + public void add(HpcJobInfo hpcJobInfo) { + Transaction transaction = session.beginTransaction(); + AlgorithmParamRequest algorithmParamRequest = hpcJobInfo.getAlgorithmParamRequest(); + List algorithmParameters = algorithmParamRequest.getAlgorithmParameters(); + for (AlgorithmParameter algorithmParameter : algorithmParameters) { + System.out.println("HpcJobInfoService: add: AlgorithmParameter: " + algorithmParameter.getParameter() + ":" + + algorithmParameter.getValue()); + session.save(algorithmParameter); + } + DataValidation dataValidation = algorithmParamRequest.getDataValidation(); + session.save(dataValidation); + List jvmOptions = algorithmParamRequest.getJvmOptions(); + for (JvmOption jvmOption : jvmOptions) { + System.out.println( + "HpcJobInfoService: add: JvmOption: " + jvmOption.getParameter() + ":" + jvmOption.getValue()); + session.save(jvmOption); + } + List hpcParameters = algorithmParamRequest.getHpcParameters(); + if (hpcParameters != null) { + for (HpcParameter param : hpcParameters) { + System.out.println("HpcJobInfoService: add: HpcParameter: " + param.getKey() + ":" + param.getValue()); + session.save(param); + } + } + session.save(algorithmParamRequest); + session.save(hpcJobInfo); + transaction.commit(); + } - @Override - public void update(HpcJobInfo hpcJobInfo) { - Transaction transaction = session.beginTransaction(); - AlgorithmParamRequest algorithmParamRequest = hpcJobInfo.getAlgorithmParamRequest(); - List algorithmParameters = algorithmParamRequest.getAlgorithmParameters(); - for (AlgorithmParameter algorithmParameter : algorithmParameters) { - session.saveOrUpdate(algorithmParameter); - } - DataValidation dataValidation = algorithmParamRequest.getDataValidation(); - session.save(dataValidation); - List jvmOptions = algorithmParamRequest.getJvmOptions(); - for (JvmOption jvmOption : jvmOptions) { - session.saveOrUpdate(jvmOption); - } - session.saveOrUpdate(algorithmParamRequest); - session.saveOrUpdate(hpcJobInfo); - transaction.commit(); - } + @Override + public void update(HpcJobInfo hpcJobInfo) { + Transaction transaction = session.beginTransaction(); + AlgorithmParamRequest algorithmParamRequest = hpcJobInfo.getAlgorithmParamRequest(); + List algorithmParameters = algorithmParamRequest.getAlgorithmParameters(); + for (AlgorithmParameter algorithmParameter : algorithmParameters) { + session.saveOrUpdate(algorithmParameter); + } + DataValidation dataValidation = algorithmParamRequest.getDataValidation(); + session.save(dataValidation); + List jvmOptions = algorithmParamRequest.getJvmOptions(); + for (JvmOption jvmOption : jvmOptions) { + session.saveOrUpdate(jvmOption); + } + session.saveOrUpdate(algorithmParamRequest); + session.saveOrUpdate(hpcJobInfo); + transaction.commit(); + } - @Override - public void remove(HpcJobInfo hpcJobInfo) { - Transaction transaction = session.beginTransaction(); - session.delete(hpcJobInfo); - transaction.commit(); - } + @Override + public void remove(HpcJobInfo hpcJobInfo) { + Transaction transaction = session.beginTransaction(); + session.delete(hpcJobInfo); + transaction.commit(); + } - @Override - public HpcJobInfo findById(long id) { - return session.load(HpcJobInfo.class, id); - } + @Override + public HpcJobInfo findById(long id) { + return session.load(HpcJobInfo.class, id); + } - @Override - public List findByHpcAccount(HpcAccount hpcAccount) { - Query query = session.createQuery("FROM HpcJobInfo WHERE hpcAccountId = ?"); - query.setLong(0, hpcAccount.getId()); - return query.list(); - } + @Override + public List findByHpcAccount(HpcAccount hpcAccount) { + Query query = session.createQuery("FROM HpcJobInfo WHERE hpcAccountId = ?"); + query.setLong(0, hpcAccount.getId()); + return query.list(); + } - @Override - public List findByStatus(int status) { - Query query = session.createQuery("FROM HpcJobInfo WHERE status = ?"); - query.setInteger(0, status); - return query.list(); - } + @Override + public List findByStatus(int status) { + Query query = session.createQuery("FROM HpcJobInfo WHERE status = ?"); + query.setInteger(0, status); + return query.list(); + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobLogDetailService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobLogDetailService.java index 626f91b..ed3370b 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobLogDetailService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobLogDetailService.java @@ -1,61 +1,59 @@ package edu.pitt.dbmi.tetrad.db.service; +import edu.pitt.dbmi.tetrad.db.entity.HpcJobLog; +import edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail; +import edu.pitt.dbmi.tetrad.db.repository.HpcJobLogDetailRepository; import java.util.List; - import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; -import edu.pitt.dbmi.tetrad.db.entity.HpcJobLog; -import edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail; -import edu.pitt.dbmi.tetrad.db.repository.HpcJobLogDetailRepository; - /** - * + * * Jan 9, 2017 12:23:52 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class HpcJobLogDetailService implements HpcJobLogDetailRepository { private final Session session; - + public HpcJobLogDetailService(final Session session) { - this.session = session; + this.session = session; } - + @Override public void add(HpcJobLogDetail hpcJobLogDetail) { - Transaction transaction = session.beginTransaction(); - session.save(hpcJobLogDetail); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.save(hpcJobLogDetail); + transaction.commit(); } @Override public void update(HpcJobLogDetail hpcJobLogDetail) { - Transaction transaction = session.beginTransaction(); - session.saveOrUpdate(hpcJobLogDetail); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.saveOrUpdate(hpcJobLogDetail); + transaction.commit(); } @Override public void remove(HpcJobLogDetail hpcJobLogDetail) { - Transaction transaction = session.beginTransaction(); - session.delete(hpcJobLogDetail); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.delete(hpcJobLogDetail); + transaction.commit(); } @Override public HpcJobLogDetail findById(long id) { - return session.load(HpcJobLogDetail.class, id); + return session.load(HpcJobLogDetail.class, id); } @Override public List findByHpcJobLog(HpcJobLog hpcJobLog) { - Query query = session.createQuery("FROM HpcJobLogDetail WHERE hpcJobLogId = ?"); - query.setLong(0, hpcJobLog.getId()); - return query.list(); + Query query = session.createQuery("FROM HpcJobLogDetail WHERE hpcJobLogId = ?"); + query.setLong(0, hpcJobLog.getId()); + return query.list(); } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobLogService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobLogService.java index df03b77..5a5985e 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobLogService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcJobLogService.java @@ -1,75 +1,79 @@ package edu.pitt.dbmi.tetrad.db.service; -import java.util.List; - -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.Transaction; - import edu.pitt.dbmi.tetrad.db.entity.HpcAccount; import edu.pitt.dbmi.tetrad.db.entity.HpcJobInfo; import edu.pitt.dbmi.tetrad.db.entity.HpcJobLog; import edu.pitt.dbmi.tetrad.db.repository.HpcJobLogRepository; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.Transaction; /** - * + * * Jan 6, 2017 3:56:59 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class HpcJobLogService implements HpcJobLogRepository { private final Session session; - - public HpcJobLogService(final Session session){ - Transaction transaction = session.beginTransaction(); - this.session = session; - transaction.commit(); + + public HpcJobLogService(final Session session) { + Transaction transaction = session.beginTransaction(); + this.session = session; + transaction.commit(); } - + @Override public void add(HpcJobLog hpcJobLog) { - Transaction transaction = session.beginTransaction(); - session.save(hpcJobLog); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.save(hpcJobLog); + transaction.commit(); } @Override public void update(HpcJobLog hpcJobLog) { - Transaction transaction = session.beginTransaction(); - session.saveOrUpdate(hpcJobLog); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.saveOrUpdate(hpcJobLog); + transaction.commit(); } @Override public void remove(HpcJobLog hpcJobLog) { - Transaction transaction = session.beginTransaction(); - session.delete(hpcJobLog); - transaction.commit(); + Transaction transaction = session.beginTransaction(); + session.delete(hpcJobLog); + transaction.commit(); } @Override public HpcJobLog findById(long id) { - return session.load(HpcJobLog.class, id); + return session.load(HpcJobLog.class, id); } @Override public HpcJobLog findByHpcJobInfo(HpcJobInfo hpcJobInfo) { - if(hpcJobInfo == null)return null; - Query query = session.createQuery("FROM HpcJobLog WHERE hpcJobInfoId = ?"); - query.setLong(0, hpcJobInfo.getId()); - List result = query.list(); - if(result.isEmpty())return null; - return (HpcJobLog)query.list().get(0); + if (hpcJobInfo == null) { + return null; + } + Query query = session.createQuery("FROM HpcJobLog WHERE hpcJobInfoId = ?"); + query.setLong(0, hpcJobInfo.getId()); + List result = query.list(); + if (result.isEmpty()) { + return null; + } + return (HpcJobLog) query.list().get(0); } @Override public List findByHpcAccount(HpcAccount hpcAccount) { - if(hpcAccount == null)return null; - Query query = session.createQuery("FROM HpcJobLog WHERE hpcAccountId = ?"); - query.setLong(0, hpcAccount.getId()); - return query.list(); + if (hpcAccount == null) { + return null; + } + Query query = session.createQuery("FROM HpcJobLog WHERE hpcAccountId = ?"); + query.setLong(0, hpcAccount.getId()); + return query.list(); } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcParameterService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcParameterService.java index 6fdc6ed..6693127 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcParameterService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/HpcParameterService.java @@ -18,62 +18,60 @@ */ package edu.pitt.dbmi.tetrad.db.service; +import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; +import edu.pitt.dbmi.tetrad.db.entity.HpcParameter; +import edu.pitt.dbmi.tetrad.db.repository.HpcParameterRepository; import java.util.List; - import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; -import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; -import edu.pitt.dbmi.tetrad.db.entity.HpcParameter; -import edu.pitt.dbmi.tetrad.db.repository.HpcParameterRepository; - /** - * + * * Mar 14, 2017 7:26:01 PM - * + * * @author Chirayu Kong Wongchokprasitti, PhD (chw20@pitt.edu) * */ public class HpcParameterService implements HpcParameterRepository { - private final Session session; - - public HpcParameterService(final Session session) { - this.session = session; - } - - @Override - public void add(HpcParameter hpcParameter) { - Transaction transaction = session.beginTransaction(); - session.save(hpcParameter); - transaction.commit(); - } + private final Session session; + + public HpcParameterService(final Session session) { + this.session = session; + } + + @Override + public void add(HpcParameter hpcParameter) { + Transaction transaction = session.beginTransaction(); + session.save(hpcParameter); + transaction.commit(); + } - @Override - public void update(HpcParameter hpcParameter) { - Transaction transaction = session.beginTransaction(); - session.saveOrUpdate(hpcParameter); - transaction.commit(); - } + @Override + public void update(HpcParameter hpcParameter) { + Transaction transaction = session.beginTransaction(); + session.saveOrUpdate(hpcParameter); + transaction.commit(); + } - @Override - public void remove(HpcParameter hpcParameter) { - Transaction transaction = session.beginTransaction(); - session.delete(hpcParameter); - transaction.commit(); - } + @Override + public void remove(HpcParameter hpcParameter) { + Transaction transaction = session.beginTransaction(); + session.delete(hpcParameter); + transaction.commit(); + } - @Override - public HpcParameter findById(long id) { - return session.load(HpcParameter.class, id); - } + @Override + public HpcParameter findById(long id) { + return session.load(HpcParameter.class, id); + } - @Override - public List findByAlgorithmParamRequest(AlgorithmParamRequest AlgorithmParamRequest) { - Query query = session.createQuery("FROM HpcParameter WHERE algorithmParamRequestId = ?"); - query.setLong(0, AlgorithmParamRequest.getId()); - return query.list(); - } + @Override + public List findByAlgorithmParamRequest(AlgorithmParamRequest AlgorithmParamRequest) { + Query query = session.createQuery("FROM HpcParameter WHERE algorithmParamRequestId = ?"); + query.setLong(0, AlgorithmParamRequest.getId()); + return query.list(); + } } diff --git a/src/main/java/edu/pitt/dbmi/tetrad/db/service/JvmOptionService.java b/src/main/java/edu/pitt/dbmi/tetrad/db/service/JvmOptionService.java index beb30da..eae8acf 100644 --- a/src/main/java/edu/pitt/dbmi/tetrad/db/service/JvmOptionService.java +++ b/src/main/java/edu/pitt/dbmi/tetrad/db/service/JvmOptionService.java @@ -1,61 +1,59 @@ package edu.pitt.dbmi.tetrad.db.service; +import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; +import edu.pitt.dbmi.tetrad.db.entity.JvmOption; +import edu.pitt.dbmi.tetrad.db.repository.JvmOptionRepository; import java.util.List; - import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; -import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; -import edu.pitt.dbmi.tetrad.db.entity.JvmOption; -import edu.pitt.dbmi.tetrad.db.repository.JvmOptionRepository; - /** - * + * * Oct 26, 2016 4:30:49 PM - * + * * @author Chirayu (Kong) Wongchokprasitti, PhD - * + * */ public class JvmOptionService implements JvmOptionRepository { - private final Session session; - - public JvmOptionService(final Session session) { - this.session = session; - } - - @Override - public void add(JvmOption jvmOption) { - Transaction transaction = session.beginTransaction(); - session.save(jvmOption); - transaction.commit(); - } - - @Override - public void update(JvmOption jvmOption) { - Transaction transaction = session.beginTransaction(); - session.saveOrUpdate(jvmOption); - transaction.commit(); - } - - @Override - public void remove(JvmOption jvmOption) { - Transaction transaction = session.beginTransaction(); - session.delete(jvmOption); - transaction.commit(); - } - - @Override - public JvmOption findById(long id) { - return session.load(JvmOption.class, id); - } - - @Override - public List findByAlgorithmParamRequest(AlgorithmParamRequest AlgorithmParamRequest) { - Query query = session.createQuery("FROM JvmOption WHERE algorithmParamRequestId = ?"); - query.setLong(0, AlgorithmParamRequest.getId()); - return query.list(); - } + private final Session session; + + public JvmOptionService(final Session session) { + this.session = session; + } + + @Override + public void add(JvmOption jvmOption) { + Transaction transaction = session.beginTransaction(); + session.save(jvmOption); + transaction.commit(); + } + + @Override + public void update(JvmOption jvmOption) { + Transaction transaction = session.beginTransaction(); + session.saveOrUpdate(jvmOption); + transaction.commit(); + } + + @Override + public void remove(JvmOption jvmOption) { + Transaction transaction = session.beginTransaction(); + session.delete(jvmOption); + transaction.commit(); + } + + @Override + public JvmOption findById(long id) { + return session.load(JvmOption.class, id); + } + + @Override + public List findByAlgorithmParamRequest(AlgorithmParamRequest AlgorithmParamRequest) { + Query query = session.createQuery("FROM JvmOption WHERE algorithmParamRequestId = ?"); + query.setLong(0, AlgorithmParamRequest.getId()); + return query.list(); + } } diff --git a/src/test/java/edu/pitt/dbmi/tetrad/db/AppTest.java b/src/test/java/edu/pitt/dbmi/tetrad/db/AppTest.java index 1422814..8c7d25f 100644 --- a/src/test/java/edu/pitt/dbmi/tetrad/db/AppTest.java +++ b/src/test/java/edu/pitt/dbmi/tetrad/db/AppTest.java @@ -5,7 +5,6 @@ import java.util.List; import org.hibernate.Session; -import org.hibernate.Transaction; import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest; import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParameter; @@ -26,153 +25,146 @@ * Unit test for simple App. */ public class AppTest extends TestCase { + /** * Create the test case * - * @param testName - * name of the test case + * @param testName name of the test case */ public AppTest(String testName) { - super(testName); + super(testName); } /** * @return the suite of tests being tested */ public static Test suite() { - return new TestSuite(AppTest.class); + return new TestSuite(AppTest.class); } /** * Rigourous Test :-) */ public void testApp() { - Session session = TetradDatabaseApplication.getSessionFactory() - .openSession(); - - try { - HpcAccountService hpcAccountService = new HpcAccountService(session); - - // Add ComputingAccount - HpcAccount hpcAccount = new HpcAccount(); - hpcAccount.setConnectionName("PSC"); - hpcAccount.setUsername(""); - hpcAccount.setPassword(""); - hpcAccount.setScheme("https"); - hpcAccount.setHostname(""); - hpcAccount.setPort(443); - hpcAccount.setCreatedDate(new Date(System.currentTimeMillis())); - hpcAccountService.add(hpcAccount); - - // Update ComputingAccount - hpcAccount.setPort(1000); - hpcAccount.setLastLoginDate(new Date()); - hpcAccountService.update(hpcAccount); - - // Retrieve ComputingAccount by Id - long id = hpcAccount.getId(); - hpcAccount = hpcAccountService.findById(id); - - // DataValidation - DataValidation dataValidation = new DataValidation(); - dataValidation.setNonZeroVariance(true); - dataValidation.setUniqueVarName(true); - - DataValidationService dataValidationService = new DataValidationService(session); - - dataValidationService.add(dataValidation); - - // AlgorithmParamRequest - AlgorithmParamRequest algorithmParamRequest = new AlgorithmParamRequest(); - algorithmParamRequest.setDatasetPath("~/dataset.txt"); - algorithmParamRequest.setDatasetMd5(""); - algorithmParamRequest.setVariableType("continuous"); - algorithmParamRequest.setFileDelimiter("tab"); - algorithmParamRequest.setDataValidation(dataValidation); - dataValidation.setAlgorithmParamRequest(algorithmParamRequest); - - // AlgorithmParameter - AlgorithmParameter param0 = new AlgorithmParameter(); - param0.setParameter("alpha"); - param0.setValue("0.01"); - param0.setAlgorithmParamRequest(algorithmParamRequest); - - //AlgorithmParameterService algorParamService = new AlgorithmParameterService(session); - - //algorParamService.add(param0); - - AlgorithmParameter param1 = new AlgorithmParameter(); - param1.setParameter("maxDegree"); - param1.setValue("100"); - param1.setAlgorithmParamRequest(algorithmParamRequest); - - //algorParamService.add(param1); - - List algorithmParameters = new ArrayList<>(); - algorithmParameters.add(param0); - algorithmParameters.add(param1); - - algorithmParamRequest.setAlgorithmParameters(algorithmParameters); - - // JvmOption - JvmOption jvmOption = new JvmOption(); - jvmOption.setAlgorithmParamRequest(algorithmParamRequest); - jvmOption.setParameter("maxHeapSize"); - jvmOption.setValue("100"); - - //JvmOptionService jvmOptionService = new JvmOptionService(session); - - //jvmOptionService.add(jvmOption); - - List jvmOptions = new ArrayList<>(); - jvmOptions.add(jvmOption); - - algorithmParamRequest.setJvmOptions(jvmOptions); - - // HpcParameter - HpcParameter hpcParameter = new HpcParameter(); - hpcParameter.setKey("wallTime"); - hpcParameter.setValue("1"); - - //HpcParameterService hpcParamService = new HpcParameterService(session); - - //hpcParamService.add(hpcParameter); - - List hpcParameters = new ArrayList<>(); - hpcParameters.add(hpcParameter); - - algorithmParamRequest.setHpcParameters(hpcParameters); - - AlgorithmParamRequestService algorParamReqService = new AlgorithmParamRequestService(session); - - algorParamReqService.add(algorithmParamRequest); - - //JobInfo - String algorithmName = "GFCI"; - HpcJobInfo jobInfo = new HpcJobInfo(); - jobInfo.setAlgorithmName(algorithmName); - jobInfo.setSubmittedTime(new Date(System.currentTimeMillis())); - jobInfo.setAlgorithmParamRequest(algorithmParamRequest); - jobInfo.setHpcAccount(hpcAccount); - jobInfo.setStatus(0); - - HpcJobInfoService jobInfoService = new HpcJobInfoService(session); - - jobInfoService.add(jobInfo); - - jobInfoService.remove(jobInfo); - - // Remove ComputingAccount - hpcAccountService.remove(hpcAccount); - - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - session.close(); - TetradDatabaseApplication.shutdown(); - } - - assertTrue(true); + Session session = TetradDatabaseApplication.getSessionFactory() + .openSession(); + + try { + HpcAccountService hpcAccountService = new HpcAccountService(session); + + // Add ComputingAccount + HpcAccount hpcAccount = new HpcAccount(); + hpcAccount.setConnectionName("PSC"); + hpcAccount.setUsername(""); + hpcAccount.setPassword(""); + hpcAccount.setScheme("https"); + hpcAccount.setHostname(""); + hpcAccount.setPort(443); + hpcAccount.setCreatedDate(new Date(System.currentTimeMillis())); + hpcAccountService.add(hpcAccount); + + // Update ComputingAccount + hpcAccount.setPort(1000); + hpcAccount.setLastLoginDate(new Date()); + hpcAccountService.update(hpcAccount); + + // Retrieve ComputingAccount by Id + long id = hpcAccount.getId(); + hpcAccount = hpcAccountService.findById(id); + + // DataValidation + DataValidation dataValidation = new DataValidation(); + dataValidation.setNonZeroVariance(true); + dataValidation.setUniqueVarName(true); + + DataValidationService dataValidationService = new DataValidationService(session); + + dataValidationService.add(dataValidation); + + // AlgorithmParamRequest + AlgorithmParamRequest algorithmParamRequest = new AlgorithmParamRequest(); + algorithmParamRequest.setDatasetPath("~/dataset.txt"); + algorithmParamRequest.setDatasetMd5(""); + algorithmParamRequest.setVariableType("continuous"); + algorithmParamRequest.setFileDelimiter("tab"); + algorithmParamRequest.setDataValidation(dataValidation); + dataValidation.setAlgorithmParamRequest(algorithmParamRequest); + + // AlgorithmParameter + AlgorithmParameter param0 = new AlgorithmParameter(); + param0.setParameter("alpha"); + param0.setValue("0.01"); + param0.setAlgorithmParamRequest(algorithmParamRequest); + + //AlgorithmParameterService algorParamService = new AlgorithmParameterService(session); + //algorParamService.add(param0); + AlgorithmParameter param1 = new AlgorithmParameter(); + param1.setParameter("maxDegree"); + param1.setValue("100"); + param1.setAlgorithmParamRequest(algorithmParamRequest); + + //algorParamService.add(param1); + List algorithmParameters = new ArrayList<>(); + algorithmParameters.add(param0); + algorithmParameters.add(param1); + + algorithmParamRequest.setAlgorithmParameters(algorithmParameters); + + // JvmOption + JvmOption jvmOption = new JvmOption(); + jvmOption.setAlgorithmParamRequest(algorithmParamRequest); + jvmOption.setParameter("maxHeapSize"); + jvmOption.setValue("100"); + + //JvmOptionService jvmOptionService = new JvmOptionService(session); + //jvmOptionService.add(jvmOption); + List jvmOptions = new ArrayList<>(); + jvmOptions.add(jvmOption); + + algorithmParamRequest.setJvmOptions(jvmOptions); + + // HpcParameter + HpcParameter hpcParameter = new HpcParameter(); + hpcParameter.setKey("wallTime"); + hpcParameter.setValue("1"); + + //HpcParameterService hpcParamService = new HpcParameterService(session); + //hpcParamService.add(hpcParameter); + List hpcParameters = new ArrayList<>(); + hpcParameters.add(hpcParameter); + + algorithmParamRequest.setHpcParameters(hpcParameters); + + AlgorithmParamRequestService algorParamReqService = new AlgorithmParamRequestService(session); + + algorParamReqService.add(algorithmParamRequest); + + //JobInfo + String algorithmName = "GFCI"; + HpcJobInfo jobInfo = new HpcJobInfo(); + jobInfo.setAlgorithmName(algorithmName); + jobInfo.setSubmittedTime(new Date(System.currentTimeMillis())); + jobInfo.setAlgorithmParamRequest(algorithmParamRequest); + jobInfo.setHpcAccount(hpcAccount); + jobInfo.setStatus(0); + + HpcJobInfoService jobInfoService = new HpcJobInfoService(session); + + jobInfoService.add(jobInfo); + + jobInfoService.remove(jobInfo); + + // Remove ComputingAccount + hpcAccountService.remove(hpcAccount); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + session.close(); + TetradDatabaseApplication.shutdown(); + } + + assertTrue(true); } }