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 import java.util.Date ; 35 36 public class Add extends ActionPlanningSupport 37 { 38 40 private String name; 42 private int year, month, date; 43 private long group = -1; 44 private String description; 45 46 48 public void setName(String inName) { name = inName; } 50 public void setDescription(String in) { description = in; } 51 public void setYear(int inYear) { year = inYear; } 52 public void setMonth(int inMonth) { month = inMonth; } 53 public void setDate(int inDate) { date = inDate; } 54 public void setGroup(long inGroup) { group = inGroup; } 55 56 public String getName () { return name; } 58 public String getDescription () { return description; } 59 public int getYear () { return year; } 60 public int getMonth() { return month; } 61 public int getDate () { return date; } 62 public long getGroup() { return group; } 63 64 protected String doExecute() 66 { 67 try 68 { 69 PlanningManager planningMgr = (PlanningManager)manager.getManager(PlanningManager.class.getName()); 70 71 if (name == null) 72 { 73 Date d = new Date (); 74 year = d.getYear()+1900; 75 month = d.getMonth(); 76 date = d.getDate(); 77 return INPUT; 78 } 79 80 Event event = new Event(group, name, description, new java.sql.Timestamp (System.currentTimeMillis())); 81 event.time.setYear(year-1900); 82 event.time.setMonth(month); 83 event.time.setDate(date); 84 planningMgr.addEvent(event); 85 } 86 catch (Exception e) 87 { 88 e.printStackTrace(); 89 addErrorMessage("executing "+getClass().toString()+" action failed, exception thrown: "+e.toString()); 90 return ERROR; 91 } 92 93 return SUCCESS; 94 } 95 } 96 | Popular Tags |