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.AllSomeType;
008: import net.opengis.wfs.LockFeatureType;
009: import net.opengis.wfs.LockType;
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:LockFeatureType.
019: *
020: * <p>
021: * <pre>
022: * <code>
023: * <xsd:complexType name="LockFeatureType">
024: * <xsd:annotation>
025: * <xsd:documentation>
026: * This type defines the LockFeature operation. The LockFeature
027: * element contains one or more Lock elements that define
028: * which features of a particular type should be locked. A lock
029: * identifier (lockId) is returned to the client application which
030: * can be used by subsequent operations to reference the locked
031: * features.
032: * </xsd:documentation>
033: * </xsd:annotation>
034: * <xsd:sequence>
035: * <xsd:element maxOccurs="unbounded" name="Lock" type="wfs:LockType">
036: * <xsd:annotation>
037: * <xsd:documentation>
038: * The lock element is used to indicate which feature
039: * instances of particular type are to be locked.
040: * </xsd:documentation>
041: * </xsd:annotation>
042: * </xsd:element>
043: * </xsd:sequence>
044: * <xsd:attribute fixed="1.0.0" name="version" type="xsd:string" use="required"/>
045: * <xsd:attribute fixed="WFS" name="service" type="xsd:string" use="required"/>
046: * <xsd:attribute name="expiry" type="xsd:positiveInteger" use="optional"/>
047: * <xsd:attribute name="lockAction" type="wfs:AllSomeType" use="optional">
048: * <xsd:annotation>
049: * <xsd:documentation>
050: * The lockAction attribute is used to indicate what
051: * a Web Feature Service should do when it encounters
052: * a feature instance that has already been locked by
053: * another client application.
054: *
055: * Valid values are ALL or SOME.
056: *
057: * ALL means that the Web Feature Service must acquire
058: * locks on all the requested feature instances. If it
059: * cannot acquire those locks then the request should
060: * fail. In this instance, all locks acquired by the
061: * operation should be released.
062: *
063: * SOME means that the Web Feature Service should lock
064: * as many of the requested features as it can.
065: * </xsd:documentation>
066: * </xsd:annotation>
067: * </xsd:attribute>
068: * </xsd:complexType>
069: *
070: * </code>
071: * </pre>
072: * </p>
073: *
074: * @generated
075: */
076: public class LockFeatureTypeBinding extends AbstractComplexBinding {
077: WfsFactory wfsfactory;
078:
079: public LockFeatureTypeBinding(WfsFactory wfsfactory) {
080: this .wfsfactory = wfsfactory;
081: }
082:
083: /**
084: * @generated
085: */
086: public QName getTarget() {
087: return WFS.LOCKFEATURETYPE;
088: }
089:
090: /**
091: * <!-- begin-user-doc -->
092: * <!-- end-user-doc -->
093: *
094: * @generated modifiable
095: */
096: public Class getType() {
097: return LockFeatureType.class;
098: }
099:
100: /**
101: * <!-- begin-user-doc -->
102: * <!-- end-user-doc -->
103: *
104: * @generated modifiable
105: */
106: public Object parse(ElementInstance instance, Node node,
107: Object value) throws Exception {
108: LockFeatureType lockFeature = wfsfactory
109: .createLockFeatureType();
110:
111: //<xsd:element maxOccurs="unbounded" name="Lock" type="wfs:LockType">
112: lockFeature.getLock().addAll(
113: node.getChildValues(LockType.class));
114:
115: //<xsd:attribute fixed="1.0.0" name="version" type="xsd:string" use="required"/>
116: //<xsd:attribute fixed="WFS" name="service" type="xsd:string" use="required"/>
117: WFSBindingUtils.version(lockFeature, node);
118: WFSBindingUtils.service(lockFeature, node);
119:
120: //<xsd:attribute name="expiry" type="xsd:positiveInteger" use="optional"/>
121: if (node.hasAttribute("expiry")) {
122: lockFeature.setExpiry(BigInteger.valueOf(((Number) node
123: .getAttributeValue("expiry")).longValue()));
124: }
125:
126: //<xsd:attribute name="lockAction" type="wfs:AllSomeType" use="optional">
127: if (node.hasAttribute(AllSomeType.class)) {
128: lockFeature.setLockAction((AllSomeType) node
129: .getAttributeValue(AllSomeType.class));
130: }
131:
132: return lockFeature;
133: }
134: }
|