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