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.contentstorage.reference;
017
018import javax.xml.bind.annotation.XmlAccessType;
019import javax.xml.bind.annotation.XmlAccessorType;
020import javax.xml.bind.annotation.XmlElement;
021import javax.xml.bind.annotation.XmlRootElement;
022
023import org.apache.commons.lang3.ArrayUtils;
024
025import service.tut.pori.contentstorage.Definitions;
026import service.tut.pori.contentstorage.MediaList;
027import core.tut.pori.http.ResponseData;
028
029/**
030 * Response example
031 * 
032 */
033@XmlRootElement(name=service.tut.pori.contentstorage.reference.Definitions.ELEMENT_EXAMPLE)
034@XmlAccessorType(XmlAccessType.NONE)
035public class Example extends ResponseData {
036  @XmlElement(name = Definitions.ELEMENT_MEDIALIST)
037  private MediaList _media = null;
038
039  /**
040   * @return the media
041   */
042  public MediaList getMediaList() {
043    return _media;
044  }
045
046  /**
047   * @param media the media to set
048   */
049  public void setMediaList(MediaList media) {
050    _media = media;
051  }
052
053  @SuppressWarnings("unchecked")
054  @Override
055  public Class<?>[] getDataClasses() {
056    if(_media == null){
057      return super.getDataClasses();
058    }
059    return ArrayUtils.addAll(_media.getDataClasses(), getClass());
060  }
061}