KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > exchange > simple > SerializableContentNode


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.exchange.simple;
14
15 import info.magnolia.cms.core.Content;
16
17
18 /**
19  * @author Sameer Charles
20  * @version 2.0
21  */

22 public class SerializableContentNode extends SerializableContent {
23
24     /**
25      * Stable serialVersionUID.
26      */

27     private static final long serialVersionUID = 222L;
28
29     private SerializableMetaData metaData;
30
31     private boolean recurse;
32
33     public SerializableContentNode(Content baseContentNode) {
34         this.makeSerializable(baseContentNode);
35     }
36
37     public SerializableContentNode(Content baseContentNode, boolean recurse) {
38         this.recurse = recurse;
39         this.makeSerializable(baseContentNode);
40     }
41
42     private void makeSerializable(Content baseContentNode) {
43         this.setName(baseContentNode.getName());
44         this.metaData = new SerializableMetaData(baseContentNode.getMetaData());
45         /* add top level node list */
46         this.addNodeDataList(baseContentNode);
47         if (this.recurse) {
48             this.addContentNodeList(baseContentNode, true);
49         }
50     }
51
52     public SerializableMetaData getMetaData() {
53         return this.metaData;
54     }
55 }
56
Popular Tags