Search in sources :

Example 56 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class ReferencesView method handleConnectorSelection.

private void handleConnectorSelection(Object firstElement) {
    ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) firstElement;
    Connector connectorSelected = connectorTreeObject.getObject();
    String connectorSelectedName = connectorSelected.getName();
    Project projectConnectorSelected = connectorSelected.getProject();
    String connectorProjectName = connectorSelected.getProject().getName();
    List<Transaction> transactions = connectorSelected.getTransactionsList();
    try {
        Project project = null;
        List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
        ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
        treeViewer.setInput(null);
        RootNode root = new RootNode();
        ConnectorNode connectorNode = null;
        connectorNode = getConnectorNode(root, connectorSelected);
        root.addChild(connectorNode);
        IsUsedByNode isUsedByNode = new IsUsedByNode(connectorNode, "Is used by");
        RequiresNode requiresNode = new RequiresNode(connectorNode, "Requires");
        ProjectNode projectFolder = null;
        // Search handlers are that referenced by the selected connector for continue with site Clipper
        if (connectorSelected instanceof HtmlConnector) {
            ProjectNode projectNode = new ProjectNode(requiresNode, connectorProjectName, projectConnectorSelected);
            for (Transaction transaction : transactions) {
                List<Statement> statements = ((HtmlTransaction) transaction).getStatements();
                List<String> siteClipperConnectorNames = new ArrayList<String>();
                for (Statement statement : statements) {
                    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 = projectConnectorSelected.getConnectorByName(siteClipperconnectorName);
                                ConnectorNode connectorSiteClipperNode = new SiteClipperConnectorNode(projectNode, siteClipperconnectorName, siteClipperConnector);
                                projectNode.addChild(connectorSiteClipperNode);
                            }
                        }
                    }
                }
            }
            if (projectNode.hasChildren()) {
                requiresNode.addChild(projectNode);
            }
        } else if (connectorSelected instanceof SiteClipperConnector) {
            List<Connector> connectors = projectConnectorSelected.getConnectorsList();
            ProjectNode projectNode = new ProjectNode(isUsedByNode, connectorProjectName, projectConnectorSelected);
            for (Connector connector : connectors) {
                if (connector instanceof HtmlConnector) {
                    List<Transaction> transactionList = ((HtmlConnector) connector).getTransactionsList();
                    for (Transaction transaction : transactionList) {
                        List<Statement> statements = ((HtmlTransaction) transaction).getStatements();
                        for (Statement statement : statements) {
                            List<Statement> statementList = ((FunctionStatement) statement).getStatements();
                            for (Statement st : statementList) {
                                if (st instanceof ContinueWithSiteClipperStatement) {
                                    String sourceSiteClipperConnectorName = ((ContinueWithSiteClipperStatement) st).getSiteClipperConnectorName();
                                    if (sourceSiteClipperConnectorName.equals(connectorSelectedName)) {
                                        ContinueWithSiteClipperStatement continueWithSiteClipperStatement = (ContinueWithSiteClipperStatement) st;
                                        HtmlConnectorNode htmlConnectorNode = new HtmlConnectorNode(projectNode, connector.getName(), connector);
                                        projectNode.addChild(htmlConnectorNode);
                                        TransactionNode transactionNode = new TransactionNode(htmlConnectorNode, transaction.getName(), continueWithSiteClipperStatement);
                                        htmlConnectorNode.addChild(transactionNode);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (projectNode.hasChildren()) {
                isUsedByNode.addChild(projectNode);
            }
        }
        // Searching all objects that are referenced by the selected connector
        for (String projectName : projectNames) {
            project = getProject(projectName, projectExplorerView);
            if (project != null) {
                projectFolder = new ProjectNode(isUsedByNode, projectName, 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.startsWith(projectConnectorSelected + "." + connectorSelectedName + ".")) {
                                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> steps = sequence.getSteps();
                    SequenceNode sequenceNode = new SequenceNode(projectFolder, sequence.getName(), sequence);
                    for (Step step : steps) {
                        getConnectorReferencingIsUsedBy(step, projectExplorerView, sequenceNode, transactions, connectorProjectName, connectorSelectedName);
                    }
                    if (sequenceNode.hasChildren()) {
                        projectFolder.addChild(sequenceNode);
                    }
                }
                if (projectFolder.hasChildren()) {
                    isUsedByNode.addChild(projectFolder);
                }
            }
        }
        if (requiresNode.hasChildren()) {
            connectorNode.addChild(requiresNode);
        }
        if (isUsedByNode.hasChildren()) {
            connectorNode.addChild(isUsedByNode);
        }
        if (!connectorNode.hasChildren()) {
            connectorNode.addChild(new InformationNode(connectorNode, "This connector is not used by any other objects"));
        }
        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) 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) RootNode(com.twinsoft.convertigo.eclipse.views.references.model.RootNode) ContinueWithSiteClipperStatement(com.twinsoft.convertigo.beans.statements.ContinueWithSiteClipperStatement) MapperNode(com.twinsoft.convertigo.eclipse.views.references.model.MapperNode) 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) FunctionStatement(com.twinsoft.convertigo.beans.statements.FunctionStatement) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) 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) 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) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) 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) MappingPathNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingPathNode) IsUsedByNode(com.twinsoft.convertigo.eclipse.views.references.model.IsUsedByNode) RequiresNode(com.twinsoft.convertigo.eclipse.views.references.model.RequiresNode) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 57 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class ReferencesView method handleCallStepselection.

private void handleCallStepselection(Object firstElement) {
    try {
        ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
        StepTreeObject stepTreeObject = (StepTreeObject) firstElement;
        Step step = stepTreeObject.getObject();
        RootNode root = new RootNode();
        if (step instanceof TransactionStep) {
            TransactionStep transactionStep = (TransactionStep) step;
            String transactionStepName = transactionStep.getName();
            TransactionStepNode transactionStepNode = new TransactionStepNode(root, transactionStepName, transactionStep);
            RequiresNode requiresNode = new RequiresNode(transactionStepNode, "Requires");
            String transactionName = transactionStep.getTransactionName();
            String connectorName = transactionStep.getConnectorName();
            String projectName = transactionStep.getProjectName();
            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);
            requiresNode.addChild(projectNode);
            transactionStepNode.addChild(requiresNode);
            root.addChild(transactionStepNode);
        } else if (step instanceof SequenceStep) {
            SequenceStep sequenceStep = (SequenceStep) step;
            String sequenceStepName = sequenceStep.getName();
            SequenceStepNode sequenceStepNode = new SequenceStepNode(root, sequenceStepName, sequenceStep);
            RequiresNode requiresNode = new RequiresNode(sequenceStepNode, "Requires");
            String sequenceName = sequenceStep.getSequenceName();
            String projectName = sequenceStep.getProjectName();
            Project project = getProject(projectName, projectExplorerView);
            ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
            Sequence sequence = null;
            try {
                if (project != null)
                    sequence = project.getSequenceByName(sequenceName);
            } catch (EngineException e) {
                sequence = null;
            }
            projectNode.addChild(new SequenceNode(projectNode, sequenceName, sequence));
            requiresNode.addChild(projectNode);
            sequenceStepNode.addChild(requiresNode);
            root.addChild(sequenceStepNode);
        } else {
            root.addChild(new InformationNode(root, "References are not handled for this object"));
            treeViewer.setInput(root);
        }
        treeViewer.setInput(root);
        treeViewer.expandAll();
    } catch (Exception e) {
        ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
    }
}
Also used : 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) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) 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) Sequence(com.twinsoft.convertigo.beans.core.Sequence) SequenceStepNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceStepNode) 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) EngineException(com.twinsoft.convertigo.engine.EngineException) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Project(com.twinsoft.convertigo.beans.core.Project) TransactionStepNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionStepNode) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) RequiresNode(com.twinsoft.convertigo.eclipse.views.references.model.RequiresNode) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) InformationNode(com.twinsoft.convertigo.eclipse.views.references.model.InformationNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 58 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class ReferencesView method getUsedRequestables.

private void getUsedRequestables(Step step, Project projectSelected, AbstractParentNode parentNode) {
    try {
        if (step instanceof SequenceStep) {
            SequenceStep sequenceStep = (SequenceStep) step;
            String sourceProjectName = sequenceStep.getProjectName();
            if (sourceProjectName.equals(projectSelected.getName())) {
                Sequence sourceSequence = null;
                String sourceSequenceName = sequenceStep.getSequenceName();
                try {
                    if (projectSelected != null)
                        sourceSequence = projectSelected.getSequenceByName(sourceSequenceName);
                } catch (EngineException e) {
                    sourceSequence = null;
                }
                SequenceStepNode sequenceStepNode = new SequenceStepNode(parentNode, step.getName() + " -> " + sequenceStep.getSourceSequence(), sourceSequence);
                parentNode.addChild(sequenceStepNode);
            }
        } else if (step instanceof TransactionStep) {
            TransactionStep transactionStep = (TransactionStep) step;
            String sourceProjectName = transactionStep.getProjectName();
            if (sourceProjectName.equals(projectSelected.getName())) {
                Transaction sourceTransaction = null;
                Connector connectorSelected = projectSelected.getConnectorByName(transactionStep.getConnectorName());
                try {
                    if (connectorSelected != null)
                        sourceTransaction = connectorSelected.getTransactionByName(transactionStep.getTransactionName());
                } catch (Exception e) {
                    sourceTransaction = null;
                }
                TransactionStepNode transactionStepNode = new TransactionStepNode(parentNode, step.getName() + " -> " + ((TransactionStep) step).getSourceTransaction(), sourceTransaction);
                parentNode.addChild(transactionStepNode);
            }
        } else if (isStepContainer(step)) {
            List<Step> steps = getStepList(step);
            if (steps != null) {
                for (Step s : steps) {
                    getUsedRequestables(s, projectSelected, parentNode);
                }
            }
        }
    } catch (EngineException e) {
        ConvertigoPlugin.logException(e, "Unable to load the project", true);
    }
}
Also used : TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) 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) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) TransactionStepNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionStepNode) 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) SequenceStepNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceStepNode) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 59 with Connector

use of com.twinsoft.convertigo.beans.core.Connector 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)

Example 60 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class MobilePickerContentProvider method addFsObjects.

private void addFsObjects(Map<String, Set<String>> map, TVObject tvd, Object object, boolean isReferenced) {
    if (object != null) {
        if (object instanceof Project) {
            Project project = (Project) object;
            for (Connector c : project.getConnectorsList()) {
                if (c instanceof FullSyncConnector) {
                    String label = isReferenced ? c.getQName() : c.getName();
                    TVObject tvc = tvd.add(new TVObject(label));
                    for (Document d : c.getDocumentsList()) {
                        if (d instanceof DesignDocument) {
                            TVObject tdd = tvc.add(new TVObject(d.getName()));
                            JSONObject views = CouchKey.views.JSONObject(((DesignDocument) d).getJSONObject());
                            if (views != null) {
                                for (Iterator<String> it = GenericUtils.cast(views.keys()); it.hasNext(); ) {
                                    try {
                                        Set<String> infos = null;
                                        String view = it.next();
                                        String key = c.getQName() + "." + d.getName() + "." + view;
                                        TVObject tvv = tdd.add(new TVObject(view));
                                        SourceData sd = null;
                                        try {
                                            sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "get"));
                                        } catch (JSONException e) {
                                            e.printStackTrace();
                                        }
                                        tvv.add(new TVObject("get", d, sd));
                                        infos = map.get(key + ".get");
                                        if (infos == null) {
                                            infos = map.get(c.getQName() + ".get");
                                        }
                                        if (infos != null) {
                                            for (String info : infos) {
                                                try {
                                                    JSONObject jsonInfo = new JSONObject(info);
                                                    boolean includeDocs = false;
                                                    if (jsonInfo.has("include_docs")) {
                                                        includeDocs = Boolean.valueOf(jsonInfo.getString("include_docs")).booleanValue();
                                                    }
                                                    if (jsonInfo.has("marker")) {
                                                        String marker = jsonInfo.getString("marker");
                                                        if (!marker.isEmpty()) {
                                                            String name = "get" + "#" + marker;
                                                            sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "get").put("marker", marker).put("includeDocs", includeDocs));
                                                            tvv.add(new TVObject(name, d, sd, jsonInfo));
                                                        }
                                                    }
                                                } catch (JSONException e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                        }
                                        try {
                                            sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "view"));
                                        } catch (JSONException e) {
                                            e.printStackTrace();
                                        }
                                        tvv.add(new TVObject("view", d, sd));
                                        infos = map.get(key + ".view");
                                        if (infos != null) {
                                            for (String info : infos) {
                                                try {
                                                    JSONObject jsonInfo = new JSONObject(info);
                                                    boolean includeDocs = false;
                                                    if (jsonInfo.has("include_docs")) {
                                                        includeDocs = Boolean.valueOf(jsonInfo.getString("include_docs")).booleanValue();
                                                    }
                                                    if (jsonInfo.has("marker")) {
                                                        String marker = jsonInfo.getString("marker");
                                                        if (!marker.isEmpty()) {
                                                            String name = "view" + "#" + marker;
                                                            sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "view").put("marker", marker).put("includeDocs", includeDocs));
                                                            tvv.add(new TVObject(name, d, sd, jsonInfo));
                                                        }
                                                    }
                                                } catch (JSONException e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                        }
                                    } catch (Exception e) {
                                        e.printStackTrace();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : Connector(com.twinsoft.convertigo.beans.core.Connector) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) JSONException(org.codehaus.jettison.json.JSONException) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) DesignDocument(com.twinsoft.convertigo.beans.couchdb.DesignDocument) Document(com.twinsoft.convertigo.beans.core.Document) SourceData(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.SourceData) JSONException(org.codehaus.jettison.json.JSONException) Project(com.twinsoft.convertigo.beans.core.Project) JSONObject(org.codehaus.jettison.json.JSONObject) DesignDocument(com.twinsoft.convertigo.beans.couchdb.DesignDocument)

Aggregations

Connector (com.twinsoft.convertigo.beans.core.Connector)72 Transaction (com.twinsoft.convertigo.beans.core.Transaction)43 Project (com.twinsoft.convertigo.beans.core.Project)32 EngineException (com.twinsoft.convertigo.engine.EngineException)28 JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)22 Sequence (com.twinsoft.convertigo.beans.core.Sequence)21 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)17 Step (com.twinsoft.convertigo.beans.core.Step)17 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)16 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)15 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)14 ScreenClass (com.twinsoft.convertigo.beans.core.ScreenClass)14 HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)14 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)12 CouchDbConnector (com.twinsoft.convertigo.beans.connectors.CouchDbConnector)11 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)11 Statement (com.twinsoft.convertigo.beans.core.Statement)11 ElseStep (com.twinsoft.convertigo.beans.steps.ElseStep)11 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)11 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)11