1 25 26 29 package net.killingar.forum.actions.planning; 30 31 import net.killingar.forum.internal.Event; 32 import net.killingar.forum.internal.EventData; 33 import net.killingar.forum.internal.managers.PlanningManager; 34 35 public class Decide extends ActionPlanningSupport 36 { 37 39 private long event = -1; 41 private int answer = -1; 42 String name; 43 int year = -1, month = -1, date = -1; 44 long group = -1; 45 boolean clear, frozen; 46 47 49 public void setEvent(long inEvent) { event = inEvent; } 51 public void setAnswer(int inAnswer) { answer = inAnswer; } 52 public void setName(String inName) { name = inName; } 53 public void setYear(int inYear) { year = inYear; } 54 public void setMonth(int inMonth) { month = inMonth; } 55 public void setDate(int inDate) { date = inDate; } 56 public void setGroup(long inGroup) { group = inGroup; } 57 public void setClear(boolean inClear) { clear = inClear; } 58 public void setFrozen(boolean inFrozen) { frozen = inFrozen; } 59 60 public long getEvent() { return event; } 62 public int getAnswer() { return answer; } 63 public String getName () { return name; } 64 public int getYear () { return year; } 65 public int getMonth() { return month; } 66 public int getDate () { return date; } 67 public long getGroup() { return group; } 68 public boolean getClear() { return clear; } 69 public boolean getFrozen() { return frozen; } 70 71 protected String doExecute() 73 { 74 try 75 { 76 PlanningManager planningMgr = (PlanningManager)manager.getManager(PlanningManager.class.getName()); 77 78 Event e = planningMgr.getEvent(event); 79 80 if (event == -1 || e == null) 81 { 82 addErrorMessage("no or invalid event specified"); 83 return ERROR; 84 } 85 86 if (answer == -1) 87 { 88 year = e.time.getYear()+1900; 89 month = e.time.getMonth(); 90 date = e.time.getDate(); 91 name = e.name; 92 group = e.groupID; 93 frozen = e.frozen; 94 95 EventData d = planningMgr.getEventData(event, manager.getUserID()); 96 if (d != null) 97 answer = d.data; 98 return INPUT; 99 } 100 101 planningMgr.setEventData(manager.getUserID(), event, answer); 102 } 103 catch (Exception e) 104 { 105 e.printStackTrace(); 106 addErrorMessage("executing "+getClass().toString()+" action failed, exception thrown: "+e.toString()); 107 return ERROR; 108 } 109 110 return SUCCESS; 111 } 112 } 113 | Popular Tags |