snippets/get-servlet-context-by-process-definition/src/main/java/org/example/get_servlet_context_by_process_definition/ProcessApplicationHelper.java
public static ProcessApplicationInfo getProcessApplicationInfo(String processDefinitionId) {
		ProcessEngineService processEngineService = BpmPlatform.getProcessEngineService();
		ProcessApplicationService processAppService = BpmPlatform.getProcessApplicationService();
		// iterate over all process applications
		for (String appName : processAppService.getProcessApplicationNames()) {
			ProcessApplicationInfo appInfo = processAppService
					.getProcessApplicationInfo(appName);
			// iterate over all deployments of a process application
			for (ProcessApplicationDeploymentInfo deploymentInfo : appInfo
					.getDeploymentInfo()) {
				long count = processEngineService
						.getProcessEngine(deploymentInfo.getProcessEngineName())
						.getRepositoryService().createProcessDefinitionQuery()
						.deploymentId(deploymentInfo.getDeploymentId())
						.processDefinitionId(processDefinitionId).count();
				if (count > 0) {
					return appInfo;
				}
			}
		}
		return null;
	}
public static ProcessApplicationInfo getProcessApplicationInfo(String processDefinitionId) {
		ProcessEngineService processEngineService = BpmPlatform.getProcessEngineService();
		ProcessApplicationService processAppService = BpmPlatform.getProcessApplicationService();
		// iterate over all process applications
		for (String appName : processAppService.getProcessApplicationNames()) {
			ProcessApplicationInfo appInfo = processAppService
					.getProcessApplicationInfo(appName);
			// iterate over all deployments of a process application
			for (ProcessApplicationDeploymentInfo deploymentInfo : appInfo
					.getDeploymentInfo()) {
				long count = processEngineService
						.getProcessEngine(deploymentInfo.getProcessEngineName())
						.getRepositoryService().createProcessDefinitionQuery()
						.deploymentId(deploymentInfo.getDeploymentId())
						.processDefinitionId(processDefinitionId).count();
				if (count > 0) {
					return appInfo;
				}
			}
		}
		return null;
	}
public static ProcessApplicationInfo getProcessApplicationInfo ( String processDefinitionId ) { ProcessEngineService processEngineService = BpmPlatform . getProcessEngineService ( ) ; ProcessApplicationService processAppService = BpmPlatform . getProcessApplicationService ( ) ; // iterate over all process applications for ( String appName : processAppService . getProcessApplicationNames ( ) ) { ProcessApplicationInfo appInfo = processAppService . getProcessApplicationInfo ( appName ) ; // iterate over all deployments of a process application for ( ProcessApplicationDeploymentInfo deploymentInfo : appInfo . getDeploymentInfo ( ) ) { long count = processEngineService . getProcessEngine ( deploymentInfo . getProcessEngineName ( ) ) . getRepositoryService ( ) . createProcessDefinitionQuery ( ) . deploymentId ( deploymentInfo . getDeploymentId ( ) ) . processDefinitionId ( processDefinitionId ) . count ( ) ; if ( count > 0 ) { return appInfo ; } } } return null ; }
Retrieve the application info path of a process definition from any process engine.
Retrieve the application info path of a process definition from any process engine .