Search in sources :

Example 1 with ProjectNode

use of com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode in project convertigo by convertigo.

the class ReferencesView method getRequiredRequestables.

private void getRequiredRequestables(Step step, Project projectSelected, ProjectExplorerView projectExplorerView, AbstractParentNode parentNode, List<String> transactionList, List<String> sequenceList) {
    try {
        if (step instanceof SequenceStep) {
            SequenceStep sequenceStep = (SequenceStep) step;
            String sourceProjectName = sequenceStep.getProjectName();
            if (!sourceProjectName.equals(projectSelected.getName())) {
                Project project;
                project = getProject(sourceProjectName, projectExplorerView);
                ProjectNode projectNode = new ProjectNode(parentNode, sourceProjectName, project);
                Sequence sourceSequence = null;
                String sourceSequenceName = sequenceStep.getSequenceName();
                try {
                    if (project != null)
                        sourceSequence = project.getSequenceByName(sourceSequenceName);
                } catch (EngineException e) {
                    sourceSequence = null;
                }
                projectNode.addChild(new SequenceNode(projectNode, sourceSequenceName, sourceSequence));
                if (!sequenceList.contains(sourceProjectName + sourceSequenceName)) {
                    sequenceList.add(sourceProjectName + sourceSequenceName);
                    parentNode.addChild(projectNode);
                }
            }
        } else if (step instanceof TransactionStep) {
            TransactionStep transactionStep = (TransactionStep) step;
            String sourceProjectName = transactionStep.getProjectName();
            if (!sourceProjectName.equals(projectSelected.getName())) {
                Project project;
                project = getProject(sourceProjectName, projectExplorerView);
                ProjectNode projectNode = new ProjectNode(parentNode, sourceProjectName, project);
                if (project != null) {
                    Connector connector = project.getConnectorByName(transactionStep.getConnectorName());
                    ConnectorNode connectorNode = null;
                    connectorNode = getConnectorNode(projectNode, connector);
                    projectNode.addChild(connectorNode);
                    Transaction sourceTransaction = null;
                    String sourceTransactionName = transactionStep.getTransactionName();
                    try {
                        if (connector != null)
                            sourceTransaction = connector.getTransactionByName(sourceTransactionName);
                    } catch (Exception e) {
                        sourceTransaction = null;
                    }
                    connectorNode.addChild(new TransactionNode(connectorNode, sourceTransactionName, sourceTransaction));
                    if (!transactionList.contains(project.getName() + connector.getName() + sourceTransactionName)) {
                        transactionList.add(project.getName() + connector.getName() + sourceTransactionName);
                        parentNode.addChild(projectNode);
                    }
                }
            }
        } else if (isStepContainer(step)) {
            List<Step> steps = getStepList(step);
            if (steps != null) {
                for (Step s : steps) {
                    getRequiredRequestables(s, projectSelected, projectExplorerView, parentNode, transactionList, sequenceList);
                }
            }
        }
    } catch (EngineException e) {
        ConvertigoPlugin.logException(e, "Unable to load the project", true);
    }
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) ProxyHttpConnector(com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) EngineException(com.twinsoft.convertigo.engine.EngineException) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) BlockStep(com.twinsoft.convertigo.beans.steps.BlockStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) ConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ConnectorNode) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) JavelinConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.JavelinConnectorNode) CicsConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.CicsConnectorNode) SqlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SqlConnectorNode) ProxyHttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ProxyHttpConnectorNode) HttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HttpConnectorNode) EngineException(com.twinsoft.convertigo.engine.EngineException) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Project(com.twinsoft.convertigo.beans.core.Project) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 2 with ProjectNode

use of com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode in project convertigo by convertigo.

the class ReferencesView method handleProjectSelection.

private void handleProjectSelection(Object firstElement) {
    List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
    ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
    Project projectSelected = null;
    ProjectTreeObject projectTreeObjectSelected = null;
    UnloadedProjectTreeObject unloadedProjectTreeObjectSelected = null;
    if (firstElement instanceof ProjectTreeObject) {
        projectTreeObjectSelected = (ProjectTreeObject) firstElement;
        projectSelected = projectTreeObjectSelected.getObject();
    } else if (firstElement instanceof UnloadedProjectTreeObject) {
        unloadedProjectTreeObjectSelected = (UnloadedProjectTreeObject) firstElement;
        String projectNameSelected = unloadedProjectTreeObjectSelected.getName();
        projectSelected = getProject(projectNameSelected, projectExplorerView);
    }
    if (projectSelected == null) {
        return;
    }
    String projectNameSelected = projectSelected.getName();
    treeViewer.setInput(null);
    // Get the referencing sequences and transactions
    List<Sequence> sequences = projectSelected.getSequencesList();
    RootNode root = new RootNode();
    ProjectNode projectNode = new ProjectNode(root, projectNameSelected, projectSelected);
    root.addChild(projectNode);
    // Get all the projects needed to successfully execute the selected project
    // i.e. get all CallTransaction and CallSequence steps from the selected project
    // that refer to other projects
    RequiresNode requiresNode = new RequiresNode(root, "Requires");
    // Search for external sequence or transaction referenced by CallSequence or CallTransaction
    // from the selected project
    List<String> transactionList = new ArrayList<String>();
    List<String> sequenceList = new ArrayList<String>();
    for (Sequence sequence : sequences) {
        List<Step> steps = sequence.getSteps();
        for (Step step : steps) {
            getRequiredRequestables(step, projectSelected, projectExplorerView, requiresNode, transactionList, sequenceList);
        }
    }
    UrlMapper urlMapper = projectSelected.getUrlMapper();
    if (urlMapper != null) {
        List<UrlMapping> mappings = urlMapper.getMappingList();
        for (UrlMapping mapping : mappings) {
            List<UrlMappingOperation> operations = mapping.getOperationList();
            for (UrlMappingOperation operation : operations) {
                try {
                    String targetRequestableName = operation.getTargetRequestable();
                    if (!targetRequestableName.isEmpty() && !targetRequestableName.startsWith(projectNameSelected)) {
                        handleTargetRequestable(targetRequestableName, projectExplorerView, requiresNode);
                    }
                } catch (Exception e) {
                    ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
                }
            }
        }
    }
    if (requiresNode.hasChildren()) {
        projectNode.addChild(requiresNode);
    } else {
        projectNode.addChild(new InformationNode(projectNode, "This project does not require any other project"));
    }
    // Get all the projects using the selected project
    // i.e. get all CallTransaction and CallSequence steps that refer to transactions
    // or sequences from the selected project
    IsUsedByNode isUsedByNode = new IsUsedByNode(root, "Is used by");
    for (String projectName : projectNames) {
        if (!(projectName.equals(projectNameSelected))) {
            Project project = getProject(projectName, projectExplorerView);
            if (project == null) {
                // Unable to load the project, just ignore it
                ConvertigoPlugin.logWarning("[References View] Unable to load the project \"" + projectName + "\"", false);
                continue;
            }
            ProjectNode projectFolderExports = new ProjectNode(root, projectName, project);
            urlMapper = project.getUrlMapper();
            if (urlMapper != null) {
                MapperNode mapperNode = new MapperNode(projectFolderExports, urlMapper.getName(), urlMapper);
                List<UrlMapping> mappings = urlMapper.getMappingList();
                for (UrlMapping mapping : mappings) {
                    MappingPathNode pathNode = new MappingPathNode(mapperNode, mapping.getPath(), mapping);
                    List<UrlMappingOperation> operations = mapping.getOperationList();
                    for (UrlMappingOperation operation : operations) {
                        String targetRequestable = operation.getTargetRequestable();
                        if (targetRequestable.startsWith(projectNameSelected + ".")) {
                            MappingOperationNode operationNode = new MappingOperationNode(pathNode, operation.getName(), operation);
                            pathNode.addChild(operationNode);
                        }
                    }
                    if (pathNode.hasChildren()) {
                        mapperNode.addChild(pathNode);
                    }
                }
                if (mapperNode.hasChildren()) {
                    projectFolderExports.addChild(mapperNode);
                }
            }
            List<Sequence> sequencesList = project.getSequencesList();
            for (Sequence sequence : sequencesList) {
                // Search for CallTransaction and CallSequence
                // referencing a transaction or sequence
                // from the selected project
                List<Step> stepList = sequence.getSteps();
                SequenceNode sequenceNode = new SequenceNode(root, sequence.getName(), sequence);
                for (Step step : stepList) {
                    getUsedRequestables(step, projectSelected, sequenceNode);
                }
                if (sequenceNode.hasChildren()) {
                    projectFolderExports.addChild(sequenceNode);
                }
            }
            if (projectFolderExports.hasChildren()) {
                isUsedByNode.addChild(projectFolderExports);
            }
        }
    }
    if (isUsedByNode.hasChildren()) {
        projectNode.addChild(isUsedByNode);
    } else {
        projectNode.addChild(new InformationNode(projectNode, "This project is not used by any other project"));
    }
    treeViewer.setInput(null);
    treeViewer.setInput(root);
    treeViewer.expandAll();
}
Also used : UrlMapping(com.twinsoft.convertigo.beans.core.UrlMapping) RootNode(com.twinsoft.convertigo.eclipse.views.references.model.RootNode) MapperNode(com.twinsoft.convertigo.eclipse.views.references.model.MapperNode) ArrayList(java.util.ArrayList) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) BlockStep(com.twinsoft.convertigo.beans.steps.BlockStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) InformationNode(com.twinsoft.convertigo.eclipse.views.references.model.InformationNode) UrlMapper(com.twinsoft.convertigo.beans.core.UrlMapper) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) UrlMappingOperation(com.twinsoft.convertigo.beans.core.UrlMappingOperation) Sequence(com.twinsoft.convertigo.beans.core.Sequence) MappingOperationNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingOperationNode) EngineException(com.twinsoft.convertigo.engine.EngineException) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) Project(com.twinsoft.convertigo.beans.core.Project) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) MappingPathNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingPathNode) RequiresNode(com.twinsoft.convertigo.eclipse.views.references.model.RequiresNode) IsUsedByNode(com.twinsoft.convertigo.eclipse.views.references.model.IsUsedByNode) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 3 with ProjectNode

use of com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode in project convertigo by convertigo.

the class ReferencesView method handleTransactionSelection.

private void handleTransactionSelection(Object firstElement) {
    TransactionTreeObject transactionTreeObject = (TransactionTreeObject) firstElement;
    Transaction transaction = transactionTreeObject.getObject();
    String transactionName = transactionTreeObject.getName();
    // Get the referencing sequence steps
    String transactionProjectName = transaction.getProject().getName();
    String transactionConnectorName = transaction.getParent().getName();
    try {
        Project project = null;
        List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
        ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
        treeViewer.setInput(null);
        RootNode root = new RootNode();
        TransactionNode transactionFolder = new TransactionNode(root, transactionName, transaction);
        root.addChild(transactionFolder);
        IsUsedByNode isUsedByNode = new IsUsedByNode(transactionFolder, "Is used by");
        RequiresNode requiresNode = new RequiresNode(transactionFolder, "Requires");
        ProjectNode projectFolder = null;
        // Searching all objects are required transaction selected
        Connector connector = transaction.getConnector();
        if (connector instanceof HtmlConnector) {
            Project proj = ((HtmlConnector) connector).getProject();
            ProjectNode projectNode = new ProjectNode(requiresNode, transactionProjectName, proj);
            HtmlTransaction htmlTransaction = (HtmlTransaction) transaction;
            List<Statement> statements = htmlTransaction.getStatements();
            List<ScreenClass> screenClassList = new ArrayList<ScreenClass>();
            List<String> siteClipperConnectorNames = new ArrayList<String>();
            for (Statement statement : statements) {
                if (statement instanceof ScHandlerStatement) {
                    ScHandlerStatement scHandlerStatement = (ScHandlerStatement) statement;
                    String screenClassName = scHandlerStatement.getNormalizedScreenClassName();
                    ScreenClass screenClass = ((HtmlConnector) connector).getScreenClassByName(screenClassName);
                    if (screenClass != null) {
                        if (!screenClassList.contains(screenClass)) {
                            screenClassList.add(screenClass);
                            requiresNode.addChild(new ScreenClassNode(requiresNode, screenClassName, screenClass));
                        }
                    }
                }
                List<Statement> statementList = ((FunctionStatement) statement).getStatements();
                for (Statement st : statementList) {
                    if (st instanceof ContinueWithSiteClipperStatement) {
                        ContinueWithSiteClipperStatement continueWithSiteClipperStatement = (ContinueWithSiteClipperStatement) st;
                        String siteClipperconnectorName = continueWithSiteClipperStatement.getSiteClipperConnectorName();
                        if (!siteClipperConnectorNames.contains(siteClipperconnectorName)) {
                            siteClipperConnectorNames.add(siteClipperconnectorName);
                            Connector siteClipperConnector = proj.getConnectorByName(siteClipperconnectorName);
                            ConnectorNode connectorSiteClipperNode = new SiteClipperConnectorNode(projectNode, siteClipperconnectorName, siteClipperConnector);
                            projectNode.addChild(connectorSiteClipperNode);
                        }
                    }
                }
            }
            if (projectNode.hasChildren()) {
                requiresNode.addChild(projectNode);
            }
        } else if (connector instanceof JavelinConnector) {
            JavelinTransaction javelinTransaction = (JavelinTransaction) transaction;
            String handlers = javelinTransaction.handlers;
            List<JavelinScreenClass> screenClasses = ((JavelinConnector) connector).getAllScreenClasses();
            List<JavelinScreenClass> screenClassList = new ArrayList<JavelinScreenClass>();
            for (JavelinScreenClass screenClass : screenClasses) {
                if (handlers.indexOf("function on" + screenClass.getName()) != -1) {
                    if (!screenClassList.contains(screenClass)) {
                        screenClassList.add(screenClass);
                        requiresNode.addChild(new ScreenClassNode(requiresNode, screenClass.getName(), screenClass));
                    }
                }
            }
        }
        // Searching all objects are used transaction selected
        for (String projectName : projectNames) {
            project = getProject(projectName, projectExplorerView);
            if (project != null) {
                projectFolder = new ProjectNode(isUsedByNode, project.getName(), project);
                UrlMapper urlMapper = project.getUrlMapper();
                if (urlMapper != null) {
                    MapperNode mapperNode = new MapperNode(projectFolder, urlMapper.getName(), urlMapper);
                    List<UrlMapping> mappings = urlMapper.getMappingList();
                    for (UrlMapping mapping : mappings) {
                        MappingPathNode pathNode = new MappingPathNode(mapperNode, mapping.getPath(), mapping);
                        List<UrlMappingOperation> operations = mapping.getOperationList();
                        for (UrlMappingOperation operation : operations) {
                            String targetRequestable = operation.getTargetRequestable();
                            if (targetRequestable.equals(transactionProjectName + "." + transactionConnectorName + "." + transactionName)) {
                                MappingOperationNode operationNode = new MappingOperationNode(pathNode, operation.getName(), operation);
                                pathNode.addChild(operationNode);
                            }
                        }
                        if (pathNode.hasChildren()) {
                            mapperNode.addChild(pathNode);
                        }
                    }
                    if (mapperNode.hasChildren()) {
                        projectFolder.addChild(mapperNode);
                    }
                }
                List<Sequence> sequences = project.getSequencesList();
                for (Sequence sequence : sequences) {
                    List<Step> stepList = sequence.getAllSteps();
                    SequenceNode sequenceNode = new SequenceNode(projectFolder, sequence.getName(), sequence);
                    for (Step step : stepList) {
                        getTransactionReferencing(step, projectExplorerView, sequenceNode, transactionProjectName, transactionConnectorName, transactionName);
                    }
                    if (sequenceNode.hasChildren()) {
                        projectFolder.addChild(sequenceNode);
                    }
                }
                if (projectFolder.hasChildren()) {
                    isUsedByNode.addChild(projectFolder);
                }
            }
        }
        if (requiresNode.hasChildren()) {
            transactionFolder.addChild(requiresNode);
        }
        if (isUsedByNode.hasChildren()) {
            transactionFolder.addChild(isUsedByNode);
        }
        if (!transactionFolder.hasChildren()) {
            transactionFolder.addChild(new InformationNode(projectFolder, "This transaction is not used in any sequence"));
        }
        treeViewer.setInput(root);
        treeViewer.expandAll();
    } catch (EngineException e) {
        ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
    }
}
Also used : UrlMapping(com.twinsoft.convertigo.beans.core.UrlMapping) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) RootNode(com.twinsoft.convertigo.eclipse.views.references.model.RootNode) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) ProxyHttpConnector(com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) ContinueWithSiteClipperStatement(com.twinsoft.convertigo.beans.statements.ContinueWithSiteClipperStatement) MapperNode(com.twinsoft.convertigo.eclipse.views.references.model.MapperNode) JavelinScreenClass(com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass) ScreenClass(com.twinsoft.convertigo.beans.core.ScreenClass) ArrayList(java.util.ArrayList) EngineException(com.twinsoft.convertigo.engine.EngineException) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) BlockStep(com.twinsoft.convertigo.beans.steps.BlockStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) FunctionStatement(com.twinsoft.convertigo.beans.statements.FunctionStatement) ScreenClassNode(com.twinsoft.convertigo.eclipse.views.references.model.ScreenClassNode) InformationNode(com.twinsoft.convertigo.eclipse.views.references.model.InformationNode) List(java.util.List) ArrayList(java.util.ArrayList) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) UrlMapper(com.twinsoft.convertigo.beans.core.UrlMapper) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinScreenClass(com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) UrlMappingOperation(com.twinsoft.convertigo.beans.core.UrlMappingOperation) FunctionStatement(com.twinsoft.convertigo.beans.statements.FunctionStatement) Statement(com.twinsoft.convertigo.beans.core.Statement) ContinueWithSiteClipperStatement(com.twinsoft.convertigo.beans.statements.ContinueWithSiteClipperStatement) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) MappingOperationNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingOperationNode) Sequence(com.twinsoft.convertigo.beans.core.Sequence) ConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ConnectorNode) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) JavelinConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.JavelinConnectorNode) CicsConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.CicsConnectorNode) SqlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SqlConnectorNode) ProxyHttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ProxyHttpConnectorNode) HttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HttpConnectorNode) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) Project(com.twinsoft.convertigo.beans.core.Project) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) MappingPathNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingPathNode) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) IsUsedByNode(com.twinsoft.convertigo.eclipse.views.references.model.IsUsedByNode) RequiresNode(com.twinsoft.convertigo.eclipse.views.references.model.RequiresNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement)

Example 4 with ProjectNode

use of com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode in project convertigo by convertigo.

the class ReferencesView method getSequenceReferencingRequires.

private void getSequenceReferencingRequires(Step step, Sequence sequenceSelected, ProjectExplorerView projectExplorerView, RequiresNode requiresNode, List<String> transactionList, List<String> sequenceList) {
    try {
        if (step instanceof SequenceStep) {
            SequenceStep sequenceStep = (SequenceStep) step;
            String projectName = sequenceStep.getProjectName();
            String sequenceName = sequenceStep.getSequenceName();
            Project project = getProject(projectName, projectExplorerView);
            ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
            Sequence sequence = null;
            try {
                if (project != null)
                    sequence = project.getSequenceByName(sequenceStep.getSequenceName());
            } catch (EngineException e) {
                sequence = null;
            }
            SequenceNode sequenceNode = new SequenceNode(projectNode, sequenceName, sequence);
            projectNode.addChild(sequenceNode);
            if (!sequenceList.contains(projectName + sequenceName)) {
                sequenceList.add(projectName + sequenceName);
                requiresNode.addChild(projectNode);
            }
        } else if (step instanceof TransactionStep) {
            TransactionStep transactionStep = (TransactionStep) step;
            String projectName = transactionStep.getProjectName();
            String connectorName = transactionStep.getConnectorName();
            String transactionName = transactionStep.getTransactionName();
            Project project = getProject(projectName, projectExplorerView);
            ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
            Connector connector = null;
            Transaction transaction = null;
            try {
                if (project != null) {
                    connector = project.getConnectorByName(connectorName);
                    if (connector != null) {
                        transaction = connector.getTransactionByName(transactionName);
                    }
                }
            } catch (EngineException e) {
                connector = null;
                transaction = null;
            }
            ConnectorNode connectorNode = getConnectorNode(projectNode, connector);
            if (connectorNode == null)
                connectorNode = new ConnectorNode(projectNode, connectorName, connector);
            projectNode.addChild(connectorNode);
            TransactionNode transactionNode = new TransactionNode(projectNode, transactionName, transaction);
            connectorNode.addChild(transactionNode);
            if (!transactionList.contains(projectName + connectorName + transactionName)) {
                transactionList.add(projectName + connectorName + transactionName);
                requiresNode.addChild(projectNode);
            }
        } else if (isStepContainer(step)) {
            List<Step> steps = getStepList(step);
            for (Step s : steps) {
                getSequenceReferencingRequires(s, sequenceSelected, projectExplorerView, requiresNode, transactionList, sequenceList);
            }
        }
    } catch (Exception e) {
        ConvertigoPlugin.logException(e, "Unable to load the project", true);
    }
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) ProxyHttpConnector(com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) EngineException(com.twinsoft.convertigo.engine.EngineException) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) BlockStep(com.twinsoft.convertigo.beans.steps.BlockStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) ConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ConnectorNode) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) JavelinConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.JavelinConnectorNode) CicsConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.CicsConnectorNode) SqlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SqlConnectorNode) ProxyHttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ProxyHttpConnectorNode) HttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HttpConnectorNode) EngineException(com.twinsoft.convertigo.engine.EngineException) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Project(com.twinsoft.convertigo.beans.core.Project) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 5 with ProjectNode

use of com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode in project convertigo by convertigo.

the class ReferencesView method handleTargetRequestable.

private void handleTargetRequestable(String targetRequestableName, ProjectExplorerView projectExplorerView, RequiresNode requiresNode) throws EngineException {
    StringTokenizer st = new StringTokenizer(targetRequestableName, ".");
    int count = st.countTokens();
    String projectName = st.nextToken();
    Project project = getProject(projectName, projectExplorerView);
    if (project != null) {
        ProjectNode requiresProjectNode = new ProjectNode(requiresNode, projectName, project);
        if (count == 2) {
            String sequenceName = count == 2 ? st.nextToken() : "";
            Sequence sequence = project.getSequenceByName(sequenceName);
            SequenceNode sequenceNode = new SequenceNode(requiresProjectNode, sequenceName, sequence);
            requiresProjectNode.addChild(sequenceNode);
        } else if (count == 3) {
            String connectorName = count == 3 ? st.nextToken() : "";
            Connector connector = project.getConnectorByName(connectorName);
            ConnectorNode connectorNode = new ConnectorNode(requiresProjectNode, connectorName, connector);
            requiresProjectNode.addChild(connectorNode);
            String transactionName = count == 3 ? st.nextToken() : "";
            Transaction transaction = connector.getTransactionByName(transactionName);
            TransactionNode transactionNode = new TransactionNode(connectorNode, transactionName, transaction);
            connectorNode.addChild(transactionNode);
        }
        if (requiresProjectNode.hasChildren()) {
            requiresNode.addChild(requiresProjectNode);
        }
    }
}
Also used : Project(com.twinsoft.convertigo.beans.core.Project) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) ProxyHttpConnector(com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) StringTokenizer(java.util.StringTokenizer) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode) Sequence(com.twinsoft.convertigo.beans.core.Sequence) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) ConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ConnectorNode) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) JavelinConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.JavelinConnectorNode) CicsConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.CicsConnectorNode) SqlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SqlConnectorNode) ProxyHttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ProxyHttpConnectorNode) HttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HttpConnectorNode)

Aggregations

Project (com.twinsoft.convertigo.beans.core.Project)8 Sequence (com.twinsoft.convertigo.beans.core.Sequence)8 ProjectNode (com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)8 SequenceNode (com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode)8 RequestableStep (com.twinsoft.convertigo.beans.core.RequestableStep)7 Step (com.twinsoft.convertigo.beans.core.Step)7 BlockStep (com.twinsoft.convertigo.beans.steps.BlockStep)7 BranchStep (com.twinsoft.convertigo.beans.steps.BranchStep)7 ElseStep (com.twinsoft.convertigo.beans.steps.ElseStep)7 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)7 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)7 TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)7 XMLComplexStep (com.twinsoft.convertigo.beans.steps.XMLComplexStep)7 CicsConnector (com.twinsoft.convertigo.beans.connectors.CicsConnector)6 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)6 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)6 JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)6 ProxyHttpConnector (com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector)6 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)6 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)6