use of org.alfresco.repo.jscript.ScriptableHashMap in project acs-community-packaging by Alfresco.
the class ScriptCommandProcessor method process.
/**
* @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, HttpServletRequest request, String command) {
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(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) {
throw new AlfrescoRuntimeException("Unregistered script command specified: " + command);
}
this.result = cmd.execute(serviceRegistry, properties);
}
Aggregations