Action API - create import action - missing variable name

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2011 11:19 AM
I'm trying to execute an import action in javascript using the Action and ActionScript API.
When I execute the actions.registered, I can see that import is a registered action, however when I call actions.create("import"), I get an error regarding a missing variable name.
According to the API documentation, actions.create only accepts a single argument of the action name. From the error, it appears that I need to be sending more arguments than just the name, however what that might be and the format of it does not seem to be documented.
Any thoughts on this?
My code is simply:
The error I am receiving is this:
When I execute the actions.registered, I can see that import is a registered action, however when I call actions.create("import"), I get an error regarding a missing variable name.
According to the API documentation, actions.create only accepts a single argument of the action name. From the error, it appears that I need to be sending more arguments than just the name, however what that might be and the format of it does not seem to be documented.
Any thoughts on this?
My code is simply:
function processCommand(){try{for (a in actions.registered) {logger.log(a + " - " + actions.registered[a]);}var import = actions.create("import"); //this line is crashing.}catch(err){logger.log("ERROR in importZipFile : " + err);}}processCommand();
The error I am receiving is this:
2011-12-12 13:12:55,139 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
2011-12-12 13:12:55,144 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 0 - mail
2011-12-12 13:12:55,144 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 1 - transform-image
2011-12-12 13:12:55,144 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 2 - copy-to-web-project
2011-12-12 13:12:55,144 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 3 - extract-metadata
2011-12-12 13:12:55,144 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 4 - counter
2011-12-12 13:12:55,144 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 5 - check-in
2011-12-12 13:12:55,144 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 6 - simple-workflow
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 7 - script
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 8 - transform
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 9 - remove-features
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 10 - specialise-type
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 11 - import
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 12 - add-features
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 13 - link-category
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 14 - blog-post
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 15 - move
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 16 - copy
2011-12-12 13:12:55,145 DEBUG [org.alfresco.repo.jscript.ScriptLogger] 17 - check-out
2011-12-12 13:12:55,146 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 2.624ms
2011-12-12 13:19:16,214 ERROR [org.alfresco.web.ui.common.Utils] Failed to run Actions due to error: 11120639 Failed to execute script 'workspace://SpacesStore/222a7e45-cfd2-489f-882a-6be88926d201': missing variable name (workspace://SpacesStore/222a7e45-cfd2-489f-882a-6be88926d201#8)
org.alfresco.scripts.ScriptException: 11120639 Failed to execute script 'workspace://SpacesStore/222a7e45-cfd2-489f-882a-6be88926d201': missing variable name
(workspace://SpacesStore/222a7e45-cfd2-489f-882a-6be88926d201#8)
at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:244)
at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:195)
at sun.reflect.GeneratedMethodAccessor971.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:146)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy228.executeScript(Unknown Source)
at org.alfresco.repo.action.executer.ScriptActionExecuter.executeImpl(ScriptActionExecuter.java:163)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:196)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:780)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:700)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:538)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:524)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:789)
at sun.reflect.GeneratedMethodAccessor968.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:146)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy24.executeAction(Unknown Source)
at org.alfresco.web.bean.actions.RunActionWizard.finishImpl(RunActionWizard.java:95)
at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:120)
at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:116)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:126)
at org.alfresco.web.bean.wizard.WizardManager.finish(WizardManager.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
at javax.faces.component.UICommand.broadcast(UICommand.java:151)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:115)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:191)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:105)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:80)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:143)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:104)
at sun.reflect.GeneratedMethodAccessor473.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy211.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:68)
at sun.reflect.GeneratedMethodAccessor473.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy211.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:185)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:159)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:444)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:372)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:396)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.mozilla.javascript.EvaluatorException: missing variable name (workspace://SpacesStore/222a7e45-cfd2-489f-882a-6be88926d201#8)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:96)
at org.mozilla.javascript.Parser.addError(Parser.java:140)
at org.mozilla.javascript.Parser.reportError(Parser.java:154)
at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:240)
at org.mozilla.javascript.Parser.variables(Parser.java:1260)
at org.mozilla.javascript.Parser.statementHelper(Parser.java:1057)
at org.mozilla.javascript.Parser.statement(Parser.java:655)
at org.mozilla.javascript.Parser.statements(Parser.java:603)
at org.mozilla.javascript.Parser.statementHelper(Parser.java:1107)
at org.mozilla.javascript.Parser.statement(Parser.java:655)
at org.mozilla.javascript.Parser.statementHelper(Parser.java:911)
at org.mozilla.javascript.Parser.statement(Parser.java:655)
at org.mozilla.javascript.Parser.parseFunctionBody(Parser.java:439)
at org.mozilla.javascript.Parser.function(Parser.java:546)
at org.mozilla.javascript.Parser.parse(Parser.java:370)
at org.mozilla.javascript.Parser.parse(Parser.java:315)
at org.mozilla.javascript.Context.compileImpl(Context.java:2320)
at org.mozilla.javascript.Context.compileString(Context.java:1348)
at org.mozilla.javascript.Context.compileString(Context.java:1337)
at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:233)
… 103 more
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2011 11:25 AM
Hello,
try to use a different variable name than 'import'.
'import' maybe/is a reserved word, see http://javascript.about.com/library/blreserved.htm
lothar
try to use a different variable name than 'import'.
'import' maybe/is a reserved word, see http://javascript.about.com/library/blreserved.htm
lothar

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2011 01:06 PM
I tried the counter action too, and received the same results.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2011 01:24 PM
Did you tried
using "import" as a variable name looks wrong to me.
var transformeraction = ….
using "import" as a variable name looks wrong to me.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2011 02:01 PM
Ah… I misunderstood you.
Thanks for clarifying things. You have found my error.
var myNewAction = actions.create('import'); works just fine.
Thank you.
Thanks for clarifying things. You have found my error.
var myNewAction = actions.create('import'); works just fine.
Thank you.
