Search in sources :

Example 1 with SourcePickerViewWrap

use of com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap 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 2 with SourcePickerViewWrap

use of com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap in project convertigo by convertigo.

the class EvaluateXpath method getServiceResult.

@Override
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
    HttpSession session = request.getSession();
    CheStudio cheStudio = CallAction.getStudio(session);
    if (cheStudio != null) {
        SourcePickerViewWrap spv = cheStudio.getSourcePickerView();
        if (spv != null) {
            String xpath = request.getParameter("xpath").trim();
            try {
                Document doc = XpathEvaluatorCompositeWrap.getXpathData(spv.getDom(), xpath);
                Element xPathTree = TwsDomTreeWrap.getTree2(doc, doc.getDocumentElement(), "xpath_tree");
                xPathTree = (Element) document.importNode(xPathTree, true);
                document.getDocumentElement().appendChild(xPathTree);
            } catch (Exception e) {
            }
        }
    }
}
Also used : CheStudio(com.twinsoft.convertigo.engine.studio.CheStudio) HttpSession(javax.servlet.http.HttpSession) Element(org.w3c.dom.Element) SourcePickerViewWrap(com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap) Document(org.w3c.dom.Document)

Example 3 with SourcePickerViewWrap

use of com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap in project convertigo by convertigo.

the class SetStepSourceDefinition method getServiceResult.

@Override
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
    HttpSession session = request.getSession();
    CheStudio cheStudio = CallAction.getStudio(session);
    Element root = document.getDocumentElement();
    if (cheStudio != null) {
        SourcePickerViewWrap spv = cheStudio.getSourcePickerView();
        if (spv != null) {
            // Retrieve the StepSource definition
            String qname = request.getParameter("qname");
            DatabaseObject dbo = Engine.theApp.databaseObjectsManager.getDatabaseObjectByQName(qname);
            StepSourceWrap ssw = (StepSourceWrap) spv.getDragData();
            // Update step source definition
            if (com.twinsoft.convertigo.engine.admin.services.studio.sourcepicker.CanCreateSource.canCreateSource(dbo, ssw)) {
                XMLVector<String> sourceDefinition = new XMLVector<>(2);
                sourceDefinition.add(ssw.getPriority());
                sourceDefinition.add(ssw.getXpath());
                IStepSourceContainer stepSourceContainer = (IStepSourceContainer) dbo;
                stepSourceContainer.setSourceDefinition(sourceDefinition);
                root.appendChild(new SetPropertyResponse("sourceDefinition").toXml(document, qname));
            }
        }
    }
}
Also used : CheStudio(com.twinsoft.convertigo.engine.studio.CheStudio) XMLVector(com.twinsoft.convertigo.beans.common.XMLVector) SetPropertyResponse(com.twinsoft.convertigo.engine.studio.responses.SetPropertyResponse) HttpSession(javax.servlet.http.HttpSession) Element(org.w3c.dom.Element) SourcePickerViewWrap(com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) IStepSourceContainer(com.twinsoft.convertigo.beans.core.IStepSourceContainer) StepSourceWrap(com.twinsoft.convertigo.engine.studio.dnd.StepSourceWrap)

Example 4 with SourcePickerViewWrap

use of com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap in project convertigo by convertigo.

the class ModifyXPathText method getServiceResult.

@Override
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
    HttpSession session = request.getSession();
    CheStudio cheStudio = CallAction.getStudio(session);
    if (cheStudio != null) {
        SourcePickerViewWrap spv = cheStudio.getSourcePickerView();
        if (spv != null) {
            String xpath = request.getParameter("xpath").trim();
            spv.modifyXpathText(xpath);
        }
    }
}
Also used : CheStudio(com.twinsoft.convertigo.engine.studio.CheStudio) HttpSession(javax.servlet.http.HttpSession) SourcePickerViewWrap(com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap)

Example 5 with SourcePickerViewWrap

use of com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap in project convertigo by convertigo.

the class CanCreateSource method getServiceResult.

@Override
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
    HttpSession session = request.getSession();
    CheStudio cheStudio = CallAction.getStudio(session);
    if (cheStudio != null) {
        SourcePickerViewWrap spv = cheStudio.getSourcePickerView();
        if (spv != null) {
            String qname = request.getParameter("qname");
            DatabaseObject dbo = Engine.theApp.databaseObjectsManager.getDatabaseObjectByQName(qname);
            StepSourceWrap ssw = (StepSourceWrap) spv.getDragData();
            boolean canCreateSource = canCreateSource(dbo, ssw);
            document.getDocumentElement().appendChild(DOMUtils.createElementWithText(document, "response", Boolean.toString(canCreateSource)));
        }
    }
}
Also used : CheStudio(com.twinsoft.convertigo.engine.studio.CheStudio) HttpSession(javax.servlet.http.HttpSession) SourcePickerViewWrap(com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) StepSourceWrap(com.twinsoft.convertigo.engine.studio.dnd.StepSourceWrap)

Aggregations

SourcePickerViewWrap (com.twinsoft.convertigo.engine.studio.views.sourcepicker.SourcePickerViewWrap)6 CheStudio (com.twinsoft.convertigo.engine.studio.CheStudio)5 HttpSession (javax.servlet.http.HttpSession)5 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)3 Element (org.w3c.dom.Element)3 StepSourceWrap (com.twinsoft.convertigo.engine.studio.dnd.StepSourceWrap)2 XMLVector (com.twinsoft.convertigo.beans.common.XMLVector)1 IStepSourceContainer (com.twinsoft.convertigo.beans.core.IStepSourceContainer)1 Step (com.twinsoft.convertigo.beans.core.Step)1 StepSource (com.twinsoft.convertigo.beans.core.StepSource)1 SetPropertyResponse (com.twinsoft.convertigo.engine.studio.responses.SetPropertyResponse)1 StepSourceEventWrap (com.twinsoft.convertigo.engine.studio.views.projectexplorer.StepSourceEventWrap)1 DatabaseObjectView (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.DatabaseObjectView)1 WrapDatabaseObject (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject)1 Document (org.w3c.dom.Document)1