--- /dev/null
+package compbio.engine;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Job {
+ private String jobid;
+ private String ExecutionStatus;
+ private String FinalStatus;
+ private String IP;
+ private String Email;
+
+ private String StartingDateStr;
+ private long StartingDate;
+ private String EndTimeStr;
+ private long EndTime;
+ private String StartingTimeStr;
+ private long StartingTime;
+ private long ExecutionTime;
+
+ static SimpleDateFormat dateformatter = new SimpleDateFormat("yyyy/MM/dd");;
+ static SimpleDateFormat timeformatter = new SimpleDateFormat("yyyy/MM/dd:H:m:s");
+
+ public Job() {
+ ExecutionStatus = "OK";
+ FinalStatus = "OK";
+ jobid = "";
+
+ StartingDateStr = "1970/1/1";
+ StartingTimeStr = "1970/1/1:0:0:0";
+ EndTimeStr = "1970/1/1:0:0:0";
+ StartingDate = 0L;
+ StartingTime = 0L;
+ EndTime = 0L;
+ ExecutionTime = 0L;
+ }
+
+ public Job(String id, String date1, String date2) {
+ jobid = id;
+ ExecutionStatus = "OK";
+ FinalStatus = "OK";
+ setDates(date1, date2);
+ }
+
+ protected void setDates (String d1, String d2) {
+ StartingTimeStr = d1;
+ StartingDateStr = d1.substring(0, d1.indexOf(":"));
+ StartingTime = convertTime(StartingTimeStr);
+ StartingDate = convertDate(StartingDateStr);
+
+ EndTimeStr = d2;
+ EndTime = convertTime(d2);
+ ExecutionTime = EndTime - StartingTime;
+ }
+
+
+ protected long convertDate (String d) {
+ try {
+ if (null != d) {
+ Date startdate = dateformatter.parse(d);
+ return startdate.getTime();
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return 0L;
+ }
+
+ protected long convertTime (String d) {
+ try {
+ if (null != d) {
+ Date startdate = timeformatter.parse(d);
+ return startdate.getTime();
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return 0L;
+ }
+
+
+ public void setStartingDate(String date) {
+ this.StartingDateStr = date;
+ StartingDate = convertDate(date);
+ StartingTime = convertTime(date);
+ if (0 < EndTime) {
+ ExecutionTime = EndTime - StartingTime;
+ }
+ }
+
+ public void setEndTime(String date) {
+ this.EndTimeStr = date;
+ EndTime = convertTime(date);
+ if (0 < StartingTime) {
+ ExecutionTime = EndTime - StartingTime;
+ }
+ }
+
+ public String getStartingDateStr() {
+ return StartingDateStr;
+ }
+ public String getStartingTimeStr() {
+ return StartingTimeStr;
+ }
+ public long getStartingDate() {
+ return StartingDate;
+ }
+ public long getStartingTime() {
+ return StartingTime;
+ }
+
+ public String getEndTimeStr() {
+ return EndTimeStr;
+ }
+ public long getEndTime() {
+ return EndTime;
+ }
+
+ public void setExecutionStatus(String status) {
+ ExecutionStatus = status;
+ }
+
+ public void setFinalStatus(String status) {
+ FinalStatus = status;
+ }
+
+ public String getExecutionStatus() {
+ return ExecutionStatus;
+ }
+
+ public String getFinalStatus() {
+ return FinalStatus;
+ }
+
+ public long getExecutionTime() {
+ return ExecutionTime;
+ }
+
+ public void setIP(String IP) {
+ this.IP = IP;
+ }
+
+ public String getIP() {
+ if (null != IP)
+ return IP;
+ return "127.0.0.1";
+ }
+
+ public void setEmail(String email) {
+ this.Email = email;
+ }
+
+ public String getEmail() {
+ if (null != Email)
+ return Email;
+ return "user@localhost";
+ }
+
+ public void setJobId(String id) {
+ this.jobid = id;
+ }
+
+ public String getJobID() {
+ return jobid;
+ }
+}
--- /dev/null
+package compbio.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import compbio.cassandra.FastaSequence;
+
+public class JpredJob extends Job {
+ private String protein;
+ private String log;
+ private List<FastaSequence> predictions;
+ private List<FastaSequence> alignment;
+
+ public JpredJob() {
+ super();
+ }
+
+ public JpredJob(String jobid, String date1, String date2) {
+ super(jobid, date1, date2);
+ this.protein = protein;
+ predictions = new ArrayList<FastaSequence>();
+ alignment = new ArrayList<FastaSequence>();
+ log = "";
+ }
+
+ public JpredJob(String jobid, String date1, String date2, List<FastaSequence> alignment, List<FastaSequence> predictions) {
+ super(jobid, date1, date2);
+ this.protein = protein;
+ this.alignment = alignment;
+ this.predictions = predictions;
+ }
+
+ public void setProtein(String protein) {
+ this.protein = protein;
+ }
+
+ public String getProtein() {
+ return protein;
+ }
+
+ public void setLog(String log) {
+ this.log = log;
+ }
+
+ public String getLog() {
+ return log;
+ }
+
+ public void setAlignment(List<FastaSequence> al) {
+ this.alignment = al;
+ }
+
+ public List<FastaSequence> getAlignment() {
+ return alignment;
+ }
+
+ public void setPredictions(List<FastaSequence> pr) {
+ this.predictions = pr;
+ }
+
+ public List<FastaSequence> getPredictions() {
+ return predictions;
+ }
+}