Statistics
| Revision:

root / trunk / libraries / libGPE / src / org / gvsig / xmlschema / som / impl / XSContentImpl.java @ 12175

History | View | Annotate | Download (3.57 KB)

1 12175 jorpiell
package org.gvsig.xmlschema.som.impl;
2
3
import org.gvsig.xmlschema.exceptions.TypeNotFoundException;
4
import org.gvsig.xmlschema.som.IXSContentType;
5
import org.gvsig.xmlschema.som.IXSExtension;
6
import org.gvsig.xmlschema.som.IXSNode;
7
import org.gvsig.xmlschema.som.IXSRestriction;
8
import org.gvsig.xmlschema.som.IXSSchema;
9
import org.gvsig.xmlschema.utils.SchemaCollection;
10
import org.gvsig.xmlschema.utils.SchemaObjectsMapping;
11
import org.gvsig.xmlschema.utils.SchemaTags;
12
13
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
14
 *
15
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
16
 *
17
 * This program is free software; you can redistribute it and/or
18
 * modify it under the terms of the GNU General Public License
19
 * as published by the Free Software Foundation; either version 2
20
 * of the License, or (at your option) any later version.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
30
 *
31
 * For more information, contact:
32
 *
33
 *  Generalitat Valenciana
34
 *   Conselleria d'Infraestructures i Transport
35
 *   Av. Blasco Ib??ez, 50
36
 *   46010 VALENCIA
37
 *   SPAIN
38
 *
39
 *      +34 963862235
40
 *   gvsig@gva.es
41
 *      www.gvsig.gva.es
42
 *
43
 *    or
44
 *
45
 *   IVER T.I. S.A
46
 *   Salamanca 50
47
 *   46005 Valencia
48
 *   Spain
49
 *
50
 *   +34 963163400
51
 *   dac@iver.es
52
 */
53
/* CVS MESSAGES:
54
 *
55
 * $Id$
56
 * $Log$
57
 * Revision 1.1  2007-06-14 16:15:03  jorpiell
58
 * builds to create the jars generated and add the schema code to the libGPEProject
59
 *
60
 * Revision 1.1  2007/06/14 13:50:07  jorpiell
61
 * The schema jar name has been changed
62
 *
63
 * Revision 1.2  2007/06/08 06:55:05  jorpiell
64
 * Fixed some bugs
65
 *
66
 * Revision 1.1  2007/06/07 14:54:13  jorpiell
67
 * Add the schema support
68
 *
69
 *
70
 */
71
/**
72
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
73
 */
74
public class XSContentImpl extends XSComponentImpl implements IXSContentType {
75
76
        public XSContentImpl(IXSSchema schema) {
77
                super(schema);
78
        }
79
80
        /*
81
         * (non-Javadoc)
82
         * @see org.gvsig.gpe.schema.som.IXSComplexContent#getExtension()
83
         */
84
        public IXSExtension getExtension() throws TypeNotFoundException {
85
                IXSNode node = new SchemaCollection(getSchema(),getElement(),getExtensionMapping()).getFirstNode();
86
                if (node != null){
87
                        return (IXSExtension)node;
88
                }
89
                return null;
90
        }
91
92
        /**
93
         * @return The extension mapping
94
         * @throws TypeNotFoundException
95
         */
96
        private SchemaObjectsMapping getExtensionMapping() throws TypeNotFoundException{
97
                SchemaObjectsMapping elementTm = new SchemaObjectsMapping(getSchema());
98
                elementTm.addType(SchemaTags.EXTENSION, XSExtensionImpl.class);
99
                return elementTm;
100
        }
101
102
        /*
103
         * (non-Javadoc)
104
         * @see org.gvsig.gpe.schema.som.IXSContentType#getRestriction()
105
         */
106
        public IXSRestriction getRestriction() throws TypeNotFoundException {
107
                IXSNode node = new SchemaCollection(getSchema(),getElement(),getRestrictionMapping()).getFirstNode();
108
                if (node != null){
109
                        return (IXSRestriction)node;
110
                }
111
                return null;
112
        }
113
114
        /**
115
         * @return The restriction mapping
116
         * @throws TypeNotFoundException
117
         */
118
        private SchemaObjectsMapping getRestrictionMapping() throws TypeNotFoundException{
119
                SchemaObjectsMapping elementTm = new SchemaObjectsMapping(getSchema());
120
                elementTm.addType(SchemaTags.RESTRICTION, XSRestrictionImpl.class);
121
                return elementTm;
122
        }
123
124
}