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.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 which
028: * 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:complexContent>
035: * <xsd:extension base="wfs:BaseRequestType">
036: * <xsd:sequence>
037: * <xsd:element maxOccurs="unbounded" name="Lock" type="wfs:LockType">
038: * <xsd:annotation>
039: * <xsd:documentation>
040: * The lock element is used to indicate which feature
041: * instances of particular type are to be locked.
042: * </xsd:documentation>
043: * </xsd:annotation>
044: * </xsd:element>
045: * </xsd:sequence>
046: * <xsd:attribute default="5" name="expiry"
047: * type="xsd:positiveInteger" use="optional">
048: * <xsd:annotation>
049: * <xsd:documentation>
050: * The expiry attribute is used to set the length
051: * of time (expressed in minutes) that features will
052: * remain locked as a result of a LockFeature
053: * request. After the expiry period elapses, the
054: * locked resources must be released. If the
055: * expiry attribute is not set, then the default
056: * value of 5 minutes will be enforced.
057: * </xsd:documentation>
058: * </xsd:annotation>
059: * </xsd:attribute>
060: * <xsd:attribute default="ALL" name="lockAction"
061: * type="wfs:AllSomeType" use="optional">
062: * <xsd:annotation>
063: * <xsd:documentation>
064: * The lockAction attribute is used to indicate what
065: * a Web Feature Service should do when it encounters
066: * a feature instance that has already been locked by
067: * another client application.
068: *
069: * Valid values are ALL or SOME.
070: *
071: * ALL means that the Web Feature Service must acquire
072: * locks on all the requested feature instances. If it
073: * cannot acquire those locks then the request should
074: * fail. In this instance, all locks acquired by the
075: * operation should be released.
076: *
077: * SOME means that the Web Feature Service should lock
078: * as many of the requested features as it can.
079: * </xsd:documentation>
080: * </xsd:annotation>
081: * </xsd:attribute>
082: * </xsd:extension>
083: * </xsd:complexContent>
084: * </xsd:complexType>
085: *
086: * </code>
087: * </pre>
088: * </p>
089: *
090: * @generated
091: */
092: public class LockFeatureTypeBinding extends AbstractComplexBinding {
093: WfsFactory wfsfactory;
094:
095: public LockFeatureTypeBinding(WfsFactory wfsfactory) {
096: this .wfsfactory = wfsfactory;
097: }
098:
099: /**
100: * @generated
101: */
102: public QName getTarget() {
103: return WFS.LOCKFEATURETYPE;
104: }
105:
106: public int getExecutionMode() {
107: return BEFORE;
108: }
109:
110: /**
111: * <!-- begin-user-doc -->
112: * <!-- end-user-doc -->
113: *
114: * @generated modifiable
115: */
116: public Class getType() {
117: return LockFeatureType.class;
118: }
119:
120: /**
121: * <!-- begin-user-doc -->
122: * <!-- end-user-doc -->
123: *
124: * @generated modifiable
125: */
126: public Object parse(ElementInstance instance, Node node,
127: Object value) throws Exception {
128: LockFeatureType lockFeature = wfsfactory
129: .createLockFeatureType();
130:
131: //<xsd:element maxOccurs="unbounded" name="Lock" type="wfs:LockType">
132: lockFeature.getLock().addAll(
133: node.getChildValues(LockType.class));
134:
135: //<xsd:attribute default="5" name="expiry" type="xsd:positiveInteger" use="optional">
136: if (node.hasAttribute("expiry")) {
137: lockFeature.setExpiry((BigInteger) node
138: .getAttributeValue("expiry"));
139: } else {
140: lockFeature.setExpiry(BigInteger.valueOf(5));
141: }
142:
143: //<xsd:attribute default="ALL" name="lockAction"
144: if (node.hasAttribute("lockAction")) {
145: lockFeature.setLockAction((AllSomeType) node
146: .getAttributeValue("lockAction"));
147: } else {
148: lockFeature.setLockAction(AllSomeType.ALL_LITERAL);
149: }
150:
151: return lockFeature;
152: }
153: }
|