1   package ixa.kaflib;
2   
3   import java.io.Serializable;
4   import java.text.SimpleDateFormat;
5   import java.util.Date;
6   
7   /**
8    * Created with IntelliJ IDEA.
9    * User: alessio
10   * Date: 19/08/14
11   * Time: 17:39
12   * To change this template use File | Settings | File Templates.
13   */
14  
15  public class LinguisticProcessor implements Serializable {
16  	String name;
17  	String timestamp;
18  	String beginTimestamp;
19  	String endTimestamp;
20  	String version;
21  	String layer;
22  
23  	public String getLayer() {
24  		return layer;
25  	}
26  
27  	public void setLayer(String layer) {
28  		this.layer = layer;
29  	}
30  
31  	/**
32  	 * Returns current timestamp.
33  	 */
34  	public static String createTimestamp() {
35  		Date date = new Date();
36  		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd H:mm:ss");
37  		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
38  		String formattedDate = sdf.format(date);
39  		return formattedDate;
40  	}
41  
42  	public LinguisticProcessor(String layer, String name) {
43  		this.name = name;
44  		this.layer = layer;
45  	}
46  
47  	public void setName(String name) {
48  		this.name = name;
49  	}
50  
51  	public String getName() {
52  		return name;
53  	}
54  
55  	public boolean hasTimestamp() {
56  		return this.timestamp != null;
57  	}
58  
59  	public void setTimestamp(String timestamp) {
60  		this.timestamp = timestamp;
61  	}
62  
63  	public void setTimestamp() {
64  		String timestamp = createTimestamp();
65  		this.timestamp = timestamp;
66  	}
67  
68  	public String getTimestamp() {
69  		return this.timestamp;
70  	}
71  
72  	public boolean hasBeginTimestamp() {
73  		return beginTimestamp != null;
74  	}
75  
76  	public void setBeginTimestamp(String timestamp) {
77  		this.beginTimestamp = timestamp;
78  	}
79  
80  	public void setBeginTimestamp() {
81  		String timestamp = createTimestamp();
82  		this.beginTimestamp = timestamp;
83  	}
84  
85  	public String getBeginTimestamp() {
86  		return beginTimestamp;
87  	}
88  
89  	public boolean hasEndTimestamp() {
90  		return endTimestamp != null;
91  	}
92  
93  	public void setEndTimestamp(String timestamp) {
94  		this.endTimestamp = timestamp;
95  	}
96  
97  	public void setEndTimestamp() {
98  		String timestamp = createTimestamp();
99  		this.endTimestamp = timestamp;
100 	}
101 
102 	public String getEndTimestamp() {
103 		return endTimestamp;
104 	}
105 
106 	public boolean hasVersion() {
107 		return version != null;
108 	}
109 
110 	public void setVersion(String version) {
111 		this.version = version;
112 	}
113 
114 	public String getVersion() {
115 		return version;
116 	}
117 
118 }