use of com.centurylink.mdw.workflow.ManagedNode in project mdw-designer by CenturyLinkCloud.
the class MdwWorkbenchWindowAdvisor method getWorkflowProject.
private WorkflowProject getWorkflowProject(String host, String port, String contextRoot) throws DiscoveryException {
BigInteger portInt = new BigInteger(port);
WorkflowApplication matchingWorkflowApp = null;
WorkflowEnvironment matchingWorkflowEnv = null;
boolean isLocalhost = "localhost".equals(host);
List<WorkflowApplication> workflowApps = WorkflowProjectManager.getInstance().discoverWorkflowApps();
for (WorkflowApplication workflowApp : workflowApps) {
if (isLocalhost) {
// right info except host and port
if (workflowApp.getWebContextRoot().equals(contextRoot) || (workflowApp.getServicesContextRoot() != null && workflowApp.getServicesContextRoot().equals(contextRoot))) {
matchingWorkflowApp = workflowApp;
matchingWorkflowEnv = workflowApp.getEnvironmentList().get(0);
ManagedNode server = matchingWorkflowEnv.getManagedServerList().get(0);
server.setHost(host);
server.setPort(new BigInteger(port));
break;
}
} else {
for (WorkflowEnvironment workflowEnv : workflowApp.getEnvironmentList()) {
for (ManagedNode server : workflowEnv.getManagedServerList()) {
if (server.getHost().equals(host) && server.getPort().equals(portInt)) {
if (matchingWorkflowEnv == null) {
matchingWorkflowEnv = workflowEnv;
matchingWorkflowApp = workflowApp;
} else {
// context root is only used to break a tie
if (workflowApp.getWebContextRoot().equals(contextRoot) || (workflowApp.getServicesContextRoot() != null && workflowApp.getServicesContextRoot().equals(contextRoot))) {
matchingWorkflowEnv = workflowEnv;
matchingWorkflowApp = workflowApp;
}
}
}
}
}
}
}
if (matchingWorkflowApp == null)
return null;
return new WorkflowProject(matchingWorkflowApp, matchingWorkflowEnv);
}
Aggregations