AnsweredAssumed Answered

Modify a Alfresco's node from Activiti context

Question asked by gawel on Sep 20, 2017
Latest reply on Sep 22, 2017 by gawel

Hi,

I have a problem with JavaDelegate class than not modify node on Alfresco Contexte.

Details :

With BPMN workflow (Task service) I call a JAVA CLASS which must modify aspect properties of a (Alfresco) document's Node.

This Class running with success but Node's properties is'nt modify on Alfresco context.

 

Environnement :

- Alfresco 5.2

- JDK8

- H2 et MYSQL

- WIN10 et Centos7

 

My delegateClass :

@Component("DocValidationGiveMetadata")
  24 public class DocValidationGiveMetadata extends AbstractDelegateWorkflowImpl {
  25
  38     @Override
  39     public void executeImpl(DelegateExecution execution) {
  40       
  48         // get Alfresco's NodeRef from activiti context
  49         NodeRef nodeRef = getDocumentNodeRef(BPM_PACKAGE);
  50         // validation state
  51         nodeService.setProperty(nodeRef, EnsaModel.PROP_VALIDATE_STATE, EnsaModel.CONSTR_VALIDATE_STATE_VALIDATED);
  52        
  63         // end of task
  64         endOfTask(true);
  65     }

 

Class AbstractDelegateWorkflowImpl :

32     public abstract class AbstractDelegateWorkflowImpl extends BaseJavaDelegate implements AbstractDelegateWorkflow {
  33
  48     protected ServiceRegistry     serviceRegistry;
  50     protected NodeService         nodeService;
  52     protected DelegateExecution   delegateExecution;
  53
  65     @Override
  66     public void execute(DelegateExecution execution) throws Exception {
  68         this.delegateExecution = execution;
  70         setAlfrescoServices();
  72         executeImpl(execution);
  73     }
  74
  98     public void setAlfrescoServices() {
  99         Map<Object, Object> registeredBeans = Context.getProcessEngineConfiguration().getBeans();
 100         ServiceRegistry registry = (ServiceRegistry) registeredBeans.get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
 101         serviceRegistry = registry;
 102         nodeService = registry.getNodeService();
 103     }

 

Can you help me please?

Outcomes