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 Edit 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 Area getArea() { return area; } 57 public List getAreaGroups() { return areaGroups; } 58 59 protected String doExecute() 61 { 62 try 63 { 64 if (!confirmed) 65 { 66 area = areamgr.getArea(area.ID); 67 AreaGroup[] areaGroups = areamgr.getAreaGroups(); 68 long indents[] = new long[areaGroups.length]; 69 Utils.buildFlatTree(areaGroups, indents); 70 71 for (int i = 0; i < areaGroups.length; i++) 72 this.areaGroups.add(new net.killingar.forum.actions.areagroup.List.AreaGroupData(areaGroups[i], false, indents[i])); 74 return INPUT; 75 } 76 else 77 { 78 Area a = areamgr.getArea(area.ID); 79 a.areaGroupID = area.areaGroupID; 80 a.name = area.name; 81 a.mode = area.mode; 82 a.description = area.description; 83 a.custom = area.custom; 84 85 areamgr.changeArea(a); 86 area = a; 87 88 return SUCCESS; 89 } 90 } 91 catch (Exception e) 92 { 93 e.printStackTrace(); 94 addErrorMessage("executing "+getClass().toString()+" action failed, exception thrown: "+e.toString()); 95 return ERROR; 96 } 97 } 98 } 99 | Popular Tags |