Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Resource |
|
| 1.0;1 |
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.core; | |
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.Inheritance; | |
12 | import javax.persistence.InheritanceType; | |
13 | import javax.persistence.JoinColumn; | |
14 | import javax.persistence.ManyToOne; | |
15 | ||
16 | import org.hibernate.annotations.Cache; | |
17 | import org.hibernate.annotations.CacheConcurrencyStrategy; | |
18 | ||
19 | /** | |
20 | * The Class Resource. | |
21 | */ | |
22 | @Entity | |
23 | @Inheritance(strategy = InheritanceType.JOINED) | |
24 | @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | |
25 | public abstract class Resource extends BaseEntity | |
26 | { | |
27 | ||
28 | /** The Constant serialVersionUID. */ | |
29 | private static final long serialVersionUID = 5477103732940234132L; | |
30 | ||
31 | /** The id. */ | |
32 | private Long id; | |
33 | ||
34 | /** The owner. */ | |
35 | private Agent owner; | |
36 | ||
37 | /** The name. */ | |
38 | private String name; | |
39 | ||
40 | /** | |
41 | * Instantiates a new resource. | |
42 | */ | |
43 | 5 | public Resource() { |
44 | 5 | } |
45 | ||
46 | /* | |
47 | * (non-Javadoc) | |
48 | * | |
49 | * @see org.directdemocracyportal.democracy.model.core.BaseEntity#getId() | |
50 | */ | |
51 | @Override | |
52 | @Id | |
53 | @GeneratedValue(strategy = GenerationType.AUTO) | |
54 | public Long getId() { | |
55 | 5 | return this.id; |
56 | } | |
57 | ||
58 | /** | |
59 | * Sets the id. | |
60 | * | |
61 | * @param id the new id | |
62 | */ | |
63 | public void setId(Long id) { | |
64 | 0 | this.id = id; |
65 | 0 | } |
66 | ||
67 | /** | |
68 | * Gets the name. | |
69 | * | |
70 | * @return the name | |
71 | */ | |
72 | public String getName() { | |
73 | 0 | return name; |
74 | } | |
75 | ||
76 | /** | |
77 | * Sets the name. | |
78 | * | |
79 | * @param name the new name | |
80 | */ | |
81 | public void setName(String name) { | |
82 | 0 | this.name = name; |
83 | 0 | } |
84 | ||
85 | /** | |
86 | * Gets the owner. | |
87 | * | |
88 | * @return the owner | |
89 | */ | |
90 | @ManyToOne | |
91 | @JoinColumn | |
92 | public Agent getOwner() { | |
93 | 0 | return owner; |
94 | } | |
95 | ||
96 | /** | |
97 | * Sets the owner. | |
98 | * | |
99 | * @param owner the new owner | |
100 | */ | |
101 | public void setOwner(Agent owner) { | |
102 | 0 | this.owner = owner; |
103 | 0 | } |
104 | } |