Mercurial > hg > LGDataverses
diff src/main/java/edu/harvard/iq/dataverse/UserNotification.java @ 10:a50cf11e5178
Rewrite LGDataverse completely upgrading to dataverse4.0
| author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
|---|---|
| date | Tue, 08 Sep 2015 17:00:21 +0200 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/edu/harvard/iq/dataverse/UserNotification.java Tue Sep 08 17:00:21 2015 +0200 @@ -0,0 +1,126 @@ +package edu.harvard.iq.dataverse; + +import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; +import java.io.Serializable; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Transient; + +/** + * + * @author xyang + */ +@Entity +@Table(indexes = {@Index(columnList="user_id")}) + +public class UserNotification implements Serializable { + public enum Type { + CREATEDV, CREATEDS, CREATEACC, MAPLAYERUPDATED, SUBMITTEDDS, RETURNEDDS, PUBLISHEDDS, REQUESTFILEACCESS, GRANTFILEACCESS, REJECTFILEACCESS + }; + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ManyToOne + @JoinColumn( nullable = false ) + private AuthenticatedUser user; + private Timestamp sendDate; + private boolean readNotification; + + @Enumerated + @Column( nullable = false ) + private Type type; + private Long objectId; + + @Transient + private boolean displayAsRead; + private boolean emailed; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public AuthenticatedUser getUser() { + return user; + } + + public void setUser(AuthenticatedUser user) { + this.user = user; + } + + public String getSendDate() { + return new SimpleDateFormat("MMMM d, yyyy h:mm a z").format(sendDate); + } + + public void setSendDate(Timestamp sendDate) { + this.sendDate = sendDate; + } + + public boolean isReadNotification() { + return readNotification; + } + + public void setReadNotification(boolean readNotification) { + this.readNotification = readNotification; + } + + public Type getType() { + return type; + } + + public void setType(Type type) { + this.type = type; + } + + public Long getObjectId() { + return objectId; + } + + public void setObjectId(Long objectId) { + this.objectId = objectId; + } + + @Transient + private Object theObject; + + public Object getTheObject() { + return theObject; + } + + public void setTheObject(Object theObject) { + this.theObject = theObject; + } + + public boolean isDisplayAsRead() { + return displayAsRead; + } + + public void setDisplayAsRead(boolean displayAsRead) { + this.displayAsRead = displayAsRead; + } + + public boolean isEmailed() { + return emailed; + } + + public void setEmailed(boolean emailed) { + this.emailed = emailed; + } +}
