001/** 002 * Copyright 2015 Tampere University of Technology, Pori Department 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package service.tut.pori.contentanalysis.reference; 017 018import java.util.ArrayList; 019import java.util.Arrays; 020import java.util.List; 021 022import javax.xml.bind.annotation.XmlAccessType; 023import javax.xml.bind.annotation.XmlAccessorType; 024import javax.xml.bind.annotation.XmlElementRef; 025import javax.xml.bind.annotation.XmlRootElement; 026 027import service.tut.pori.contentanalysis.AnalysisBackend; 028import service.tut.pori.contentanalysis.PhotoParameters; 029import service.tut.pori.contentanalysis.BackendStatus; 030import service.tut.pori.contentanalysis.BackendStatusList; 031import service.tut.pori.contentanalysis.MediaObject; 032import service.tut.pori.contentanalysis.MediaObjectList; 033import service.tut.pori.contentanalysis.Photo; 034import service.tut.pori.contentanalysis.PhotoFeedbackList; 035import service.tut.pori.contentanalysis.PhotoList; 036import service.tut.pori.contentanalysis.PhotoTaskDetails; 037import service.tut.pori.contentanalysis.PhotoTaskResponse; 038import service.tut.pori.contentanalysis.ResultInfo; 039import service.tut.pori.contentanalysis.VisualShape; 040import core.tut.pori.http.ResponseData; 041 042/** 043 * Response example 044 * 045 */ 046@XmlRootElement(name=service.tut.pori.contentanalysis.reference.Definitions.ELEMENT_EXAMPLE) 047@XmlAccessorType(XmlAccessType.NONE) 048public class Example extends ResponseData { 049 @XmlElementRef 050 private PhotoParameters _analysisParameters = null; 051 @XmlElementRef 052 private AnalysisBackend _analysisBackend = null; 053 @XmlElementRef 054 private BackendStatus _backendStatus = null; 055 @XmlElementRef 056 private BackendStatusList _backendStatusList = null; 057 @XmlElementRef 058 private PhotoFeedbackList _feedbackList = null; 059 @XmlElementRef 060 private Photo _photo = null; 061 @XmlElementRef 062 private PhotoList _photoList = null; 063 @XmlElementRef 064 private ResultInfo _resultInfo = null; 065 @XmlElementRef 066 private MediaObject _mediaObject = null; 067 @XmlElementRef 068 private MediaObjectList _mediaObjectList = null; 069 @XmlElementRef 070 private VisualShape _visualShape = null; 071 @XmlElementRef 072 private PhotoTaskResponse _taskResponse = null; 073 @XmlElementRef 074 private PhotoTaskDetails _taskDetails = null; 075 076 /** 077 * overridden to gather the real classes required for serialization 078 */ 079 @Override 080 public Class<?>[] getDataClasses() { 081 List<Class<?>> classes = new ArrayList<>(); 082 classes.add(getClass()); 083 if(_feedbackList != null){ 084 classes.add(_feedbackList.getClass()); 085 } 086 if(_photoList != null){ 087 classes.add(_photoList.getClass()); 088 } 089 if(_mediaObjectList != null){ 090 classes.add(_mediaObjectList.getClass()); 091 } 092 if(_taskResponse != null){ 093 classes.addAll(Arrays.asList(_taskResponse.getDataClasses())); 094 } 095 if(_taskDetails != null){ 096 classes.addAll(Arrays.asList(_taskDetails.getDataClasses())); 097 } 098 if(_backendStatusList != null){ 099 classes.add(_backendStatusList.getClass()); 100 } 101 if(_photo != null){ 102 classes.add(_photo.getClass()); 103 } 104 if(_resultInfo != null){ 105 classes.add(_resultInfo.getClass()); 106 } 107 if(_mediaObject != null){ 108 classes.add(_mediaObject.getClass()); 109 } 110 if(_visualShape != null){ 111 classes.add(_visualShape.getClass()); 112 } 113 if(_analysisBackend != null){ 114 classes.add(_analysisBackend.getClass()); 115 } 116 if(_analysisParameters != null){ 117 classes.add(_analysisParameters.getClass()); 118 } 119 return classes.toArray(new Class<?>[classes.size()]); 120 } 121 122 /** 123 * @return the analysisBackend 124 */ 125 public AnalysisBackend getAnalysisBackend() { 126 return _analysisBackend; 127 } 128 129 /** 130 * @param analysisBackend the analysisBackend to set 131 */ 132 public void setAnalysisBackend(AnalysisBackend analysisBackend) { 133 _analysisBackend = analysisBackend; 134 } 135 136 /** 137 * @return the feedbackList 138 */ 139 public PhotoFeedbackList getFeedbackList() { 140 return _feedbackList; 141 } 142 143 /** 144 * @param feedbackList the feedbackList to set 145 */ 146 public void setFeedbackList(PhotoFeedbackList feedbackList) { 147 _feedbackList = feedbackList; 148 } 149 150 /** 151 * @return the photoList 152 */ 153 public PhotoList getPhotoList() { 154 return _photoList; 155 } 156 157 /** 158 * @param photoList the photoList to set 159 */ 160 public void setPhotoList(PhotoList photoList) { 161 _photoList = photoList; 162 } 163 164 /** 165 * @return the mediaObjectList 166 */ 167 public MediaObjectList getMediaObjectList() { 168 return _mediaObjectList; 169 } 170 171 /** 172 * @param mediaObjectList the mediaObjectList to set 173 */ 174 public void setMediaObjectList(MediaObjectList mediaObjectList) { 175 _mediaObjectList = mediaObjectList; 176 } 177 178 /** 179 * @return the taskResponse 180 */ 181 public PhotoTaskResponse getTaskResponse() { 182 return _taskResponse; 183 } 184 185 /** 186 * @param taskResponse the taskResponse to set 187 */ 188 public void setTaskResponse(PhotoTaskResponse taskResponse) { 189 _taskResponse = taskResponse; 190 } 191 192 /** 193 * @return the photoTaskDetails 194 */ 195 public PhotoTaskDetails getTaskDetails() { 196 return _taskDetails; 197 } 198 199 /** 200 * @param taskDetails the photoTaskDetails to set 201 */ 202 public void setTaskDetails(PhotoTaskDetails taskDetails) { 203 _taskDetails = taskDetails; 204 } 205 206 /** 207 * @return the backendStatusList 208 */ 209 public BackendStatusList getBackendStatusList() { 210 return _backendStatusList; 211 } 212 213 /** 214 * @param backendStatusList the backendStatusList to set 215 */ 216 public void setBackendStatusList(BackendStatusList backendStatusList) { 217 _backendStatusList = backendStatusList; 218 } 219 220 /** 221 * @return the photo 222 */ 223 public Photo getPhoto() { 224 return _photo; 225 } 226 227 /** 228 * @param photo the photo to set 229 */ 230 public void setPhoto(Photo photo) { 231 _photo = photo; 232 } 233 234 /** 235 * @return the backendStatus 236 */ 237 public BackendStatus getBackendStatus() { 238 return _backendStatus; 239 } 240 241 /** 242 * @param backendStatus the backendStatus to set 243 */ 244 public void setBackendStatus(BackendStatus backendStatus) { 245 _backendStatus = backendStatus; 246 } 247 248 /** 249 * @return the resultInfo 250 */ 251 public ResultInfo getResultInfo() { 252 return _resultInfo; 253 } 254 255 /** 256 * @param resultInfo the resultInfo to set 257 */ 258 public void setResultInfo(ResultInfo resultInfo) { 259 _resultInfo = resultInfo; 260 } 261 262 /** 263 * @return the mediaObject 264 */ 265 public MediaObject getMediaObject() { 266 return _mediaObject; 267 } 268 269 /** 270 * @param mediaObject the mediaObject to set 271 */ 272 public void setMediaObject(MediaObject mediaObject) { 273 _mediaObject = mediaObject; 274 } 275 276 /** 277 * @return the visualShape 278 */ 279 public VisualShape getVisualShape() { 280 return _visualShape; 281 } 282 283 /** 284 * @param visualShape the visualShape to set 285 */ 286 public void setVisualShape(VisualShape visualShape) { 287 _visualShape = visualShape; 288 } 289 290 /** 291 * @return the analysisParameters 292 */ 293 public PhotoParameters getAnalysisParameters() { 294 return _analysisParameters; 295 } 296 297 /** 298 * @param analysisParameters the analysisParameters to set 299 */ 300 public void setAnalysisParameters(PhotoParameters analysisParameters) { 301 _analysisParameters = analysisParameters; 302 } 303}