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:
Britt Park
2006-05-17 22:42:03 +00:00
parent 009fd6f36f
commit e18a26f4f3
72 changed files with 1300 additions and 5517 deletions

View File

@@ -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.

View File

@@ -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);
}

View File

@@ -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)
{

View File

@@ -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