Mercurial > hg > LGServer
view src/main/java/de/mpiwg/gazetteer/bo/LGFile.java @ 0:7682c04c63a8
First commit of the source code!
author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
---|---|
date | Tue, 10 Mar 2015 14:50:41 +0100 |
parents | |
children |
line wrap: on
line source
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 + "]"; } }