1 25 26 29 package net.killingar.forum.actions.planning; 30 31 import net.killingar.forum.internal.Event; 32 import net.killingar.forum.internal.managers.PlanningManager; 33 34 public class Edit extends ActionPlanningSupport 35 { 36 38 private long eventID; 40 41 String name; 42 int year = -1, month = -1, date = -1; 43 long group = -1; 44 boolean clear = false, frozen = false; 45 String description; 46 47 49 public void setEvent(long inEvent) { eventID = inEvent; } 51 public void setName(String inName) { name = inName; } 52 public void setDescription(String in) { description = in; } 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 = true; } public void setFrozen(boolean inFrozen) { frozen = true; } 60 public long getEvent() { return eventID; } 62 public String getName () { return name; } 63 public String getDescription () { return description; } 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 event = planningMgr.getEvent(eventID); 79 80 if (name == null || year == -1 || month == -1 || date == -1 || group == -1) 81 { 82 year = event.time.getYear()+1900; 83 month = event.time.getMonth(); 84 date = event.time.getDate(); 85 name = event.name; 86 group = event.groupID; 87 frozen = event.frozen; 88 description = event.description; 89 90 return INPUT; 91 } 92 93 event.time.setYear(year-1900); 94 event.time.setMonth(month); 95 event.time.setDate(date); 96 event.name = name; 97 event.groupID = group; 98 event.frozen = frozen; 99 event.description = description; 100 101 planningMgr.changeEvent(event, clear); 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 |