Search in sources :

Example 1 with IStepSourceContainer

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

the class Migration7_0_0 method handleSteps.

private static void handleSteps(XmlSchema projectSchema, Map<String, Reference> referenceMap, List<Step> stepList) {
    for (Step step : stepList) {
        if (step instanceof XMLActionStep) {
            XMLVector<XMLVector<Object>> sourcesDefinition = ((XMLActionStep) step).getSourcesDefinition();
            for (XMLVector<Object> row : sourcesDefinition) {
                if (row.size() > 1) {
                    XMLVector<String> definition = GenericUtils.cast(row.get(1));
                    handleSourceDefinition(definition);
                }
            }
        }
        if (step instanceof TransactionStep) {
            XMLVector<String> definition = ((TransactionStep) step).getConnectionStringDefinition();
            handleSourceDefinition(definition);
        }
        if (step instanceof IStepSourceContainer) {
            /**
             * Case step's xpath has not been migrated when project has been deployed
             ** on a 5.0 server from a Studio with an older version *
             */
            IStepSourceContainer stepSourceContainer = (IStepSourceContainer) step;
            XMLVector<String> definition = stepSourceContainer.getSourceDefinition();
            handleSourceDefinition(definition);
        }
        if (step instanceof IVariableContainer) {
            IVariableContainer variableContainer = (IVariableContainer) step;
            for (Variable variable : variableContainer.getVariables()) {
                if (variable instanceof IStepSourceContainer) {
                    IStepSourceContainer stepSourceContainer = (IStepSourceContainer) variable;
                    XMLVector<String> definition = stepSourceContainer.getSourceDefinition();
                    handleSourceDefinition(definition);
                }
            }
        }
        String targetProjectName = null;
        String typeLocalName = null;
        if (step instanceof TransactionStep) {
            targetProjectName = ((TransactionStep) step).getProjectName();
            typeLocalName = ((TransactionStep) step).getConnectorName() + "__" + ((TransactionStep) step).getTransactionName() + "ResponseType";
        } else if (step instanceof SequenceStep) {
            targetProjectName = ((SequenceStep) step).getProjectName();
            typeLocalName = ((SequenceStep) step).getSequenceName() + "ResponseType";
        }
        String namespaceURI = null;
        // Case of Requestable steps
        if (targetProjectName != null) {
            try {
                namespaceURI = Project.CONVERTIGO_PROJECTS_NAMESPACEURI + targetProjectName;
                if (!targetProjectName.equals(step.getProject().getName())) {
                    try {
                        namespaceURI = Engine.theApp.databaseObjectsManager.getOriginalProjectByName(targetProjectName).getTargetNamespace();
                    } catch (Exception e) {
                    }
                    // Add reference
                    String location = "../" + targetProjectName + "/" + targetProjectName + ".xsd";
                    addReferenceToMap(referenceMap, namespaceURI, location);
                }
                // Set step's typeQName
                step.setXmlComplexTypeAffectation(new XmlQName(new QName(namespaceURI, typeLocalName)));
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else // Other steps
        {
            try {
                String targetNamespace = projectSchema.getTargetNamespace();
                String targetPrefix = projectSchema.getNamespaceContext().getPrefix(targetNamespace);
                String s = null;
                try {
                    if (step instanceof XMLCopyStep) {
                        XmlSchemaCollection collection = SchemaMeta.getCollection(projectSchema);
                        XmlSchemaObject ob = step.getXmlSchemaObject(collection, projectSchema);
                        if (ob != null) {
                            if (ob instanceof XmlSchemaSequence) {
                                ob = ((XmlSchemaSequence) ob).getItems().getItem(0);
                            }
                            if (ob instanceof XmlSchemaElement || ob instanceof XmlSchemaAttribute) {
                                QName schemaTypeName = ob instanceof XmlSchemaElement ? ((XmlSchemaElement) ob).getSchemaTypeName() : ((XmlSchemaAttribute) ob).getSchemaTypeName();
                                String schemaTypePrefix = projectSchema.getNamespaceContext().getPrefix(schemaTypeName.getNamespaceURI());
                                String schemaTypeLocalName = schemaTypeName.getLocalPart();
                                s = schemaTypePrefix + ":" + schemaTypeLocalName;
                            }
                        }
                    } else {
                        String schemaType = step.getSchemaDataType();
                        s = schemaType.equals("") ? "xsd:string" : schemaType;
                    }
                } catch (Exception e) {
                    s = "xsd:string";
                }
                if ((s != null) && (!s.equals("")) && (!s.startsWith("xsd:"))) {
                    String prefix = s.split(":")[0];
                    typeLocalName = s.split(":")[1];
                    if (prefix.equals(targetPrefix)) {
                    // ignore
                    } else {
                        // Retrieve namespace uri
                        namespaceURI = projectSchema.getNamespaceContext().getNamespaceURI(prefix);
                        // Set step's typeQName
                        QName qname = new QName(namespaceURI, typeLocalName);
                        XmlSchemaType schemaType = projectSchema.getTypeByName(qname);
                        if (schemaType instanceof XmlSchemaComplexType)
                            step.setXmlComplexTypeAffectation(new XmlQName(qname));
                        if (schemaType instanceof XmlSchemaSimpleType)
                            step.setXmlSimpleTypeAffectation(new XmlQName(qname));
                    }
                }
            } catch (Exception e) {
            }
        }
        if (step instanceof ISimpleTypeAffectation) {
            QName qName = XmlSchemaUtils.getSchemaDataTypeName(step.getSchemaDataType());
            step.setXmlSimpleTypeAffectation(new XmlQName(qName));
        }
        if (step instanceof StepWithExpressions) {
            handleSteps(projectSchema, referenceMap, ((StepWithExpressions) step).getSteps());
        }
    }
}
Also used : XMLVector(com.twinsoft.convertigo.beans.common.XMLVector) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) Variable(com.twinsoft.convertigo.beans.core.Variable) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) Step(com.twinsoft.convertigo.beans.core.Step) XMLActionStep(com.twinsoft.convertigo.beans.steps.XMLActionStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) XMLCopyStep(com.twinsoft.convertigo.beans.steps.XMLCopyStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) IStepSourceContainer(com.twinsoft.convertigo.beans.core.IStepSourceContainer) XMLCopyStep(com.twinsoft.convertigo.beans.steps.XMLCopyStep) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) QName(javax.xml.namespace.QName) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) ISimpleTypeAffectation(com.twinsoft.convertigo.beans.core.ISimpleTypeAffectation) XMLActionStep(com.twinsoft.convertigo.beans.steps.XMLActionStep) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaCollection(org.apache.ws.commons.schema.XmlSchemaCollection) XmlSchemaAttribute(org.apache.ws.commons.schema.XmlSchemaAttribute) EngineException(com.twinsoft.convertigo.engine.EngineException) IOException(java.io.IOException) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) IVariableContainer(com.twinsoft.convertigo.beans.core.IVariableContainer) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Example 2 with IStepSourceContainer

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

the class TreeDropAdapter method validateDrop.

/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
	 */
@Override
public boolean validateDrop(Object target, int operation, TransferData transferType) {
    if (TextTransfer.getInstance().isSupportedType(transferType)) {
        if (getCurrentOperation() == DND.DROP_MOVE) {
            Object targetObject = getCurrentTarget();
            Object sourceObject = getSelectedObject();
            if (targetObject != null && targetObject instanceof TreeObject) {
                TreeObject targetTreeObject = (TreeObject) targetObject;
                if (sourceObject != null && sourceObject instanceof TreeObject) {
                    TreeObject sourceTreeObject = (TreeObject) sourceObject;
                    boolean isFocus = sourceTreeObject.viewer.getControl().isFocusControl();
                    if (isFocus && (sourceObject == targetObject || targetTreeObject.isChildOf(sourceTreeObject))) {
                        return false;
                    }
                }
                if (targetObject instanceof DatabaseObjectTreeObject) {
                    try {
                        String xmlData = TextTransfer.getInstance().nativeToJava(transferType).toString();
                        List<Object> list = ConvertigoPlugin.clipboardManagerDND.read(xmlData);
                        DatabaseObject databaseObject = (DatabaseObject) list.get(0);
                        DatabaseObject targetDatabaseObject = ((DatabaseObjectTreeObject) target).getObject();
                        if (DatabaseObjectsManager.acceptDatabaseObjects(targetDatabaseObject, databaseObject)) {
                            return true;
                        }
                        DatabaseObject parentDatabaseObject = targetDatabaseObject.getParent();
                        if (parentDatabaseObject != null && DatabaseObjectsManager.acceptDatabaseObjects(parentDatabaseObject, databaseObject)) {
                            return true;
                        }
                        return false;
                    } catch (Exception e) {
                        e.printStackTrace(System.out);
                    }
                }
            }
        }
        return true;
    }
    if (StepSourceTransfer.getInstance().isSupportedType(transferType)) {
        if (target instanceof TreeObject) {
            TreeObject targetTreeObject = (TreeObject) target;
            // Check for drop to a step which contains a stepSource definition
            // if (targetTreeObject.getObject() instanceof IStepSourceContainer) {
            Object ob = targetTreeObject.getObject();
            if (ob instanceof Step && ((Step) ob).canWorkOnSource() || ob instanceof IStepSourceContainer) {
                StepSource stepSource = StepSourceTransfer.getInstance().getStepSource();
                if (stepSource != null) {
                    Step targetStep = (Step) ((ob instanceof StepVariable) ? ((StepVariable) ob).getParent() : ob);
                    // Check for drop to a step in the same sequence
                    Long key = Long.valueOf(stepSource.getPriority());
                    Step sourceStep = targetStep.getSequence().loadedSteps.get(key);
                    if ((sourceStep != null) && (!targetStep.equals(sourceStep))) {
                        // Check for drop on a 'following' step
                        try {
                            List<TreeObject> siblings = new ArrayList<TreeObject>();
                            getNextSiblings(siblings, targetTreeObject.getProjectTreeObject(), sourceStep);
                            // System.out.println("siblings: "+siblings.toString());
                            return siblings.contains(targetTreeObject);
                        } catch (Exception e) {
                            e.printStackTrace(System.out);
                        }
                        ;
                    }
                }
            }
        }
    }
    if (PaletteSourceTransfer.getInstance().isSupportedType(transferType)) {
        if (target instanceof TreeObject) {
            TreeObject targetTreeObject = (TreeObject) target;
            PaletteSource paletteSource = PaletteSourceTransfer.getInstance().getPaletteSource();
            if (paletteSource != null) {
                try {
                    String xmlData = paletteSource.getXmlData();
                    List<Object> list = ConvertigoPlugin.clipboardManagerDND.read(xmlData);
                    DatabaseObject databaseObject = (DatabaseObject) list.get(0);
                    if (targetTreeObject instanceof ObjectsFolderTreeObject) {
                        ObjectsFolderTreeObject folderTreeObject = (ObjectsFolderTreeObject) targetTreeObject;
                        if (!ProjectExplorerView.folderAcceptMobileComponent(folderTreeObject.folderType, databaseObject)) {
                            return false;
                        }
                        // continue
                        targetTreeObject = folderTreeObject.getParent();
                    }
                    if (targetTreeObject instanceof DatabaseObjectTreeObject) {
                        DatabaseObject targetDatabaseObject = ((DatabaseObjectTreeObject) targetTreeObject).getObject();
                        if (targetDatabaseObject != null) {
                            if (!DatabaseObjectsManager.acceptDatabaseObjects(targetDatabaseObject, databaseObject)) {
                                return false;
                            }
                            if (targetTreeObject instanceof MobileComponentTreeObject) {
                                if (!com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.acceptDatabaseObjects(targetDatabaseObject, databaseObject)) {
                                    return false;
                                }
                                if (!com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.isTplCompatible(targetDatabaseObject, databaseObject)) {
                                    return false;
                                }
                            }
                            if (targetTreeObject instanceof NgxComponentTreeObject) {
                                if (!com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.acceptDatabaseObjects(targetDatabaseObject, databaseObject)) {
                                    return false;
                                }
                                if (!com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.isTplCompatible(targetDatabaseObject, databaseObject)) {
                                    return false;
                                }
                            }
                            return true;
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace(System.out);
                }
            }
        }
    }
    if (MobileSourceTransfer.getInstance().isSupportedType(transferType)) {
        MobileSource mobileSource = MobileSourceTransfer.getInstance().getMobileSource();
        if (mobileSource != null) {
            if (target instanceof MobileUIComponentTreeObject) {
                MobileUIComponentTreeObject mcto = GenericUtils.cast(target);
                com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource mss = com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.valueOf(mobileSource.getJsonString());
                if (mss == null || !mss.isDroppableInto(mcto.getObject())) {
                    return false;
                }
                for (IPropertyDescriptor descriptor : mcto.getPropertyDescriptors()) {
                    if (descriptor instanceof MobileSmartSourcePropertyDescriptor) {
                        if (!((MobileSmartSourcePropertyDescriptor) descriptor).isReadOnly()) {
                            return true;
                        }
                    }
                }
            }
            if (target instanceof NgxUIComponentTreeObject) {
                NgxUIComponentTreeObject mcto = GenericUtils.cast(target);
                com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource mss = com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.valueOf(mobileSource.getJsonString());
                if (mss == null || !mss.isDroppableInto(mcto.getObject())) {
                    return false;
                }
                for (IPropertyDescriptor descriptor : mcto.getPropertyDescriptors()) {
                    if (descriptor instanceof NgxSmartSourcePropertyDescriptor) {
                        if (!((NgxSmartSourcePropertyDescriptor) descriptor).isReadOnly()) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobileSmartSourcePropertyDescriptor(com.twinsoft.convertigo.eclipse.property_editors.MobileSmartSourcePropertyDescriptor) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) ArrayList(java.util.ArrayList) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) XMLElementStep(com.twinsoft.convertigo.beans.steps.XMLElementStep) Step(com.twinsoft.convertigo.beans.core.Step) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) StepVariable(com.twinsoft.convertigo.beans.variables.StepVariable) NgxSmartSourcePropertyDescriptor(com.twinsoft.convertigo.eclipse.property_editors.NgxSmartSourcePropertyDescriptor) IStepSourceContainer(com.twinsoft.convertigo.beans.core.IStepSourceContainer) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) IOException(java.io.IOException) ObjectWithSameNameException(com.twinsoft.convertigo.engine.ObjectWithSameNameException) SAXException(org.xml.sax.SAXException) EngineException(com.twinsoft.convertigo.engine.EngineException) InvalidOperationException(com.twinsoft.convertigo.engine.InvalidOperationException) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) IOrderableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IOrderableTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) IOrderableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IOrderableTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) IPropertyDescriptor(org.eclipse.ui.views.properties.IPropertyDescriptor)

Example 3 with IStepSourceContainer

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

the class SourcePickerView method showStep.

private void showStep(DatabaseObject dbo, boolean showSource) {
    if (selectedDbo == null)
        return;
    String priority, xpath;
    DatabaseObject dboToShow = null;
    if (showSource) {
        XMLVector<String> sourceDefinition = ((IStepSourceContainer) dbo).getSourceDefinition();
        if (!sourceDefinition.isEmpty()) {
            Long key = Long.valueOf(sourceDefinition.firstElement());
            priority = "" + key;
            xpath = sourceDefinition.lastElement();
            Step step = dbo instanceof Step ? (Step) dbo : (Step) dbo.getParent();
            dboToShow = step.getSequence().loadedSteps.get(key);
            if (dboToShow == null) {
                ConvertigoPlugin.infoMessageBox("Source is not valid!");
                return;
            }
        } else {
            ConvertigoPlugin.infoMessageBox("Source is empty!");
            return;
        }
    } else {
        dboToShow = dbo;
        priority = "" + dboToShow.priority;
        xpath = ".";
    }
    sourcePicker.getTwsDomTree().removeAll();
    sourcePicker.getXpathEvaluator().removeAnchor();
    sourcePicker.getXpathEvaluator().getXpath().setText("");
    XMLVector<String> stepSourceDefinition = new XMLVector<String>();
    stepSourceDefinition.add(priority);
    stepSourceDefinition.add(xpath);
    sourcePicker.setStepSourceDefinition(stepSourceDefinition);
    sourcePicker.displayTargetWsdlDom(dboToShow);
    try {
        TreeObject treeObject = ConvertigoPlugin.getDefault().getProjectExplorerView().findTreeObjectByUserObject(dboToShow);
        ConvertigoPlugin.getDefault().getProjectExplorerView().setSelectedTreeObject(treeObject);
    } catch (Throwable t) {
    }
}
Also used : XMLVector(com.twinsoft.convertigo.beans.common.XMLVector) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) Step(com.twinsoft.convertigo.beans.core.Step) IStepSourceContainer(com.twinsoft.convertigo.beans.core.IStepSourceContainer)

Example 4 with IStepSourceContainer

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

the class SourcePickerView method removeSource.

private void removeSource() {
    if (selectedDbo != null) {
        if (selectedDbo instanceof IStepSourceContainer) {
            try {
                DatabaseObjectTreeObject dboTreeObject = (DatabaseObjectTreeObject) ConvertigoPlugin.getDefault().getProjectExplorerView().findTreeObjectByUserObject(selectedDbo);
                ConvertigoPlugin.getDefault().getProjectExplorerView().setSelectedTreeObject(dboTreeObject);
                dboTreeObject.setPropertyValue("sourceDefinition", new XMLVector<String>());
                showBtn.setEnabled(false);
                showBtn.setSelection(false);
                remBtn.setEnabled(false);
            } catch (Throwable t) {
            }
        }
    }
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) IStepSourceContainer(com.twinsoft.convertigo.beans.core.IStepSourceContainer)

Example 5 with IStepSourceContainer

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

Aggregations

IStepSourceContainer (com.twinsoft.convertigo.beans.core.IStepSourceContainer)6 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)4 Step (com.twinsoft.convertigo.beans.core.Step)4 XMLVector (com.twinsoft.convertigo.beans.common.XMLVector)3 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)3 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)2 TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)2 StepVariable (com.twinsoft.convertigo.beans.variables.StepVariable)2 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)2 EngineException (com.twinsoft.convertigo.engine.EngineException)2 StepSourceWrap (com.twinsoft.convertigo.engine.studio.dnd.StepSourceWrap)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 XmlQName (com.twinsoft.convertigo.beans.common.XmlQName)1 ISimpleTypeAffectation (com.twinsoft.convertigo.beans.core.ISimpleTypeAffectation)1 IVariableContainer (com.twinsoft.convertigo.beans.core.IVariableContainer)1 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)1 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)1 Variable (com.twinsoft.convertigo.beans.core.Variable)1 XMLActionStep (com.twinsoft.convertigo.beans.steps.XMLActionStep)1