Mercurial > hg > LGServices
comparison src/main/java/de/mpiwg/gazetteer/bo/LGFile.java @ 0:3e62083dbcbf
First commit. This project comes from LGServer. We removed the framework icefaces. Now, LGServices uses just JSP and jquery.
author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
---|---|
date | Thu, 23 Apr 2015 15:46:01 +0200 |
parents | |
children | 3b3e2963c8f7 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3e62083dbcbf |
---|---|
1 package de.mpiwg.gazetteer.bo; | |
2 | |
3 import java.io.Serializable; | |
4 | |
5 import javax.persistence.Column; | |
6 import javax.persistence.Entity; | |
7 import javax.persistence.Inheritance; | |
8 import javax.persistence.InheritanceType; | |
9 import javax.persistence.Table; | |
10 import javax.persistence.Transient; | |
11 | |
12 import cl.maps.duplex.DuplexKey; | |
13 import de.mpiwg.gazetteer.dataverse.DataverseUtils; | |
14 | |
15 | |
16 @Entity | |
17 @Table(name="File") | |
18 @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) | |
19 public class LGFile extends DBEntry implements Cloneable, Serializable, Comparable<LGFile> { | |
20 | |
21 private static final long serialVersionUID = 1638482732212457961L; | |
22 | |
23 //many files can have the same fileId | |
24 @Column(name="branchId") | |
25 private Long branchId; | |
26 | |
27 //if this file has been exported to DV, here is saved the id. | |
28 @Column(name="dvId") | |
29 private Long dvId; | |
30 | |
31 @Column(name="version") | |
32 private Integer version = 0; | |
33 | |
34 @Column(name="fileName") | |
35 private String fileName; | |
36 | |
37 @Column(name="userId") | |
38 private Long userId; | |
39 | |
40 @Column(name="lastVersion") | |
41 private boolean lastVersion = true; | |
42 | |
43 | |
44 @Column(name="notes") | |
45 private String notes; | |
46 | |
47 @Transient | |
48 private String content; | |
49 | |
50 public Long getDvId() { | |
51 return dvId; | |
52 } | |
53 | |
54 public void setDvId(Long dvId) { | |
55 this.dvId = dvId; | |
56 } | |
57 | |
58 public Integer getVersion() { | |
59 return version; | |
60 } | |
61 | |
62 public void setVersion(Integer version) { | |
63 this.version = version; | |
64 } | |
65 | |
66 public String getFileName() { | |
67 return fileName; | |
68 } | |
69 | |
70 public void setFileName(String fileName) { | |
71 this.fileName = fileName; | |
72 } | |
73 | |
74 public Long getUserId() { | |
75 return userId; | |
76 } | |
77 | |
78 public void setUserId(Long userId) { | |
79 this.userId = userId; | |
80 } | |
81 | |
82 public String getUsername(){ | |
83 if(this.userId != null){ | |
84 return DataverseUtils.getUsername(this.userId); | |
85 } | |
86 return null; | |
87 } | |
88 | |
89 public String getContent() { | |
90 return content; | |
91 } | |
92 | |
93 public void setContent(String content) { | |
94 this.content = content; | |
95 } | |
96 | |
97 public boolean isLastVersion() { | |
98 return lastVersion; | |
99 } | |
100 | |
101 public void setLastVersion(boolean lastVersion) { | |
102 this.lastVersion = lastVersion; | |
103 } | |
104 | |
105 public Long getBranchId() { | |
106 return branchId; | |
107 } | |
108 | |
109 public void setBranchId(Long branchId) { | |
110 this.branchId = branchId; | |
111 } | |
112 | |
113 public String getNotes() { | |
114 return notes; | |
115 } | |
116 | |
117 public void setNotes(String notes) { | |
118 this.notes = notes; | |
119 } | |
120 | |
121 @Override | |
122 public int compareTo(LGFile o) { | |
123 return getCreationDate().compareTo(o.getCreationDate()); | |
124 } | |
125 | |
126 public DuplexKey<Long, Long> getKey(){ | |
127 return new DuplexKey<Long, Long>(this.branchId, this.id); | |
128 } | |
129 | |
130 @Override | |
131 public String toString(){ | |
132 return "LGFile [id=" + id + ", branchId=" + branchId + ", fileName=" + fileName + "]"; | |
133 } | |
134 } |