KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Created on Jan 13, 2004
20  */

21 package org.apache.roller.pojos;
22
23 import org.apache.roller.RollerException;
24 import java.util.List JavaDoc;
25
26 /**
27  * Abstract base class for hierarchical persistent objects. Provides generic
28  * implementations of save and remove that know how to handle parents, children,
29  * and descendents.
30  *
31  * @author David M Johnson
32  */

33 public abstract class HierarchicalPersistentObject extends PersistentObject
34 {
35     HierarchicalPersistentObject mNewParent = null;
36     
37     /** Create an association between object and ancestor. */
38     public abstract Assoc createAssoc(
39         HierarchicalPersistentObject object,
40         HierarchicalPersistentObject ancestor,
41         String JavaDoc relation ) throws RollerException;
42         
43     /** Name of association class which must implement Assoc. */
44     public abstract Class JavaDoc getAssocClass();
45     
46     /** Name of object propery in association class */
47     public abstract String JavaDoc getObjectPropertyName();
48     
49     /** Name of ancestor propery in association class */
50     public abstract String JavaDoc getAncestorPropertyName();
51     
52     /** Set new parent - invalidates getPath() until object is saved(). */
53     public abstract void setParent(HierarchicalPersistentObject parent);
54     
55     public abstract Assoc getParentAssoc() throws RollerException;
56
57     public abstract List JavaDoc getChildAssocs() throws RollerException;
58     
59     public abstract List JavaDoc getAllDescendentAssocs() throws RollerException;
60     
61     public abstract List JavaDoc getAncestorAssocs() throws RollerException;
62     
63     /** Returns true if this object is in use and should not be deleted */
64     public abstract boolean isInUse() throws RollerException;
65
66     /** Should be needed only be manager objects */
67     public HierarchicalPersistentObject getNewParent()
68     {
69         return mNewParent;
70     }
71        
72 }
73
Popular Tags