KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > model > core > GlobalProperty


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.blandware.atleap.model.core;
17
18 /**
19  * <p>Represents global property. Global property is a pair <em>name, value</em>:
20  * that's <em>value</em>, corresponding to global property named <em>name</em>.
21  * </p>
22  * <p>
23  * Global properties are used to specify some parameters that are common for
24  * whole application. They can be static and dynamic. Static properties are
25  * those that were defined in configuration files, they can't be changed at
26  * runtime. Dynamic properties are those that can be edited through
27  * web-interface -- they influence application behaviour at runtime.
28  * </p>
29  * <p><a HREF="GlobalProperty.java.htm"><i>View Source</i></a>
30  * </p>
31  *
32  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
33  * @version $Revision: 1.11 $ $Date: 2005/10/19 07:27:39 $
34  * @hibernate.class table="`al_core_global_property`" lazy="false"
35  */

36 public class GlobalProperty extends BaseObject {
37
38     //~ Instance variables
39

40     /**
41      * Name of global property
42      */

43     protected String JavaDoc name;
44     /**
45      * Value of global property
46      */

47     protected String JavaDoc value;
48     /**
49      * Version of this global property (used in optimistic locking)
50      */

51     protected Long JavaDoc version;
52
53     //~ Constructors
54

55     /**
56      * Creates new instance of GlobalProperty
57      */

58     public GlobalProperty() {
59     }
60
61     /**
62      * Creates new instance of GlobalProperty with the specified name
63      *
64      * @param name Name of property
65      */

66     public GlobalProperty(String JavaDoc name) {
67         this.name = name;
68     }
69
70     /**
71      * Creates new instance of GlobalProperty with the specified name and value
72      *
73      * @param name Name of property
74      * @param value Value of property
75      */

76     public GlobalProperty(String JavaDoc name, String JavaDoc value) {
77         this.name = name;
78         this.value = value;
79     }
80
81     //~ Methods
82

83     /**
84      * Gets global property name
85      *
86      * @return name
87      * @hibernate.id column="`property_name`" generator-class="assigned"
88      * unsaved-value="null" length="252"
89      */

90     public String JavaDoc getName() {
91         return name;
92     }
93
94     /**
95      * Sets global property name
96      *
97      * @param name name to set
98      */

99     public void setName(String JavaDoc name) {
100         this.name = name;
101     }
102
103     /**
104      * Gets global property value
105      *
106      * @return value
107      * @hibernate.property column="`property_value`" not-null="false" unique="false" length="252"
108      */

109     public String JavaDoc getValue() {
110         return value;
111     }
112
113     /**
114      * Sets global property value
115      *
116      * @param value value to set
117      */

118     public void setValue(String JavaDoc value) {
119         this.value = value;
120     }
121
122     /**
123      * Returns version of this global property
124      *
125      * @return version
126      * @hibernate.version column="`version`" type="long" unsaved-value="null"
127      */

128     public Long JavaDoc getVersion() {
129         return version;
130     }
131
132     /**
133      * Sets version of this global property
134      *
135      * @param version version to set
136      */

137     public void setVersion(Long JavaDoc version) {
138         this.version = version;
139     }
140
141     public boolean equals(Object JavaDoc o) {
142         if ( this == o ) {
143             return true;
144         }
145         if ( !(o instanceof GlobalProperty) ) {
146             return false;
147         }
148
149         final GlobalProperty globalProperty = (GlobalProperty) o;
150
151         if ( name != null ? !name.equals(globalProperty.name) : globalProperty.name != null ) {
152             return false;
153         }
154
155         return true;
156     }
157
158     public int hashCode() {
159         return (name != null ? name.hashCode() : 0);
160     }
161
162 }
163
164
Popular Tags