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_0_0;
006:
007: import net.opengis.wfs.GetFeatureWithLockType;
008: import net.opengis.wfs.QueryType;
009: import net.opengis.wfs.WfsFactory;
010: import org.geotools.xml.AbstractComplexBinding;
011: import org.geotools.xml.ElementInstance;
012: import org.geotools.xml.Node;
013: import java.math.BigInteger;
014: import javax.xml.namespace.QName;
015:
016: /**
017: * Binding object for the type http://www.opengis.net/wfs:GetFeatureWithLockType.
018: *
019: * <p>
020: * <pre>
021: * <code>
022: * <xsd:complexType name="GetFeatureWithLockType">
023: * <xsd:annotation>
024: * <xsd:documentation>
025: * A GetFeatureWithLock request operates identically to a
026: * GetFeature request expect that it attempts to lock the
027: * feature instances in the result set and includes a lock
028: * identifier in its response to a client. A lock identifier
029: * is an identifier generated by a Web Feature Service that
030: * a client application can use, in subsequent operations,
031: * to reference the locked set of feature instances.
032: * </xsd:documentation>
033: * </xsd:annotation>
034: * <xsd:sequence>
035: * <xsd:element maxOccurs="unbounded" ref="wfs:Query"/>
036: * </xsd:sequence>
037: * <xsd:attribute fixed="1.0.0" name="version" type="xsd:string" use="required"/>
038: * <xsd:attribute fixed="WFS" name="service" type="xsd:string" use="required"/>
039: * <xsd:attribute name="handle" type="xsd:string" use="optional"/>
040: * <xsd:attribute name="expiry" type="xsd:positiveInteger" use="optional"/>
041: * <xsd:attribute default="GML2" name="outputFormat" type="xsd:string" use="optional"/>
042: * <xsd:attribute name="maxFeatures" type="xsd:positiveInteger" use="optional"/>
043: * </xsd:complexType>
044: *
045: * </code>
046: * </pre>
047: * </p>
048: *
049: * @generated
050: */
051: public class GetFeatureWithLockTypeBinding extends
052: AbstractComplexBinding {
053: WfsFactory wfsfactory;
054:
055: public GetFeatureWithLockTypeBinding(WfsFactory wfsfactory) {
056: this .wfsfactory = wfsfactory;
057: }
058:
059: /**
060: * @generated
061: */
062: public QName getTarget() {
063: return WFS.GETFEATUREWITHLOCKTYPE;
064: }
065:
066: /**
067: * <!-- begin-user-doc -->
068: * <!-- end-user-doc -->
069: *
070: * @generated modifiable
071: */
072: public Class getType() {
073: return GetFeatureWithLockType.class;
074: }
075:
076: /**
077: * <!-- begin-user-doc -->
078: * <!-- end-user-doc -->
079: *
080: * @generated modifiable
081: */
082: public Object parse(ElementInstance instance, Node node,
083: Object value) throws Exception {
084: GetFeatureWithLockType getFeatureWithLock = wfsfactory
085: .createGetFeatureWithLockType();
086:
087: WFSBindingUtils.service(getFeatureWithLock, node);
088: WFSBindingUtils.version(getFeatureWithLock, node);
089: WFSBindingUtils.outputFormat(getFeatureWithLock, node, "GML2");
090:
091: if (node.getAttributeValue("handle") != null) {
092: getFeatureWithLock.setHandle((String) node
093: .getAttributeValue("handle"));
094: }
095:
096: //get the max features
097: BigInteger maxFeatures = WFSBindingUtils
098: .asBigInteger((Number) node
099: .getAttributeValue("maxFeatures"));
100:
101: if (maxFeatures != null) {
102: getFeatureWithLock.setMaxFeatures(maxFeatures);
103: }
104:
105: //get the lock expiry
106: BigInteger expiry = WFSBindingUtils.asBigInteger((Number) node
107: .getAttributeValue("expiry"));
108:
109: if (expiry != null) {
110: getFeatureWithLock.setExpiry(expiry);
111: }
112:
113: //queries
114: getFeatureWithLock.getQuery().addAll(
115: node.getChildValues(QueryType.class));
116:
117: return getFeatureWithLock;
118: }
119: }
|