/src/main/java/com/nearfuturelaboratory/humans/flickr/entities/FlickrStatus.java

https://github.com/bleeckerj/HumansService · Java · 401 lines · 304 code · 90 blank · 7 comment · 0 complexity · 2412d97fefa15657a4cbfb53db7979ea MD5 · raw file

  1. package com.nearfuturelaboratory.humans.flickr.entities;
  2. import com.google.gson.Gson;
  3. import com.google.gson.JsonObject;
  4. import com.google.gson.annotations.SerializedName;
  5. import com.nearfuturelaboratory.humans.entities.ServiceEntry;
  6. import com.nearfuturelaboratory.humans.service.status.ServiceStatus;
  7. import org.apache.logging.log4j.LogManager;
  8. import org.apache.logging.log4j.Logger;
  9. import org.mongodb.morphia.annotations.*;
  10. import java.util.Date;
  11. import java.util.Map;
  12. @Entity("status")
  13. public class FlickrStatus extends ServiceStatus {
  14. final static Logger logger = LogManager.getLogger(com.nearfuturelaboratory.humans.flickr.entities.FlickrStatus.class);
  15. @Version
  16. @Property ("version")
  17. private Long version;
  18. protected Date lastUpdated;
  19. @Transient
  20. protected String service="flickr";
  21. /**
  22. * @return the service
  23. */
  24. public String getService() {
  25. return service;
  26. }
  27. @SerializedName("status_on_behalf_of")
  28. //@Property("status-on-behalf-of")
  29. @Embedded
  30. private ServiceEntry onBehalfOf;
  31. @Id
  32. protected String id;
  33. protected String owner;
  34. protected String secret;
  35. protected String server;
  36. protected String farm;
  37. protected String title;
  38. protected String ispublic;
  39. protected String isfriend;
  40. protected String isfamily;
  41. protected Map<String, String> description;
  42. protected Integer license;
  43. protected Long dateupload;
  44. protected Date datetaken;
  45. protected Long datetakengranularity;
  46. protected String ownername;
  47. protected Integer iconserver;
  48. protected Integer iconfarm;
  49. protected String originalsecret;
  50. protected String originalformat;
  51. protected Long lastupdate;
  52. protected Double latitude;
  53. protected Double longitude;
  54. protected Double accuracy;
  55. protected Integer context;
  56. protected String tags;
  57. protected String machine_tags;
  58. protected Integer o_width;
  59. protected Integer o_height;
  60. protected Integer views;
  61. protected String media;
  62. protected String media_status;
  63. protected String pathalias;
  64. protected String url_sq;
  65. protected Integer height_sq;
  66. protected Integer width_sq;
  67. protected String url_t;
  68. protected Integer height_t;
  69. protected Integer width_t;
  70. protected String url_s;
  71. protected Integer height_s;
  72. protected Integer width_s;
  73. protected String url_q;
  74. protected Integer height_q;
  75. protected Integer width_q;
  76. protected String url_m;
  77. protected Integer height_m;
  78. protected Integer width_m;
  79. protected String url_n;
  80. protected Integer height_n;
  81. protected Integer width_n;
  82. protected String url_z;
  83. protected Integer height_z;
  84. protected Integer width_z;
  85. protected String url_c;
  86. protected Integer height_c;
  87. protected Integer width_c;
  88. protected String url_l;
  89. protected Integer height_l;
  90. protected Integer width_l;
  91. protected String url_o;
  92. protected Integer height_o;
  93. protected Integer width_o;
  94. @Property("created")
  95. public long created;
  96. @Override
  97. /**
  98. * Use date taken for sorting
  99. */
  100. public long getCreated() {
  101. return this.getDateupload()*1000l;
  102. }
  103. @PrePersist void prePersist() {
  104. lastUpdated = new Date();
  105. created = getCreated();
  106. }
  107. public ServiceEntry getOnBehalfOf() {
  108. return onBehalfOf;
  109. }
  110. public void setOnBehalfOf(ServiceEntry onBehalfOf) {
  111. this.onBehalfOf = onBehalfOf;
  112. }
  113. public Long getVersion() {
  114. return version;
  115. }
  116. public Date getLastUpdated() {
  117. return lastUpdated;
  118. }
  119. public String getId() {
  120. return id;
  121. }
  122. public String getOwner() {
  123. return owner;
  124. }
  125. public String getSecret() {
  126. return secret;
  127. }
  128. public String getServer() {
  129. return server;
  130. }
  131. public String getFarm() {
  132. return farm;
  133. }
  134. public String getTitle() {
  135. return title;
  136. }
  137. public String getIspublic() {
  138. return ispublic;
  139. }
  140. public String getIsfriend() {
  141. return isfriend;
  142. }
  143. public String getIsfamily() {
  144. return isfamily;
  145. }
  146. public Map<String, String> getDescription() {
  147. return description;
  148. }
  149. public Integer getLicense() {
  150. return license;
  151. }
  152. public Long getDateupload() {
  153. return dateupload;
  154. }
  155. public Date getDatetaken() {
  156. return datetaken;
  157. }
  158. public Long getDatetakengranularity() {
  159. return datetakengranularity;
  160. }
  161. public String getOwnername() {
  162. return ownername;
  163. }
  164. public Integer getIconserver() {
  165. return iconserver;
  166. }
  167. public Integer getIconfarm() {
  168. return iconfarm;
  169. }
  170. public String getOriginalsecret() {
  171. return originalsecret;
  172. }
  173. public String getOriginalformat() {
  174. return originalformat;
  175. }
  176. public Long getLastupdate() {
  177. return lastupdate;
  178. }
  179. public Double getLatitude() {
  180. return latitude;
  181. }
  182. public Double getLongitude() {
  183. return longitude;
  184. }
  185. public Double getAccuracy() {
  186. return accuracy;
  187. }
  188. public Integer getContext() {
  189. return context;
  190. }
  191. public String getTags() {
  192. return tags;
  193. }
  194. public String getMachine_tags() {
  195. return machine_tags;
  196. }
  197. public Integer getO_width() {
  198. return o_width;
  199. }
  200. public Integer getO_height() {
  201. return o_height;
  202. }
  203. public Integer getViews() {
  204. return views;
  205. }
  206. public String getMedia() {
  207. return media;
  208. }
  209. public String getMedia_status() {
  210. return media_status;
  211. }
  212. public String getPathalias() {
  213. return pathalias;
  214. }
  215. public String getUrl_sq() {
  216. return url_sq;
  217. }
  218. public Integer getHeight_sq() {
  219. return height_sq;
  220. }
  221. public Integer getWidth_sq() {
  222. return width_sq;
  223. }
  224. public String getUrl_t() {
  225. return url_t;
  226. }
  227. public Integer getHeight_t() {
  228. return height_t;
  229. }
  230. public Integer getWidth_t() {
  231. return width_t;
  232. }
  233. public String getUrl_s() {
  234. return url_s;
  235. }
  236. public Integer getHeight_s() {
  237. return height_s;
  238. }
  239. public Integer getWidth_s() {
  240. return width_s;
  241. }
  242. public String getUrl_q() {
  243. return url_q;
  244. }
  245. public Integer getHeight_q() {
  246. return height_q;
  247. }
  248. public Integer getWidth_q() {
  249. return width_q;
  250. }
  251. public String getUrl_m() {
  252. return url_m;
  253. }
  254. public Integer getHeight_m() {
  255. return height_m;
  256. }
  257. public Integer getWidth_m() {
  258. return width_m;
  259. }
  260. public String getUrl_n() {
  261. return url_n;
  262. }
  263. public Integer getHeight_n() {
  264. return height_n;
  265. }
  266. public Integer getWidth_n() {
  267. return width_n;
  268. }
  269. public String getUrl_z() {
  270. return url_z;
  271. }
  272. public Integer getHeight_z() {
  273. return height_z;
  274. }
  275. public Integer getWidth_z() {
  276. return width_z;
  277. }
  278. public String getUrl_c() {
  279. return url_c;
  280. }
  281. public Integer getHeight_c() {
  282. return height_c;
  283. }
  284. public Integer getWidth_c() {
  285. return width_c;
  286. }
  287. public String getUrl_l() {
  288. return url_l;
  289. }
  290. public Integer getHeight_l() {
  291. return height_l;
  292. }
  293. public Integer getWidth_l() {
  294. return width_l;
  295. }
  296. public String getUrl_o() {
  297. return url_o;
  298. }
  299. public Integer getHeight_o() {
  300. return height_o;
  301. }
  302. public Integer getWidth_o() {
  303. return width_o;
  304. }
  305. @Override
  306. public JsonObject getStatusJSON() {
  307. JsonObject obj = new Gson().toJsonTree(this, this.getClass()).getAsJsonObject();
  308. obj.addProperty("service", "flickr");
  309. return obj;
  310. }
  311. }