View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   
6   package com.hack23.cia.model.sweden.impl;
7   
8   import java.util.Date;
9   
10  import javax.persistence.Entity;
11  import javax.persistence.GeneratedValue;
12  import javax.persistence.GenerationType;
13  import javax.persistence.Id;
14  import javax.persistence.ManyToOne;
15  import javax.persistence.Table;
16  import javax.persistence.Temporal;
17  import javax.persistence.TemporalType;
18  import javax.persistence.UniqueConstraint;
19  import javax.persistence.Version;
20  
21  import org.hibernate.annotations.Cache;
22  import org.hibernate.annotations.CacheConcurrencyStrategy;
23  
24  import com.hack23.cia.model.core.impl.BaseEntity;
25  
26  /***
27   * The Class ParliamentMemberVoteCompareResult.
28   */
29  @Entity
30  @Table(uniqueConstraints = { @UniqueConstraint(columnNames = {
31          "parliamentMember_id", "opponentParliamentMember_id" }) })
32  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
33  public class ParliamentMemberVoteCompareResult extends BaseEntity {
34  
35      /*** The Constant NO_RESULT. */
36      public static final float NO_RESULT = 1.0f;
37  
38      /*** The Constant serialVersionUID. */
39      private static final long serialVersionUID = 1L;
40  
41      /*** The datum. */
42      private Date datum;
43  
44      /*** The id. */
45      private Long id;
46  
47      /*** The opponent parliament member. */
48      private ParliamentMember opponentParliamentMember;
49  
50      /*** The parliament member. */
51      private ParliamentMember parliamentMember;
52  
53      /*** The result. */
54      private float result = NO_RESULT;
55  
56      /*** The version. */
57      private Long version=1L;
58  
59      /*** The votes compared. */
60      private int votesCompared;
61  
62      /***
63       * Instantiates a new parliament member vote compare result.
64       */
65      public ParliamentMemberVoteCompareResult() {
66          super();
67      }
68  
69      /***
70       * Instantiates a new parliament member vote compare result.
71       *
72       * @param datum the datum
73       * @param votesCompared the votes compared
74       * @param result the result
75       * @param parliamentMember the parliament member
76       * @param opponentParliamentMember the opponent parliament member
77       */
78      public ParliamentMemberVoteCompareResult(final Date datum, final int votesCompared,
79              final float result, final ParliamentMember parliamentMember,
80              final ParliamentMember opponentParliamentMember) {
81          super();
82          this.datum = datum;
83          this.votesCompared = votesCompared;
84          this.result = result;
85          this.parliamentMember = parliamentMember;
86          this.opponentParliamentMember = opponentParliamentMember;
87      }
88  
89      /***
90       * Gets the datum.
91       *
92       * @return the datum
93       */
94      @Temporal(TemporalType.DATE)
95      public Date getDatum() {
96          return datum;
97      }
98  
99      /*
100      * (non-Javadoc)
101      * 
102      * @see com.hack23.cia.model.core.BaseEntity#getId()
103      */
104     @Override
105     @Id
106     @GeneratedValue(strategy = GenerationType.AUTO)
107     public Long getId() {
108         return id;
109     }
110 
111     /***
112      * Gets the opponent parliament member.
113      *
114      * @return the opponent parliament member
115      */
116     @ManyToOne
117     public ParliamentMember getOpponentParliamentMember() {
118         return opponentParliamentMember;
119     }
120 
121     /***
122      * Gets the parliament member.
123      *
124      * @return the parliament member
125      */
126     @ManyToOne
127     public ParliamentMember getParliamentMember() {
128         return parliamentMember;
129     }
130 
131     /***
132      * Gets the result.
133      *
134      * @return the result
135      */
136     public float getResult() {
137         return result;
138     }
139 
140     /* (non-Javadoc)
141      * @see com.hack23.cia.model.core.BaseEntity#getVersion()
142      */
143     @Override
144     @Version
145     public Long getVersion() {
146         return version;
147     }
148 
149     /***
150      * Gets the votes compared.
151      *
152      * @return the votes compared
153      */
154     public int getVotesCompared() {
155         return votesCompared;
156     }
157 
158     /***
159      * Sets the datum.
160      *
161      * @param datum the new datum
162      */
163     public void setDatum(final Date datum) {
164         this.datum = datum;
165     }
166 
167     /***
168      * Sets the id.
169      *
170      * @param id the new id
171      */
172     public void setId(final Long id) {
173         this.id = id;
174     }
175 
176     /***
177      * Sets the opponent parliament member.
178      *
179      * @param opponentParliamentMember the new opponent parliament member
180      */
181     public void setOpponentParliamentMember(
182             final ParliamentMember opponentParliamentMember) {
183         this.opponentParliamentMember = opponentParliamentMember;
184     }
185 
186     /***
187      * Sets the parliament member.
188      *
189      * @param parliamentMember the new parliament member
190      */
191     public void setParliamentMember(final ParliamentMember parliamentMember) {
192         this.parliamentMember = parliamentMember;
193     }
194 
195     /***
196      * Sets the result.
197      *
198      * @param result the new result
199      */
200     public void setResult(final float result) {
201         this.result = result;
202     }
203     
204     /***
205      * Sets the version.
206      *
207      * @param version the new version
208      */
209     public void setVersion(final Long version) {
210         this.version = version;
211     }
212 
213     /***
214      * Sets the votes compared.
215      *
216      * @param votesCompared the new votes compared
217      */
218     public void setVotesCompared(final int votesCompared) {
219         this.votesCompared = votesCompared;
220     }
221 
222 }