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.application.impl.common;
7   
8   import javax.persistence.Entity;
9   import javax.persistence.GeneratedValue;
10  import javax.persistence.GenerationType;
11  import javax.persistence.Id;
12  import javax.persistence.ManyToOne;
13  import javax.persistence.Version;
14  
15  import org.hibernate.annotations.Cache;
16  import org.hibernate.annotations.CacheConcurrencyStrategy;
17  
18  import com.hack23.cia.model.core.impl.BaseEntity;
19  import com.hack23.cia.model.sweden.impl.ParliamentMember;
20  
21  /***
22   * The Class Player.
23   */
24  @Entity
25  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
26  public class Player extends BaseEntity {
27  
28      /*** The Constant serialVersionUID. */
29      private static final long serialVersionUID = -1381199844545595026L;
30  
31      /*** The id. */
32      private Long id;
33  
34      /*** The shadow parliament member. */
35      private ParliamentMember shadowParliamentMember;
36  
37      /*** The user. */
38      private User user;
39      
40      /*** The version. */
41      private Long version=1L;
42  
43      /***
44       * Instantiates a new player.
45       */
46      public Player() {
47      }
48  
49      /*
50       * (non-Javadoc)
51       * 
52       * @see com.hack23.cia.model.core.BaseEntity#getId()
53       */
54      @Override
55      @Id
56      @GeneratedValue(strategy = GenerationType.AUTO)
57      public Long getId() {
58          return id;
59      }
60  
61  
62      /***
63       * Gets the shadow parliament member.
64       *
65       * @return the shadow parliament member
66       */
67      @ManyToOne
68  	public ParliamentMember getShadowParliamentMember() {
69  		return shadowParliamentMember;
70  	}
71  
72      /***
73       * Gets the user.
74       *
75       * @return the user
76       */
77      @ManyToOne
78  	public User getUser() {
79  		return user;
80  	}
81  
82      /* (non-Javadoc)
83       * @see com.hack23.cia.model.core.BaseEntity#getVersion()
84       */
85      @Override
86      @Version
87      public Long getVersion() {
88          return version;
89      }
90  
91      /***
92       * Sets the id.
93       *
94       * @param id the new id
95       */
96      public void setId(final Long id) {
97          this.id = id;
98      }
99  
100 	/***
101 	 * Sets the shadow parliament member.
102 	 *
103 	 * @param shadowParliamentMember the new shadow parliament member
104 	 */
105 	public void setShadowParliamentMember(final ParliamentMember shadowParliamentMember) {
106 		this.shadowParliamentMember = shadowParliamentMember;
107 	}
108 
109     /***
110      * Sets the user.
111      *
112      * @param user the new user
113      */
114 	public void setUser(final User user) {
115 		this.user = user;
116 	}
117 
118 	/***
119 	 * Sets the version.
120 	 *
121 	 * @param version the new version
122 	 */
123     public void setVersion(final Long version) {
124         this.version = version;
125     }
126 }