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 gnu.trove.THashSet;
9   
10  import java.util.Set;
11  
12  import javax.persistence.CascadeType;
13  import javax.persistence.Entity;
14  import javax.persistence.FetchType;
15  import javax.persistence.GeneratedValue;
16  import javax.persistence.GenerationType;
17  import javax.persistence.Id;
18  import javax.persistence.JoinTable;
19  import javax.persistence.OneToMany;
20  import javax.persistence.Version;
21  
22  import org.hibernate.annotations.Cache;
23  import org.hibernate.annotations.CacheConcurrencyStrategy;
24  
25  import com.hack23.cia.model.core.impl.BaseEntity;
26  
27  /***
28   * The Class ParliamentYear.
29   */
30  @Entity
31  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
32  public class ParliamentYear extends BaseEntity {
33  
34      /*** The Constant serialVersionUID. */
35      private static final long serialVersionUID = 1L;
36  
37  
38      /*** The id. */
39      private Long id;
40  
41      /*** The name. */
42      private String name;
43      
44      /*** The committee reports. */
45      private Set<CommitteeReport> committeeReports = new THashSet<CommitteeReport>();
46      
47      /*** The short code. */
48      private String shortCode;
49      
50      /*** The version. */
51      private Long version=1L;
52      
53      /***
54       * Instantiates a new parliament year.
55       */
56  	public ParliamentYear() {
57  		super();
58  	}
59  
60      /*
61       * (non-Javadoc)
62       * 
63       * @see com.hack23.cia.model.core.BaseEntity#getId()
64       */
65      @Override
66      @Id
67      @GeneratedValue(strategy = GenerationType.AUTO)
68      public Long getId() {
69          return id;
70      }
71  
72      /***
73       * Gets the name.
74       *
75       * @return the name
76       */
77  	public String getName() {
78  		return name;
79  	}
80  
81  
82      /***
83       * Gets the committee reports.
84       *
85       * @return the committee reports
86       */
87      @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
88      @JoinTable(name = "ParliamentYearCommitteeReports")
89  	public Set<CommitteeReport> getCommitteeReports() {
90  		return committeeReports;
91  	}
92  
93  	/***
94  	 * Gets the short code.
95  	 *
96  	 * @return the short code
97  	 */
98  	public String getShortCode() {
99  		return shortCode;
100 	}
101 
102 	/* (non-Javadoc)
103      * @see com.hack23.cia.model.core.BaseEntity#getVersion()
104      */
105     @Override
106     @Version
107     public Long getVersion() {
108         return version;
109     }
110 
111 	/***
112 	 * Sets the id.
113 	 *
114 	 * @param id the new id
115 	 */
116     public void setId(final Long id) {
117         this.id = id;
118     }
119 
120 	/***
121 	 * Sets the name.
122 	 *
123 	 * @param name the new name
124 	 */
125 	public void setName(final String name) {
126 		this.name = name;
127 	}
128 
129     /***
130      * Sets the short code.
131      *
132      * @param shortCode the new short code
133      */
134 	public void setShortCode(final String shortCode) {
135 		this.shortCode = shortCode;
136 	}
137 
138 	/***
139 	 * Sets the version.
140 	 *
141 	 * @param version the new version
142 	 */
143     public void setVersion(final Long version) {
144         this.version = version;
145     }
146 
147 	/***
148 	 * Sets the committee reports.
149 	 *
150 	 * @param committeeReports the new committee reports
151 	 */
152 	public void setCommitteeReports(final Set<CommitteeReport> committeeReports) {
153 		this.committeeReports = committeeReports;
154 	}
155 }