1/**
2 * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
5 *
6 *     http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14package org.jivesoftware.smackx.pubsub;
15
16import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
17
18/**
19 * The types of forms supported by the pubsub specification.
20 *
21 * @author Robin Collier
22 */
23public enum FormNodeType
24{
25	/** Form for configuring an existing node */
26	CONFIGURE_OWNER,
27
28	/** Form for configuring a node during creation */
29	CONFIGURE,
30
31	/** Form for configuring subscription options */
32	OPTIONS,
33
34	/** Form which represents the default node configuration options */
35	DEFAULT;
36
37	public PubSubElementType getNodeElement()
38	{
39		return PubSubElementType.valueOf(toString());
40	}
41
42	public static FormNodeType valueOfFromElementName(String elem, String configNamespace)
43	{
44		if ("configure".equals(elem) && PubSubNamespace.OWNER.getXmlns().equals(configNamespace))
45		{
46			return CONFIGURE_OWNER;
47		}
48		return valueOf(elem.toUpperCase());
49	}
50}
51