1 18 19 package cowsultants.itracker.ejb.beans.entity; 20 21 import java.util.*; 22 import java.sql.Timestamp ; 23 24 import cowsultants.itracker.ejb.client.models.NotificationModel; 25 26 public abstract class NotificationBean extends GenericBean { 27 28 public abstract int getNotificationRole(); 29 public abstract void setNotificationRole(int value); 30 31 public abstract UserLocal getUser(); 32 public abstract void setUser(UserLocal value); 33 34 public abstract IssueLocal getIssue(); 35 public abstract void setIssue(IssueLocal value); 36 37 public NotificationModel getModel() { 38 NotificationModel model = new NotificationModel(); 39 model.setId(this.getId()); 40 model.setNotificationRole(this.getNotificationRole()); 41 model.setLastModifiedDate(this.getLastModifiedDate()); 42 model.setCreateDate(this.getCreateDate()); 43 44 if(this.getIssue() != null) { 45 model.setIssueId(this.getIssue().getId()); 46 } 47 48 if(this.getUser() != null) { 49 model.setUserId(this.getUser().getId()); 50 model.setUserLogin(this.getUser().getLogin()); 51 model.setUserFirstName(this.getUser().getFirstName()); 52 model.setUserLastName(this.getUser().getLastName()); 53 model.setUserEmail(this.getUser().getEmail()); 54 } 55 56 return model; 57 } 58 59 public void setModel(NotificationModel model) { 60 this.setNotificationRole(model.getNotificationRole()); 61 this.setLastModifiedDate(new Timestamp (new Date().getTime())); 62 } 63 64 } 65 | Popular Tags |