use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.
the class TransactionExecuteSelectedFromStubAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
if ((treeObject != null) && (treeObject instanceof TransactionTreeObject)) {
TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject;
Transaction transaction = transactionTreeObject.getObject();
transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
Connector connector = (Connector) transaction.getParent();
ProjectTreeObject projectTreeObject = transactionTreeObject.getProjectTreeObject();
ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
if (connectorEditor != null) {
getActivePage().activate(connectorEditor);
connectorEditor.getDocument(transaction.getName(), true);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to execute the selected transaction!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.
the class SetDefaultTransactionAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TransactionTreeObject transactionTreeObject = (TransactionTreeObject) explorerView.getFirstSelectedTreeObject();
Transaction transaction = (Transaction) explorerView.getFirstSelectedDatabaseObject();
Connector connector = (Connector) transaction.getParent();
// Report from 4.5: fix #401
TransactionTreeObject defaultTransactionTreeObject = null;
Transaction defaultTransaction = connector.getDefaultTransaction();
if (defaultTransaction != null) {
defaultTransactionTreeObject = (TransactionTreeObject) explorerView.findTreeObjectByUserObject(defaultTransaction);
}
connector.setDefaultTransaction(transaction);
if (defaultTransactionTreeObject != null) {
defaultTransactionTreeObject.isDefault = false;
defaultTransactionTreeObject.hasBeenModified(true);
}
transactionTreeObject.isDefault = true;
transactionTreeObject.hasBeenModified(true);
// Updating the tree
explorerView.refreshTreeObject(transactionTreeObject.getParentDatabaseObjectTreeObject());
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to set transaction to default one!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.beans.core.Connector 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);
Sequence subSequence = projectTreeObject.getObject().getSequenceByName(sequenceStep.getSequenceName());
SequenceTreeObject subSequenceTreeObject = (SequenceTreeObject) explorerView.findTreeObjectByUserObject(subSequence);
// recurse on sequence
openEditors(explorerView, subSequenceTreeObject, alreadyOpened);
} catch (EngineException e) {
e.printStackTrace();
}
} else if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String projectName = transactionStep.getProjectName();
if (!step.getSequence().getProject().getName().equals(projectName))
// load project if necessary
loadProject(explorerView, projectName);
try {
ProjectTreeObject projectTreeObject = (ProjectTreeObject) explorerView.getProjectRootObject(projectName);
Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(connector);
// open connector editor
connectorTreeObject.openConnectorEditor();
} catch (EngineException e) {
e.printStackTrace();
}
} else if (step instanceof StepWithExpressions) {
openEditors(explorerView, ((StepWithExpressions) step).getSteps(), alreadyOpened);
}
}
}
}
use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.
the class JavelinTransaction method insertObjectsInScope.
protected void insertObjectsInScope() throws EngineException {
super.insertObjectsInScope();
Connector connector = (Connector) parent;
// Insert the Javelin object in the script scope
Scriptable jsJavelin = org.mozilla.javascript.Context.toObject(((JavelinConnector) connector).javelin, scope);
scope.put("javelin", scope, jsJavelin);
// Insert the dataStableTimeout object in the script scope
Scriptable jsDataStableTimeout = org.mozilla.javascript.Context.toObject(Integer.valueOf(timeoutForDataStable), scope);
scope.put("timeout", scope, jsDataStableTimeout);
// Insert the dataStableThreshold object in the script scope
Scriptable jsDataStableThreshold = org.mozilla.javascript.Context.toObject(Integer.valueOf(dataStableThreshold), scope);
scope.put("threshold", scope, jsDataStableThreshold);
}
use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.
the class DatabaseObjectsManager method performWsMigration.
private boolean performWsMigration(String version, String projectName) {
if (VersionUtils.compare(version, "4.6.0") < 0) {
try {
// Retrieve a !clone! of project to perform update
Project project = getProjectByName(projectName);
for (Connector connector : project.getConnectorsList()) {
// Retrieve backup wsdlTypes and store Transaction's schema
for (Transaction transaction : connector.getTransactionsList()) {
try {
String xsdTypes = transaction.migrateToXsdTypes();
transaction.writeSchemaToFile(xsdTypes);
Engine.logDatabaseObjectManager.info("Internal schema stored for \"" + transaction.getName() + "\" transaction");
} catch (Exception e) {
Engine.logDatabaseObjectManager.error("An error occured while writing schema to file for \"" + transaction.getName() + "\" transaction");
}
}
}
// Fix sequence's steps sources
for (Sequence sequence : project.getSequencesList()) {
try {
List<Step> steps = sequence.getSteps();
// Replace source's xpath
// replace ./xxx by
// ./transaction/document/xxx or by
// ./sequence/document/xxx
replaceSourceXpath(version, sequence, steps);
Engine.logDatabaseObjectManager.info("Step sources updated for sequence \"" + sequence.getName() + "\"");
} catch (Exception e) {
Engine.logDatabaseObjectManager.error("An error occured while updating step sources for sequence \"" + sequence.getName() + "\"");
}
}
} catch (Exception e) {
Engine.logDatabaseObjectManager.error("An error occured while updating project '" + projectName + "' for XSD", e);
return false;
}
}
return true;
}
Aggregations