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.PropertyType;
008: import net.opengis.wfs.UpdateElementType;
009: import net.opengis.wfs.WfsFactory;
010: import org.geotools.xml.AbstractComplexEMFBinding;
011: import org.geotools.xml.ElementInstance;
012: import org.geotools.xml.Node;
013: import org.opengis.filter.Filter;
014: import java.net.URI;
015: import javax.xml.namespace.QName;
016:
017: /**
018: * Binding object for the type http://www.opengis.net/wfs:UpdateElementType.
019: *
020: * <p>
021: * <pre>
022: * <code>
023: * <xsd:complexType name="UpdateElementType">
024: * <xsd:sequence>
025: * <xsd:element maxOccurs="unbounded" ref="wfs:Property">
026: * <xsd:annotation>
027: * <xsd:documentation>
028: * Changing or updating a feature instance means that
029: * the current value of one or more properties of
030: * the feature are replaced with new values. The Update
031: * element contains one or more Property elements. A
032: * Property element contains the name or a feature property
033: * who's value is to be changed and the replacement value
034: * for that property.
035: * </xsd:documentation>
036: * </xsd:annotation>
037: * </xsd:element>
038: * <xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter">
039: * <xsd:annotation>
040: * <xsd:documentation>
041: * The Filter element is used to constrain the scope
042: * of the update operation to those features identified
043: * by the filter. Feature instances can be specified
044: * explicitly and individually using the identifier of
045: * each feature instance OR a set of features to be
046: * operated on can be identified by specifying spatial
047: * and non-spatial constraints in the filter.
048: * If no filter is specified then update operation
049: * applies to all feature instances.
050: * </xsd:documentation>
051: * </xsd:annotation>
052: * </xsd:element>
053: * </xsd:sequence>
054: * <xsd:attribute name="handle" type="xsd:string" use="optional">
055: * <xsd:annotation>
056: * <xsd:documentation>
057: * The handle attribute allows a client application
058: * to assign a client-generated request identifier
059: * to an Insert action. The handle is included to
060: * facilitate error reporting. If an Update action
061: * in a Transaction request fails, then a WFS may
062: * include the handle in an exception report to localize
063: * the error. If no handle is included of the offending
064: * Insert element then a WFS may employee other means of
065: * localizing the error (e.g. line number).
066: * </xsd:documentation>
067: * </xsd:annotation>
068: * </xsd:attribute>
069: * <xsd:attribute name="typeName" type="xsd:QName" use="required">
070: * <xsd:annotation>
071: * <xsd:documentation>
072: * The value of the typeName attribute is the name
073: * of the feature type to be updated. The name
074: * specified must be a valid type that belongs to
075: * the feature content as defined by the GML
076: * Application Schema.
077: * </xsd:documentation>
078: * </xsd:annotation>
079: * </xsd:attribute>
080: * <xsd:attribute default="x-application/gml:3" name="inputFormat"
081: * type="xsd:string" use="optional">
082: * <xsd:annotation>
083: * <xsd:documentation>
084: * This inputFormat attribute is used to indicate
085: * the format used to encode a feature instance in
086: * an Insert element. The default value of
087: * 'text/xml; subtype=gml/3.1.1' is used to indicate
088: * that feature encoding is GML3. Another example
089: * might be 'text/xml; subtype=gml/2.1.2' indicating
090: * that the feature us encoded in GML2. A WFS must
091: * declare in the capabilities document, using a
092: * Parameter element, which version of GML it supports.
093: * </xsd:documentation>
094: * </xsd:annotation>
095: * </xsd:attribute>
096: * <xsd:attribute name="srsName" type="xsd:anyURI" use="optional">
097: * <xsd:annotation>
098: * <xsd:documentation>
099: * DO WE NEED THIS HERE?
100: * </xsd:documentation>
101: * </xsd:annotation>
102: * </xsd:attribute>
103: * </xsd:complexType>
104: *
105: * </code>
106: * </pre>
107: * </p>
108: *
109: * @generated
110: */
111: public class UpdateElementTypeBinding extends AbstractComplexEMFBinding {
112: WfsFactory wfsfactory;
113:
114: public UpdateElementTypeBinding(WfsFactory wfsfactory) {
115: this .wfsfactory = wfsfactory;
116: }
117:
118: /**
119: * @generated
120: */
121: public QName getTarget() {
122: return WFS.UPDATEELEMENTTYPE;
123: }
124:
125: /**
126: * <!-- begin-user-doc -->
127: * <!-- end-user-doc -->
128: *
129: * @generated modifiable
130: */
131: public Class getType() {
132: return null;
133: }
134:
135: /**
136: * <!-- begin-user-doc -->
137: * <!-- end-user-doc -->
138: *
139: * @generated modifiable
140: */
141: public Object parse(ElementInstance instance, Node node,
142: Object value) throws Exception {
143: UpdateElementType updateElement = wfsfactory
144: .createUpdateElementType();
145:
146: //<xsd:element maxOccurs="unbounded" ref="wfs:Property">
147: updateElement.getProperty().addAll(
148: node.getChildValues(PropertyType.class));
149:
150: //<xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter">
151: updateElement.setFilter((Filter) node
152: .getChildValue(Filter.class));
153:
154: //<xsd:attribute name="handle" type="xsd:string" use="optional">
155: if (node.hasAttribute("handle")) {
156: updateElement.setHandle((String) node
157: .getAttributeValue("handle"));
158: }
159:
160: //<xsd:attribute name="typeName" type="xsd:QName" use="required">
161: updateElement.setTypeName((QName) node
162: .getAttributeValue("typeName"));
163:
164: //<xsd:attribute default="x-application/gml:3" name="inputFormat"
165: // type="xsd:string" use="optional">
166: if (node.hasAttribute("inputFormat")) {
167: updateElement.setInputFormat((String) node
168: .getAttributeValue("inputFormat"));
169: }
170:
171: //<xsd:attribute name="srsName" type="xsd:anyURI" use="optional">
172: if (node.hasAttribute("srsName")) {
173: updateElement.setSrsName((URI) node
174: .getAttributeValue("srsName"));
175: }
176:
177: return updateElement;
178: }
179:
180: public Object getProperty(Object arg0, QName arg1) throws Exception {
181: Object result = super .getProperty(arg0, arg1);
182:
183: //System.out.println("Being asked for " + arg1);
184: //System.out.println("Returning " + result);
185: return result;
186: }
187: }
|