1 25 26 package net.killingar.forum.actions.area; 27 28 public class DeleteMessage extends View 29 { 30 32 long messageID = 0; 34 MessageData message = null; 35 boolean delete; 36 int pageID = -1; 37 38 40 public void setMessageID(long messageID) { this.messageID = messageID; } 42 public void setDelete(boolean delete) { this.delete = delete; } 43 public void setPage(int pageID) { this.pageID = pageID; } 44 45 public MessageData getMessage() { return message; } 47 public int getPage() { return pageID; } 48 49 protected void doValidation() 51 { 52 if (messageID == 0) 54 addErrorMessage("no message specified"); 55 56 try 57 { 58 message = new MessageData(manager, areamgr.getMessage(messageID), false, false); 59 areaID = message.getAreaID(); 60 61 super.doValidation(); 62 } 63 catch (Exception e) 64 { 65 e.printStackTrace(); 66 addErrorMessage("error getting area manager or area (" + e.getMessage() + ")"); 67 } 68 69 if (message == null) 70 addErrorMessage("invalid messsage ID specified"); 71 } 72 73 protected String doExecute() 74 { 75 try 76 { 77 if (delete) 78 { 79 areamgr.removeMessage(message.getId()); 80 81 return SUCCESS; 82 } 83 else 84 { 85 super.doExecute(); 86 return INPUT; 87 } 88 } 89 catch (Exception e) 90 { 91 e.printStackTrace(); 92 addErrorMessage("error getting area manager or area (" + e.getMessage() + ")"); 93 94 return ERROR; 95 } 96 } 97 } 98 | Popular Tags |