comparison src/main/java/edu/harvard/iq/dataverse/CustomQuestionResponse.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 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6 package edu.harvard.iq.dataverse;
7
8 import java.io.Serializable;
9 import java.util.List;
10 import javax.faces.model.SelectItem;
11 import javax.persistence.*;
12
13 /**
14 *
15 * @author skraffmiller
16 */
17 @Entity
18 @Table(indexes = {
19 @Index(columnList = "guestbookresponse_id")
20 })
21 public class CustomQuestionResponse implements Serializable {
22
23 private static final long serialVersionUID = 1L;
24 @Id
25 @GeneratedValue(strategy = GenerationType.IDENTITY)
26 private Long id;
27 @ManyToOne
28 @JoinColumn(nullable = false)
29 private GuestbookResponse guestbookResponse;
30
31 @ManyToOne
32 @JoinColumn(nullable = false)
33 private CustomQuestion customQuestion;
34
35 private String response;
36
37 public Long getId() {
38 return id;
39 }
40
41 public void setId(Long id) {
42 this.id = id;
43 }
44
45 public GuestbookResponse getGuestbookResponse() {
46 return guestbookResponse;
47 }
48
49 public void setGuestbookResponse(GuestbookResponse guestbookResponse) {
50 this.guestbookResponse = guestbookResponse;
51 }
52
53 public String getResponse() {
54 return response;
55 }
56
57 public void setResponse(String response) {
58 this.response = response;
59 }
60
61
62 public CustomQuestion getCustomQuestion() {
63 return customQuestion;
64 }
65
66 public void setCustomQuestion(CustomQuestion customQuestion) {
67 this.customQuestion = customQuestion;
68 }
69
70 @Transient
71 private List<SelectItem> responseSelectItems;
72
73 public List<SelectItem> getResponseSelectItems() {
74 return responseSelectItems;
75 }
76
77 public void setResponseSelectItems(List<SelectItem> responseSelectItems) {
78 this.responseSelectItems = responseSelectItems;
79 }
80
81 @Override
82 public int hashCode() {
83 int hash = 0;
84 hash += (id != null ? id.hashCode() : 0);
85 return hash;
86 }
87
88 @Override
89 public boolean equals(Object object) {
90 // TODO: Warning - this method won't work in the case the id fields are not set
91 if (!(object instanceof CustomQuestionResponse)) {
92 return false;
93 }
94 CustomQuestionResponse other = (CustomQuestionResponse) object;
95 if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
96 return false;
97 }
98 return true;
99 }
100
101 @Override
102 public String toString() {
103 return "edu.harvard.iq.dvn.core.vdc.CustomQuestionResponse[ id=" + id + " ]";
104 }
105 }
106