Mercurial > hg > LGDataverses
comparison src/main/java/edu/harvard/iq/dataverse/DatasetLock.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 /* | |
| 2 Copyright (C) 2005-2012, by the President and Fellows of Harvard College. | |
| 3 | |
| 4 Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 you may not use this file except in compliance with the License. | |
| 6 You may obtain a copy of the License at | |
| 7 | |
| 8 http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | |
| 10 Unless required by applicable law or agreed to in writing, software | |
| 11 distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 See the License for the specific language governing permissions and | |
| 14 limitations under the License. | |
| 15 | |
| 16 Dataverse Network - A web application to share, preserve and analyze research data. | |
| 17 Developed at the Institute for Quantitative Social Science, Harvard University. | |
| 18 Version 3.0. | |
| 19 */ | |
| 20 | |
| 21 package edu.harvard.iq.dataverse; | |
| 22 | |
| 23 import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; | |
| 24 import java.util.Date; | |
| 25 import java.io.Serializable; | |
| 26 import javax.persistence.Entity; | |
| 27 import javax.persistence.GeneratedValue; | |
| 28 import javax.persistence.GenerationType; | |
| 29 import javax.persistence.Id; | |
| 30 import javax.persistence.JoinColumn; | |
| 31 import javax.persistence.ManyToOne; | |
| 32 import javax.persistence.OneToOne; | |
| 33 import javax.persistence.Temporal; | |
| 34 import javax.persistence.TemporalType; | |
| 35 | |
| 36 /** | |
| 37 * | |
| 38 * @author Leonid Andreev | |
| 39 */ | |
| 40 @Entity | |
| 41 public class DatasetLock implements Serializable { | |
| 42 private static final long serialVersionUID = 1L; | |
| 43 | |
| 44 public DatasetLock() { | |
| 45 } | |
| 46 | |
| 47 | |
| 48 @Id | |
| 49 @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 50 private Long id; | |
| 51 | |
| 52 @Temporal(value = TemporalType.TIMESTAMP) | |
| 53 private Date startTime; | |
| 54 | |
| 55 @OneToOne | |
| 56 @JoinColumn(nullable=false) | |
| 57 private Dataset dataset; | |
| 58 | |
| 59 @ManyToOne | |
| 60 @JoinColumn(nullable=false) | |
| 61 private AuthenticatedUser user; | |
| 62 | |
| 63 private String info; | |
| 64 | |
| 65 public Long getId() { | |
| 66 return id; | |
| 67 } | |
| 68 | |
| 69 public void setId(Long id) { | |
| 70 this.id = id; | |
| 71 } | |
| 72 | |
| 73 public Date getStartTime() { | |
| 74 return startTime; | |
| 75 } | |
| 76 | |
| 77 public void setStartTime(Date startTime) { | |
| 78 this.startTime = startTime; | |
| 79 } | |
| 80 | |
| 81 | |
| 82 public Dataset getDataset() { | |
| 83 return dataset; | |
| 84 } | |
| 85 | |
| 86 public void setDataset(Dataset dataset) { | |
| 87 this.dataset = dataset; | |
| 88 } | |
| 89 | |
| 90 | |
| 91 public AuthenticatedUser getUser() { | |
| 92 return user; | |
| 93 } | |
| 94 | |
| 95 public void setUser(AuthenticatedUser user) { | |
| 96 this.user = user; | |
| 97 } | |
| 98 | |
| 99 | |
| 100 public String getInfo() { | |
| 101 return info; | |
| 102 } | |
| 103 | |
| 104 public void setInfo(String info) { | |
| 105 this.info = info; | |
| 106 } | |
| 107 | |
| 108 | |
| 109 @Override | |
| 110 public int hashCode() { | |
| 111 int hash = 0; | |
| 112 hash += (id != null ? id.hashCode() : 0); | |
| 113 return hash; | |
| 114 } | |
| 115 | |
| 116 @Override | |
| 117 public boolean equals(Object object) { | |
| 118 if (!(object instanceof DatasetLock)) { | |
| 119 return false; | |
| 120 } | |
| 121 DatasetLock other = (DatasetLock) object; | |
| 122 return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))); | |
| 123 } | |
| 124 | |
| 125 @Override | |
| 126 public String toString() { | |
| 127 return "edu.harvard.iq.dataverse.DatasetLock[ id=" + id + " ]"; | |
| 128 } | |
| 129 | |
| 130 } |
