package org.gcube.portal.databook.shared; import com.datastax.oss.driver.api.core.cql.Row; import org.gcube.portal.databook.shared.ex.PostTypeNotFoundException; import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException; import java.io.Serializable; import java.util.Date; import java.util.Objects; import static org.gcube.portal.databook.server.Schema.*; /** * * @author Massimiliano Assante, ISTI-CNR * @version 0.1 July 2012 * */ @SuppressWarnings("serial") public class Like implements Serializable { private String key; private String userid; private Date time; private String postid; private String fullName; private String thumbnailURL; public Like() { super(); } public Like(String key, String userid, Date time, String postid, String fullName, String thumbnailURL) { super(); this.key = key; this.userid = userid; this.time = time; this.postid = postid; this.fullName = fullName; this.thumbnailURL = thumbnailURL; } public Like(Row record) { super(); this.key = Objects.requireNonNull(record.getUuid(LIKE_ID)).toString(); this.userid = record.getString(USER_ID); this.time = Date.from(Objects.requireNonNull(record.getInstant(TIMESTAMP))); this.postid = Objects.requireNonNull(record.getUuid(POST_ID)).toString(); this.fullName = record.getString(FULL_NAME); this.thumbnailURL = record.getString(THUMBNAIL_URL); } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } public String getpostid() { return postid; } public void setpostid(String postid) { this.postid = postid; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getThumbnailURL() { return thumbnailURL; } public void setThumbnailURL(String thumbnailURL) { this.thumbnailURL = thumbnailURL; } public String toString() { return "KEY: " + key + " Time: "+ time + "\nuserid: "+userid + " Full name: " + fullName; } }