Search in sources :

Example 6 with Step

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

the class XMLCopyStep method getTargetXPath.

protected String getTargetXPath() throws EngineException {
    String xpath = "";
    StepSource source = getSource();
    if (!source.isEmpty()) {
        Step sourceStep = source.getStep();
        if (sourceStep instanceof IteratorStep) {
            xpath = source.getXpath().substring(1);
        }
    }
    return xpath;
}
Also used : StepSource(com.twinsoft.convertigo.beans.core.StepSource) Step(com.twinsoft.convertigo.beans.core.Step)

Example 7 with Step

use of com.twinsoft.convertigo.beans.core.Step 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);
                    Project p = step.getProject();
                    Sequence subSequence = p.getSequenceByName(sequenceStep.getSequenceName());
                    SequenceView subSequenceTreeObject = (SequenceView) Studio.getViewFromDbo(subSequence, studio);
                    // recurse on sequence
                    openEditors(/*explorerView, */
                    subSequenceTreeObject, alreadyOpened);
                } catch (EngineException e) {
                }
            } else if (step instanceof TransactionStep) {
                TransactionStep transactionStep = (TransactionStep) step;
                String projectName = transactionStep.getProjectName();
                if (!step.getSequence().getProject().getName().equals(projectName)) {
                // loadProject(explorerView, projectName); // load project if necessary
                }
                try {
                    // ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getProjectRootObject(projectName);
                    Project project = Engine.theApp.databaseObjectsManager.getProjectByName(projectName);
                    ProjectView projectTreeObject = new ProjectView(project, studio);
                    Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
                    ConnectorView connectorTreeObject = new ConnectorView(connector, studio);
                    // open connector editor
                    connectorTreeObject.openConnectorEditor();
                } catch (EngineException e) {
                }
            } else if (step instanceof StepWithExpressions) {
                openEditors(/*explorerView, */
                ((StepWithExpressions) step).getSteps(), alreadyOpened);
            }
        }
    }
}
Also used : TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Project(com.twinsoft.convertigo.beans.core.Project) Connector(com.twinsoft.convertigo.beans.core.Connector) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) SequenceView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.SequenceView) ConnectorView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView) EngineException(com.twinsoft.convertigo.engine.EngineException) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) 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) ProjectView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView)

Example 8 with Step

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

the class ShowStepInPickerAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapDatabaseObject treeObject = (WrapDatabaseObject) studio.getFirstSelectedTreeObject();
        if (treeObject != null) {
            if (treeObject.instanceOf(DatabaseObject.class)) {
                DatabaseObject selectedDbo = ((DatabaseObjectView) treeObject).getObject();
                if (selectedDbo != null) {
                    StepSourceEventWrap event = null;
                    if (showSource) {
                        if (selectedDbo instanceof Step) {
                            Step step = (Step) selectedDbo;
                            Set<StepSource> sources = step.getSources();
                            if (!sources.isEmpty()) {
                                event = new StepSourceEventWrap(sources.iterator().next());
                            } else {
                                throw new Exception("No Source defined");
                            }
                        }
                    } else {
                        event = new StepSourceEventWrap(selectedDbo);
                    }
                    if (event != null) {
                        SourcePickerViewWrap spv = studio.getSourcePickerView();
                        spv.sourceSelected(event);
                    }
                }
            }
        }
    } catch (Exception e) {
        throw e;
    // ConvertigoPlugin.logException(e, "Unable to show object in Picker!");
    }
}
Also used : StepSource(com.twinsoft.convertigo.beans.core.StepSource) SourcePickerViewWrap(com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) DatabaseObjectView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.DatabaseObjectView) StepSourceEventWrap(com.twinsoft.convertigo.engine.studio.views.projectexplorer.StepSourceEventWrap) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) Step(com.twinsoft.convertigo.beans.core.Step)

Example 9 with Step

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

the class SourcePickerHelperWrap method displayTargetWsdlDom.

public void displayTargetWsdlDom(DatabaseObject dbo) {
    try {
        if (dbo instanceof Step) {
            Step step = (Step) dbo;
            String xpath = getSourceXPath();
            String anchor = step.getAnchor();
            Document stepDoc = null;
            Step targetStep = step;
            while (targetStep instanceof IteratorStep) {
                targetStep = getTargetStep(targetStep);
            }
            if (targetStep != null) {
                Project project = step.getProject();
                XmlSchema schema = Engine.theApp.schemaManager.getSchemaForProject(project.getName(), Option.fullSchema);
                XmlSchemaObject xso = SchemaMeta.getXmlSchemaObject(schema, targetStep);
                if (xso != null) {
                    stepDoc = XmlSchemaUtils.getDomInstance(xso);
                }
            }
            if (stepDoc != null) /* && !(targetStep instanceof IteratorStep)*/
            {
                // stepDoc can be null for non "xml" step : e.g jIf
                Document doc = step.getSequence().createDOM();
                Element root = (Element) doc.importNode(stepDoc.getDocumentElement(), true);
                doc.replaceChild(root, doc.getDocumentElement());
                removeUserDefinedNodes(doc.getDocumentElement());
                boolean shouldDisplayDom = (!(!step.isXml() && (step instanceof StepWithExpressions) && !(step instanceof IteratorStep)));
                if ((doc != null) && (shouldDisplayDom)) {
                    xpath = onDisplayXhtml(xpath);
                    displayXhtml(doc);
                    xpathEvaluator.removeAnchor();
                    xpathEvaluator.displaySelectionXpathWithAnchor(twsDomTree, anchor, xpath);
                    return;
                }
            }
        }
    } catch (Exception e) {
    // ConvertigoPlugin.logException(e, StringUtils.readStackTraceCauses(e));
    }
    clean();
}
Also used : Project(com.twinsoft.convertigo.beans.core.Project) IteratorStep(com.twinsoft.convertigo.beans.steps.IteratorStep) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) XmlSchema(org.apache.ws.commons.schema.XmlSchema) Element(org.w3c.dom.Element) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) Step(com.twinsoft.convertigo.beans.core.Step) IteratorStep(com.twinsoft.convertigo.beans.steps.IteratorStep) Document(org.w3c.dom.Document) TransformerException(javax.xml.transform.TransformerException) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 10 with Step

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

the class SequenceEditorPartWrap method checkEventSource.

private boolean checkEventSource(EventObject event) {
    boolean isSourceFromSequence = false;
    if (event instanceof RequestableEngineEvent) {
        RequestableEngineEvent requestableEvent = (RequestableEngineEvent) event;
        String sequenceName = requestableEvent.getSequenceName();
        if (sequenceName != null) {
            if (sequenceName.equals(sequence.getName()) && requestableEvent.getProjectName().equals(sequence.getProject().getName())) {
                isSourceFromSequence = true;
            }
        }
    } else if (event instanceof EngineEvent) {
        Object ob = ((EngineEvent) event).getSource();
        if (ob instanceof Step) {
            try {
                String projectName = ((Step) ob).getProject().getName();
                String sequenceName = ((Step) ob).getSequence().getName();
                if (sequenceName.equals(sequence.getName()) && projectName.equals(sequence.getProject().getName())) {
                    isSourceFromSequence = true;
                }
            } catch (Exception e) {
            }
        }
    }
    return isSourceFromSequence;
}
Also used : RequestableEngineEvent(com.twinsoft.convertigo.engine.RequestableEngineEvent) EngineEvent(com.twinsoft.convertigo.engine.EngineEvent) RequestableEngineEvent(com.twinsoft.convertigo.engine.RequestableEngineEvent) EventObject(java.util.EventObject) Step(com.twinsoft.convertigo.beans.core.Step)

Aggregations

Step (com.twinsoft.convertigo.beans.core.Step)70 Sequence (com.twinsoft.convertigo.beans.core.Sequence)36 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)32 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)26 EngineException (com.twinsoft.convertigo.engine.EngineException)26 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)25 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)24 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)24 TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)21 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)21 ElseStep (com.twinsoft.convertigo.beans.steps.ElseStep)20 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)19 RequestableStep (com.twinsoft.convertigo.beans.core.RequestableStep)18 Connector (com.twinsoft.convertigo.beans.core.Connector)17 Project (com.twinsoft.convertigo.beans.core.Project)17 Cursor (org.eclipse.swt.graphics.Cursor)17 Display (org.eclipse.swt.widgets.Display)17 Shell (org.eclipse.swt.widgets.Shell)17 Transaction (com.twinsoft.convertigo.beans.core.Transaction)16 StepTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject)16