1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.imca.model.entities;
17
18 import java.util.Date;
19
20 import javax.persistence.Entity;
21 import javax.persistence.GeneratedValue;
22 import javax.persistence.GenerationType;
23 import javax.persistence.Id;
24 import javax.persistence.NamedQueries;
25 import javax.persistence.NamedQuery;
26 import javax.persistence.OneToOne;
27
28 import net.sf.imca.model.ImcaUtils;
29
30
31
32
33
34
35
36
37 @Entity
38 @NamedQueries( {
39 @NamedQuery(name = "findMembershipTypes",
40 query = "SELECT m FROM MembershipTypeEntity m WHERE " +
41 "m.association = :association"),
42 @NamedQuery(name = "MembershipTypeBasicSearch",
43 query = "SELECT m FROM MembershipTypeEntity m WHERE " +
44 "m.name LIKE :search")
45 })
46
47 public class MembershipTypeEntity {
48
49
50
51
52 @Id
53 @GeneratedValue(strategy=GenerationType.TABLE)
54 private long id;
55
56 @OneToOne
57 private AssociationEntity association;
58
59 private String name = "";
60
61 @OneToOne
62 private FeeEntity currentFee;
63
64 private Date validFrom;
65
66 private Date validTo;
67
68 public Date getValidFrom() {
69 return validFrom;
70 }
71
72 public void setValidFrom(Date validFrom) {
73 this.validFrom = validFrom;
74 }
75
76 public Date getValidTo() {
77 return validTo;
78 }
79
80 public void setValidTo(Date validTo) {
81 this.validTo = validTo;
82 }
83
84 public FeeEntity getCurrentFee() {
85 return currentFee;
86 }
87
88
89
90
91 public void setCurrentFee(FeeEntity currentFee) {
92 this.currentFee = currentFee;
93 }
94
95 public long getId() {
96 return id;
97 }
98
99 public void setId(long id) {
100 this.id = id;
101 }
102
103 public String getName() {
104 return name;
105 }
106
107 public void setName(String name) {
108 this.name = name;
109 }
110
111 public AssociationEntity getAssociation() {
112 return association;
113 }
114
115 public void setAssociation(AssociationEntity association) {
116 this.association = association;
117 }
118
119
120
121
122
123 public String toString(){
124 return name + " - " + association.toString() + " ( " +
125 ImcaUtils.formatDate(validFrom) + " - " +
126 ImcaUtils.formatDate(validTo) + " ).";
127 }
128 }