Search in sources :

Example 11 with HtmlTransaction

use of com.twinsoft.convertigo.beans.transactions.HtmlTransaction in project convertigo by convertigo.

the class WaitTriggerStatement method execute.

@Override
public boolean execute(Context javascriptContext, Scriptable scope) throws EngineException {
    if (isEnabled()) {
        if (super.execute(javascriptContext, scope)) {
            HtmlTransaction htmlTransaction = getParentTransaction();
            HtmlConnector htmlConnector = (HtmlConnector) htmlTransaction.getParent();
            htmlConnector.getHtmlParser().waitTrigger(htmlTransaction.context, trigger.getTrigger());
            return true;
        }
    }
    return false;
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction)

Example 12 with HtmlTransaction

use of com.twinsoft.convertigo.beans.transactions.HtmlTransaction in project convertigo by convertigo.

the class TreeDropAdapter method paste.

public DatabaseObject paste(Node node, DatabaseObject parentDatabaseObject, boolean bChangeName) throws EngineException {
    Object object = ConvertigoPlugin.clipboardManagerDND.read(node);
    if (object instanceof DatabaseObject) {
        DatabaseObject databaseObject = (DatabaseObject) object;
        String dboName = databaseObject.getName();
        String name = null;
        boolean bContinue = true;
        int index = 0;
        while (bContinue) {
            if (bChangeName) {
                if (index == 0)
                    name = dboName;
                else
                    name = dboName + index;
                databaseObject.setName(name);
            }
            databaseObject.hasChanged = true;
            databaseObject.bNew = true;
            try {
                if (parentDatabaseObject != null)
                    parentDatabaseObject.add(databaseObject);
                bContinue = false;
            } catch (ObjectWithSameNameException owsne) {
                if ((parentDatabaseObject instanceof HtmlTransaction) && (databaseObject instanceof Statement))
                    throw new EngineException("HtmlTransaction already contains a statement named \"" + name + "\".", owsne);
                if ((parentDatabaseObject instanceof Sequence) && (databaseObject instanceof Step))
                    throw new EngineException("Sequence already contains a step named \"" + name + "\".", owsne);
                // Silently ignore
                index++;
            }
        }
        NodeList childNodes = node.getChildNodes();
        int len = childNodes.getLength();
        Node childNode;
        String childNodeName;
        for (int i = 0; i < len; i++) {
            childNode = childNodes.item(i);
            if (childNode.getNodeType() != Node.ELEMENT_NODE)
                continue;
            childNodeName = childNode.getNodeName();
            if (!(childNodeName.equalsIgnoreCase("property")) && !(childNodeName.equalsIgnoreCase("handlers")) && !(childNodeName.equalsIgnoreCase("wsdltype")) && !(childNodeName.equalsIgnoreCase("docdata")) && !(childNodeName.equalsIgnoreCase("beandata")) && !(childNodeName.equalsIgnoreCase("dnd"))) {
                paste(childNode, databaseObject, bChangeName);
            }
        }
        // needed !
        databaseObject.isImporting = false;
        databaseObject.isSubLoaded = true;
        return databaseObject;
    }
    return null;
}
Also used : XpathableStatement(com.twinsoft.convertigo.beans.statements.XpathableStatement) Statement(com.twinsoft.convertigo.beans.core.Statement) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) EngineException(com.twinsoft.convertigo.engine.EngineException) Sequence(com.twinsoft.convertigo.beans.core.Sequence) 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) ObjectWithSameNameException(com.twinsoft.convertigo.engine.ObjectWithSameNameException) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) 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) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) 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)

Example 13 with HtmlTransaction

use of com.twinsoft.convertigo.beans.transactions.HtmlTransaction in project convertigo by convertigo.

the class HtmlConnectorDesignComposite method startLearn.

protected void startLearn() {
    if (htmlConnector.isLearning()) {
        stopLearn();
    }
    // add current composite view to the HTTP proxy listeners
    getWebViewer().addHttpProxyEventListener(this);
    // set learning flag
    htmlConnector.markAsLearning(true);
    HtmlTransaction htmlTransaction = (HtmlTransaction) htmlConnector.getLearningTransaction();
    if (htmlTransaction == null) {
        Object object = projectExplorerView.getFirstSelectedDatabaseObject();
        if (object != null && object instanceof HtmlTransaction) {
            try {
                htmlTransaction = (HtmlTransaction) object;
                htmlTransaction.markAsLearning(true);
                ConvertigoPlugin.logDebug2("(HtmlConnector) learning transaction named '" + htmlTransaction.getName() + "'");
            } catch (Exception e) {
            }
        }
    }
    final HtmlTransaction transaction = htmlTransaction;
    Thread th = new Thread(new Runnable() {

        public void run() {
            Document dom = getWebViewer().getDom();
            transaction.setCurrentXmlDocument(dom);
        }
    });
    th.setName("Document completed Update");
    th.start();
    if (!toolLearn.isEnabled()) {
        toolLearn.setEnabled(true);
    }
    if (!toolLearn.getSelection()) {
        toolLearn.setSelection(true);
    }
}
Also used : HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) EventObject(java.util.EventObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Document(org.w3c.dom.Document) KeyExpiredException(com.twinsoft.convertigo.engine.KeyExpiredException) EngineException(com.twinsoft.convertigo.engine.EngineException) TransformerException(javax.xml.transform.TransformerException) MaxCvsExceededException(com.twinsoft.convertigo.engine.MaxCvsExceededException) ObjectWithSameNameException(com.twinsoft.convertigo.engine.ObjectWithSameNameException)

Example 14 with HtmlTransaction

use of com.twinsoft.convertigo.beans.transactions.HtmlTransaction in project convertigo by convertigo.

the class HtmlConnector method prepareForTransaction.

/* (non-Javadoc)
	 * @see com.twinsoft.convertigo.beans.connectors.HttpConnector#prepareForTransaction(com.twinsoft.convertigo.engine.Context)
	 */
@Override
public void prepareForTransaction(Context context) throws EngineException {
    if (!Engine.hasXulRunner()) {
        throw new EngineException("This configuration doesn't have XulRunner for the HTML Connector (32 bits version have).");
    }
    Engine.logBeans.trace("(HtmlConnector) Retrieving or Initializing HtmlParser");
    // Engine mode : retrieve HtmlParser from context
    if (Engine.isEngineMode()) {
        if (this.htmlParser == null) {
            Engine.logBeans.trace("(HtmlConnector) Creating new HtmlParser for context id " + context.contextID);
            HtmlParser htmlParser = new HtmlParser(null);
            this.addHttpStateListener(htmlParser);
            setHtmlParser(htmlParser);
        } else
            Engine.logBeans.trace("(HtmlConnector) Using HtmlParser of HTML Connector for context id " + context.contextID);
    } else // Studio mode
    {
        if (this.htmlParser == null) {
            throw new EngineException("Studio mode: the HTML connector must be open in order to execute transactions");
        }
        Engine.logBeans.trace("(HtmlConnector) Using HtmlParser of Studio for context id " + context.contextID);
    }
    if (context.requestedObject != null && context.requestedObject instanceof HtmlTransaction) {
        HtmlTransaction htmlTransaction = (HtmlTransaction) context.requestedObject;
        if (!htmlTransaction.isStateFull())
            getHtmlParser().resetBrowserProperty(context);
    }
    super.prepareForTransaction(context);
}
Also used : HtmlParser(com.twinsoft.convertigo.engine.parsers.HtmlParser) EngineException(com.twinsoft.convertigo.engine.EngineException) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction)

Example 15 with HtmlTransaction

use of com.twinsoft.convertigo.beans.transactions.HtmlTransaction in project convertigo by convertigo.

the class HtmlConnector method prepareForHTTPStatement.

public void prepareForHTTPStatement(Context context) throws EngineException {
    Engine.logBeans.debug("(HtmlConnector) Preparing for http statement");
    // Retrieve current executing transaction
    HtmlTransaction htmlTransaction = getCurrentHtmlTransaction(context);
    if ((htmlTransaction == null) || (!htmlTransaction.runningThread.bContinue)) {
        return;
    }
    // Retrieve current statement : the statement being executed
    Statement statement = htmlTransaction.currentStatement;
    if (statement == null) {
        return;
    }
    if (!(statement instanceof HTTPStatement)) {
        return;
    }
    HTTPStatement httpStatement = (HTTPStatement) statement;
    handleCookie = httpStatement.isHandleCookie();
    httpParameters = httpStatement.getHttpParameters();
    sUrl = httpStatement.getUrl(isHttps(), getServer(), getPort());
    Engine.logBeans.debug("(HtmlConnector) URL: " + sUrl);
    // Parse input document for HTTPStatement variables
    httpStatement.parseInputDocument(context);
    // Getting all input variables marked as GET
    Engine.logBeans.trace("(HtmlConnector) Loading all GET input variables");
    String queryString = httpStatement.getQueryString(context);
    if (Engine.logBeans.isDebugEnabled())
        Engine.logBeans.debug("(HtmlConnector) GET query: " + Visibility.Logs.replaceVariables(httpStatement.getVariables(), queryString));
    // Encodes URL if it contains special characters
    sUrl = URLUtils.encodeAbsoluteURL(sUrl, htmlTransaction.getComputedUrlEncodingCharset());
    if (queryString.length() != 0) {
        sUrl += (sUrl.indexOf('?') == -1 ? "?" : "&") + queryString;
    }
    // Posting all input variables marked as POST
    Engine.logBeans.trace("(HtmlConnector) Loading all POST input variables");
    postQuery = httpStatement.getPostQuery(context);
    if (Engine.logBeans.isDebugEnabled()) {
        Engine.logBeans.debug("(HtmlConnector) POST query: " + Visibility.Logs.replaceVariables(httpStatement.getVariables(), postQuery));
    }
    // Setup the SSL properties if needed
    if (isHttps() || httpStatement.isHttps()) {
        Engine.logBeans.debug("(HtmlConnector) Setting up SSL properties");
        certificateManager.collectStoreInformation(context);
    }
    Engine.logBeans.debug("(HtmlConnector) Connector successfully prepared for statement");
}
Also used : HTTPUploadStatement(com.twinsoft.convertigo.beans.statements.HTTPUploadStatement) HTTPStatement(com.twinsoft.convertigo.beans.statements.HTTPStatement) Statement(com.twinsoft.convertigo.beans.core.Statement) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) HTTPStatement(com.twinsoft.convertigo.beans.statements.HTTPStatement)

Aggregations

HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)28 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)14 EngineException (com.twinsoft.convertigo.engine.EngineException)13 Transaction (com.twinsoft.convertigo.beans.core.Transaction)11 Statement (com.twinsoft.convertigo.beans.core.Statement)10 Connector (com.twinsoft.convertigo.beans.core.Connector)8 JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)6 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)6 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)6 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)6 ScreenClass (com.twinsoft.convertigo.beans.core.ScreenClass)6 Sequence (com.twinsoft.convertigo.beans.core.Sequence)6 Step (com.twinsoft.convertigo.beans.core.Step)6 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)6 CicsConnector (com.twinsoft.convertigo.beans.connectors.CicsConnector)5 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)5 JavelinScreenClass (com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass)5 HTTPStatement (com.twinsoft.convertigo.beans.statements.HTTPStatement)5 JavelinTransaction (com.twinsoft.convertigo.beans.transactions.JavelinTransaction)5 ScHandlerStatement (com.twinsoft.convertigo.beans.statements.ScHandlerStatement)4