2a092bd4ecaf096d7efc71d0a2a5fdc3d109736e
[jalview.git] / src / jalview / ws / api / JobId.java
1 package jalview.ws.api;
2
3 import java.time.Instant;
4 import java.util.Date;
5
6 public class JobId
7 {
8   // TODO: JobId could include sequenceI anonymisation stuff
9   // TODO: getProgress() -> input stream to log file for job.
10   private String serviceType;
11
12   private String serviceImpl;
13
14   private String jobId;
15
16   private Instant creationTime;
17
18   public JobId(String serviceType, String serviceImpl, String id)
19   {
20     this.serviceType = serviceType;
21     this.serviceImpl = serviceImpl;
22     jobId = id;
23     creationTime = Instant.now();
24   }
25
26   @Override
27   public String toString()
28   {
29     return "" + serviceType + ":" + serviceImpl + ":" + jobId + "\nCreated "
30             + Date.from(creationTime);
31   }
32   /**
33    * a stringified version of the Job Id that can be saved in project.
34    */
35   public String getURI()
36   {
37     return jobId;
38   }
39
40   public String getServiceType()
41   {
42     return serviceType;
43   }
44
45   public String getServiceImpl()
46   {
47     return serviceImpl;
48   }
49
50   public String getJobId()
51   {
52     return jobId;
53   }
54
55   public Instant getCreationTime()
56   {
57     return creationTime;
58   }
59 }