01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-impl/api-impl/src/java/org/sakaiproject/metaobj/utils/xml/impl/CustomTypeSchemaNodeImpl.java $
03: * $Id: CustomTypeSchemaNodeImpl.java 14225 2006-09-05 17:39:44Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.metaobj.utils.xml.impl;
21:
22: import java.util.List;
23: import java.util.Map;
24:
25: import org.apache.commons.logging.Log;
26: import org.apache.commons.logging.LogFactory;
27: import org.jdom.Element;
28: import org.sakaiproject.metaobj.utils.xml.SchemaInvalidException;
29: import org.sakaiproject.metaobj.utils.xml.SchemaNode;
30:
31: public class CustomTypeSchemaNodeImpl extends RefSchemaNodeImpl {
32: protected final Log logger = LogFactory.getLog(getClass());
33: private String name = null;
34: private Map localGlobalElements;
35: private String refName;
36: private boolean isAttribute = false;
37:
38: public CustomTypeSchemaNodeImpl(Element schemaElement,
39: GlobalMaps globalMaps, String type, boolean isAttribute)
40: throws SchemaInvalidException {
41: // use the type to look up the real SchemaNode
42: super (type, schemaElement, globalMaps);
43: refName = type;
44: localGlobalElements = globalMaps.globalCustomTypes;
45: name = schemaElement.getAttributeValue("name");
46: this .isAttribute = isAttribute;
47: }
48:
49: public String getName() {
50: return name;
51: }
52:
53: protected SchemaNode getActualNode() {
54: return (SchemaNode) localGlobalElements.get(refName);
55: }
56:
57: public boolean isAttribute() {
58: return isAttribute;
59: }
60:
61: public List getEnumeration() {
62: return getActualNode().getEnumeration();
63: }
64: }
|