1 25 26 29 package net.killingar.forum.actions.area; 30 31 import net.killingar.forum.actions.Utils; 32 import net.killingar.forum.internal.Area; 33 import net.killingar.forum.internal.AreaGroup; 34 35 import java.util.ArrayList ; 36 import java.util.List ; 37 38 public class Add extends ActionAreaSupport 39 { 40 42 Area area = new Area(); 44 boolean confirmed = false; 45 List areaGroups = new ArrayList (); 46 47 49 51 public void setAreaID(long in) { area.ID = in; } 53 public void setConfirmed(boolean in) {confirmed = in; } 54 55 public long getAreaID() { return area.ID; } 57 public long getAreaGroupID(){ return area.areaGroupID; } 58 public Area getArea() { return area; } 59 public List getAreaGroups() { return areaGroups; } 60 61 protected String doExecute() 63 { 64 try 65 { 66 if (!confirmed) 67 { 68 AreaGroup[] areaGroups = areamgr.getAreaGroups(); 69 long indents[] = new long[areaGroups.length]; 70 Utils.buildFlatTree(areaGroups, indents); 71 72 for (int i = 0; i < areaGroups.length; i++) 73 this.areaGroups.add(new net.killingar.forum.actions.areagroup.List.AreaGroupData(areaGroups[i], false, indents[i])); 75 return INPUT; 76 } 77 else 78 { 79 area.ID = areamgr.addArea(area); 80 81 return SUCCESS; 82 } 83 } 84 catch (Exception e) 85 { 86 e.printStackTrace(); 87 addErrorMessage("executing "+getClass().toString()+" action failed, exception thrown: "+e.toString()); 88 return ERROR; 89 } 90 } 91 } 92 | Popular Tags |