Search in sources :

Example 1 with WorkflowApplication

use of com.centurylink.mdw.workflow.WorkflowApplication 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);
}
Also used : WorkflowApplication(com.centurylink.mdw.workflow.WorkflowApplication) WorkflowEnvironment(com.centurylink.mdw.workflow.WorkflowEnvironment) BigInteger(java.math.BigInteger) ManagedNode(com.centurylink.mdw.workflow.ManagedNode) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Example 2 with WorkflowApplication

use of com.centurylink.mdw.workflow.WorkflowApplication in project mdw-designer by CenturyLinkCloud.

the class ImportProjectPage method populateProjectList.

public void populateProjectList() {
    List<WorkflowProject> projectList = new ArrayList<>();
    String workflowApp = applicationCombo.getText();
    if (discoveredWorkflowApps != null) {
        for (WorkflowApplication discoveredApp : discoveredWorkflowApps) {
            if (workflowApp.equals(discoveredApp.getName())) {
                // set the project list
                for (WorkflowEnvironment workflowEnv : discoveredApp.getEnvironmentList()) {
                    WorkflowProject project = new WorkflowProject(discoveredApp, workflowEnv);
                    projectList.add(project);
                }
                break;
            }
        }
    }
    setProjectList(projectList);
    ((ImportProjectWizard) getWizard()).initializeProjectSelectPage();
}
Also used : WorkflowApplication(com.centurylink.mdw.workflow.WorkflowApplication) WorkflowEnvironment(com.centurylink.mdw.workflow.WorkflowEnvironment) ArrayList(java.util.ArrayList) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Aggregations

WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2 WorkflowApplication (com.centurylink.mdw.workflow.WorkflowApplication)2 WorkflowEnvironment (com.centurylink.mdw.workflow.WorkflowEnvironment)2 ManagedNode (com.centurylink.mdw.workflow.ManagedNode)1 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1