1 25 26 package net.killingar.forum.actions.area; 27 28 import net.killingar.forum.actions.Utils; 29 import net.killingar.forum.internal.Message; 30 import net.killingar.forum.internal.User; 31 import net.killingar.forum.internal.managers.ForumManager; 32 33 import java.sql.SQLException ; 34 35 public class MessageData extends Message 36 { 37 User owner; 38 boolean deleteAccess; 39 boolean firstNew; 40 boolean expand; 41 boolean unread; 42 String time; 43 long colspan; 44 boolean bodyEmpty; 45 long test; 46 47 public MessageData(MessageData message) 48 throws SQLException 49 { 50 super(message); 51 this.firstNew = message.firstNew; 52 this.unread = message.unread; 53 this.time = message.time; 54 this.colspan = message.colspan; 55 this.bodyEmpty = message.bodyEmpty; 56 this.owner = message.owner; 57 this.deleteAccess = message.deleteAccess; 58 } 59 60 public MessageData(ForumManager manager, Message message, boolean firstNew, boolean unread, long indent, long colspan) 61 throws SQLException 62 { 63 super(message); 64 this.firstNew = firstNew; 65 this.unread = unread; 66 this.time = Utils.formatDate(message.timecreated); 67 this.colspan = colspan; 68 this.bodyEmpty = message.body == null || message.body.length() == 0; 69 this.owner = manager.getUser(message.ownerID); 70 this.deleteAccess = message.ownerID == manager.getUserID() || manager.hasAccess(manager.getUserID(), 0x40000L); 71 72 if (subject != null) 73 subject = message.subject.trim(); 74 if (body != null) 75 body = message.body.trim(); 76 } 77 78 public MessageData(ForumManager manager, Message message, boolean firstNew, boolean unread) 79 throws SQLException 80 { 81 this(manager, message, firstNew, unread, 0L, 1L); 82 } 83 84 public MessageData(ForumManager manager, Message message) 85 throws SQLException 86 { 87 this(manager, message, false, false, 0L, 1L); 88 } 89 90 public User getOwner() { return owner; } 91 public boolean getDeleteAccess() { return deleteAccess; } 92 public boolean getFirstNew() { return firstNew; } 93 public boolean getUnread() { return unread; } 94 public String getTime() { return time; } 95 public int getColspan() { return (int)colspan; } 96 public boolean getBodyEmpty() { return bodyEmpty; } 97 98 public int getIndent() { return 0; } 99 100 } 102 | Popular Tags |