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.video.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.video.Timecode; 028import service.tut.pori.contentanalysis.video.TimecodeList; 029import service.tut.pori.contentanalysis.video.Video; 030import service.tut.pori.contentanalysis.video.VideoList; 031import service.tut.pori.contentanalysis.video.VideoParameters; 032import service.tut.pori.contentanalysis.video.VideoTaskDetails; 033import service.tut.pori.contentanalysis.video.VideoTaskResponse; 034import core.tut.pori.http.ResponseData; 035 036/** 037 * Response example 038 * 039 */ 040@XmlRootElement(name=service.tut.pori.contentanalysis.video.reference.Definitions.ELEMENT_EXAMPLE) 041@XmlAccessorType(XmlAccessType.NONE) 042public class Example extends ResponseData { 043 @XmlElementRef 044 private VideoTaskDetails _taskDetails = null; 045 @XmlElementRef 046 private VideoTaskResponse _taskResponse = null; 047 @XmlElementRef 048 private Timecode _timecode = null; 049 @XmlElementRef 050 private TimecodeList _timecodeList = null; 051 @XmlElementRef 052 private Video _video = null; 053 @XmlElementRef 054 private VideoList _videoList = null; 055 @XmlElementRef 056 private VideoParameters _videoOptions = null; 057 058 /** 059 * @return the video 060 */ 061 public Video getVideo() { 062 return _video; 063 } 064 065 /** 066 * @param video the video to set 067 */ 068 public void setVideo(Video video) { 069 _video = video; 070 } 071 072 /** 073 * @return the videoList 074 */ 075 public VideoList getVideoList() { 076 return _videoList; 077 } 078 079 /** 080 * @param videoList the videoList to set 081 */ 082 public void setVideoList(VideoList videoList) { 083 _videoList = videoList; 084 } 085 086 /** 087 * @return the taskDetails 088 */ 089 public VideoTaskDetails getTaskDetails() { 090 return _taskDetails; 091 } 092 093 /** 094 * @param taskDetails the taskDetails to set 095 */ 096 public void setTaskDetails(VideoTaskDetails taskDetails) { 097 _taskDetails = taskDetails; 098 } 099 100 /** 101 * @return the timecode 102 */ 103 public Timecode getTimecode() { 104 return _timecode; 105 } 106 107 /** 108 * @param timecode the timecode to set 109 */ 110 public void setTimecode(Timecode timecode) { 111 _timecode = timecode; 112 } 113 114 /** 115 * @return the timecodeList 116 */ 117 public TimecodeList getTimecodeList() { 118 return _timecodeList; 119 } 120 121 /** 122 * @param timecodeList the timecodeList to set 123 */ 124 public void setTimecodeList(TimecodeList timecodeList) { 125 _timecodeList = timecodeList; 126 } 127 128 /** 129 * @return the videoOptions 130 */ 131 public VideoParameters getVideoOptions() { 132 return _videoOptions; 133 } 134 135 /** 136 * @param videoOptions the videoOptions to set 137 */ 138 public void setVideoOptions(VideoParameters videoOptions) { 139 _videoOptions = videoOptions; 140 } 141 142 /** 143 * @return the taskResponse 144 */ 145 public VideoTaskResponse getTaskResponse() { 146 return _taskResponse; 147 } 148 149 /** 150 * @param taskResponse the taskResponse to set 151 */ 152 public void setTaskResponse(VideoTaskResponse taskResponse) { 153 _taskResponse = taskResponse; 154 } 155 156 @Override 157 public Class<?>[] getDataClasses() { 158 List<Class<?>> classes = new ArrayList<>(); 159 classes.add(getClass()); 160 if(_video != null){ 161 classes.add(_video.getClass()); 162 } 163 if(_videoList != null){ 164 classes.add(_videoList.getClass()); 165 } 166 if(_taskDetails != null){ 167 classes.addAll(Arrays.asList(_taskDetails.getDataClasses())); 168 } 169 if(_timecode != null){ 170 classes.add(_timecode.getClass()); 171 } 172 if(_timecodeList != null){ 173 classes.add(_timecodeList.getClass()); 174 } 175 if(_videoOptions != null){ 176 classes.add(_videoOptions.getClass()); 177 } 178 if(_taskResponse != null){ 179 classes.addAll(Arrays.asList(_taskResponse.getDataClasses())); 180 } 181 return classes.toArray(new Class<?>[classes.size()]); 182 } 183}