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   package org.directdemocracyportal.democracy.model.world;
6   
7   import java.util.Date;
8   
9   import javax.persistence.Entity;
10  import javax.persistence.EnumType;
11  import javax.persistence.Enumerated;
12  import javax.persistence.ManyToOne;
13  import javax.persistence.Temporal;
14  import javax.persistence.TemporalType;
15  
16  import org.hibernate.annotations.Cache;
17  import org.hibernate.annotations.CacheConcurrencyStrategy;
18  
19  /***
20   * The Class Vote.
21   */
22  @Entity
23  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
24  public class Vote extends Document
25  {
26  
27      /*** The Constant serialVersionUID. */
28      private static final long serialVersionUID = 5477103732940234132L;
29  
30      /*** The position. */
31      private Position position;
32  
33      /*** The vote date. */
34      private Date voteDate;
35  
36      /*** The vote result. */
37      private VoteResult voteResult;
38  
39      /***
40       * Gets the position.
41       *
42       * @return the position
43       */
44      @Enumerated(EnumType.STRING)
45      public Position getPosition() {
46          return position;
47      }
48  
49      /***
50       * Sets the position.
51       *
52       * @param position the new position
53       */
54      public void setPosition(Position position) {
55          this.position = position;
56      }
57  
58      /***
59       * Gets the vote date.
60       *
61       * @return the vote date
62       */
63      @Temporal(TemporalType.DATE)
64      public Date getVoteDate() {
65          return voteDate;
66      }
67  
68      /***
69       * Sets the vote date.
70       *
71       * @param voteDate the new vote date
72       */
73      public void setVoteDate(Date voteDate) {
74          this.voteDate = voteDate;
75      }
76  
77      /***
78       * Gets the vote result.
79       *
80       * @return the vote result
81       */
82      @ManyToOne
83      public VoteResult getVoteResult() {
84          return voteResult;
85      }
86  
87      /***
88       * Sets the vote result.
89       *
90       * @param voteResult the new vote result
91       */
92      public void setVoteResult(VoteResult voteResult) {
93          this.voteResult = voteResult;
94      }
95  
96      /***
97       * The Enum Position.
98       */
99      public enum Position {
100 
101         /*** The Yes. */
102         Yes,
103 
104         /*** The No. */
105         No,
106 
107         /*** The Neutral. */
108         Neutral,
109 
110         /*** The Absent. */
111         Absent,
112 
113         /*** The Acclamation. */
114         Acclamation;
115     }
116 }