/* (c) 2014 Open Source Geospatial Foundation - all rights reserved * (c) 2001 - 2013 OpenPlans * This code is licensed under the GPL 2.0 license, available at the root * application directory. */ package org.geoserver.wfs.xml.v1_0_0; import java.math.BigInteger; import javax.xml.namespace.QName; import net.opengis.wfs.AllSomeType; import net.opengis.wfs.LockFeatureType; import net.opengis.wfs.LockType; import net.opengis.wfs.WfsFactory; import org.geotools.xml.AbstractComplexBinding; import org.geotools.xml.ElementInstance; import org.geotools.xml.Node; /** * Binding object for the type http://www.opengis.net/wfs:LockFeatureType. * * <p> * <pre> * <code> * <xsd:complexType name="LockFeatureType"> * <xsd:annotation> * <xsd:documentation> * This type defines the LockFeature operation. The LockFeature * element contains one or more Lock elements that define * which features of a particular type should be locked. A lock * identifier (lockId) is returned to the client application which * can be used by subsequent operations to reference the locked * features. * </xsd:documentation> * </xsd:annotation> * <xsd:sequence> * <xsd:element maxOccurs="unbounded" name="Lock" type="wfs:LockType"> * <xsd:annotation> * <xsd:documentation> * The lock element is used to indicate which feature * instances of particular type are to be locked. * </xsd:documentation> * </xsd:annotation> * </xsd:element> * </xsd:sequence> * <xsd:attribute fixed="1.0.0" name="version" type="xsd:string" use="required"/> * <xsd:attribute fixed="WFS" name="service" type="xsd:string" use="required"/> * <xsd:attribute name="expiry" type="xsd:positiveInteger" use="optional"/> * <xsd:attribute name="lockAction" type="wfs:AllSomeType" use="optional"> * <xsd:annotation> * <xsd:documentation> * The lockAction attribute is used to indicate what * a Web Feature Service should do when it encounters * a feature instance that has already been locked by * another client application. * * Valid values are ALL or SOME. * * ALL means that the Web Feature Service must acquire * locks on all the requested feature instances. If it * cannot acquire those locks then the request should * fail. In this instance, all locks acquired by the * operation should be released. * * SOME means that the Web Feature Service should lock * as many of the requested features as it can. * </xsd:documentation> * </xsd:annotation> * </xsd:attribute> * </xsd:complexType> * * </code> * </pre> * @generated */ public class LockFeatureTypeBinding extends AbstractComplexBinding { WfsFactory wfsfactory; public LockFeatureTypeBinding(WfsFactory wfsfactory) { this.wfsfactory = wfsfactory; } /** * @generated */ public QName getTarget() { return WFS.LOCKFEATURETYPE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Class getType() { return LockFeatureType.class; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { LockFeatureType lockFeature = wfsfactory.createLockFeatureType(); //<xsd:element maxOccurs="unbounded" name="Lock" type="wfs:LockType"> lockFeature.getLock().addAll(node.getChildValues(LockType.class)); //<xsd:attribute fixed="1.0.0" name="version" type="xsd:string" use="required"/> //<xsd:attribute fixed="WFS" name="service" type="xsd:string" use="required"/> WFSBindingUtils.version(lockFeature, node); WFSBindingUtils.service(lockFeature, node); //<xsd:attribute name="expiry" type="xsd:positiveInteger" use="optional"/> if (node.hasAttribute("expiry")) { lockFeature.setExpiry(BigInteger.valueOf( ((Number) node.getAttributeValue("expiry")).longValue())); } //<xsd:attribute name="lockAction" type="wfs:AllSomeType" use="optional"> if (node.hasAttribute(AllSomeType.class)) { lockFeature.setLockAction((AllSomeType) node.getAttributeValue(AllSomeType.class)); } return lockFeature; } }