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.LockType;
008: import net.opengis.wfs.WfsFactory;
009: import org.geotools.xml.AbstractComplexBinding;
010: import org.geotools.xml.ElementInstance;
011: import org.geotools.xml.Node;
012: import org.opengis.filter.Filter;
013: import javax.xml.namespace.QName;
014:
015: /**
016: * Binding object for the type http://www.opengis.net/wfs:LockType.
017: *
018: * <p>
019: * <pre>
020: * <code>
021: * <xsd:complexType name="LockType">
022: * <xsd:annotation>
023: * <xsd:documentation>
024: * This type defines the Lock element. The Lock element
025: * defines a locking operation on feature instances of
026: * a single type. An OGC Filter is used to constrain the
027: * scope of the operation. Features to be locked can be
028: * identified individually by using their feature identifier
029: * or they can be locked by satisfying the spatial and
030: * non-spatial constraints defined in the filter.
031: * </xsd:documentation>
032: * </xsd:annotation>
033: * <xsd:sequence>
034: * <xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter"/>
035: * </xsd:sequence>
036: * <xsd:attribute name="handle" type="xsd:string" use="optional">
037: * <xsd:annotation>
038: * <xsd:documentation>
039: * The handle attribute allows a client application
040: * to assign a client-generated request identifier
041: * to a Lock action. The handle is included to
042: * facilitate error reporting. If one of a set of
043: * Lock actions failed while processing a LockFeature
044: * request, a WFS may report the handle in an exception
045: * report to localize the error. If a handle is not
046: * present then a WFS may employ some other means of
047: * localizing the error (e.g. line number).
048: * </xsd:documentation>
049: * </xsd:annotation>
050: * </xsd:attribute>
051: * <xsd:attribute name="typeName" type="xsd:QName" use="required">
052: * <xsd:annotation>
053: * <xsd:documentation>
054: * The value of the typeName attribute is the name
055: * of the feature type to be updated. The name
056: * specified must be a valid type that belongs to
057: * the feature content as defined by the GML
058: * Application Schema.
059: * </xsd:documentation>
060: * </xsd:annotation>
061: * </xsd:attribute>
062: * </xsd:complexType>
063: *
064: * </code>
065: * </pre>
066: * </p>
067: *
068: * @generated
069: */
070: public class LockTypeBinding extends AbstractComplexBinding {
071: WfsFactory wfsfactory;
072:
073: public LockTypeBinding(WfsFactory wfsfactory) {
074: this .wfsfactory = wfsfactory;
075: }
076:
077: /**
078: * @generated
079: */
080: public QName getTarget() {
081: return WFS.LOCKTYPE;
082: }
083:
084: /**
085: * <!-- begin-user-doc -->
086: * <!-- end-user-doc -->
087: *
088: * @generated modifiable
089: */
090: public Class getType() {
091: return LockType.class;
092: }
093:
094: /**
095: * <!-- begin-user-doc -->
096: * <!-- end-user-doc -->
097: *
098: * @generated modifiable
099: */
100: public Object parse(ElementInstance instance, Node node,
101: Object value) throws Exception {
102: LockType lock = wfsfactory.createLockType();
103:
104: //<xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter"/>
105: if (node.hasChild(Filter.class)) {
106: lock.setFilter((Filter) node.getChildValue(Filter.class));
107: }
108:
109: //<xsd:attribute name="handle" type="xsd:string" use="optional">
110: if (node.hasAttribute("handle")) {
111: lock.setHandle((String) node.getAttributeValue("handle"));
112: }
113:
114: //<xsd:attribute name="typeName" type="xsd:QName" use="required">
115: lock.setTypeName((QName) node.getAttributeValue("typeName"));
116:
117: return lock;
118: }
119: }
|