use of com.twinsoft.convertigo.beans.steps.SequenceStep in project convertigo by convertigo.
the class ReferencesView method getRequiredRequestables.
private void getRequiredRequestables(Step step, Project projectSelected, ProjectExplorerView projectExplorerView, AbstractParentNode parentNode, List<String> transactionList, List<String> sequenceList) {
try {
if (step instanceof SequenceStep) {
SequenceStep sequenceStep = (SequenceStep) step;
String sourceProjectName = sequenceStep.getProjectName();
if (!sourceProjectName.equals(projectSelected.getName())) {
Project project;
project = getProject(sourceProjectName, projectExplorerView);
ProjectNode projectNode = new ProjectNode(parentNode, sourceProjectName, project);
Sequence sourceSequence = null;
String sourceSequenceName = sequenceStep.getSequenceName();
try {
if (project != null)
sourceSequence = project.getSequenceByName(sourceSequenceName);
} catch (EngineException e) {
sourceSequence = null;
}
projectNode.addChild(new SequenceNode(projectNode, sourceSequenceName, sourceSequence));
if (!sequenceList.contains(sourceProjectName + sourceSequenceName)) {
sequenceList.add(sourceProjectName + sourceSequenceName);
parentNode.addChild(projectNode);
}
}
} else if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String sourceProjectName = transactionStep.getProjectName();
if (!sourceProjectName.equals(projectSelected.getName())) {
Project project;
project = getProject(sourceProjectName, projectExplorerView);
ProjectNode projectNode = new ProjectNode(parentNode, sourceProjectName, project);
if (project != null) {
Connector connector = project.getConnectorByName(transactionStep.getConnectorName());
ConnectorNode connectorNode = null;
connectorNode = getConnectorNode(projectNode, connector);
projectNode.addChild(connectorNode);
Transaction sourceTransaction = null;
String sourceTransactionName = transactionStep.getTransactionName();
try {
if (connector != null)
sourceTransaction = connector.getTransactionByName(sourceTransactionName);
} catch (Exception e) {
sourceTransaction = null;
}
connectorNode.addChild(new TransactionNode(connectorNode, sourceTransactionName, sourceTransaction));
if (!transactionList.contains(project.getName() + connector.getName() + sourceTransactionName)) {
transactionList.add(project.getName() + connector.getName() + sourceTransactionName);
parentNode.addChild(projectNode);
}
}
}
} else if (isStepContainer(step)) {
List<Step> steps = getStepList(step);
if (steps != null) {
for (Step s : steps) {
getRequiredRequestables(s, projectSelected, projectExplorerView, parentNode, transactionList, sequenceList);
}
}
}
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Unable to load the project", true);
}
}
use of com.twinsoft.convertigo.beans.steps.SequenceStep in project convertigo by convertigo.
the class ReferencesView method getSequenceReferencingIsUsedBy.
private void getSequenceReferencingIsUsedBy(Step step, Sequence sequenceSelected, SequenceNode seNode) {
if (step instanceof SequenceStep) {
String sourceSequence = ((SequenceStep) step).getSourceSequence();
if (sourceSequence.equals(sequenceSelected.getProject().getName() + RequestableStep.SOURCE_SEPARATOR + sequenceSelected.getName())) {
SequenceStepNode sequenceStepNode = new SequenceStepNode(seNode, step.getName(), step);
seNode.addChild(sequenceStepNode);
}
} else if (isStepContainer(step)) {
List<Step> steps = getStepList(step);
for (Step s : steps) {
getSequenceReferencingIsUsedBy(s, sequenceSelected, seNode);
}
}
}
use of com.twinsoft.convertigo.beans.steps.SequenceStep in project convertigo by convertigo.
the class ReferencesView method getSequenceReferencingRequires.
private void getSequenceReferencingRequires(Step step, Sequence sequenceSelected, ProjectExplorerView projectExplorerView, RequiresNode requiresNode, List<String> transactionList, List<String> sequenceList) {
try {
if (step instanceof SequenceStep) {
SequenceStep sequenceStep = (SequenceStep) step;
String projectName = sequenceStep.getProjectName();
String sequenceName = sequenceStep.getSequenceName();
Project project = getProject(projectName, projectExplorerView);
ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
Sequence sequence = null;
try {
if (project != null)
sequence = project.getSequenceByName(sequenceStep.getSequenceName());
} catch (EngineException e) {
sequence = null;
}
SequenceNode sequenceNode = new SequenceNode(projectNode, sequenceName, sequence);
projectNode.addChild(sequenceNode);
if (!sequenceList.contains(projectName + sequenceName)) {
sequenceList.add(projectName + sequenceName);
requiresNode.addChild(projectNode);
}
} else if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String projectName = transactionStep.getProjectName();
String connectorName = transactionStep.getConnectorName();
String transactionName = transactionStep.getTransactionName();
Project project = getProject(projectName, projectExplorerView);
ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
Connector connector = null;
Transaction transaction = null;
try {
if (project != null) {
connector = project.getConnectorByName(connectorName);
if (connector != null) {
transaction = connector.getTransactionByName(transactionName);
}
}
} catch (EngineException e) {
connector = null;
transaction = null;
}
ConnectorNode connectorNode = getConnectorNode(projectNode, connector);
if (connectorNode == null)
connectorNode = new ConnectorNode(projectNode, connectorName, connector);
projectNode.addChild(connectorNode);
TransactionNode transactionNode = new TransactionNode(projectNode, transactionName, transaction);
connectorNode.addChild(transactionNode);
if (!transactionList.contains(projectName + connectorName + transactionName)) {
transactionList.add(projectName + connectorName + transactionName);
requiresNode.addChild(projectNode);
}
} else if (isStepContainer(step)) {
List<Step> steps = getStepList(step);
for (Step s : steps) {
getSequenceReferencingRequires(s, sequenceSelected, projectExplorerView, requiresNode, transactionList, sequenceList);
}
}
} catch (Exception e) {
ConvertigoPlugin.logException(e, "Unable to load the project", true);
}
}
use of com.twinsoft.convertigo.beans.steps.SequenceStep in project convertigo by convertigo.
the class ProjectTreeObject method checkForImports.
private void checkForImports(List<String> missingList, List<Step> steps) {
String targetProjectName;
for (Step step : steps) {
if (step instanceof StepWithExpressions) {
checkForImports(missingList, ((StepWithExpressions) step).getSteps());
} else {
if (step instanceof TransactionStep) {
TransactionStep transactionStep = ((TransactionStep) step);
targetProjectName = transactionStep.getProjectName();
if (!targetProjectName.equals(getName())) {
try {
transactionStep.getSequence().getLoadedProject(targetProjectName);
} catch (EngineException e) {
if (!missingList.contains(targetProjectName))
missingList.add(targetProjectName);
}
}
} else if (step instanceof SequenceStep) {
SequenceStep sequenceStep = ((SequenceStep) step);
targetProjectName = sequenceStep.getProjectName();
if (!targetProjectName.equals(getName())) {
try {
sequenceStep.getSequence().getLoadedProject(targetProjectName);
} catch (EngineException e) {
if (!missingList.contains(targetProjectName))
missingList.add(targetProjectName);
}
}
}
}
}
}
use of com.twinsoft.convertigo.beans.steps.SequenceStep in project convertigo by convertigo.
the class VariableTreeObject2 method handlesBeanNameChanged.
protected void handlesBeanNameChanged(TreeObjectEvent treeObjectEvent) {
DatabaseObjectTreeObject treeObject = (DatabaseObjectTreeObject) treeObjectEvent.getSource();
DatabaseObject databaseObject = (DatabaseObject) treeObject.getObject();
Object oldValue = treeObjectEvent.oldValue;
Object newValue = treeObjectEvent.newValue;
int update = treeObjectEvent.update;
// Updates variables references
if (update != TreeObjectEvent.UPDATE_NONE) {
boolean isLocalProject = false;
boolean isSameValue = false;
boolean shouldUpdate = false;
try {
if (getObject() instanceof Variable) {
Variable variable = (Variable) getObject();
if (databaseObject instanceof RequestableVariable) {
isLocalProject = variable.getProject().equals(databaseObject.getProject());
isSameValue = variable.getName().equals(oldValue);
shouldUpdate = (update == TreeObjectEvent.UPDATE_ALL) || ((update == TreeObjectEvent.UPDATE_LOCAL) && (isLocalProject));
// Verify if parent of databaseObject is a transaction
if (databaseObject.getParent() instanceof Transaction) {
Transaction transaction = (Transaction) databaseObject.getParent();
// Case of rename for Call Transaction
if (variable.getParent() instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) variable.getParent();
if (transactionStep.getSourceTransaction().equals(transaction.getProject() + "." + transaction.getConnector() + "." + transaction.getName())) {
updateNameReference(isSameValue, shouldUpdate, variable, newValue);
}
}
/*
* propagation to testCases of variable renaming in a transaction
*/
if (variable.getParent() instanceof TransactionWithVariables) {
propagateVariableRename(true, true, treeObjectEvent, ((TransactionWithVariables) transaction).getTestCasesList(), transaction.getName());
}
}
// Verify if parent of databaseObject is a sequence
if (databaseObject.getParent() instanceof Sequence) {
Sequence sequence = (Sequence) databaseObject.getParent();
// Case of rename for Call Sequence
if (variable.getParent() instanceof SequenceStep) {
SequenceStep sequenceStep = (SequenceStep) variable.getParent();
if (sequenceStep.getSourceSequence().equals(sequence.getProject() + "." + sequence.getName())) {
updateNameReference(isSameValue, shouldUpdate, variable, newValue);
}
}
/*
* propagation to testCases of variable renaming in a sequence
*/
if (variable.getParent() instanceof Sequence) {
propagateVariableRename(true, true, treeObjectEvent, sequence.getTestCasesList(), sequence.getName());
}
}
}
}
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Unable to rename the variable references of '" + databaseObject.getName() + "'!");
}
}
}
Aggregations