use of com.twinsoft.convertigo.beans.core.Step in project convertigo by convertigo.
the class XMLCopyStep method getTargetXPath.
protected String getTargetXPath() throws EngineException {
String xpath = "";
StepSource source = getSource();
if (!source.isEmpty()) {
Step sourceStep = source.getStep();
if (sourceStep instanceof IteratorStep) {
xpath = source.getXpath().substring(1);
}
}
return xpath;
}
use of com.twinsoft.convertigo.beans.core.Step 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);
Project p = step.getProject();
Sequence subSequence = p.getSequenceByName(sequenceStep.getSequenceName());
SequenceView subSequenceTreeObject = (SequenceView) Studio.getViewFromDbo(subSequence, studio);
// recurse on sequence
openEditors(/*explorerView, */
subSequenceTreeObject, alreadyOpened);
} catch (EngineException e) {
}
} else if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String projectName = transactionStep.getProjectName();
if (!step.getSequence().getProject().getName().equals(projectName)) {
// loadProject(explorerView, projectName); // load project if necessary
}
try {
// ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getProjectRootObject(projectName);
Project project = Engine.theApp.databaseObjectsManager.getProjectByName(projectName);
ProjectView projectTreeObject = new ProjectView(project, studio);
Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
ConnectorView connectorTreeObject = new ConnectorView(connector, studio);
// open connector editor
connectorTreeObject.openConnectorEditor();
} catch (EngineException e) {
}
} else if (step instanceof StepWithExpressions) {
openEditors(/*explorerView, */
((StepWithExpressions) step).getSteps(), alreadyOpened);
}
}
}
}
use of com.twinsoft.convertigo.beans.core.Step 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!");
}
}
use of com.twinsoft.convertigo.beans.core.Step in project convertigo by convertigo.
the class SourcePickerHelperWrap method displayTargetWsdlDom.
public void displayTargetWsdlDom(DatabaseObject dbo) {
try {
if (dbo instanceof Step) {
Step step = (Step) dbo;
String xpath = getSourceXPath();
String anchor = step.getAnchor();
Document stepDoc = null;
Step targetStep = step;
while (targetStep instanceof IteratorStep) {
targetStep = getTargetStep(targetStep);
}
if (targetStep != null) {
Project project = step.getProject();
XmlSchema schema = Engine.theApp.schemaManager.getSchemaForProject(project.getName(), Option.fullSchema);
XmlSchemaObject xso = SchemaMeta.getXmlSchemaObject(schema, targetStep);
if (xso != null) {
stepDoc = XmlSchemaUtils.getDomInstance(xso);
}
}
if (stepDoc != null) /* && !(targetStep instanceof IteratorStep)*/
{
// stepDoc can be null for non "xml" step : e.g jIf
Document doc = step.getSequence().createDOM();
Element root = (Element) doc.importNode(stepDoc.getDocumentElement(), true);
doc.replaceChild(root, doc.getDocumentElement());
removeUserDefinedNodes(doc.getDocumentElement());
boolean shouldDisplayDom = (!(!step.isXml() && (step instanceof StepWithExpressions) && !(step instanceof IteratorStep)));
if ((doc != null) && (shouldDisplayDom)) {
xpath = onDisplayXhtml(xpath);
displayXhtml(doc);
xpathEvaluator.removeAnchor();
xpathEvaluator.displaySelectionXpathWithAnchor(twsDomTree, anchor, xpath);
return;
}
}
}
} catch (Exception e) {
// ConvertigoPlugin.logException(e, StringUtils.readStackTraceCauses(e));
}
clean();
}
use of com.twinsoft.convertigo.beans.core.Step in project convertigo by convertigo.
the class SequenceEditorPartWrap method checkEventSource.
private boolean checkEventSource(EventObject event) {
boolean isSourceFromSequence = false;
if (event instanceof RequestableEngineEvent) {
RequestableEngineEvent requestableEvent = (RequestableEngineEvent) event;
String sequenceName = requestableEvent.getSequenceName();
if (sequenceName != null) {
if (sequenceName.equals(sequence.getName()) && requestableEvent.getProjectName().equals(sequence.getProject().getName())) {
isSourceFromSequence = true;
}
}
} else if (event instanceof EngineEvent) {
Object ob = ((EngineEvent) event).getSource();
if (ob instanceof Step) {
try {
String projectName = ((Step) ob).getProject().getName();
String sequenceName = ((Step) ob).getSequence().getName();
if (sequenceName.equals(sequence.getName()) && projectName.equals(sequence.getProject().getName())) {
isSourceFromSequence = true;
}
} catch (Exception e) {
}
}
}
return isSourceFromSequence;
}
Aggregations