mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Afternoon merge.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2915 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,7 @@ package org.alfresco.web.app.servlet.command;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
@@ -60,10 +61,10 @@ public interface CommandProcessor
|
||||
* exception should be thrown to indicate this.
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param session HttpSession
|
||||
* @param request HttpServletRequest
|
||||
* @param command Name of the command to construct and execute
|
||||
*/
|
||||
public void process(ServiceRegistry serviceRegistry, HttpSession session, String command);
|
||||
public void process(ServiceRegistry serviceRegistry, HttpServletRequest request, String command);
|
||||
|
||||
/**
|
||||
* Output a simple status message to the supplied PrintWriter.
|
||||
|
@@ -39,8 +39,9 @@ public final class ExecuteScriptCommand implements Command
|
||||
public static final String PROP_SCRIPT = "script";
|
||||
public static final String PROP_DOCUMENT = "document";
|
||||
public static final String PROP_USERPERSON = "person";
|
||||
public static final String PROP_ARGS = "args";
|
||||
|
||||
private static final String[] PROPERTIES = new String[] {PROP_SCRIPT, PROP_DOCUMENT, PROP_USERPERSON};
|
||||
private static final String[] PROPERTIES = new String[] {PROP_SCRIPT, PROP_DOCUMENT, PROP_USERPERSON, PROP_ARGS};
|
||||
|
||||
|
||||
/**
|
||||
@@ -90,6 +91,9 @@ public final class ExecuteScriptCommand implements Command
|
||||
spaceRef,
|
||||
DefaultModelHelper.imageResolver);
|
||||
|
||||
// add the url arguments map
|
||||
model.put("args", properties.get(PROP_ARGS));
|
||||
|
||||
// execute the script and return the result
|
||||
return serviceRegistry.getScriptService().executeScript(scriptRef, null, model);
|
||||
}
|
||||
|
@@ -17,12 +17,14 @@
|
||||
package org.alfresco.web.app.servlet.command;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.jscript.ScriptableHashMap;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
@@ -83,16 +85,27 @@ public final class ScriptCommandProcessor implements CommandProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.app.servlet.command.CommandProcessor#process(org.alfresco.service.ServiceRegistry, java.lang.String)
|
||||
* @see org.alfresco.web.app.servlet.command.CommandProcessor#process(org.alfresco.service.ServiceRegistry, javax.servlet.http.HttpServletRequest, java.lang.String)
|
||||
*/
|
||||
public void process(ServiceRegistry serviceRegistry, HttpSession session, String command)
|
||||
public void process(ServiceRegistry serviceRegistry, HttpServletRequest request, String command)
|
||||
{
|
||||
Map<String, Object> properties = new HashMap<String, Object>(2, 1.0f);
|
||||
Map<String, Object> properties = new HashMap<String, Object>(4, 1.0f);
|
||||
|
||||
properties.put(ExecuteScriptCommand.PROP_SCRIPT, this.scriptRef);
|
||||
properties.put(ExecuteScriptCommand.PROP_DOCUMENT, this.docRef);
|
||||
User user = Application.getCurrentUser(session);
|
||||
User user = Application.getCurrentUser(request.getSession());
|
||||
properties.put(ExecuteScriptCommand.PROP_USERPERSON, user.getPerson());
|
||||
|
||||
// add URL arguments as a special Scriptable Map property called 'args'
|
||||
Map<String, String> args = new ScriptableHashMap<String, String>();
|
||||
Enumeration names = request.getParameterNames();
|
||||
while (names.hasMoreElements())
|
||||
{
|
||||
String name = (String)names.nextElement();
|
||||
args.put(name, request.getParameter(name));
|
||||
}
|
||||
properties.put(ExecuteScriptCommand.PROP_ARGS, args);
|
||||
|
||||
Command cmd = CommandFactory.getInstance().createCommand(command);
|
||||
if (cmd == null)
|
||||
{
|
||||
|
@@ -20,6 +20,7 @@ import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
@@ -44,9 +45,9 @@ public final class WorkflowCommandProcessor extends BaseNodeCommandProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.app.servlet.command.CommandProcessor#process(org.alfresco.service.ServiceRegistry, java.lang.String)
|
||||
* @see org.alfresco.web.app.servlet.command.CommandProcessor#process(org.alfresco.service.ServiceRegistry, javax.servlet.http.HttpServletRequest, java.lang.String)
|
||||
*/
|
||||
public void process(ServiceRegistry serviceRegistry, HttpSession session, String command)
|
||||
public void process(ServiceRegistry serviceRegistry, HttpServletRequest request, String command)
|
||||
{
|
||||
Map<String, Object> properties = new HashMap<String, Object>(1, 1.0f);
|
||||
// all workflow commands use a "target" Node property as an argument
|
||||
|
Reference in New Issue
Block a user