KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.apache.roller.pojos;
19
20
21 /**
22  * @author David M Johnson
23  *
24  * @ejb:bean name="FolderAssoc"
25  * @hibernate.class lazy="false" table="folderassoc"
26  * @hibernate.cache usage="read-write"
27  */

28 public class FolderAssoc extends PersistentObject
29     implements Assoc
30 {
31     static final long serialVersionUID = 882325251670705915L;
32     public static final String JavaDoc PARENT = "PARENT";
33     public static final String JavaDoc GRANDPARENT = "GRANDPARENT";
34
35     private String JavaDoc id;
36     private FolderData folder;
37     private FolderData ancestor;
38     private java.lang.String JavaDoc relation;
39     
40     public FolderAssoc()
41     {
42     }
43
44     public FolderAssoc(
45         String JavaDoc id,
46         FolderData folder,
47         FolderData ancestor,
48         String JavaDoc relation)
49     {
50         this.id = id;
51         this.folder = folder;
52         this.ancestor = ancestor;
53         this.relation = relation;
54     }
55
56     public FolderAssoc(FolderAssoc otherData)
57     {
58         setData(otherData);
59     }
60
61     /**
62      * @ejb:persistent-field
63      * @hibernate.id column="id"
64      * generator-class="uuid.hex" unsaved-value="null"
65      */

66     public java.lang.String JavaDoc getId()
67     {
68         return this.id;
69     }
70     /** @ejb:persistent-field */
71     public void setId(java.lang.String JavaDoc id)
72     {
73         this.id = id;
74     }
75
76     /**
77         * Setter is needed in RollerImpl.storePersistentObject()
78      */

79     public void setData(org.apache.roller.pojos.PersistentObject otherData)
80     {
81         this.id = otherData.getId();
82         this.folder = ((FolderAssoc)otherData).getFolder();
83         this.ancestor = ((FolderAssoc)otherData).getAncestorFolder();
84         this.relation = ((FolderAssoc)otherData).getRelation();
85     }
86
87     /**
88      * @ejb:persistent-field
89      * @hibernate.many-to-one column="ancestorid" cascade="none"
90      */

91     public FolderData getAncestorFolder()
92     {
93         return ancestor;
94     }
95     
96     /** @ejb:persistent-field */
97     public void setAncestorFolder(FolderData data)
98     {
99         ancestor = data;
100     }
101
102     /**
103      * @ejb:persistent-field
104      * @hibernate.many-to-one column="folderid" cascade="none" not-null="true"
105      */

106     public FolderData getFolder()
107     {
108         return folder;
109     }
110
111     /** @ejb:persistent-field */
112     public void setFolder(FolderData data)
113     {
114         folder = data;
115     }
116
117     /**
118      * @ejb:persistent-field
119      * @hibernate.property column="relation" non-null="true" unique="false"
120      */

121     public java.lang.String JavaDoc getRelation()
122     {
123         return relation;
124     }
125
126     /** @ejb:persistent-field */
127     public void setRelation(java.lang.String JavaDoc string)
128     {
129         relation = string;
130     }
131
132     public HierarchicalPersistentObject getObject()
133     {
134         return getFolder();
135     }
136
137     public void setObject(HierarchicalPersistentObject hpo)
138     {
139         setFolder((FolderData)hpo);
140     }
141
142     public HierarchicalPersistentObject getAncestor()
143     {
144         return getAncestorFolder();
145     }
146
147     public void setAncestor(HierarchicalPersistentObject hpo)
148     {
149         setAncestorFolder((FolderData)hpo);
150     }
151
152 }
153
Popular Tags