Mercurial > hg > LGDataverses
comparison src/main/java/edu/harvard/iq/dataverse/DatasetLinkingDataverse.java @ 10:a50cf11e5178
Rewrite LGDataverse completely upgrading to dataverse4.0
| author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
|---|---|
| date | Tue, 08 Sep 2015 17:00:21 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 9:5926d6419569 | 10:a50cf11e5178 |
|---|---|
| 1 package edu.harvard.iq.dataverse; | |
| 2 | |
| 3 import java.io.Serializable; | |
| 4 import java.util.Date; | |
| 5 import javax.persistence.Column; | |
| 6 import javax.persistence.Entity; | |
| 7 import javax.persistence.GeneratedValue; | |
| 8 import javax.persistence.GenerationType; | |
| 9 import javax.persistence.Id; | |
| 10 import javax.persistence.Index; | |
| 11 import javax.persistence.JoinColumn; | |
| 12 import javax.persistence.OneToOne; | |
| 13 import javax.persistence.Table; | |
| 14 import javax.persistence.Temporal; | |
| 15 import javax.persistence.TemporalType; | |
| 16 | |
| 17 /** | |
| 18 * | |
| 19 * @author skraffmiller | |
| 20 */ | |
| 21 @Entity | |
| 22 @Table(indexes = { | |
| 23 @Index(columnList = "dataset_id"), | |
| 24 @Index(columnList = "linkingDataverse_id") | |
| 25 }) | |
| 26 public class DatasetLinkingDataverse implements Serializable { | |
| 27 private static final long serialVersionUID = 1L; | |
| 28 @Id | |
| 29 @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 30 private Long id; | |
| 31 | |
| 32 @OneToOne | |
| 33 @JoinColumn(nullable = false) | |
| 34 private Dataset dataset; | |
| 35 | |
| 36 @OneToOne | |
| 37 @JoinColumn(nullable = false) | |
| 38 private Dataverse linkingDataverse; | |
| 39 | |
| 40 @Temporal(value = TemporalType.TIMESTAMP) | |
| 41 @Column( nullable=false ) | |
| 42 private Date linkCreateTime; | |
| 43 | |
| 44 public Long getId() { | |
| 45 return id; | |
| 46 } | |
| 47 | |
| 48 public void setId(Long id) { | |
| 49 this.id = id; | |
| 50 } | |
| 51 | |
| 52 public Dataset getDataset() { | |
| 53 return dataset; | |
| 54 } | |
| 55 | |
| 56 public void setDataset(Dataset dataset) { | |
| 57 this.dataset = dataset; | |
| 58 } | |
| 59 | |
| 60 public Dataverse getLinkingDataverse() { | |
| 61 return linkingDataverse; | |
| 62 } | |
| 63 | |
| 64 public void setLinkingDataverse(Dataverse linkingDataverse) { | |
| 65 this.linkingDataverse = linkingDataverse; | |
| 66 } | |
| 67 | |
| 68 public Date getLinkCreateTime() { | |
| 69 return linkCreateTime; | |
| 70 } | |
| 71 | |
| 72 public void setLinkCreateTime(Date linkCreateTime) { | |
| 73 this.linkCreateTime = linkCreateTime; | |
| 74 } | |
| 75 | |
| 76 @Override | |
| 77 public int hashCode() { | |
| 78 int hash = 0; | |
| 79 hash += (id != null ? id.hashCode() : 0); | |
| 80 return hash; | |
| 81 } | |
| 82 | |
| 83 @Override | |
| 84 public boolean equals(Object object) { | |
| 85 // TODO: Warning - this method won't work in the case the id fields are not set | |
| 86 if (!(object instanceof DatasetLinkingDataverse)) { | |
| 87 return false; | |
| 88 } | |
| 89 DatasetLinkingDataverse other = (DatasetLinkingDataverse) object; | |
| 90 if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { | |
| 91 return false; | |
| 92 } | |
| 93 return true; | |
| 94 } | |
| 95 | |
| 96 @Override | |
| 97 public String toString() { | |
| 98 return "edu.harvard.iq.dataverse.DatasetLinkingDataverse[ id=" + id + " ]"; | |
| 99 } | |
| 100 | |
| 101 } |
