KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > core > ContentNode


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.core;
14
15 import info.magnolia.cms.security.AccessDeniedException;
16 import info.magnolia.cms.security.AccessManager;
17 import info.magnolia.cms.security.Permission;
18
19 import javax.jcr.Node;
20 import javax.jcr.PathNotFoundException;
21 import javax.jcr.RepositoryException;
22
23
24 /**
25  * @author Sameer Charles
26  * @version $Revision $ ($Author $)
27  * @deprecated use info.magnolia.cms.core.Content instead this calss has been deprecated since magnolia 2.1 since jcr
28  * allows to define custom nodetypes there is no use for the wrapper classes over content. use
29  * info.magnolia.cms.core.Content to bind to any kind of NodeType
30  */

31 public class ContentNode extends Content {
32
33     /**
34      * JCR node which act as a base for this object
35      */

36     private Node workingNode;
37
38     /**
39      * this object name
40      */

41     private String JavaDoc name;
42
43     /**
44      * pointing to this object
45      */

46     private Content contentNode;
47
48     /**
49      * @param workingNode parent <code>Node</code>
50      * @param name of the content node to retrieve
51      * @param manager access manager for this object
52      * @throws PathNotFoundException if the workingNode does not exist
53      * @throws RepositoryException if failed to create new node
54      * @throws AccessDeniedException if not allowed to write under workingNode
55      */

56     public ContentNode(Node workingNode, String JavaDoc name, AccessManager manager)
57         throws PathNotFoundException,
58         RepositoryException,
59         AccessDeniedException {
60         this.workingNode = workingNode;
61         this.name = name;
62         this.contentNode = new Content(this.workingNode, this.name, manager);
63         this.node = this.contentNode.node;
64     }
65
66     /**
67      * constructor use to typecast node to ContentNode
68      * @param node current <code>Node</code>
69      * @param manager access manager for this object
70      * @throws RepositoryException if failed to retrieve this node
71      * @throws AccessDeniedException if not allowed to read this node
72      */

73     public ContentNode(Node node, AccessManager manager) throws RepositoryException, AccessDeniedException {
74         Access.isGranted(manager, Path.getAbsolutePath(node.getPath()), Permission.READ);
75         this.node = node;
76         this.setAccessManager(manager);
77     }
78
79     /**
80      * Package private constructor
81      * @param workingNode parent <code>Node</code>
82      * @param name to be assigned
83      * @param createNew creates a new container
84      * @throws PathNotFoundException if workingNode does not exist
85      * @throws RepositoryException
86      * @throws AccessDeniedException if not allowed to read this node or write under workingNode
87      */

88     public ContentNode(Node workingNode, String JavaDoc name, boolean createNew, AccessManager manager)
89         throws PathNotFoundException,
90         RepositoryException,
91         AccessDeniedException {
92         this.workingNode = workingNode;
93         this.name = name;
94         this.contentNode = new Content(this.workingNode, this.name, ItemType.CONTENTNODE.getSystemName(), manager);
95         this.node = this.contentNode.node;
96     }
97
98 }
99
Popular Tags