1 package de.webman.acl; 2 3 import com.teamkonzept.lib.TKException; 4 import com.teamkonzept.lib.TKVector; 5 import de.webman.acl.db.TaskDBData; 6 7 15 public class Task 16 extends WMObject 17 { 18 19 21 23 26 private String name = null; 27 28 31 private Integer context = null; 32 33 34 36 41 protected Task (TaskDBData data) 42 { 43 super(data); 44 45 this.name = data.getName(); 46 this.context = data.getContext(); 47 } 48 49 50 52 58 public final ObjectFactory getFactory () 59 throws TKException 60 { 61 return TaskFactory.getInstance(); 62 } 63 64 69 public final String getName () 70 { 71 return name; 72 } 73 74 79 public final void setName (String name) 80 { 81 super.modifyAttribute(this.name, name); 82 this.name = name; 83 } 84 85 90 public final Integer getContextID () 91 { 92 return context; 93 } 94 95 101 public final Context getContext () 102 throws TKException 103 { 104 return context != null 105 ? (Context) ContextFactory.getInstance().getObject(context) 106 : null; 107 } 108 109 114 public final void setContext (Context context) 115 { 116 Integer id = context != null 117 ? context.getID() 118 : null; 119 120 super.modifyAttribute(this.context, id); 121 this.context = id; 122 } 123 124 130 public final TKVector getActions () 131 throws TKException 132 { 133 return ActionFactory.getInstance().getObjects(super.getAssociations()); 134 } 135 136 142 public final void addAction (Action action) 143 throws TKException 144 { 145 super.addAssociation(action); 146 } 147 148 154 public final void removeAction (Action action) 155 throws TKException 156 { 157 super.removeAssociation(action); 158 } 159 160 165 public final void removeActions () 166 throws TKException 167 { 168 super.removeAssociations(); 169 } 170 171 179 public final boolean hasAction (Action action) 180 throws TKException 181 { 182 return super.containsAssociation(action); 183 } 184 185 191 public final TKVector getRoles () 192 throws TKException 193 { 194 return RoleFactory.getInstance().getRoles(this); 195 } 196 197 } 198 | Popular Tags |