1 package com.opensymphony.workflow.designer.spi; 2 3 import java.util.Iterator ; 4 import java.util.Map ; 5 import java.util.Set ; 6 7 import com.opensymphony.workflow.designer.dialogs.DialogUtils; 8 import com.opensymphony.workflow.loader.PermissionConditionDescriptor; 9 10 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 args) 29 { 30 Map newArg = DialogUtils.getMapDialog(perm, perm.getType(), perm.getOwner()); 31 if(newArg == null) 32 { 33 return false; 34 } 35 36 Map oldArg = perm.getArgs(); 37 Set keys = oldArg.keySet(); 38 Iterator iter = keys.iterator(); 39 while(iter.hasNext()) 40 { 41 Object key = iter.next(); 42 oldArg.put(key, newArg.get(key)); 43 } 44 return true; 45 } 46 47 } 48 | Popular Tags |