Hello.
New to Alfresco Activity.
I have uploaded some files in my process. Now I want to access them in my execution listener but whenever I try to Autowire the RelatedContentService it gives me null. I will attach picture of my relevant code.
In thee activiti the user task only calls this execution listener. It does call the listener.
I am doing it on a trial version if that's relevant
I haven't done any configurations. I have tried to list the bean in activit.cfg.xml but it doesn't work
package com.elixir.fileWriter;
import com.activiti.domain.runtime.RelatedContent;
import com.activiti.service.runtime.RelatedContentService;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.activiti.engine.delegate.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component;
@Component("fileWriterExecuter")
public class FileWriterExecuter implements JavaDelegate {
@Autowired
private RelatedContentService relatedContentService;
@Override
public void execute(DelegateExecution execution) throws Exception {
execution.getVariable("attachment", InputStream.class);
String absoluteFilePath = "D:\\filetest\\fileExecution.txt";
File file = new File(absoluteFilePath);
List<RelatedContent> relatedContent = new ArrayList<RelatedContent>();
Page<RelatedContent> page = null;
int pageNumber = 0;
//RelatedContentService relatedContentService = new RelatedContentService();
while ((page == null) || (page.hasNext())) {
page = relatedContentService
.getAllFieldContentForProcessInstance(
execution.getProcessInstanceId(), 50,
pageNumber);
relatedContent.addAll(page.getContent());
pageNumber++;
}
}