001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/ogcwebservices/wfs/operation/LockFeatureResponse.java $
002    /*----------------------------------------------------------------------------
003     This file is part of deegree, http://deegree.org/
004     Copyright (C) 2001-2009 by:
005       Department of Geography, University of Bonn
006     and
007       lat/lon GmbH
008    
009     This library is free software; you can redistribute it and/or modify it under
010     the terms of the GNU Lesser General Public License as published by the Free
011     Software Foundation; either version 2.1 of the License, or (at your option)
012     any later version.
013     This library is distributed in the hope that it will be useful, but WITHOUT
014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016     details.
017     You should have received a copy of the GNU Lesser General Public License
018     along with this library; if not, write to the Free Software Foundation, Inc.,
019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020    
021     Contact information:
022    
023     lat/lon GmbH
024     Aennchenstr. 19, 53177 Bonn
025     Germany
026     http://lat-lon.de/
027    
028     Department of Geography, University of Bonn
029     Prof. Dr. Klaus Greve
030     Postfach 1147, 53001 Bonn
031     Germany
032     http://www.geographie.uni-bonn.de/deegree/
033    
034     e-mail: info@deegree.org
035    ----------------------------------------------------------------------------*/
036    package org.deegree.ogcwebservices.wfs.operation;
037    
038    import org.deegree.ogcwebservices.DefaultOGCWebServiceResponse;
039    
040    /**
041     * Represents the response to a {@link LockFeature} request.
042     *
043     * In response to a <LockFeature> request, the web feature server shall generate an XML
044     * document containing a lock identifier that a client application can reference when operating upon
045     * the <code>locked</code> features. The response can also contain optional blocks depending on
046     * the value of the <code>lockAction</code> attribute.
047     *
048     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
049     * @author <a href="mailto:schneider@lat-lon.de">Markus Schneider</a>
050     * @author last edited by: $Author: mschneider $
051     *
052     * @version $Revision: 18195 $
053     */
054    public class LockFeatureResponse extends DefaultOGCWebServiceResponse {
055    
056        private String[] featuresLocked;
057    
058        private String[] featuresNotLocked;
059    
060        private String lockId;
061    
062        /**
063         * Creates a new instance of <code>LockFeatureResponse</code>.
064         *
065         * @param request
066         *            <code>LockFeature</code> request for which the response is generated
067         * @param lockId
068         *            lock identifier (must not be null)
069         * @param featuresLocked
070         *            ids of succesfully locked features (may not be null, but empty)
071         * @param featuresNotLocked
072         *            ids of features that could not be locked sucessfully (may not be null, but empty)
073         */
074        public LockFeatureResponse( LockFeature request, String lockId, String[] featuresLocked,
075                                    String[] featuresNotLocked ) {
076            super( request );
077            assert lockId != null;
078            assert featuresLocked != null;
079            assert featuresNotLocked != null;
080            this.lockId = lockId;
081            this.featuresLocked = featuresLocked;
082            this.featuresNotLocked = featuresNotLocked;
083        }
084    
085        /**
086         * Returns the lock identifier.
087         *
088         * @return the lock identifier
089         */
090        public String getLockId() {
091            return this.lockId;
092        }
093    
094        /**
095         * Returns the feature identifiers of all features that have been locked successfully.
096         *
097         * @return the feature identifiers of all features that have been locked successfully, (array
098         *         may not be null, but empty)
099         */
100        public String[] getFeaturesLocked() {
101            return this.featuresLocked;
102        }
103    
104        /**
105         * Returns the feature identifiers of all features that were requested for locking, but which
106         * could not be locked.
107         *
108         * @return the feature identifiers of all features that were requested for locking, but which
109         *         could not be locked, (array may not be null, but empty)
110         */
111        public String[] getFeaturesNotLocked() {
112            return this.featuresNotLocked;
113        }
114    
115        @Override
116        public String toString() {
117            String ret = this.getClass().getName() + ":\n";
118            ret += ( "lockId: " + lockId + "\n" );
119            for ( int i = 0; i < featuresLocked.length; i++ ) {
120                ret += ( "featuresLocked: " + featuresLocked[i] + "\n" );
121            }
122            for ( int i = 0; i < featuresNotLocked.length; i++ ) {
123                ret += ( "featuresNotLocked: " + featuresNotLocked[i] + "\n" );
124            }
125            return ret;
126        }
127    }