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.ArrayList;
9   import java.util.Date;
10  import java.util.List;
11  
12  import javax.persistence.CascadeType;
13  import javax.persistence.Entity;
14  import javax.persistence.EnumType;
15  import javax.persistence.Enumerated;
16  import javax.persistence.FetchType;
17  import javax.persistence.GeneratedValue;
18  import javax.persistence.GenerationType;
19  import javax.persistence.Id;
20  import javax.persistence.OneToMany;
21  import javax.persistence.Table;
22  import javax.persistence.Temporal;
23  import javax.persistence.TemporalType;
24  import javax.persistence.UniqueConstraint;
25  import javax.persistence.Version;
26  
27  import org.hibernate.annotations.Cache;
28  import org.hibernate.annotations.CacheConcurrencyStrategy;
29  
30  import com.hack23.cia.model.core.impl.BaseEntity;
31  
32  /***
33   * The Class CommitteeReport.
34   */
35  @Entity
36  @Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "name", "href" }) })
37  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
38  public class CommitteeReport extends BaseEntity {
39  
40      /***
41       * The Enum ImportStatus.
42       */
43      public enum ImportStatus {
44  
45          /*** The Completed. */
46          Completed,
47  
48          /*** The Created. */
49          Created,
50  
51          /*** The Waiting. */
52          Waiting
53      }
54  
55      /*** The Constant serialVersionUID. */
56      private static final long serialVersionUID = 1L;
57  
58      /*** The ballots. */
59      private List<Ballot> ballots = new ArrayList<Ballot>();
60  
61      /*** The decision date. */
62      private Date decisionDate;
63  
64      /*** The href. */
65      private String href;
66  
67      /*** The id. */
68      private Long id;
69  
70      /*** The import status. */
71      private ImportStatus importStatus = ImportStatus.Created;
72  
73      /*** The name. */
74      private String name;
75  
76      /*** The version. */
77      private Long version=1L;
78  
79      /***
80       * Gets the ballots.
81       *
82       * @return the ballots
83       */
84      @OneToMany(mappedBy = "commiteeReport", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
85      @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
86      public List<Ballot> getBallots() {
87          return ballots;
88      }
89  
90      /***
91       * Gets the decision date.
92       *
93       * @return the decision date
94       */
95      @Temporal(TemporalType.DATE)
96      public Date getDecisionDate() {
97          return decisionDate;
98      }
99  
100     /***
101      * Gets the href.
102      *
103      * @return the href
104      */
105     public String getHref() {
106         return href;
107     }
108 
109     /*
110      * (non-Javadoc)
111      * 
112      * @see com.hack23.cia.model.core.BaseEntity#getId()
113      */
114     @Override
115     @Id
116     @GeneratedValue(strategy = GenerationType.AUTO)
117     public Long getId() {
118         return id;
119     }
120 
121     /***
122      * Gets the import status.
123      *
124      * @return the import status
125      */
126     @Enumerated(EnumType.STRING)
127     public ImportStatus getImportStatus() {
128         return importStatus;
129     }
130 
131     /***
132      * Gets the name.
133      *
134      * @return the name
135      */
136     public String getName() {
137         return name;
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      * Sets the ballots.
151      *
152      * @param ballots the new ballots
153      */
154     public void setBallots(final List<Ballot> ballots) {
155         this.ballots = ballots;
156     }
157 
158     /***
159      * Sets the decision date.
160      *
161      * @param decisionDate the new decision date
162      */
163     public void setDecisionDate(final Date decisionDate) {
164         this.decisionDate = decisionDate;
165     }
166 
167     /***
168      * Sets the href.
169      *
170      * @param href the new href
171      */
172     public void setHref(final String href) {
173         this.href = href;
174     }
175 
176     /***
177      * Sets the id.
178      *
179      * @param id the new id
180      */
181     public void setId(final Long id) {
182         this.id = id;
183     }
184 
185     /***
186      * Sets the import status.
187      *
188      * @param importStatus the new import status
189      */
190     public void setImportStatus(final ImportStatus importStatus) {
191         this.importStatus = importStatus;
192     }
193 
194     /***
195      * Sets the name.
196      *
197      * @param name the new name
198      */
199     public void setName(final String name) {
200         this.name = name;
201     }
202 
203     /***
204      * Sets the version.
205      *
206      * @param version the new version
207      */
208     public void setVersion(final Long version) {
209         this.version = version;
210     }
211 
212 }