001/**
002 * Copyright 2014 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.facebookjazz;
017
018import java.util.ArrayList;
019import java.util.List;
020
021import javax.xml.bind.annotation.XmlAccessType;
022import javax.xml.bind.annotation.XmlAccessorType;
023import javax.xml.bind.annotation.XmlElement;
024import javax.xml.bind.annotation.XmlElementWrapper;
025import javax.xml.bind.annotation.XmlRootElement;
026
027import core.tut.pori.http.ResponseData;
028
029/**
030 * a class containing a profile of a single facebook user
031 * 
032 * <h2>Optional Elements</h2>
033 * <ul>
034 *  <li>{@value service.tut.pori.facebookjazz.Definitions#ELEMENT_EVENT_LIST}</li>
035 *  <li>{@value service.tut.pori.facebookjazz.Definitions#ELEMENT_GROUP_LIST}</li>
036 *  <li>{@value service.tut.pori.facebookjazz.Definitions#ELEMENT_LIKE_LIST}</li>
037 *  <li>{@value service.tut.pori.facebookjazz.Definitions#ELEMENT_PHOTO_DESCRIPTION_LIST}</li>
038 *  <li>{@value service.tut.pori.facebookjazz.Definitions#ELEMENT_STATUS_MESSAGE_LIST}</li>
039 *  <li>{@value service.tut.pori.facebookjazz.Definitions#ELEMENT_VIDEO_DESCRIPTION_LIST}</li>
040 * </ul>
041 * 
042 * <h3>XML Example</h3>
043 * 
044 * {@doc.restlet service="[service.tut.pori.facebookjazz.reference.Definitions#SERVICE_FBJ_REFERENCE_EXAMPLE]" method="[service.tut.pori.facebookjazz.Definitions#ELEMENT_FACEBOOK_PROFILE]" type="GET" query="" body_uri=""}
045 *
046 * @see service.tut.pori.facebookjazz.FacebookEvent
047 * @see service.tut.pori.facebookjazz.FacebookGroup
048 * @see service.tut.pori.facebookjazz.FacebookLike
049 * @see service.tut.pori.facebookjazz.FacebookPhotoDescription
050 * @see service.tut.pori.facebookjazz.FacebookStatusMessage
051 * @see service.tut.pori.facebookjazz.FacebookUserDetails
052 * @see service.tut.pori.facebookjazz.FacebookVideoDescription
053 */
054@XmlRootElement(name=Definitions.ELEMENT_FACEBOOK_PROFILE)
055@XmlAccessorType(XmlAccessType.NONE)
056public class FacebookProfile extends ResponseData{
057  @XmlElementWrapper(name = Definitions.ELEMENT_EVENT_LIST)
058  @XmlElement(name = Definitions.ELEMENT_EVENT)
059  private List<FacebookEvent> _events = null;
060  @XmlElementWrapper(name = Definitions.ELEMENT_GROUP_LIST)
061  @XmlElement(name = Definitions.ELEMENT_GROUP)
062  private List<FacebookGroup> _groups = null;
063  @XmlElementWrapper(name = Definitions.ELEMENT_LIKE_LIST)
064  @XmlElement(name = Definitions.ELEMENT_LIKE)
065  private List<FacebookLike> _likes = null;
066  @XmlElementWrapper(name = Definitions.ELEMENT_PHOTO_DESCRIPTION_LIST)
067  @XmlElement(name = Definitions.ELEMENT_PHOTO_DESCRIPTION)
068  private List<FacebookPhotoDescription> _photoDescriptions = null;
069  @XmlElementWrapper(name = Definitions.ELEMENT_STATUS_MESSAGE_LIST)
070  @XmlElement(name = Definitions.ELEMENT_STATUS_MESSAGE)
071  private List<FacebookStatusMessage> _statusMessages = null;
072  @XmlElement(name = Definitions.ELEMENT_USER_DETAILS)
073  private FacebookUserDetails _user = null;
074  @XmlElementWrapper(name = Definitions.ELEMENT_VIDEO_DESCRIPTION_LIST)
075  @XmlElement(name = Definitions.ELEMENT_VIDEO_DESCRIPTION)
076  private List<FacebookVideoDescription> _videoDescriptions = null;
077
078  /**
079   * @param user
080   */
081  public FacebookProfile(FacebookUserDetails user){
082    _user = user;
083  }
084  
085  /**
086   * for serialization
087   */
088  protected FacebookProfile(){
089    // nothing needed
090  }
091
092  /**
093   * 
094   * @return user details
095   */
096  public FacebookUserDetails getUser(){
097    return _user;
098  }
099
100  /**
101   * 
102   * @param like
103   * @see #getLikes()
104   */
105  public void addLike(FacebookLike like) {
106    if(_likes == null){
107      _likes = new ArrayList<>();
108    }
109    _likes.add(like);
110  }
111
112  /**
113   * 
114   * @param likes 
115   * @see #getLikes()
116   */
117  public void setLikes(List<FacebookLike> likes){
118    _likes = likes;
119  }
120
121  /**
122   * 
123   * @return likes
124   * @see #setLikes(List)
125   */
126  public List<FacebookLike> getLikes(){
127    return _likes;
128  }
129
130  /**
131   * 
132   * @param groups 
133   * @see #getGroups()
134   */
135  public void setGroups(List<FacebookGroup> groups){
136    _groups = groups;
137  }
138
139  /**
140   * 
141   * @param group
142   * @see #getGroups()
143   */
144  public void addGroup(FacebookGroup group) {
145    if(_groups == null){
146      _groups = new ArrayList<>();
147    }
148    _groups.add(group);
149  }
150
151  /**
152   * 
153   * @return groups
154   * @see #setGroups(List)
155   */
156  public List<FacebookGroup> getGroups(){
157    return _groups;
158  }
159
160  /**
161   * 
162   * @return events
163   * @see #setEvents(List)
164   */
165  public List<FacebookEvent> getEvents() {
166    return _events;
167  }
168
169  /**
170   * 
171   * @param events 
172   * @see #getEvents()
173   */
174  public void setEvents(List<FacebookEvent> events) {
175    _events = events;
176  }
177
178  /**
179   * 
180   * @param messages 
181   * @see #getStatusMessages()
182   */
183  public void setStatusMessages(List<FacebookStatusMessage> messages){
184    _statusMessages = messages;
185  }
186
187  /**
188   * 
189   * @param statusMessage
190   * @see #getStatusMessages()
191   */
192  public void addStatusMessage(FacebookStatusMessage statusMessage) {
193    if(_statusMessages == null){
194      _statusMessages = new ArrayList<>();
195    }
196    _statusMessages.add(statusMessage);
197  }
198
199  /**
200   * 
201   * @return status messages
202   * @see #setStatusMessages(List)
203   */
204  public List<FacebookStatusMessage> getStatusMessages(){
205    return _statusMessages;
206  }
207
208  /**
209   * 
210   * @return photo descriptions
211   * @see #setPhotoDescriptions(List)
212   */
213  public List<FacebookPhotoDescription> getPhotoDescriptions() {
214    return _photoDescriptions;
215  }
216
217  /**
218   * 
219   * @param photoDescriptions 
220   * @see #getPhotoDescriptions()
221   */
222  public void setPhotoDescriptions(List<FacebookPhotoDescription> photoDescriptions) {
223    _photoDescriptions = photoDescriptions;
224  }
225
226  /**
227   * 
228   * @return video descriptions
229   * @see #setVideoDescriptions(List)
230   */
231  public List<FacebookVideoDescription> getVideoDescriptions() {
232    return _videoDescriptions;
233  }
234
235  /**
236   * 
237   * @param videoDescriptions 
238   * @see #getVideoDescriptions()
239   */
240  public void setVideoDescriptions(List<FacebookVideoDescription> videoDescriptions) {
241    _videoDescriptions = videoDescriptions;
242  }
243}