cancel
Showing results for 
Search instead for 
Did you mean: 

Starting Workflow programatically in WCM

rupesh_alfresco
Champ in-the-making
Champ in-the-making
Hi All,

I am facing problem in starting workflow programmatically on an avmnode. following is the scenario.
1) creating files in stagging sandbox with the help of AVMService.
2) creating a separate translation store and copy the same file to it.
3) creating an action to submit the file to the workflow.
4) finally execute the action.
i tried it with two ways first one is creating an action to execute javascript, but it is not executing,
and second one is i created an action to start a workflow for this it is giving exception invalid node ref and node does not exist

org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: avm://Sports–Translation–en–28e37284-ab0a-11dd-b87a-4d5e6d1f30ed/-1;www;avm_webapps;ROOT;English;2008;8;25spo0005.08082501355.xml
        at org.alfresco.repo.node.db.DbNodeServiceImpl.getNodeNotNull(DbNodeServiceImpl.java:142)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.addChild(DbNodeServiceImpl.java:794)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:163)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
        at $Proxy3.addChild(Unknown Source)
        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.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
        at $Proxy4.addChild(Unknown Source)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:241)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:241)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:280)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:280)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
        at $Proxy3.addChild(Unknown Source)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
        at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
        at $Proxy3.addChild(Unknown Source)
        at org.alfresco.repo.workflow.StartWorkflowActionExecuter.executeImpl(StartWorkflowActionExecuter.java:129)
        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:120)
        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:537)
        at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:472)
        at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:399)
        at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:387)
        at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:545)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
        at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
        at $Proxy18.executeAction(Unknown Source)
        at com.sports.core.util.WorkflowUtil.createTranslationStore(Unknown Source)
        at com.sports.core.util.WorkflowUtil.createAndStartWorkflow(Unknown Source)
        at com.sports.core.util.WorkflowUtil.submitToWorkflow(Unknown Source)
        at com.sports.core.content.dao.RepositoryImplDao.createNewsNodes(Unknown Source)
        at com.sports.core.content.dao.RepositoryImplDao.saveTree(Unknown Source)
        at com.sports.core.content.dao.RepositoryImplDao.saveContent(Unknown Source)
        at com.sports.core.content.AssetManager.saveRepositoryContent(Unknown Source)
        at com.sports.core.content.AssetManager.importContent(Unknown Source)
        at com.sports.core.content.service.ContentIngestionService.importContent(Unknown Source)
        at com.sports.core.content.scheduler.ContentIngestionScheduler.execute(Unknown Source)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

Thanks,
Rupesh
6 REPLIES 6

rupesh_alfresco
Champ in-the-making
Champ in-the-making
Hi All,
i got success to start the workflow programmatically but whenever it is going to the particular user, it is not displaying the content in to the resource section.
That means it is unable to get the resource on which workflow started there is some association problem of resource, it will be great anybody  can guide me.
Thanks in Advance.

Regards,
Rupesh

himanshu
Champ in-the-making
Champ in-the-making
Hi Rupesh,

I am trying to create content programatically in WCM using Java-backed Web-script.

From your earlier post it seems that you were able to achieve this.

Can you please help me with this, and if possible kindly share the code so that i can get a fair idea about it.

Thanks in advance

Regards
Himanshu

brian_robinson
Champ in-the-making
Champ in-the-making
Rupesh,

What version of Alfresco are you running?

Thanks,
-Brian

rupesh_alfresco
Champ in-the-making
Champ in-the-making
hi Brian,
The problem is resolved and i am using alfresco version 2.2.2.

Himanshu- i am not creating content just moving content from file system to Alfresco Avm Repository

himanshu
Champ in-the-making
Champ in-the-making
Hi Rupesh,

I was also able to create content programatically.

So how were you able to resolve your problem of starting the workflow??

Regards
~~Himanshu Seth~~

http://www.IntelliGrape.com

alfdhar
Champ in-the-making
Champ in-the-making
Hi All,

I am trying to initiate a wcm workflow using java backed webscript. right now am using

workflowService.startWorkflow(wid,parameters);

The workflow has initiated but its not attached with any group and content .. Please help me on this.. Its very urgent

Thanks in Advance