View Javadoc

1   /**
2    * This file Copyright (c) 2003-2010 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.cms.core;
35  
36  import java.io.Serializable;
37  
38  
39  /**
40   * @author Sameer Charles
41   * @version $Revision:2719 $ ($Author:scharles $)
42   */
43  public final class ItemType implements Serializable {
44  
45      /**
46       * Node type: base.
47       */
48      public static final String NT_BASE = "nt:base"; //$NON-NLS-1$
49  
50      /**
51       * Node type: unstructured.
52       */
53      public static final String NT_UNSTRUCTURED = "nt:unstructured"; //$NON-NLS-1$
54  
55      /**
56       * Node type: hierarchyNode.
57       */
58      public static final String NT_HIERARCHY = "nt:hierarchyNode"; //$NON-NLS-1$
59  
60      /**
61       * Node type: folder.
62       */
63      public static final String NT_FOLDER = "mgnl:folder"; //$NON-NLS-1$
64  
65      /**
66       * Node type: base.
67       */
68      public static final String NT_FILE = "nt:file"; //$NON-NLS-1$
69  
70      /**
71       * Node type: resource.
72       */
73      public static final String NT_RESOURCE = "mgnl:resource"; //$NON-NLS-1$
74  
75      /**
76       * Node type: metadata.
77       */
78      public static final String NT_METADATA = "mgnl:metaData"; //$NON-NLS-1$
79  
80      /**
81       * "wfe:workItem".
82       */
83      public static final ItemType WORKITEM = new ItemType("workItem");
84  
85      /**
86       * "wfe:expression".
87       */
88      public static final ItemType EXPRESSION = new ItemType("expression"); //$NON-NLS-1$
89  
90      /**
91       * Mixin: node has access control.
92       */
93      public static final String MIX_ACCESSCONTROLLABLE = "mix:accessControllable"; //$NON-NLS-1$
94  
95      /**
96       * Mixin: node can be referenced.
97       */
98      public static final String MIX_REFERENCEABLE = "mix:referenceable"; //$NON-NLS-1$
99  
100     /**
101      * Mixin: node can be versioned.
102      */
103     public static final String MIX_VERSIONABLE = "mix:versionable"; //$NON-NLS-1$
104 
105     public static final String MIX_LOCKABLE = "mix:lockable"; //$NON-NLS-1$
106 
107     /**
108      * Magnolia content.
109      * @deprecated use ItemType.CONTENT
110      */
111     public static final String NT_CONTENT = "mgnl:content"; //$NON-NLS-1$
112 
113     public static final String NT_FROZENNODE = "nt:frozenNode";
114 
115     public static final String JCR_FROZENNODE = "jcr:frozenNode";
116 
117     public static final String JCR_FROZEN_PRIMARY_TYPE = "jcr:frozenPrimaryType";
118 
119     public static final String JCR_PRIMARY_TYPE = "jcr:primaryType";
120 
121     public static final String JCR_DATA = "jcr:data";
122 
123     /**
124      * Magnolia content node.
125      * @deprecated use ItemType.CONTENTNODE
126      */
127     public static final String NT_CONTENTNODE = "mgnl:contentNode"; //$NON-NLS-1$
128 
129     public static final ItemType CONTENT = new ItemType("mgnl:content"); //$NON-NLS-1$
130 
131     public static final ItemType CONTENTNODE = new ItemType("mgnl:contentNode"); //$NON-NLS-1$
132 
133     public static final ItemType USER = new ItemType("mgnl:user"); //$NON-NLS-1$
134 
135     public static final ItemType ROLE = new ItemType("mgnl:role"); //$NON-NLS-1$
136 
137     public static final ItemType GROUP = new ItemType("mgnl:group"); //$NON-NLS-1$
138 
139     public static final ItemType SYSTEM = new ItemType("mgnl:reserve"); //$NON-NLS-1$
140 
141     public static final ItemType JCR_CONTENT = new ItemType("jcr:content"); //$NON-NLS-1$
142 
143     public static final ItemType FOLDER = new ItemType(NT_FOLDER); //$NON-NLS-1$
144 
145 
146     /**
147      * Stable serialVersionUID.
148      */
149     private static final long serialVersionUID = 222L;
150 
151     /**
152      * Node name.
153      */
154     private String systemName;
155 
156     /**
157      * Ctor.
158      * @param systemName jcr system name
159      */
160     public ItemType(String systemName) {
161         this.systemName = systemName;
162     }
163 
164     /**
165      * Getter for <code>name</code>.
166      * @return Returns the name.
167      */
168     public String getSystemName() {
169         return this.systemName;
170     }
171 
172     /**
173      * @see java.lang.Object#equals(Object)
174      */
175     public boolean equals(Object object) {
176         if (!(object instanceof ItemType)) {
177             return false;
178         }
179         ItemType rhs = (ItemType) object;
180         return this.systemName.equals(rhs.systemName);
181     }
182 
183     /**
184      * @see java.lang.Object#toString()
185      */
186     public String toString() {
187         return this.systemName;
188     }
189 
190     /**
191      * @see java.lang.Object#hashCode()
192      */
193     public int hashCode() {
194         return this.systemName.hashCode();
195     }
196 
197 }