KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > roller > pojos > RollerPropertyData


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * 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. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */

18 /*
19  * RollerConfigProperty.java
20  *
21  * Created on April 20, 2005, 2:58 PM
22  */

23
24 package org.apache.roller.pojos;
25
26
27 /**
28  * This POJO represents a single property of the roller system.
29  *
30  * @author Allen Gilliland
31  *
32  * @ejb:bean name="RollerPropertyData"
33  * @hibernate.class lazy="false" table="roller_properties"
34  * @hibernate.cache usage="read-write"
35  */

36 public class RollerPropertyData
37     extends org.apache.roller.pojos.PersistentObject
38     implements java.io.Serializable JavaDoc
39 {
40     
41     static final long serialVersionUID = 6913562779484028899L;
42     
43     
44     /**
45      * Holds value of property name.
46      */

47     private String JavaDoc name;
48
49     /**
50      * Holds value of property value.
51      */

52     private String JavaDoc value;
53
54     
55     public RollerPropertyData() {}
56     
57     
58     public RollerPropertyData(String JavaDoc name, String JavaDoc value) {
59         this.name = name;
60         this.value = value;
61     }
62     
63     
64     public void setData(PersistentObject object)
65     {
66         if (object instanceof RollerPropertyData)
67         {
68             RollerPropertyData prop = (RollerPropertyData) object;
69             this.name = prop.getName();
70             this.value = prop.getValue();
71         }
72     }
73     
74     
75     public String JavaDoc toString()
76     {
77         return (this.name + "=" + this.value);
78     }
79     
80
81     /**
82      * Getter for property name.
83      *
84      * @return Value of property name.
85      * @ejb:persistent-field
86      * @hibernate.id column="name" generator-class="assigned"
87      */

88     public String JavaDoc getName() {
89
90         return this.name;
91     }
92
93     /**
94      * Setter for property name.
95      *
96      * @param name New value of property name.
97      * @ejb:persistent-field
98      */

99     public void setName(String JavaDoc name) {
100
101         this.name = name;
102     }
103
104     /**
105      * Getter for property value.
106      *
107      * @return Value of property value.
108      * @ejb:persistent-field
109      * @hibernate.property column="value" non-null="false" unique="false"
110      */

111     public String JavaDoc getValue() {
112
113         return this.value;
114     }
115
116     /**
117      * Setter for property value.
118      *
119      * @param value New value of property value.
120      * @ejb:persistent-field
121      */

122     public void setValue(String JavaDoc value) {
123
124         this.value = value;
125     }
126     
127     
128     public String JavaDoc getId() {
129         // this is only here because it is required by PersistentObject
130
return null;
131     }
132     
133     
134     public void setId(String JavaDoc id) {
135         // do nothing ... only here because the PersistentObject class requires it
136
}
137 }
138
Popular Tags