Search in sources :

Example 26 with Connector

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

the class TransactionExecuteSelectedFromStubAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
            if ((treeObject != null) && (treeObject instanceof TransactionTreeObject)) {
                TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject;
                Transaction transaction = transactionTreeObject.getObject();
                transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
                Connector connector = (Connector) transaction.getParent();
                ProjectTreeObject projectTreeObject = transactionTreeObject.getProjectTreeObject();
                ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
                if (connectorEditor != null) {
                    getActivePage().activate(connectorEditor);
                    connectorEditor.getDocument(transaction.getName(), true);
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the selected transaction!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) Connector(com.twinsoft.convertigo.beans.core.Connector) Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) Transaction(com.twinsoft.convertigo.beans.core.Transaction) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) ConnectorEditor(com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor) Display(org.eclipse.swt.widgets.Display)

Example 27 with Connector

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

the class SetDefaultTransactionAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TransactionTreeObject transactionTreeObject = (TransactionTreeObject) explorerView.getFirstSelectedTreeObject();
            Transaction transaction = (Transaction) explorerView.getFirstSelectedDatabaseObject();
            Connector connector = (Connector) transaction.getParent();
            // Report from 4.5: fix #401
            TransactionTreeObject defaultTransactionTreeObject = null;
            Transaction defaultTransaction = connector.getDefaultTransaction();
            if (defaultTransaction != null) {
                defaultTransactionTreeObject = (TransactionTreeObject) explorerView.findTreeObjectByUserObject(defaultTransaction);
            }
            connector.setDefaultTransaction(transaction);
            if (defaultTransactionTreeObject != null) {
                defaultTransactionTreeObject.isDefault = false;
                defaultTransactionTreeObject.hasBeenModified(true);
            }
            transactionTreeObject.isDefault = true;
            transactionTreeObject.hasBeenModified(true);
            // Updating the tree
            explorerView.refreshTreeObject(transactionTreeObject.getParentDatabaseObjectTreeObject());
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to set transaction to default one!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) Connector(com.twinsoft.convertigo.beans.core.Connector) Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) Transaction(com.twinsoft.convertigo.beans.core.Transaction) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 28 with Connector

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

the class SequenceExecuteSelectedAction method openEditors.

private void openEditors(ProjectExplorerView explorerView, List<Step> steps, Set<SequenceStep> alreadyOpened) {
    for (Step step : steps) {
        if (step.isEnabled()) {
            if (step instanceof SequenceStep) {
                SequenceStep sequenceStep = (SequenceStep) step;
                String projectName = sequenceStep.getProjectName();
                // load project if necessary
                if (!step.getSequence().getProject().getName().equals(projectName))
                    loadProject(explorerView, projectName);
                if (alreadyOpened.contains(sequenceStep)) {
                    // avoid sequence recursion
                    return;
                }
                alreadyOpened.add(sequenceStep);
                try {
                    ProjectTreeObject projectTreeObject = (ProjectTreeObject) explorerView.getProjectRootObject(projectName);
                    Sequence subSequence = projectTreeObject.getObject().getSequenceByName(sequenceStep.getSequenceName());
                    SequenceTreeObject subSequenceTreeObject = (SequenceTreeObject) explorerView.findTreeObjectByUserObject(subSequence);
                    // recurse on sequence
                    openEditors(explorerView, subSequenceTreeObject, alreadyOpened);
                } catch (EngineException e) {
                    e.printStackTrace();
                }
            } else if (step instanceof TransactionStep) {
                TransactionStep transactionStep = (TransactionStep) step;
                String projectName = transactionStep.getProjectName();
                if (!step.getSequence().getProject().getName().equals(projectName))
                    // load project if necessary
                    loadProject(explorerView, projectName);
                try {
                    ProjectTreeObject projectTreeObject = (ProjectTreeObject) explorerView.getProjectRootObject(projectName);
                    Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
                    ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(connector);
                    // open connector editor
                    connectorTreeObject.openConnectorEditor();
                } catch (EngineException e) {
                    e.printStackTrace();
                }
            } else if (step instanceof StepWithExpressions) {
                openEditors(explorerView, ((StepWithExpressions) step).getSteps(), alreadyOpened);
            }
        }
    }
}
Also used : TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Connector(com.twinsoft.convertigo.beans.core.Connector) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) EngineException(com.twinsoft.convertigo.engine.EngineException) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Step(com.twinsoft.convertigo.beans.core.Step) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Sequence(com.twinsoft.convertigo.beans.core.Sequence)

Example 29 with Connector

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

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

the class DatabaseObjectsManager method performWsMigration.

private boolean performWsMigration(String version, String projectName) {
    if (VersionUtils.compare(version, "4.6.0") < 0) {
        try {
            // Retrieve a !clone! of project to perform update
            Project project = getProjectByName(projectName);
            for (Connector connector : project.getConnectorsList()) {
                // Retrieve backup wsdlTypes and store Transaction's schema
                for (Transaction transaction : connector.getTransactionsList()) {
                    try {
                        String xsdTypes = transaction.migrateToXsdTypes();
                        transaction.writeSchemaToFile(xsdTypes);
                        Engine.logDatabaseObjectManager.info("Internal schema stored for \"" + transaction.getName() + "\" transaction");
                    } catch (Exception e) {
                        Engine.logDatabaseObjectManager.error("An error occured while writing schema to file for \"" + transaction.getName() + "\" transaction");
                    }
                }
            }
            // Fix sequence's steps sources
            for (Sequence sequence : project.getSequencesList()) {
                try {
                    List<Step> steps = sequence.getSteps();
                    // Replace source's xpath
                    // replace ./xxx by
                    // ./transaction/document/xxx or by
                    // ./sequence/document/xxx
                    replaceSourceXpath(version, sequence, steps);
                    Engine.logDatabaseObjectManager.info("Step sources updated for sequence \"" + sequence.getName() + "\"");
                } catch (Exception e) {
                    Engine.logDatabaseObjectManager.error("An error occured while updating step sources for sequence \"" + sequence.getName() + "\"");
                }
            }
        } catch (Exception e) {
            Engine.logDatabaseObjectManager.error("An error occured while updating project '" + projectName + "' for XSD", e);
            return false;
        }
    }
    return true;
}
Also used : Project(com.twinsoft.convertigo.beans.core.Project) Connector(com.twinsoft.convertigo.beans.core.Connector) Transaction(com.twinsoft.convertigo.beans.core.Transaction) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Step(com.twinsoft.convertigo.beans.core.Step) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ReadFileStep(com.twinsoft.convertigo.beans.steps.ReadFileStep) XMLActionStep(com.twinsoft.convertigo.beans.steps.XMLActionStep) XMLGenerateDatesStep(com.twinsoft.convertigo.beans.steps.XMLGenerateDatesStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) FileNotFoundException(java.io.FileNotFoundException) SAXException(org.xml.sax.SAXException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

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