001// Generated by delombok at Sun Sep 26 16:30:34 CEST 2021 002/* 003 * Copyright (c) 2010-2021 Mark Allen, Norbert Bartels. 004 * 005 * Permission is hereby granted, free of charge, to any person obtaining a copy 006 * of this software and associated documentation files (the "Software"), to deal 007 * in the Software without restriction, including without limitation the rights 008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 009 * copies of the Software, and to permit persons to whom the Software is 010 * furnished to do so, subject to the following conditions: 011 * 012 * The above copyright notice and this permission notice shall be included in 013 * all copies or substantial portions of the Software. 014 * 015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 021 * THE SOFTWARE. 022 */ 023package com.restfb.types; 024 025import static java.util.Collections.unmodifiableList; 026import java.util.ArrayList; 027import java.util.Date; 028import java.util.List; 029import com.restfb.Facebook; 030import com.restfb.types.features.HasFrom; 031import com.restfb.types.features.HasMessage; 032 033/** 034 * Represents the <a href="http://developers.facebook.com/docs/reference/api/status">Status Message Graph API type</a>. 035 * 036 * @author <a href="http://restfb.com">Mark Allen</a> 037 * @since 1.6 038 * @deprecated removed after Graph API 2.0 039 */ 040@Deprecated 041public class StatusMessage extends NamedFacebookType implements HasFrom, HasMessage { 042 /** 043 * The user who posted the message. 044 * 045 */ 046 @Facebook 047 private NamedFacebookType from; 048 /** 049 * The status message content. 050 * 051 */ 052 @Facebook 053 private String message; 054 /** 055 * The place where status message is attached. 056 * 057 * @since 1.6.15 058 */ 059 @Facebook 060 private Place place; 061 /** 062 * The object type which is set to status. 063 * 064 */ 065 @Facebook 066 private String type; 067 /** 068 * The time the message was published. 069 * 070 */ 071 @Facebook("updated_time") 072 private Date updatedTime; 073 @Facebook 074 private List<NamedFacebookType> likes = new ArrayList<>(); 075 /** 076 * Hack so JSON mapping won't fail when FB returns inconsistent JSON when there are 0 likes. 077 */ 078 @Facebook("likes") 079 private EmptyLikes emptyLikes; 080 @Facebook 081 private List<Comment> comments = new ArrayList<>(); 082 /** 083 * Hack so JSON mapping won't fail when FB returns inconsistent JSON when there are 0 comments. 084 */ 085 @Facebook("comments") 086 private EmptyComments emptyComments; 087 private static final long serialVersionUID = 2L; 088 089 090 /** 091 * Sometimes Facebook will return <tt>"likes":{"count":0}</tt> instead of the connection-formatted likes object that's 092 * documented - this class handles that so JSON mapping won't fail. 093 * 094 * @author <a href="http://restfb.com">Mark Allen</a> 095 * @since 1.6.8 096 */ 097 private static class EmptyLikes extends AbstractFacebookType { 098 @Facebook 099 private Long count; 100 private static final long serialVersionUID = 1L; 101 } 102 103 104 /** 105 * Sometimes Facebook will return <tt>"comments":{"count":0}</tt> instead of the connection-formatted comments object 106 * that's documented - this class handles that so JSON mapping won't fail. 107 * 108 * @author <a href="http://restfb.com">Mark Allen</a> 109 * @since 1.6.8 110 */ 111 private static class EmptyComments extends AbstractFacebookType { 112 @Facebook 113 private Long count; 114 private static final long serialVersionUID = 1L; 115 } 116 117 /** 118 * The users that have liked this message. 119 * 120 * @return The users that have liked this message. 121 */ 122 public List<NamedFacebookType> getLikes() { 123 return unmodifiableList(likes); 124 } 125 126 public boolean addLike(NamedFacebookType like) { 127 return likes.add(like); 128 } 129 130 public boolean removeLike(NamedFacebookType like) { 131 return likes.remove(like); 132 } 133 134 /** 135 * All of the comments on this message. 136 * 137 * @return All of the comments on this message. 138 */ 139 public List<Comment> getComments() { 140 return unmodifiableList(comments); 141 } 142 143 public boolean addComment(Comment comment) { 144 return comments.add(comment); 145 } 146 147 public boolean removeComment(Comment comment) { 148 return comments.remove(comment); 149 } 150 151 /** 152 * The user who posted the message. 153 * 154 * @return The user who posted the message. 155 */ 156 @Override 157 @java.lang.SuppressWarnings("all") 158 public NamedFacebookType getFrom() { 159 return this.from; 160 } 161 162 /** 163 * The user who posted the message. 164 * 165 */ 166 @java.lang.SuppressWarnings("all") 167 public void setFrom(final NamedFacebookType from) { 168 this.from = from; 169 } 170 171 /** 172 * The status message content. 173 * 174 * @return The status message content. 175 */ 176 @Override 177 @java.lang.SuppressWarnings("all") 178 public String getMessage() { 179 return this.message; 180 } 181 182 /** 183 * The status message content. 184 * 185 */ 186 @java.lang.SuppressWarnings("all") 187 public void setMessage(final String message) { 188 this.message = message; 189 } 190 191 /** 192 * The place where status message is attached. 193 * 194 * @return The place where the status message posted. 195 * @since 1.6.15 196 */ 197 @java.lang.SuppressWarnings("all") 198 public Place getPlace() { 199 return this.place; 200 } 201 202 /** 203 * The place where status message is attached. 204 * 205 * @since 1.6.15 206 */ 207 @java.lang.SuppressWarnings("all") 208 public void setPlace(final Place place) { 209 this.place = place; 210 } 211 212 /** 213 * The object type which is set to status. 214 * 215 * @return The object type which is set to status. 216 */ 217 @java.lang.SuppressWarnings("all") 218 public String getType() { 219 return this.type; 220 } 221 222 /** 223 * The object type which is set to status. 224 * 225 */ 226 @java.lang.SuppressWarnings("all") 227 public void setType(final String type) { 228 this.type = type; 229 } 230 231 /** 232 * The time the message was published. 233 * 234 * @return The time the message was published. 235 */ 236 @java.lang.SuppressWarnings("all") 237 public Date getUpdatedTime() { 238 return this.updatedTime; 239 } 240 241 /** 242 * The time the message was published. 243 * 244 */ 245 @java.lang.SuppressWarnings("all") 246 public void setUpdatedTime(final Date updatedTime) { 247 this.updatedTime = updatedTime; 248 } 249}