Search in sources :

Example 1 with JavelinConnector

use of com.twinsoft.convertigo.beans.connectors.JavelinConnector 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 2 with JavelinConnector

use of com.twinsoft.convertigo.beans.connectors.JavelinConnector in project convertigo by convertigo.

the class ReferencesView method handleScreenClassSelection.

private void handleScreenClassSelection(Object firstElement) {
    ScreenClassTreeObject screenClassTreeObject = (ScreenClassTreeObject) firstElement;
    ScreenClass screenClass = screenClassTreeObject.getObject();
    String screenClassName = screenClassTreeObject.getName();
    // Get the referencing transactions
    Connector connector = screenClass.getConnector();
    List<Transaction> transactions = connector.getTransactionsList();
    RootNode root = new RootNode();
    ScreenClassNode screenClassFolder = new ScreenClassNode(root, screenClassName, screenClass);
    root.addChild(screenClassFolder);
    IsUsedByNode isUsedByNode = new IsUsedByNode(screenClassFolder, "Is used by");
    EntryHandlerNode entryFolder = new EntryHandlerNode(isUsedByNode, "Transaction entry handlers", null);
    ExitHandlerNode exitFolder = new ExitHandlerNode(isUsedByNode, "Transaction exit handlers", null);
    if (connector instanceof HtmlConnector) {
        for (Transaction transaction : transactions) {
            HtmlTransaction htmlTransaction = (HtmlTransaction) transaction;
            List<Statement> statements = htmlTransaction.getStatements();
            for (Statement statement : statements) {
                if (statement instanceof ScHandlerStatement) {
                    ScHandlerStatement scHandlerStatement = (ScHandlerStatement) statement;
                    if (scHandlerStatement.getNormalizedScreenClassName().equals(screenClassName)) {
                        if (scHandlerStatement.getName().endsWith("Entry")) {
                            entryFolder.addChild(new TransactionNode(entryFolder, transaction.getName(), scHandlerStatement));
                        } else {
                            exitFolder.addChild(new TransactionNode(exitFolder, transaction.getName(), scHandlerStatement));
                        }
                    }
                }
            }
        }
    } else if (connector instanceof JavelinConnector) {
        for (Transaction transaction : transactions) {
            JavelinTransaction javelinTransaction = (JavelinTransaction) transaction;
            if (javelinTransaction.handlers.indexOf("function on" + screenClassName + "Entry()") != -1) {
                entryFolder.addChild(new TransactionNode(entryFolder, transaction.getName(), transaction));
            }
            if (javelinTransaction.handlers.indexOf("function on" + screenClassName + "Exit()") != -1) {
                exitFolder.addChild(new TransactionNode(exitFolder, transaction.getName(), transaction));
            }
        }
    }
    if (entryFolder.hasChildren()) {
        isUsedByNode.addChild(entryFolder);
    }
    if (exitFolder.hasChildren()) {
        isUsedByNode.addChild(exitFolder);
    }
    if (!isUsedByNode.hasChildren()) {
        screenClassFolder.addChild(new InformationNode(screenClassFolder, "This screen class is not used in any transaction"));
    } else {
        screenClassFolder.addChild(isUsedByNode);
    }
    // Build the treeviewer model
    treeViewer.setInput(null);
    treeViewer.setInput(root);
    treeViewer.expandAll();
}
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) RootNode(com.twinsoft.convertigo.eclipse.views.references.model.RootNode) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinScreenClass(com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass) ScreenClass(com.twinsoft.convertigo.beans.core.ScreenClass) 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) EntryHandlerNode(com.twinsoft.convertigo.eclipse.views.references.model.EntryHandlerNode) ExitHandlerNode(com.twinsoft.convertigo.eclipse.views.references.model.ExitHandlerNode) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) ScreenClassNode(com.twinsoft.convertigo.eclipse.views.references.model.ScreenClassNode) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) IsUsedByNode(com.twinsoft.convertigo.eclipse.views.references.model.IsUsedByNode) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) InformationNode(com.twinsoft.convertigo.eclipse.views.references.model.InformationNode) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement)

Example 3 with JavelinConnector

use of com.twinsoft.convertigo.beans.connectors.JavelinConnector in project convertigo by convertigo.

the class JavelinTransaction method runCore.

public void runCore() throws EngineException {
    try {
        JavelinConnector connector = (JavelinConnector) parent;
        Javelin javelin = ((JavelinConnector) connector).javelin;
        vExtractionRulesInited = new ArrayList<String>(32);
        boolean bDocumentLogScreenDumps = (EnginePropertiesManager.getProperty(PropertyName.DOCUMENT_LOG_SCREEN_DUMPS).equals("true") ? true : false);
        if (handlerResult.equalsIgnoreCase(RETURN_CANCEL)) {
            // must detect screen class before exit
            String t = context.statistics.start(EngineStatistics.GET_CURRENT_SCREEN_CLASS);
            try {
                /*
					if ((Engine.objectsProvider == null) && !javelin.isConnected()) {
						throw new ConnectionException("The emulator has been disconnected! See the emulator logs for more details...");
					}
					*/
                screenClass = ((JavelinConnector) connector).getCurrentScreenClass();
                normalizedScreenClassName = StringUtils.normalize(screenClass.getName());
                context.lastDetectedObject = screenClass;
                score += 1;
                // for compatibility with older javelin projects, set the legacy lastDetectedScreenClass context property
                context.lastDetectedScreenClass = screenClass;
                Engine.logContext.info("Detected screen class: '" + screenClass.getName() + "'");
                if (bDocumentLogScreenDumps) {
                    StringBuffer screenDump = new StringBuffer("");
                    int sw = javelin.getScreenWidth();
                    int sh = javelin.getScreenHeight();
                    for (int i = 0; i < sh; i++) {
                        screenDump.append(javelin.getString(0, i, sw) + "\n");
                    }
                    Engine.logContext.info("Screen dump for screen class '" + screenClass.getName() + "':\n" + screenDump.toString());
                }
                // We fire engine events only in studio mode.
                if (Engine.isStudioMode()) {
                    Engine.theApp.fireObjectDetected(new EngineEvent(screenClass));
                }
                return;
            } finally {
                context.statistics.stop(t, bNotFirstLoop1);
            }
        }
        if (!handlerResult.equalsIgnoreCase(RETURN_BYPASS)) {
            applyUserRequest(javelin);
        }
        blocks = new ArrayList<Collection<Block>>(16);
        bNotFirstLoop1 = false;
        bNotFirstLoop2 = false;
        if (!runningThread.bContinue) {
            return;
        }
        do {
            do {
                String t = context.statistics.start(EngineStatistics.GET_CURRENT_SCREEN_CLASS);
                try {
                    /*
    					if ((Engine.objectsProvider == null) && !javelin.isConnected()) {
    						throw new ConnectionException("The emulator has been disconnected! See the emulator logs for more details...");
    					}
    					*/
                    screenClass = (JavelinScreenClass) ((JavelinConnector) connector).getCurrentScreenClass();
                    if (screenClass == null) {
                        throw new EngineException("(JavelinTransaction) The currentScreenClass is null, is the emulator connected ?");
                    }
                    normalizedScreenClassName = StringUtils.normalize(screenClass.getName());
                    context.lastDetectedObject = screenClass;
                    score += 1;
                    // for compatibility with older javelin projects, set the legacy lastDetectedScreenClass context property
                    context.lastDetectedScreenClass = screenClass;
                    Engine.logContext.info("Detected screen class: '" + screenClass.getName() + "'");
                    if (bDocumentLogScreenDumps) {
                        StringBuffer screenDump = new StringBuffer("");
                        int sw = javelin.getScreenWidth();
                        int sh = javelin.getScreenHeight();
                        for (int i = 0; i < sh; i++) {
                            screenDump.append(javelin.getString(0, i, sw) + "\n");
                        }
                        Engine.logContext.info("Screen dump for screen class '" + screenClass.getName() + "':\n" + screenDump.toString());
                    }
                    // We fire engine events only in studio mode.
                    if (Engine.isStudioMode()) {
                        Engine.theApp.fireObjectDetected(new EngineEvent(screenClass));
                    }
                } finally {
                    context.statistics.stop(t, bNotFirstLoop1);
                }
                // We execute the entry handler for the detected screen class
                executeHandler(EVENT_ENTRY_HANDLER, ((RequestableThread) Thread.currentThread()).javascriptContext);
                bNotFirstLoop1 = true;
            } while (runningThread.bContinue && (handlerResult.equalsIgnoreCase(RETURN_REDETECT)));
            if (!handlerResult.equalsIgnoreCase(RETURN_SKIP)) {
                BlockFactory blockFactory = screenClass.getBlockFactory();
                // We fire engine events only in studio mode.
                if (Engine.isStudioMode()) {
                    Engine.theApp.fireObjectDetected(new EngineEvent(blockFactory));
                }
                if (!runningThread.bContinue) {
                    return;
                }
                applyBlockFactory(screenClass, blockFactory, javelin, bNotFirstLoop2);
                Engine.logContext.debug("(JavelinTransaction) Block factory executed...");
                if (!runningThread.bContinue) {
                    return;
                }
                // first extraction rules execution on the block factory
                applyExtractionRules(screenClass, blockFactory, javelin, bNotFirstLoop2);
                if (executeExtractionRulesInPanels) {
                    // search panels and apply extraction rules on their content blocks
                    searchPanelsAndApplyExtractionRules(screenClass, blockFactory, javelin, bNotFirstLoop2);
                }
                Engine.logContext.debug("(JavelinTransaction) Extraction rules executed ...");
                blocks.add(blockFactory.getAllBlocks());
                Engine.logContext.debug("(JavelinTransaction) Blocks added to output");
            }
            if (!runningThread.bContinue) {
                return;
            }
            // We execute the exit handler for the current screen class
            executeHandler(EVENT_EXIT_HANDLER, ((RequestableThread) Thread.currentThread()).javascriptContext);
            bNotFirstLoop2 = true;
        } while (runningThread.bContinue && (handlerResult.equalsIgnoreCase(RETURN_ACCUMULATE)));
        if (!runningThread.bContinue) {
            return;
        }
        // Adding screen resolution information and cursor position information to the XML document
        Element documentElement = context.outputDocument.getDocumentElement();
        documentElement.setAttribute("screenWidth", Integer.toString(javelin.getScreenWidth()));
        documentElement.setAttribute("screenHeight", Integer.toString(javelin.getScreenHeight()));
        documentElement.setAttribute("cursorLine", Integer.toString(javelin.getCurrentLine()));
        documentElement.setAttribute("cursorColumn", Integer.toString(javelin.getCurrentColumn()));
        // Generating the blocks XML tags
        renderBlocksToXml(blocks);
        // and move all sub blocks node to the root element.
        if (isRemoveBlocksNode()) {
            NodeList childNodes = documentElement.getChildNodes();
            int len = childNodes.getLength();
            for (int i = 0; i < len; i++) {
                // Use index 0 because blocks node is removed at each loop round!
                Node node = childNodes.item(0);
                if (node.getNodeName().equalsIgnoreCase("blocks")) {
                    NodeList subNodesBlocks = node.getChildNodes();
                    int len2 = subNodesBlocks.getLength();
                    while (len2 > 0) {
                        documentElement.appendChild(subNodesBlocks.item(0));
                        subNodesBlocks = node.getChildNodes();
                        len2 = subNodesBlocks.getLength();
                    }
                    documentElement.removeChild(node);
                }
            }
        }
    } finally {
        if (sessionMustBeDestroyed) {
            Engine.logContext.debug("(JavelinTransaction) Destroying the current session");
            Engine.theApp.sessionManager.removeSession(context.contextID);
        }
        if ((runningThread == null) || (!runningThread.bContinue)) {
            Engine.logContext.warn("(JavelinTransaction) The transaction \"" + getName() + "\" has been successfully interrupted.");
        } else {
            Engine.logContext.debug("(JavelinTransaction) The transaction \"" + getName() + "\" has successfully finished.");
        }
    }
}
Also used : DefaultBlockFactory(com.twinsoft.convertigo.beans.common.DefaultBlockFactory) BlockFactory(com.twinsoft.convertigo.beans.core.BlockFactory) PanelBlockFactory(com.twinsoft.convertigo.beans.common.PanelBlockFactory) Element(org.w3c.dom.Element) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) EngineException(com.twinsoft.convertigo.engine.EngineException) Javelin(com.twinsoft.twinj.Javelin) com.twinsoft.twinj.iJavelin(com.twinsoft.twinj.iJavelin) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) EngineEvent(com.twinsoft.convertigo.engine.EngineEvent) Collection(java.util.Collection)

Example 4 with JavelinConnector

use of com.twinsoft.convertigo.beans.connectors.JavelinConnector in project convertigo by convertigo.

the class JavelinTransaction method insertObjectsInScope.

protected void insertObjectsInScope() throws EngineException {
    super.insertObjectsInScope();
    Connector connector = (Connector) parent;
    // Insert the Javelin object in the script scope
    Scriptable jsJavelin = org.mozilla.javascript.Context.toObject(((JavelinConnector) connector).javelin, scope);
    scope.put("javelin", scope, jsJavelin);
    // Insert the dataStableTimeout object in the script scope
    Scriptable jsDataStableTimeout = org.mozilla.javascript.Context.toObject(Integer.valueOf(timeoutForDataStable), scope);
    scope.put("timeout", scope, jsDataStableTimeout);
    // Insert the dataStableThreshold object in the script scope
    Scriptable jsDataStableThreshold = org.mozilla.javascript.Context.toObject(Integer.valueOf(dataStableThreshold), scope);
    scope.put("threshold", scope, jsDataStableThreshold);
}
Also used : Connector(com.twinsoft.convertigo.beans.core.Connector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) Scriptable(org.mozilla.javascript.Scriptable)

Example 5 with JavelinConnector

use of com.twinsoft.convertigo.beans.connectors.JavelinConnector in project convertigo by convertigo.

the class EmulatorTechnology method isMatching0.

protected boolean isMatching0(Connector connector) {
    try {
        JavelinConnector javelinConnector = (JavelinConnector) connector;
        iJavelin javelin = ((JavelinConnector) connector).javelin;
        String projectConnectorTechnology = javelinConnector.getEmulatorTechnology();
        String javelinTerminalClass = javelin.getTerminalClass();
        return (javelinTerminalClass.equals(projectConnectorTechnology));
    } catch (Exception e) {
        Engine.logBeans.error("Unable to match the emulator technology", e);
        return false;
    }
}
Also used : JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) com.twinsoft.twinj.iJavelin(com.twinsoft.twinj.iJavelin)

Aggregations

JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)50 ScreenClass (com.twinsoft.convertigo.beans.core.ScreenClass)17 Javelin (com.twinsoft.twinj.Javelin)12 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)11 Connector (com.twinsoft.convertigo.beans.core.Connector)11 EngineException (com.twinsoft.convertigo.engine.EngineException)10 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)9 Transaction (com.twinsoft.convertigo.beans.core.Transaction)8 JavelinTransaction (com.twinsoft.convertigo.beans.transactions.JavelinTransaction)8 XMLRectangle (com.twinsoft.convertigo.beans.common.XMLRectangle)7 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)7 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)7 CicsConnector (com.twinsoft.convertigo.beans.connectors.CicsConnector)6 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)6 com.twinsoft.twinj.iJavelin (com.twinsoft.twinj.iJavelin)6 Project (com.twinsoft.convertigo.beans.core.Project)5 ScHandlerStatement (com.twinsoft.convertigo.beans.statements.ScHandlerStatement)5 HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)5 AbstractConnectorComposite (com.twinsoft.convertigo.eclipse.editors.connector.AbstractConnectorComposite)5 ConnectorEditor (com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor)5