KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > beancoder > MgnlProperty


1 package info.magnolia.beancoder;
2
3 import info.magnolia.cms.core.NodeData;
4 import openwfe.org.jcr.*;
5
6 import javax.jcr.RepositoryException;
7
8 /**
9  * Magnolia wrapper for the property
10  */

11 public class MgnlProperty implements Property {
12
13     NodeData data;
14     Node parent;
15
16     public String JavaDoc getPath() throws JcrException {
17         return data.getHandle();
18     }
19
20     public Object JavaDoc getWrappedInstance() throws JcrException {
21         return data;
22     }
23
24     public MgnlProperty(Node parent,NodeData data) {
25         this.data = data;
26         this.parent = parent;
27     }
28
29     public Value getValue() throws JcrException {
30         return new MgnlValue(data.getValue());
31     }
32
33     public String JavaDoc getString() throws JcrException {
34         return data.getString();
35     }
36
37     public long getLong() throws JcrException {
38         return data.getLong();
39     }
40
41     public String JavaDoc getName() throws JcrException {
42         return data.getName();
43     }
44
45     public Item getParent() throws JcrException {
46         return parent;
47     }
48
49     public boolean isNode() throws JcrException {
50         return false;
51     }
52
53     public void save() throws JcrException {
54         try {
55             data.save();
56         } catch (RepositoryException e) {
57             throw new JcrException(e.getMessage());
58         }
59     }
60 }
61
Popular Tags