03-20-2014 11:57 AM
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="Examples">
<process id="MyTest" name="MyTest">
<startEvent id="theStart" name="Start">
</startEvent>
<serviceTask id="javaService" name="Java service invocation" activiti:class="org.activiti.examples.bpmn.test.manager2.SetterTest">
<extensionElements>
<activiti:field name="text">
<activiti:string>Success</activiti:string>
</activiti:field>
<activiti:taskListener event="create" class="org.activiti.examples.bpmn.test.manager2.SetterTest">
</activiti:taskListener>
</extensionElements>
</serviceTask>
<userTask id="usertask1" name="User Task" activiti:candidateGroups="user"></userTask>
<endEvent id="theEnd" name="End"></endEvent>
<sequenceFlow id="flow1" name="" sourceRef="theStart" targetRef="javaService"></sequenceFlow>
<sequenceFlow id="flow2" name="" sourceRef="javaService" targetRef="usertask1"></sequenceFlow>
<sequenceFlow id="flow4" name="" sourceRef="usertask1" targetRef="theEnd"></sequenceFlow>
</process>
</definitions>
package org.activiti.examples.bpmn.test.manager2;
import …
……….
public class SetterTest implements JavaDelegate {
private static final String VARIABLE_NAME = "testVariable";
private Expression text;
ServiceRegistry serviceRegistry=null;
//public ServiceRegistry getServiceRegistry() {return serviceRegistry;}
protected ServiceRegistry getServiceRegistry() {
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null) {
ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
if (registry == null) {
throw new RuntimeException(
"Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" +
ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
}
else
System.out.println("————— config =null");
return registry;
}
throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context");
}
public void setServiceRegistry(ServiceRegistry serviceRegistry) {this.serviceRegistry = serviceRegistry;}
public void execute(DelegateExecution execution)
{
if (serviceRegistry==null)
System.out.println("serviceRegistry is null!!");
}
}
03-21-2014 12:08 PM
activiti:class
attribute, I'll recommand you to declare your delegate as a bean, inject the services you need, and reference this bean in your serviceTask via the activiti:delegateExpression
attribute (see the Activiti guide for more information).org.activiti.engine.delegate.TaskListener
interface.
03-25-2014 05:58 AM
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="Examples">
<process id="certificadosExpedientesCMAE" name="CMAE 10:48 - Generación de certificados de expedientes">
<startEvent id="theStart" name="Start">
</startEvent>
<serviceTask id="javaService" activiti:delegateExpression="${CreacionCertificadosExpedientes}">
</serviceTask>
<userTask id="usertask1" name="User Task" activiti:candidateGroups="user"></userTask>
<endEvent id="theEnd" name="End"></endEvent>
<sequenceFlow id="flow1" name="" sourceRef="theStart" targetRef="javaService"></sequenceFlow>
<sequenceFlow id="flow2" name="" sourceRef="javaService" targetRef="usertask1"></sequenceFlow>
<sequenceFlow id="flow3" name="" sourceRef="usertask1" targetRef="theEnd"></sequenceFlow>
</process>
</definitions>
<bean id="CreacionCertificadosExpedientes"
class="org.activiti.colaboracion.cmae.wfs.expedientes.certificados.CreacionCertificadosExpedientes" parent="baseJavaDelegate" abstract="true" depends-on="activitiBeanRegistry">
<property name="serviceRegistry">
<ref bean="ServiceRegistry" />
</property>
</bean>
03-25-2014 11:26 AM
<bean id="creacionCertificadosExpedientes" class="org.activiti.colaboracion.cmae.wfs.expedientes.certificados.CreacionCertificadosExpedientes" parent="baseJavaDelegate">
</bean>
03-25-2014 12:23 PM
17:13:35,500 INFO [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] Starting 'sysAdmin' subsystem, ID: [sysAdmin, default]
17:13:35,652 INFO [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] Startup of 'sysAdmin' subsystem, ID: [sysAdmin, default] complete
17:13:46,082 DEBUG [org.alfresco.repo.workflow.jbpm.JBPMTransactionTemplate] jBPM persistence service present
17:13:46,082 DEBUG [org.alfresco.repo.workflow.jbpm.JBPMTransactionTemplate] creating hibernateTemplate based on jBPM SessionFactory
17:13:46,236 DEBUG [org.alfresco.repo.workflow] Registered Workflow Component 'jbpm' (class org.alfresco.repo.workflow.jbpm.JBPMEngine)
17:13:46,245 DEBUG [org.alfresco.repo.workflow] Registered Task Component 'jbpm' (class org.alfresco.repo.workflow.jbpm.JBPMEngine)
17:13:47,199 DEBUG [org.alfresco.repo.workflow] Registered Workflow Component 'activiti' (class org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine)
17:13:47,200 DEBUG [org.alfresco.repo.workflow] Registered Task Component 'activiti' (class org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine)
17:13:48,269 WARN [org.alfresco.util.AbstractTriggerBean] Job ehCacheTracerJob is not active
17:13:52,364 DEBUG [org.alfresco.repo.module.ModuleComponentHelper] Registered component: ModuleComponent[ module=intranetAmp, name=justicia.intranetamp.component, since=1.0, appliesFrom=1.0, appliesTo=999, onceOnly=true]
17:13:53,964 INFO [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] Stopping 'sysAdmin' subsystem, ID: [sysAdmin, default]
17:13:53,993 INFO [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] Stopped 'sysAdmin' subsystem, ID: [sysAdmin, default]
17:13:54,013 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'creacionCertificadosExpedientes' defined in class path resource [alfresco/module/colaboracionAmp/context/wf-certificados-expedientes-context.xml]:
Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException:
Invalid property 'beanRegistry'
of bean class
[org.activiti.colaboracion.cmae.wfs.expedientes.certificados.CreacionCertificadosExpedientes]:
Bean property 'beanRegistry' is not writable or has an invalid setter method. Does the parameter
type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.NotWritablePropertyException:
Invalid property 'beanRegistry' of bean class
[org.activiti.colaboracion.cmae.wfs.expedientes.certificados.CreacionCertificadosExpedientes]:
Bean property 'beanRegistry' is not writable or has an invalid setter method.
Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
… 38 more
03-26-2014 04:17 AM
03-26-2014 11:30 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.