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;
}
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;
}
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);
}
}
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);
}
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");
}
Aggregations