Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libGPE / src / org / gvsig / xmlschema / som / impl / XSContentImpl.java @ 12311

History | View | Annotate | Download (3.51 KB)

1
package org.gvsig.xmlschema.som.impl;
2

    
3
import org.gvsig.xmlschema.som.IXSContentType;
4
import org.gvsig.xmlschema.som.IXSExtension;
5
import org.gvsig.xmlschema.som.IXSNode;
6
import org.gvsig.xmlschema.som.IXSRestriction;
7
import org.gvsig.xmlschema.som.IXSSchema;
8
import org.gvsig.xmlschema.utils.SchemaCollection;
9
import org.gvsig.xmlschema.utils.SchemaObjectsMapping;
10
import org.gvsig.xmlschema.utils.SchemaTags;
11

    
12
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
13
 *
14
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
15
 *
16
 * This program is free software; you can redistribute it and/or
17
 * modify it under the terms of the GNU General Public License
18
 * as published by the Free Software Foundation; either version 2
19
 * of the License, or (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
29
 *
30
 * For more information, contact:
31
 *
32
 *  Generalitat Valenciana
33
 *   Conselleria d'Infraestructures i Transport
34
 *   Av. Blasco Ib??ez, 50
35
 *   46010 VALENCIA
36
 *   SPAIN
37
 *
38
 *      +34 963862235
39
 *   gvsig@gva.es
40
 *      www.gvsig.gva.es
41
 *
42
 *    or
43
 *
44
 *   IVER T.I. S.A
45
 *   Salamanca 50
46
 *   46005 Valencia
47
 *   Spain
48
 *
49
 *   +34 963163400
50
 *   dac@iver.es
51
 */
52
/* CVS MESSAGES:
53
 *
54
 * $Id: XSContentImpl.java 12311 2007-06-22 12:22:53Z jorpiell $
55
 * $Log$
56
 * Revision 1.2  2007-06-22 12:20:48  jorpiell
57
 * The typeNotFoundException has been deleted. It never was thrown
58
 *
59
 * Revision 1.1  2007/06/14 16:15:03  jorpiell
60
 * builds to create the jars generated and add the schema code to the libGPEProject
61
 *
62
 * Revision 1.1  2007/06/14 13:50:07  jorpiell
63
 * The schema jar name has been changed
64
 *
65
 * Revision 1.2  2007/06/08 06:55:05  jorpiell
66
 * Fixed some bugs
67
 *
68
 * Revision 1.1  2007/06/07 14:54:13  jorpiell
69
 * Add the schema support
70
 *
71
 *
72
 */
73
/**
74
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
75
 */
76
public class XSContentImpl extends XSComponentImpl implements IXSContentType {
77

    
78
        public XSContentImpl(IXSSchema schema) {
79
                super(schema);                
80
        }
81

    
82
        /*
83
         * (non-Javadoc)
84
         * @see org.gvsig.gpe.schema.som.IXSComplexContent#getExtension()
85
         */
86
        public IXSExtension getExtension(){
87
                IXSNode node = new SchemaCollection(getSchema(),getElement(),getExtensionMapping()).getFirstNode();
88
                if (node != null){
89
                        return (IXSExtension)node;
90
                }
91
                return null;
92
        }
93
        
94
        /**
95
         * @return The extension mapping
96
         * @throws TypeNotFoundException
97
         */
98
        private SchemaObjectsMapping getExtensionMapping(){
99
                SchemaObjectsMapping elementTm = new SchemaObjectsMapping(getSchema());
100
                elementTm.addType(SchemaTags.EXTENSION, XSExtensionImpl.class);
101
                return elementTm;
102
        }
103

    
104
        /*
105
         * (non-Javadoc)
106
         * @see org.gvsig.gpe.schema.som.IXSContentType#getRestriction()
107
         */
108
        public IXSRestriction getRestriction(){
109
                IXSNode node = new SchemaCollection(getSchema(),getElement(),getRestrictionMapping()).getFirstNode();
110
                if (node != null){
111
                        return (IXSRestriction)node;
112
                }
113
                return null;
114
        }
115
        
116
        /**
117
         * @return The restriction mapping
118
         * @throws TypeNotFoundException
119
         */
120
        private SchemaObjectsMapping getRestrictionMapping(){
121
                SchemaObjectsMapping elementTm = new SchemaObjectsMapping(getSchema());
122
                elementTm.addType(SchemaTags.RESTRICTION, XSRestrictionImpl.class);
123
                return elementTm;
124
        }
125
        
126
}