1 25 26 29 package net.killingar.forum.actions.task; 30 31 import net.killingar.forum.internal.Task; 32 33 public class Remove extends ActionTaskSupport 34 { 35 37 long taskID = -1; 39 boolean confirmed = false; 40 Task task; 41 42 44 public void setTask(long inTask) { taskID = inTask; } 46 public void setConfirmed(boolean inConfirmed) { confirmed = inConfirmed; } 47 48 public long getTask() { return taskID; } 50 public String getName() { return task.getName(); } 51 52 protected String doExecute() 54 { 55 try 56 { 57 if (taskID == -1) 58 { 59 addErrorMessage("no task id specified"); 60 return ERROR; 61 } 62 63 task = taskMgr.getTask(taskID); 64 65 if (!confirmed) 66 return INPUT; 67 68 taskMgr.removeTask(taskID); 69 } 70 catch (Exception e) 71 { 72 e.printStackTrace(); 73 addErrorMessage("executing "+getClass().toString()+" action failed, exception thrown: "+e.toString()); 74 return ERROR; 75 } 76 77 return SUCCESS; 78 } 79 } 80 | Popular Tags |