Commits

Anonymous committed 2073985

Patch from WF-423

Comments (0)

Files changed (9)

src/java/com/opensymphony/workflow/AbstractWorkflow.java

      * @ejb.interface-method
      */
     public List getSecurityPermissions(long id) {
+        return getSecurityPermissions(id, null);
+    }
+
+    /**
+     * @ejb.interface-method
+     */
+    public List getSecurityPermissions(long id, Map inputs) {
         try {
             WorkflowStore store = getPersistence();
             WorkflowEntry entry = store.findEntry(id);
             WorkflowDescriptor wf = getConfiguration().getWorkflow(entry.getWorkflowName());
 
             PropertySet ps = store.getPropertySet(id);
-            Map transientVars = new HashMap();
+            Map transientVars = (inputs == null) ? new HashMap() : new HashMap(inputs);
             Collection currentSteps = store.findCurrentSteps(id);
             populateTransientMap(entry, transientVars, wf.getRegisters(), null, currentSteps);
 

src/java/com/opensymphony/workflow/Workflow.java

      * Get a collection (Strings) of currently defined permissions for the specified workflow instance.
      * @param id the workflow instance id.
      * @return A List of permissions specified currently (a permission is a string name).
+     * @deprecated use {@link #getSecurityPermissions(long, java.util.Map)} with a null map instead.
      */
     public List getSecurityPermissions(long id);
 
     /**
+     * Get a collection (Strings) of currently defined permissions for the specified workflow instance.
+     * @param id id the workflow instance id.
+     * @param inputs inputs The inputs to the workflow instance.
+     * @return A List of permissions specified currently (a permission is a string name).
+     */
+    public List getSecurityPermissions(long id, Map inputs);
+
+    /**
      * Get the workflow descriptor for the specified workflow name.
      * @param workflowName The workflow name.
      */

src/java/com/opensymphony/workflow/ejb/EJBWorkflow.java

  * This class acts as a wrapper around a workflow session bean.
  *
  * @author plightbo
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
  */
 public class EJBWorkflow implements Workflow {
     //~ Static fields/initializers /////////////////////////////////////////////
         }
     }
 
+    public List getSecurityPermissions(long id, Map inputs) {
+        try {
+            return wf.getSecurityPermissions(id, inputs);
+        } catch (RemoteException e) {
+            log.error("Error getting security permissions", e);
+
+            return Collections.EMPTY_LIST;
+        }
+    }
+
     public WorkflowDescriptor getWorkflowDescriptor(String workflowName) {
         try {
             return wf.getWorkflowDescriptor(workflowName);

src/java/com/opensymphony/workflow/loader/WorkflowLoader.java

 
         Element root = (Element) doc.getElementsByTagName("workflow").item(0);
 
-        WorkflowDescriptor descriptor = new WorkflowDescriptor(root);
+        WorkflowDescriptor descriptor = DescriptorFactory.getFactory().createWorkflowDescriptor(root);
 
         if (validate) {
             descriptor.validate();

src/java/com/opensymphony/workflow/soap/BasicSOAPWorkflow.java

     }
 
     public List getSecurityPermissions(long id) {
-        return new BasicWorkflow(getRemoteUser()).getSecurityPermissions(id);
+        return new BasicWorkflow(getRemoteUser()).getSecurityPermissions(id, null);
+    }
+
+    public List getSecurityPermissions(long id, Map inputs) {
+        return new BasicWorkflow(getRemoteUser()).getSecurityPermissions(id, inputs);
     }
 
     public WorkflowDescriptor getWorkflowDescriptor(String workflowName) {

src/java/com/opensymphony/workflow/soap/OfbizSOAPWorkflow.java

     }
 
     public List getSecurityPermissions(long id) {
-        return new OfbizWorkflow(getRemoteUser()).getSecurityPermissions(id);
+        return new OfbizWorkflow(getRemoteUser()).getSecurityPermissions(id, null);
+    }
+
+    public List getSecurityPermissions(long id, Map inputs) {
+        return new OfbizWorkflow(getRemoteUser()).getSecurityPermissions(id, inputs);
     }
 
     public WorkflowDescriptor getWorkflowDescriptor(String workflowName) {

src/test/com/opensymphony/workflow/spi/AbstractFunctionalWorkflowTest.java

             log.debug("Name of workorder:" + workorderName);
         }
 
-        assertTrue("Expected external-permission permA in step 1 not found", workflow.getSecurityPermissions(workflowId).contains("permA"));
+        assertTrue("Expected external-permission permA in step 1 not found", workflow.getSecurityPermissions(workflowId, null).contains("permA"));
 
         List currentSteps = workflow.getCurrentSteps(workflowId);
         assertEquals("Unexpected number of current steps", 1, currentSteps.size());

src/webapp/test.jsp

 <p>
 
 <%
-    List perms = wf.getSecurityPermissions(id);
+    List perms = wf.getSecurityPermissions(id, null);
     for (Iterator iterator = perms.iterator(); iterator.hasNext();) {
         String perm = (String) iterator.next();
 %>

src/webapp/webapp.iml

       <attribute name="method" value="1" />
       <attribute name="URI" value="/WEB-INF/lib" />
     </containerElement>
-    <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/WEB-INF/web.xml" version="2.3" />
+    <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/WEB-INF/web.xml" optional="false" version="2.3" />
     <webroots>
       <root url="file://$MODULE_DIR$" relative="/" />
     </webroots>
   </component>
+  <component name="WeblogicWebModuleProperties">
+    <option name="IS_RUN_APPC" value="false" />
+  </component>
 </module>
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.