01: package com.opensymphony.workflow.designer.spi;
02:
03: import java.awt.Component;
04: import java.util.Iterator;
05: import java.util.Map;
06: import java.util.Set;
07:
08: import com.opensymphony.workflow.designer.dialogs.DialogUtils;
09: import com.opensymphony.workflow.loader.PermissionConditionDescriptor;
10:
11: /**
12: * @author Gulei
13: */
14: public class DefaultPermissionPlugin implements PermissionCondition {
15:
16: PermissionConditionDescriptor perm;
17:
18: public void setPermissionCondition(
19: PermissionConditionDescriptor descriptor) {
20: perm = descriptor;
21: }
22:
23: public PermissionConditionDescriptor getPermissionCondition() {
24: return perm;
25: }
26:
27: public boolean editPermissionCondition(Map args, Component parent) {
28: Map newArg = DialogUtils.getMapDialog(perm, perm.getType(),
29: perm.getOwner(), parent);
30: if (newArg == null) {
31: return false;
32: }
33:
34: Map oldArg = perm.getArgs();
35: Set keys = oldArg.keySet();
36: Iterator iter = keys.iterator();
37: while (iter.hasNext()) {
38: Object key = iter.next();
39: oldArg.put(key, newArg.get(key));
40: }
41: return true;
42: }
43:
44: }
|