001 //$HeadURL: $
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.wcts.operation;
038
039 import org.deegree.i18n.Messages;
040 import org.deegree.model.crs.CoordinateSystem;
041 import org.deegree.ogcwebservices.wcts.data.TransformableData;
042 import org.deegree.owscommon_1_1_0.Manifest;
043
044 /**
045 * <code>TransformResponse</code> wraps the requested inputdata (e.g. the metadata) and the transformed feature
046 * collections.
047 *
048 * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a>
049 *
050 * @author last edited by: $Author:$
051 *
052 * @version $Revision:$, $Date:$
053 *
054 */
055 public class TransformResponse {
056
057 private final boolean store;
058
059 private final Manifest inputData;
060
061 private final TransformableData<?> transformableData;
062
063 private final int dataPresentation;
064
065 private final CoordinateSystem sourceCRS;
066
067 private final CoordinateSystem targetCRS;
068
069 /**
070 * @param sourceCRS
071 * defining the source crs of the transformable data.
072 * @param targetCRS
073 * defining the target crs of the transformable data.
074 * @param dataPresentation
075 * a flag signaling the way the data was presented to the wcts. Valid values are {@link Transform#INLINE}
076 * and {@link Transform#MULTIPART}. If another value is given, {@link Transform#MULTIPART} is assumed.
077 * @param store
078 * true if the transformableData should be stored, false otherwise.
079 *
080 * @param inputData
081 * may be <code>null</code>. Meaning the request did not provide any inputdata or it was a kvp
082 * request.
083 * @param transformableData
084 * the transformed data.
085 * @throws IllegalArgumentException
086 * if the transformableData object is <code>null</code>.
087 */
088 public TransformResponse( CoordinateSystem sourceCRS, CoordinateSystem targetCRS, int dataPresentation,
089 boolean store, Manifest inputData, TransformableData<?> transformableData )
090 throws IllegalArgumentException {
091 this.sourceCRS = sourceCRS;
092 this.targetCRS = targetCRS;
093 if ( dataPresentation != Transform.INLINE && dataPresentation != Transform.MULTIPART ) {
094 dataPresentation = Transform.MULTIPART;
095 }
096 this.dataPresentation = dataPresentation;
097 this.store = store;
098 this.inputData = inputData;
099 if ( transformableData == null ) {
100 throw new IllegalArgumentException( Messages.getMessage( "WCTS_MISSING_ARGUMENT", transformableData ) );
101 }
102 this.transformableData = transformableData;
103 }
104
105 /**
106 * @return true if the data should be stored.
107 */
108 public final boolean shouldStore() {
109 return store;
110 }
111
112 /**
113 * @return the inputData, may be <code>null</code>
114 */
115 public final Manifest getInputData() {
116 return inputData;
117 }
118
119 /**
120 * @return the transformableData, will never be <code>null</code>
121 */
122 public final TransformableData<?> getTransformableData() {
123 return transformableData;
124 }
125
126 /**
127 * @return a flag signaling the way the data was presented to the wcts. Valid values are {@link Transform#INLINE}
128 * and {@link Transform#MULTIPART}.
129 */
130 public final int getDataPresentation() {
131 return dataPresentation;
132 }
133
134 /**
135 * @return the sourceCRS
136 */
137 public final CoordinateSystem getSourceCRS() {
138 return sourceCRS;
139 }
140
141 /**
142 * @return the targetCRS
143 */
144 public final CoordinateSystem getTargetCRS() {
145 return targetCRS;
146 }
147
148 }