1 11 package org.jboss.portlet.forums.commands.post; 12 13 import java.util.Date ; 14 15 import org.jboss.portal.common.command.result.Result; 16 import org.jboss.portlet.forums.commands.ValidationException; 17 import org.jboss.portlet.forums.model.Post; 18 import org.jboss.portlet.forums.model.AuthType; 19 import org.jboss.portlet.JBossActionRequest; 20 import org.jboss.portlet.JBossActionResponse; 21 22 26 public final class ReplyCommand 27 extends PostCommand 28 { 29 30 public Post newPost; 31 32 33 public Date current_time; 34 35 36 public boolean notify; 37 38 public ReplyCommand(JBossActionRequest request, JBossActionResponse response) 39 { 40 super(request, response); 41 } 42 43 48 public int authType() 49 { 50 return AuthType.REPLY; 51 } 52 53 58 protected void prepare() 59 throws ValidationException 60 { 61 super.prepare(); 62 PostTools.validate(message); 63 } 64 65 70 public Result __execute() 71 { 72 try 73 { 74 newPost = forumsModule.createPost(topic, 75 forum, 76 message, 77 current_time, 78 getPoster()); 79 poster.incrementPostCount(); 80 81 113 } 114 catch (Exception e) 115 { 116 log.error("Cannot create post reply", e); 117 return TYPE_ERROR_IN_POSTING; 118 } 119 120 return TYPE_REPLY_POSTED; 121 } 122 } | Popular Tags |