1 11 package org.jboss.portlet.forums.action; 12 13 import java.util.Collections ; 14 import java.util.List ; 15 16 import org.jboss.portal.core.modules.ModuleException; 17 import org.jboss.portlet.forums.impl.MessageImpl; 18 import org.jboss.portlet.forums.impl.PollImpl; 19 import org.jboss.portlet.forums.impl.PosterImpl; 20 import org.jboss.portlet.forums.model.Forum; 21 import org.jboss.portlet.forums.model.Message; 22 import org.jboss.portlet.forums.model.Poll; 23 import org.jboss.portlet.forums.model.Poster; 24 25 30 public class NewTopicAction 31 extends ForumAction 32 { 33 private int forumID; 34 private Poster poster; 35 private Message message; 36 private Poll poll; 37 private List attachments; 38 private Forum forum; 39 40 49 public NewTopicAction(Poster poster, 50 Message message, 51 int forumID, 52 List attachments, 53 Poll poll) 54 { 55 super(REFRESH); 56 this.poster = poster; 57 this.message = message; 58 this.forumID = forumID; 59 this.attachments = attachments; 60 this.poll = poll; 61 } 62 63 68 public NewTopicAction(int forumID) 69 { 70 super(INIT); 71 this.poster = new PosterImpl(); 72 this.message = new MessageImpl(); 73 this.forumID = forumID; 74 this.attachments = Collections.EMPTY_LIST; 75 this.poll = new PollImpl(); 76 } 77 78 83 public Poster getPoster() 84 { 85 return poster; 86 } 87 88 93 public Forum getForum() 94 { 95 return forum; 96 } 97 98 103 public Message getMessage() 104 { 105 return message; 106 } 107 108 113 public List getAttachments() 114 { 115 return attachments; 116 } 117 118 121 public void init() 122 { 123 try 124 { 125 forum = module.findForumByID(new Integer (forumID)); 126 if (getMode() == INIT) 127 { 128 message.setSignatureEnabled((poster.getUser().getSignature() != null) 129 && (poster.getUser().getSignature().trim().length() != 0)); 130 } 131 } 132 catch (ModuleException e) 133 { 134 throw new RuntimeException (); 135 } 136 } 137 138 143 public Poll getPoll() 144 { 145 return poll; 146 } 147 } | Popular Tags |