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 javax.persistence.Entity;
8   import javax.persistence.GeneratedValue;
9   import javax.persistence.GenerationType;
10  import javax.persistence.Id;
11  import javax.persistence.JoinColumn;
12  import javax.persistence.ManyToOne;
13  
14  import org.directdemocracyportal.democracy.model.core.BaseEntity;
15  import org.hibernate.annotations.Cache;
16  import org.hibernate.annotations.CacheConcurrencyStrategy;
17  
18  /***
19   * The Class Election.
20   */
21  @Entity
22  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
23  public class Election extends BaseEntity
24  {
25  
26      /*** The Constant serialVersionUID. */
27      private static final long serialVersionUID = 5477103732940234132L;
28  
29      /*** The id. */
30      private Long id;
31  
32      /*** The name. */
33      private String name;
34  
35      /*** The government. */
36      private Government government;
37  
38      /*** The type. */
39      private ElectionType type;
40  
41      /***
42       * Instantiates a new election.
43       */
44      public Election() {
45      }
46  
47      /***
48       * Gets the name.
49       *
50       * @return the name
51       */
52      public String getName() {
53          return this.name;
54      }
55  
56      /***
57       * Sets the name.
58       *
59       * @param name the new name
60       */
61      public void setName(String name) {
62          this.name = name;
63      }
64  
65      /*
66       * (non-Javadoc)
67       *
68       * @see org.directdemocracyportal.democracy.model.core.BaseEntity#getId()
69       */
70      @Override
71      @Id
72      @GeneratedValue(strategy = GenerationType.AUTO)
73      public Long getId() {
74          return this.id;
75      }
76  
77      /***
78       * Sets the id.
79       *
80       * @param id the new id
81       */
82      public void setId(Long id) {
83          this.id = id;
84      }
85  
86      /***
87       * Gets the type.
88       *
89       * @return the type
90       */
91      public ElectionType getType() {
92          return type;
93      }
94  
95      /***
96       * Sets the type.
97       *
98       * @param type the new type
99       */
100     public void setType(ElectionType type) {
101         this.type = type;
102     }
103 
104     /***
105      * Gets the government.
106      *
107      * @return the government
108      */
109     @ManyToOne
110     @JoinColumn
111     public Government getGovernment() {
112         return government;
113     }
114 
115     /***
116      * Sets the government.
117      *
118      * @param government the new government
119      */
120     public void setGovernment(Government government) {
121         this.government = government;
122     }
123 }