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