Skip to content

ProcessManagerRemote API

Jinyoung Jang edited this page May 15, 2017 · 12 revisions

#ProcessManagerRemote API ProcessManagerRemote is the interface to invoke uEngine's APIs

Spring example to invoke uEngine APIs

@Component
public class ProcessService{

    @Autowired
    @Qualifier("processManagerBeanForQueue")
    ProcessManagerRemote pm;  //Declare uEngine's API proxy.

    @Transactional  //You have to declare this for transaction demarcation
    public void runProcess(Map<String, String> paramMap) throws Exception{
        String defId = paramMap.get("defId");
        String userId = paramMap.get("userId");
        String userName = paramMap.get("userName");
        String processVariableValue = paramMap.get("pvv");
        new TenantContext(paramMap.get("tenantId"));

        String initInstId = "";
        ProcessInstance instance = null;
            
            initInstId = pm.initializeProcess(defId);

            instance = pm.getProcessInstance(initInstId);

            instance.set("var1", processVariableValue1);
            instance.set("var2", processVariableValue2);

            RoleMapping roleMapping = RoleMapping.create();
            roleMapping.setName("Initiator");
            roleMapping.setEndpoint(userId);
            roleMapping.setResourceName(userName);
            roleMapping.fill(instance);
            instance.putRoleMapping(roleMapping);

            pm.executeProcess(initInstId);

    }
}

API descriptions

###public String initializeProcess(String defVerId) throws RemoteException;

intialize a process instance. it would not actually start an instance, just initializes an instance and wait for setting the variables, and role mappings before it actually begin by executeActivity()
parameters  : defVerId - process definition's id
returns    : instance id.

###public ProcessInstance getProcessInstance(String instanceId) throws RemoteException;

용도 해당  : instanceId의 processInstace 객체를 얻어온다.
파라미터   : instanceId – processInstance의 ID값
반환값     : ProcessInstance 객체를 반환한다.

###public void executeProcess(String instanceId) throws RemoteException;

용도 해당 : instanceid의 procssInstance를 실행 개시한다.
파라미터  : instanceId - instance의 ID값
반환값    : 없음(void)

FAQ

Production Version 으로 프로세스 정의 시작시키기

	@Autowired
	VersionManager versionManager;

...
	versionManager.setAppName("codi");
	String prodDefId = versionManager.getProductionResourcePath(defId);

	processManager.initializeProcess(prodDefId);