View Javadoc

1   /**
2    * This file Copyright (c) 2003-2011 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   * The Magnolia equivalent to {@link NodeType}.
41   * @author Sameer Charles
42   * @version $Revision:2719 $ ($Author:scharles $)
43   */
44  public final class ItemType implements Serializable {
45  
46      /**
47       * Node type: base.
48       */
49      public static final String NT_BASE = "nt:base"; //$NON-NLS-1$
50  
51      /**
52       * Node type: unstructured.
53       */
54      public static final String NT_UNSTRUCTURED = "nt:unstructured"; //$NON-NLS-1$
55  
56      /**
57       * Node type: hierarchyNode.
58       */
59      public static final String NT_HIERARCHY = "nt:hierarchyNode"; //$NON-NLS-1$
60  
61      /**
62       * Node type: folder.
63       */
64      public static final String NT_FOLDER = "mgnl:folder"; //$NON-NLS-1$
65  
66      /**
67       * Node type: base.
68       */
69      public static final String NT_FILE = "nt:file"; //$NON-NLS-1$
70  
71      /**
72       * Node type: resource.
73       */
74      public static final String NT_RESOURCE = "mgnl:resource"; //$NON-NLS-1$
75  
76      /**
77       * Node type: metadata.
78       */
79      public static final String NT_METADATA = "mgnl:metaData"; //$NON-NLS-1$
80  
81      /**
82       * "wfe:workItem".
83       */
84      public static final ItemType WORKITEM = new ItemType("workItem");
85  
86      /**
87       * "wfe:expression".
88       */
89      public static final ItemType EXPRESSION = new ItemType("expression"); //$NON-NLS-1$
90  
91      /**
92       * Mixin: node has access control.
93       */
94      public static final String MIX_ACCESSCONTROLLABLE = "mix:accessControllable"; //$NON-NLS-1$
95  
96      /**
97       * Mixin: node can be referenced.
98       */
99      public static final String MIX_REFERENCEABLE = "mix:referenceable"; //$NON-NLS-1$
100 
101     /**
102      * Mixin: node can be versioned.
103      */
104     public static final String MIX_VERSIONABLE = "mix:versionable"; //$NON-NLS-1$
105 
106     public static final String MIX_LOCKABLE = "mix:lockable"; //$NON-NLS-1$
107 
108     public static final String DELETED_NODE_MIXIN = "mgnl:deleted";
109 
110     /**
111      * Magnolia content.
112      * @deprecated use ItemType.CONTENT
113      */
114     @Deprecated
115     public static final String NT_CONTENT = "mgnl:content"; //$NON-NLS-1$
116 
117     public static final String MGNL_NODE_DATA = "mgnl:nodeData";
118 
119     public static final String NT_FROZENNODE = "nt:frozenNode";
120 
121     public static final String JCR_FROZENNODE = "jcr:frozenNode";
122 
123     public static final String JCR_FROZEN_PRIMARY_TYPE = "jcr:frozenPrimaryType";
124 
125     public static final String JCR_PRIMARY_TYPE = "jcr:primaryType";
126 
127     public static final String JCR_DATA = "jcr:data";
128 
129     /**
130      * Magnolia content node.
131      * @deprecated use ItemType.CONTENTNODE
132      */
133     @Deprecated
134     public static final String NT_CONTENTNODE = "mgnl:contentNode"; //$NON-NLS-1$
135 
136     public static final ItemType CONTENT = new ItemType("mgnl:content"); //$NON-NLS-1$
137 
138     public static final ItemType CONTENTNODE = new ItemType("mgnl:contentNode"); //$NON-NLS-1$
139 
140     public static final ItemType USER = new ItemType("mgnl:user"); //$NON-NLS-1$
141 
142     public static final ItemType ROLE = new ItemType("mgnl:role"); //$NON-NLS-1$
143 
144     public static final ItemType GROUP = new ItemType("mgnl:group"); //$NON-NLS-1$
145 
146     public static final ItemType SYSTEM = new ItemType("mgnl:reserve"); //$NON-NLS-1$
147 
148     public static final ItemType JCR_CONTENT = new ItemType("jcr:content"); //$NON-NLS-1$
149 
150     public static final ItemType FOLDER = new ItemType(NT_FOLDER); 
151 
152 
153     /**
154      * Stable serialVersionUID.
155      */
156     private static final long serialVersionUID = 222L;
157 
158     /**
159      * Node name.
160      */
161     private final String systemName;
162 
163     /**
164      * Ctor.
165      * @param systemName jcr system name
166      */
167     public ItemType(String systemName) {
168         this.systemName = systemName;
169     }
170 
171     /**
172      * Getter for <code>name</code>.
173      * @return Returns the name.
174      */
175     public String getSystemName() {
176         return this.systemName;
177     }
178 
179     /**
180      * @see java.lang.Object#equals(Object)
181      */
182     @Override
183     public boolean equals(Object object) {
184         if (!(object instanceof ItemType)) {
185             return false;
186         }
187         ItemType rhs = (ItemType) object;
188         return this.systemName.equals(rhs.systemName);
189     }
190 
191     /**
192      * @see java.lang.Object#toString()
193      */
194     @Override
195     public String toString() {
196         return this.systemName;
197     }
198 
199     /**
200      * @see java.lang.Object#hashCode()
201      */
202     @Override
203     public int hashCode() {
204         return this.systemName.hashCode();
205     }
206 
207 }