001: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
002: * This code is licensed under the GPL 2.0 license, availible at the root
003: * application directory.
004: */
005: package org.geoserver.wfs.xml.v1_1_0;
006:
007: import net.opengis.wfs.GetFeatureType;
008: import net.opengis.wfs.QueryType;
009: import net.opengis.wfs.ResultTypeType;
010: import net.opengis.wfs.WfsFactory;
011: import org.geotools.xml.AbstractComplexBinding;
012: import org.geotools.xml.ElementInstance;
013: import org.geotools.xml.Node;
014: import java.math.BigInteger;
015: import javax.xml.namespace.QName;
016:
017: /**
018: * Binding object for the type http://www.opengis.net/wfs:GetFeatureType.
019: *
020: * <p>
021: * <pre>
022: * <code>
023: * <xsd:complexType name="GetFeatureType">
024: * <xsd:annotation>
025: * <xsd:documentation>
026: * A GetFeature element contains one or more Query elements
027: * that describe a query operation on one feature type. In
028: * response to a GetFeature request, a Web Feature Service
029: * must be able to generate a GML3 response that validates
030: * using a schema generated by the DescribeFeatureType request.
031: * A Web Feature Service may support other possibly non-XML
032: * (and even binary) output formats as long as those formats
033: * are advertised in the capabilities document.
034: * </xsd:documentation>
035: * </xsd:annotation>
036: * <xsd:complexContent>
037: * <xsd:extension base="wfs:BaseRequestType">
038: * <xsd:sequence>
039: * <xsd:element maxOccurs="unbounded" ref="wfs:Query"/>
040: * </xsd:sequence>
041: * <xsd:attribute default="results" name="resultType"
042: * type="wfs:ResultTypeType" use="optional">
043: * <xsd:annotation>
044: * <xsd:documentation>
045: * The resultType attribute is used to indicate
046: * what response a WFS should return to user once
047: * a GetFeature request is processed.
048: * Possible values are:
049: * results - meaning that the full response set
050: * (i.e. all the feature instances)
051: * should be returned.
052: * hits - meaning that an empty response set
053: * should be returned (i.e. no feature
054: * instances should be returned) but
055: * the "numberOfFeatures" attribute
056: * should be set to the number of feature
057: * instances that would be returned.
058: * </xsd:documentation>
059: * </xsd:annotation>
060: * </xsd:attribute>
061: * <xsd:attribute default="text/xml; subtype=gml/3.1.1"
062: * name="outputFormat" type="xsd:string" use="optional">
063: * <xsd:annotation>
064: * <xsd:documentation>
065: * The outputFormat attribute is used to specify the output
066: * format that the Web Feature Service should generate in
067: * response to a GetFeature or GetFeatureWithLock element.
068: * The default value of 'text/xml; subtype=gml/3.1.1'
069: * indicates that the output is an XML document that
070: * conforms to the Geography Markup Language (GML)
071: * Implementation Specification V3.1.1.
072: * For the purposes of experimentation, vendor extension,
073: * or even extensions that serve a specific community of
074: * interest, other acceptable output format values may be
075: * used to specify other formats as long as those values
076: * are advertised in the capabilities document.
077: * For example, the value WKB may be used to indicate that a
078: * Well Known Binary format be used to encode the output.
079: * </xsd:documentation>
080: * </xsd:annotation>
081: * </xsd:attribute>
082: * <xsd:attribute name="maxFeatures" type="xsd:positiveInteger" use="optional">
083: * <xsd:annotation>
084: * <xsd:documentation>
085: * The maxFeatures attribute is used to specify the maximum
086: * number of features that a GetFeature operation should
087: * generate (regardless of the actual number of query hits).
088: * </xsd:documentation>
089: * </xsd:annotation>
090: * </xsd:attribute>
091: * <xsd:attribute name="traverseXlinkDepth" type="xsd:string" use="optional">
092: * <xsd:annotation>
093: * <xsd:documentation>
094: * This attribute indicates the depth to which nested property
095: * XLink linking element locator attribute (href) XLinks are
096: * traversed and resolved if possible. A value of "1"
097: * indicates that one linking element locator attribute
098: * (href) Xlink will be traversed and the referenced element
099: * returned if possible, but nested property XLink linking
100: * element locator attribute (href) XLinks in the returned
101: * element are not traversed. A value of "*" indicates that
102: * all nested property XLink linking element locator attribute
103: * (href) XLinks will be traversed and the referenced elements
104: * returned if possible. The range of valid values for this
105: * attribute consists of positive integers plus "*".
106: * If this attribute is not specified then no xlinks shall be
107: * resolved and the value of traverseXlinkExpiry attribute (if
108: * it specified) may be ignored.
109: * </xsd:documentation>
110: * </xsd:annotation>
111: * </xsd:attribute>
112: * <xsd:attribute name="traverseXlinkExpiry"
113: * type="xsd:positiveInteger" use="optional">
114: * <xsd:annotation>
115: * <xsd:documentation>
116: * The traverseXlinkExpiry attribute value is specified in
117: * minutes. It indicates how long a Web Feature Service
118: * should wait to receive a response to a nested GetGmlObject
119: * request.
120: * This attribute is only relevant if a value is specified
121: * for the traverseXlinkDepth attribute.
122: * </xsd:documentation>
123: * </xsd:annotation>
124: * </xsd:attribute>
125: * </xsd:extension>
126: * </xsd:complexContent>
127: * </xsd:complexType>
128: *
129: * </code>
130: * </pre>
131: * </p>
132: *
133: * @generated
134: */
135: public class GetFeatureTypeBinding extends AbstractComplexBinding {
136: WfsFactory wfsfactory;
137:
138: public GetFeatureTypeBinding(WfsFactory wfsfactory) {
139: this .wfsfactory = wfsfactory;
140: }
141:
142: /**
143: * @generated
144: */
145: public QName getTarget() {
146: return WFS.GETFEATURETYPE;
147: }
148:
149: /**
150: * Sets execution mode to be before
151: */
152: public int getExecutionMode() {
153: return BEFORE;
154: }
155:
156: /**
157: * <!-- begin-user-doc -->
158: * <!-- end-user-doc -->
159: *
160: * @generated modifiable
161: */
162: public Class getType() {
163: return GetFeatureType.class;
164: }
165:
166: /**
167: * <!-- begin-user-doc -->
168: * <!-- end-user-doc -->
169: *
170: * @generated modifiable
171: */
172: public Object parse(ElementInstance instance, Node node,
173: Object value) throws Exception {
174: GetFeatureType getFeature = wfsfactory.createGetFeatureType();
175:
176: //lt;xsd:element maxOccurs="unbounded" ref="wfs:Query"/>
177: getFeature.getQuery().addAll(
178: node.getChildValues(QueryType.class));
179:
180: //<xsd:attribute default="results" name="resultType"
181: // type="wfs:ResultTypeType" use="optional">
182: if (node.hasAttribute("resultType")) {
183: getFeature.setResultType((ResultTypeType) node
184: .getAttributeValue("resultType"));
185: }
186:
187: //<xsd:attribute default="text/xml; subtype=gml/3.1.1"
188: // name="outputFormat" type="xsd:string" use="optional">
189: if (node.hasAttribute("outputFormat")) {
190: getFeature.setOutputFormat((String) node
191: .getAttributeValue("outputFormat"));
192: }
193:
194: //<xsd:attribute name="maxFeatures" type="xsd:positiveInteger" use="optional">
195: if (node.hasAttribute("maxFeatures")) {
196: getFeature.setMaxFeatures((BigInteger) node
197: .getAttributeValue("maxFeatures"));
198: }
199:
200: //<xsd:attribute name="traverseXlinkDepth" type="xsd:string" use="optional">
201: if (node.hasAttribute("traverseXlinkDepth")) {
202: getFeature.setTraverseXlinkDepth((String) node
203: .getAttributeValue("traverseXlinkDepth"));
204: }
205:
206: //<xsd:attribute name="traverseXlinkExpiry"
207: // type="xsd:positiveInteger" use="optional">
208: if (node.hasAttribute("traverseXlinkExpiry")) {
209: getFeature.setTraverseXlinkExpiry((BigInteger) node
210: .getAttributeValue("traverseXlinkExpiry"));
211: }
212:
213: return getFeature;
214: }
215: }
|