KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > spi > DefaultPermissionPlugin


1 package com.opensymphony.workflow.designer.spi;
2
3 import java.util.Iterator JavaDoc;
4 import java.util.Map JavaDoc;
5 import java.util.Set JavaDoc;
6
7 import com.opensymphony.workflow.designer.dialogs.DialogUtils;
8 import com.opensymphony.workflow.loader.PermissionConditionDescriptor;
9
10 /**
11  * @author Gulei
12  */

13 public class DefaultPermissionPlugin implements PermissionCondition
14 {
15
16   PermissionConditionDescriptor perm;
17
18   public void setPermissionCondition(PermissionConditionDescriptor descriptor)
19   {
20     perm = descriptor;
21   }
22
23   public PermissionConditionDescriptor getPermissionCondition()
24   {
25     return perm;
26   }
27
28   public boolean editPermissionCondition(Map JavaDoc args)
29   {
30     Map JavaDoc newArg = DialogUtils.getMapDialog(perm, perm.getType(), perm.getOwner());
31     if(newArg == null)
32     {
33       return false;
34     }
35
36     Map JavaDoc oldArg = perm.getArgs();
37     Set JavaDoc keys = oldArg.keySet();
38     Iterator JavaDoc iter = keys.iterator();
39     while(iter.hasNext())
40     {
41       Object JavaDoc key = iter.next();
42       oldArg.put(key, newArg.get(key));
43     }
44     return true;
45   }
46
47 }
48
Popular Tags