    001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/ogcwebservices/csw/manager/TransactionResult.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
    037    package org.deegree.ogcwebservices.csw.manager;
    038
    039    import org.deegree.framework.xml.XMLParsingException;
    040    import org.deegree.ogcwebservices.DefaultOGCWebServiceResponse;
    041    import org.deegree.ogcwebservices.OGCWebServiceRequest;
    042    import org.w3c.dom.Element;
    043
    044    /**
    045     *
    046     *
    047     *
    048     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
    049     * @author last edited by: $Author: mschneider $
    050     *
    051     * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
    052     */
    053    public class TransactionResult extends DefaultOGCWebServiceResponse {
    054
    055        private int totalInserted = 0;
    056
    057        private int totalDeleted = 0;
    058
    059        private int totalUpdated = 0;
    060
    061        private InsertResults results = null;
    062
    063        /**
    064         *
    065         * @param transaction
    066         * @param root
    067         * @return the result
    068         * @throws XMLParsingException
    069         */
    070        public static final TransactionResult create( Transaction transaction, Element root )
    071                                throws XMLParsingException {
    072            TransactionResultDocument doc = new TransactionResultDocument();
    073            doc.setRootElement( root );
    074            return doc.parseTransactionResponse( transaction );
    075        }
    076
    077        /**
    078         *
    079         * @param transaction
    080         *            source Transaction request
    081         * @param totalInserted
    082         *            the amount of records that has been inserted
    083         * @param totalDeleted
    084         *            the amount of records that has been deleted
    085         * @param totalUpdated
    086         *            the amount of records that has been updated
    087         * @param results
    088         *            insert result description
    089         */
    090        public TransactionResult( OGCWebServiceRequest transaction, int totalInserted, int totalDeleted, int totalUpdated,
    091                                  InsertResults results ) {
    092            super( transaction );
    093            this.totalInserted = totalInserted;
    094            this.totalDeleted = totalDeleted;
    095            this.totalUpdated = totalUpdated;
    096            this.results = results;
    097        }
    098
    099        /**
    100         * returns insert result description
    101         *
    102         * @return insert result description
    103         */
    104        public InsertResults getResults() {
    105            return results;
    106        }
    107
    108        /**
    109         * returns the amount of records that has been deleted
    110         *
    111         * @return the amount of records that has been deleted
    112         */
    113        public int getTotalDeleted() {
    114            return totalDeleted;
    115        }
    116
    117        /**
    118         * returns the amount of records that has been inserted
    119         *
    120         * @return the amount of records that has been inserted
    121         */
    122        public int getTotalInserted() {
    123            return totalInserted;
    124        }
    125
    126        /**
    127         * returns the amount of records that has been updated
    128         *
    129         * @return the amount of records that has been updated
    130         */
    131        public int getTotalUpdated() {
    132            return totalUpdated;
    133        }
    134
    135    }