diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/bo/LGFile.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,134 @@
+package de.mpiwg.gazetteer.bo;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import cl.maps.duplex.DuplexKey;
+import de.mpiwg.gazetteer.dataverse.DataverseUtils;
+
+
+@Entity
+@Table(name="File")
+@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
+public class LGFile extends DBEntry implements Cloneable, Serializable, Comparable<LGFile> {
+	
+	private static final long serialVersionUID = 1638482732212457961L;
+
+	//many files can have the same fileId
+	@Column(name="branchId")
+	private Long branchId;
+	
+	//if this file has been exported to DV, here is saved the id.
+	@Column(name="dvId")
+	private Long dvId;
+	
+	@Column(name="version")
+	private Integer version = 0;
+	
+	@Column(name="fileName")
+	private String fileName;
+
+	@Column(name="userId")
+	private Long userId;
+	
+	@Column(name="lastVersion")
+	private boolean lastVersion = true;
+	
+	
+	@Column(name="notes")
+	private String notes;
+	
+	@Transient
+	private String content;
+	
+	public Long getDvId() {
+		return dvId;
+	}
+
+	public void setDvId(Long dvId) {
+		this.dvId = dvId;
+	}
+
+	public Integer getVersion() {
+		return version;
+	}
+
+	public void setVersion(Integer version) {
+		this.version = version;
+	}
+
+	public String getFileName() {
+		return fileName;
+	}
+
+	public void setFileName(String fileName) {
+		this.fileName = fileName;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+	
+	public String getUsername(){
+		if(this.userId != null){
+			return DataverseUtils.getUsername(this.userId);
+		}
+		return null;
+	}
+	
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+
+	public boolean isLastVersion() {
+		return lastVersion;
+	}
+
+	public void setLastVersion(boolean lastVersion) {
+		this.lastVersion = lastVersion;
+	}
+	
+	public Long getBranchId() {
+		return branchId;
+	}
+
+	public void setBranchId(Long branchId) {
+		this.branchId = branchId;
+	}
+
+	public String getNotes() {
+		return notes;
+	}
+
+	public void setNotes(String notes) {
+		this.notes = notes;
+	}
+	
+	 @Override
+	 public int compareTo(LGFile o) {
+	    return getCreationDate().compareTo(o.getCreationDate());
+	 }
+
+	public DuplexKey<Long, Long> getKey(){
+		return new DuplexKey<Long, Long>(this.branchId, this.id);
+	}
+	
+	@Override
+	public String toString(){
+		return "LGFile [id=" + id + ", branchId=" + branchId + ", fileName=" + fileName + "]";
+	}
+}