📄 rmiworksession.java
字号:
RemoteException, WorkListException { final FlowExpressionId fei = (FlowExpressionId)this.ids.get(id); return getAndLock(storeName, fei); } public void release (final String storeName, final InFlowWorkItem item) throws RemoteException, WorkListException { try { Subject.doAs (this.subject, new openwfe.org.wlactions.ReleaseAction (this.applicationContext, this.subject, storeName, item)); } catch (PrivilegedActionException pae) { throw (WorkListException)pae.getException(); } } public void save (final String storeName, final InFlowWorkItem item) throws RemoteException, WorkListException { try { Subject.doAs (this.subject, new openwfe.org.wlactions.SaveAction (this.applicationContext, this.subject, storeName, item)); } catch (PrivilegedActionException pae) { throw (WorkListException)pae.getException(); } } public void forward (final String storeName, final InFlowWorkItem item) throws RemoteException, OpenWfeException { try { Subject.doAs (this.subject, new openwfe.org.wlactions.ForwardAction (this.applicationContext, this.subject, storeName, item)); } catch (PrivilegedActionException pae) { log.debug("forward() failure", pae); throw (OpenWfeException)pae.getException(); } } /** * This method returns a list of Launchable instances, ie objects * pointing to workflow definitions the user is authorized to launch. */ public java.util.List getLaunchables () throws RemoteException, WorkListException { java.util.List launchPermissions = getPermissions(LaunchPermission.class); // // build launchables out of launch permissions java.util.Map result = new java.util.HashMap(); java.util.Iterator it = launchPermissions.iterator(); while (it.hasNext()) { LaunchPermission lp = (LaunchPermission)it.next(); java.util.Iterator lit = lp.resolveUrl().iterator(); while (lit.hasNext()) { String url = null; try { url = (String)lit.next(); if (url.indexOf(".*") > -1) continue; result.put (url, new Launchable (this.applicationContext, this.serviceParams, lp.getEngineId(), url)); } catch (final LaunchException le) { log.info ("Failed to build launchable for "+ lp.getEngineId()+"::"+url); } } } // // return result java.util.ArrayList keys = new java.util.ArrayList(result.keySet()); java.util.Collections.sort(keys); java.util.ArrayList launchables = new java.util.ArrayList(keys.size()); it = keys.iterator(); while (it.hasNext()) launchables.add(result.get(it.next())); return launchables; } public String launch (final String engineId, final LaunchItem item) throws RemoteException, OpenWfeException { try { final Object result = Subject.doAs (this.subject, new openwfe.org.wlactions.LaunchAction (this.applicationContext, this.subject, engineId, item)); //log.debug // ("launch() result is of class "+result.getClass().getName()); return (String)result; } catch (PrivilegedActionException pae) { throw (OpenWfeException)pae.getException(); } } public void delegate (String storeName, InFlowWorkItem item, String targetStoreName) throws RemoteException, WorkListException { try { Subject.doAs (this.subject, new openwfe.org.wlactions.DelegateAction (this.applicationContext, this.subject, storeName, item, targetStoreName)); } catch (PrivilegedActionException pae) { throw (WorkListException)pae.getException(); } } public java.util.List getParticipantsForDelegation () throws RemoteException, WorkListException { java.util.List delegationPermissions = getPermissions(DelegationPermission.class); java.util.List result = new java.util.ArrayList(delegationPermissions.size()); java.util.Iterator it = delegationPermissions.iterator(); while (it.hasNext()) { DelegationPermission dp = (DelegationPermission)it.next(); result.add(dp.getName()); } return result; } public void delegateToParticipant (String storeName, InFlowWorkItem item, String participantName) throws RemoteException, WorkListException { try { Subject.doAs (this.subject, new openwfe.org.wlactions.DelegateToParticipantAction (this.applicationContext, this.subject, storeName, item, participantName)); } catch (PrivilegedActionException pae) { throw (WorkListException)pae.getException(); } } public boolean checkPermission (String storeName, String action) throws RemoteException, WorkListException { log.debug("checkPermission() action >"+action+"<"); try { return ((Boolean)Subject.doAs (this.subject, new openwfe.org.wlactions.CheckPermissionAction (this.applicationContext, this.subject, storeName, action))).booleanValue(); } catch (PrivilegedActionException pae) { throw (WorkListException)pae.getException(); } } public void release () throws RemoteException { // // remove all locks ! } // // OTHER METHODS /* * Keeps a map of the ' flow expression ids with the * string id as key and with the workitem as values. */ private void registerIds (final java.util.List l) { final java.util.Iterator it = l.iterator(); while (it.hasNext()) { final Object o = it.next(); FlowExpressionId fei = null; if (o instanceof Header) { fei = ((Header)o).getExpressionId(); } else if (o instanceof FlowExpressionId) { fei = (FlowExpressionId)o; } else { throw new IllegalArgumentException ("Couldn't register flow expression id "+ "out of object of class "+o.getClass().getName()); } this.ids.put(fei.asStringId(), fei); } } protected java.util.List getPermissions (Class permissionClass) throws WorkListException { // // get policy service PolicyService policy = PolicyService.lookupPolicyService(this.applicationContext); policy.refresh(); // // get permissions PermissionCollection permissions = null; try { permissions = policy.getPermissions(this.subject); } catch (openwfe.org.auth.AuthException ae) { throw new WorkListException ("Failed to list permissions for subject", ae); } // // take out valid permissions java.util.List result = new java.util.ArrayList(); java.util.Enumeration en = permissions.elements(); while (en.hasMoreElements()) { Object o = en.nextElement(); if (permissionClass.isAssignableFrom(o.getClass())) result.add(o); } // // return result return result; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -