package com.artfess.activiti.cmd;

import com.artfess.activiti.def.graph.ilog.activiti.ProcessDiagramGenerator;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;

import java.io.InputStream;

public class GenFlowImageCmd implements Command<InputStream> {

    private String bpmnXml = "";

    public GenFlowImageCmd(String bpmnXml) {
        this.bpmnXml = bpmnXml;
    }

    @Override
    public InputStream execute(CommandContext context) {

//		RepositoryService repositoryService=(RepositoryService) AppUtil.getBean("repositoryService");
//		
//		
//		BpmnModel bpmnModel= repositoryService.getBpmnModel(bpmnDefId);

        InputStream inputStream = ProcessDiagramGenerator.generatePngDiagram(bpmnXml);
        return inputStream;
    }

}
