use of com.twinsoft.convertigo.beans.transactions.HtmlTransaction in project convertigo by convertigo.
the class ReferencesView method handleConnectorSelection.
private void handleConnectorSelection(Object firstElement) {
ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) firstElement;
Connector connectorSelected = connectorTreeObject.getObject();
String connectorSelectedName = connectorSelected.getName();
Project projectConnectorSelected = connectorSelected.getProject();
String connectorProjectName = connectorSelected.getProject().getName();
List<Transaction> transactions = connectorSelected.getTransactionsList();
try {
Project project = null;
List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
treeViewer.setInput(null);
RootNode root = new RootNode();
ConnectorNode connectorNode = null;
connectorNode = getConnectorNode(root, connectorSelected);
root.addChild(connectorNode);
IsUsedByNode isUsedByNode = new IsUsedByNode(connectorNode, "Is used by");
RequiresNode requiresNode = new RequiresNode(connectorNode, "Requires");
ProjectNode projectFolder = null;
// Search handlers are that referenced by the selected connector for continue with site Clipper
if (connectorSelected instanceof HtmlConnector) {
ProjectNode projectNode = new ProjectNode(requiresNode, connectorProjectName, projectConnectorSelected);
for (Transaction transaction : transactions) {
List<Statement> statements = ((HtmlTransaction) transaction).getStatements();
List<String> siteClipperConnectorNames = new ArrayList<String>();
for (Statement statement : statements) {
List<Statement> statementList = ((FunctionStatement) statement).getStatements();
for (Statement st : statementList) {
if (st instanceof ContinueWithSiteClipperStatement) {
ContinueWithSiteClipperStatement continueWithSiteClipperStatement = (ContinueWithSiteClipperStatement) st;
String siteClipperconnectorName = continueWithSiteClipperStatement.getSiteClipperConnectorName();
if (!siteClipperConnectorNames.contains(siteClipperconnectorName)) {
siteClipperConnectorNames.add(siteClipperconnectorName);
Connector siteClipperConnector = projectConnectorSelected.getConnectorByName(siteClipperconnectorName);
ConnectorNode connectorSiteClipperNode = new SiteClipperConnectorNode(projectNode, siteClipperconnectorName, siteClipperConnector);
projectNode.addChild(connectorSiteClipperNode);
}
}
}
}
}
if (projectNode.hasChildren()) {
requiresNode.addChild(projectNode);
}
} else if (connectorSelected instanceof SiteClipperConnector) {
List<Connector> connectors = projectConnectorSelected.getConnectorsList();
ProjectNode projectNode = new ProjectNode(isUsedByNode, connectorProjectName, projectConnectorSelected);
for (Connector connector : connectors) {
if (connector instanceof HtmlConnector) {
List<Transaction> transactionList = ((HtmlConnector) connector).getTransactionsList();
for (Transaction transaction : transactionList) {
List<Statement> statements = ((HtmlTransaction) transaction).getStatements();
for (Statement statement : statements) {
List<Statement> statementList = ((FunctionStatement) statement).getStatements();
for (Statement st : statementList) {
if (st instanceof ContinueWithSiteClipperStatement) {
String sourceSiteClipperConnectorName = ((ContinueWithSiteClipperStatement) st).getSiteClipperConnectorName();
if (sourceSiteClipperConnectorName.equals(connectorSelectedName)) {
ContinueWithSiteClipperStatement continueWithSiteClipperStatement = (ContinueWithSiteClipperStatement) st;
HtmlConnectorNode htmlConnectorNode = new HtmlConnectorNode(projectNode, connector.getName(), connector);
projectNode.addChild(htmlConnectorNode);
TransactionNode transactionNode = new TransactionNode(htmlConnectorNode, transaction.getName(), continueWithSiteClipperStatement);
htmlConnectorNode.addChild(transactionNode);
}
}
}
}
}
}
}
if (projectNode.hasChildren()) {
isUsedByNode.addChild(projectNode);
}
}
// Searching all objects that are referenced by the selected connector
for (String projectName : projectNames) {
project = getProject(projectName, projectExplorerView);
if (project != null) {
projectFolder = new ProjectNode(isUsedByNode, projectName, project);
UrlMapper urlMapper = project.getUrlMapper();
if (urlMapper != null) {
MapperNode mapperNode = new MapperNode(projectFolder, urlMapper.getName(), urlMapper);
List<UrlMapping> mappings = urlMapper.getMappingList();
for (UrlMapping mapping : mappings) {
MappingPathNode pathNode = new MappingPathNode(mapperNode, mapping.getPath(), mapping);
List<UrlMappingOperation> operations = mapping.getOperationList();
for (UrlMappingOperation operation : operations) {
String targetRequestable = operation.getTargetRequestable();
if (targetRequestable.startsWith(projectConnectorSelected + "." + connectorSelectedName + ".")) {
MappingOperationNode operationNode = new MappingOperationNode(pathNode, operation.getName(), operation);
pathNode.addChild(operationNode);
}
}
if (pathNode.hasChildren()) {
mapperNode.addChild(pathNode);
}
}
if (mapperNode.hasChildren()) {
projectFolder.addChild(mapperNode);
}
}
List<Sequence> sequences = project.getSequencesList();
for (Sequence sequence : sequences) {
List<Step> steps = sequence.getSteps();
SequenceNode sequenceNode = new SequenceNode(projectFolder, sequence.getName(), sequence);
for (Step step : steps) {
getConnectorReferencingIsUsedBy(step, projectExplorerView, sequenceNode, transactions, connectorProjectName, connectorSelectedName);
}
if (sequenceNode.hasChildren()) {
projectFolder.addChild(sequenceNode);
}
}
if (projectFolder.hasChildren()) {
isUsedByNode.addChild(projectFolder);
}
}
}
if (requiresNode.hasChildren()) {
connectorNode.addChild(requiresNode);
}
if (isUsedByNode.hasChildren()) {
connectorNode.addChild(isUsedByNode);
}
if (!connectorNode.hasChildren()) {
connectorNode.addChild(new InformationNode(connectorNode, "This connector is not used by any other objects"));
}
treeViewer.setInput(root);
treeViewer.expandAll();
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
}
}
use of com.twinsoft.convertigo.beans.transactions.HtmlTransaction in project convertigo by convertigo.
the class TransactionTreeObject method hasBeenModified.
@Override
public void hasBeenModified(boolean modified) {
super.hasBeenModified(modified);
if (modified && (getObject() instanceof HtmlTransaction)) {
HtmlConnector htmlConnector = (HtmlConnector) ((HtmlTransaction) getObject()).getConnector();
htmlConnector.checkForStateless();
}
}
use of com.twinsoft.convertigo.beans.transactions.HtmlTransaction in project convertigo by convertigo.
the class Connector method setupConnector.
public static void setupConnector(DatabaseObject connector) throws EngineException {
if (connector instanceof JavelinConnector) {
JavelinConnector javelinConnector = (JavelinConnector) connector;
JavelinScreenClass defaultScreenClass = new JavelinScreenClass();
defaultScreenClass.setName("Default_screen_class");
defaultScreenClass.hasChanged = true;
defaultScreenClass.bNew = true;
javelinConnector.setDefaultScreenClass(defaultScreenClass);
DefaultBlockFactory blockFactory = new DefaultBlockFactory();
blockFactory.setName("Block_factory");
blockFactory.hasChanged = true;
blockFactory.bNew = true;
defaultScreenClass.setBlockFactory(blockFactory);
EmulatorTechnology emulatorTechnology = new EmulatorTechnology();
emulatorTechnology.hasChanged = true;
emulatorTechnology.bNew = true;
emulatorTechnology.setName("Emulator_technology");
defaultScreenClass.add(emulatorTechnology);
JavelinTransaction transaction = new JavelinTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("XMLize");
javelinConnector.add(transaction);
javelinConnector.setDefaultTransaction(transaction);
} else if (connector instanceof HtmlConnector) {
HtmlConnector htmlConnector = (HtmlConnector) connector;
htmlConnector.setServer("www.convertigo.com");
HtmlScreenClass defaultScreenClass = new HtmlScreenClass();
defaultScreenClass.setName("Default_screen_class");
defaultScreenClass.hasChanged = true;
defaultScreenClass.bNew = true;
htmlConnector.setDefaultScreenClass(defaultScreenClass);
HtmlTransaction transaction = new HtmlTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("XMLize");
htmlConnector.add(transaction);
htmlConnector.setDefaultTransaction(transaction);
} else if (connector instanceof HttpConnector) {
HttpConnector httpConnector = (HttpConnector) connector;
HttpTransaction transaction = new HttpTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("Default_transaction");
httpConnector.add(transaction);
httpConnector.setDefaultTransaction(transaction);
} else if (connector instanceof SapJcoConnector) {
SapJcoConnector sapConnector = (SapJcoConnector) connector;
SapJcoLogonTransaction sapLogon = new SapJcoLogonTransaction();
sapLogon.hasChanged = true;
sapLogon.bNew = true;
sapLogon.setName("Logon");
sapLogon.addCredentialsVariables();
sapConnector.add(sapLogon);
sapConnector.setDefaultTransaction(sapLogon);
SapJcoTransaction transaction = new SapJcoTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("RFC_FUNCTION_SEARCH");
transaction.setBapiName("RFC_FUNCTION_SEARCH");
RequestableVariable variable = new RequestableVariable();
variable.hasChanged = true;
variable.bNew = true;
variable.setName("FUNCNAME");
variable.setValueOrNull("BAPI_*");
transaction.add(variable);
sapConnector.add(transaction);
} else if (connector instanceof SqlConnector) {
SqlConnector sqlConnector = (SqlConnector) connector;
sqlConnector.setJdbcDriverClassName("org.hsqldb.jdbcDriver");
SqlTransaction transaction = new SqlTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("Default_transaction");
sqlConnector.add(transaction);
sqlConnector.setDefaultTransaction(transaction);
} else if (connector instanceof CicsConnector) {
CicsConnector cicsConnector = (CicsConnector) connector;
CicsTransaction transaction = new CicsTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("Default_transaction");
cicsConnector.add(transaction);
cicsConnector.setDefaultTransaction(transaction);
} else if (connector instanceof SiteClipperConnector) {
SiteClipperConnector siteClipperConnector = (SiteClipperConnector) connector;
SiteClipperScreenClass defaultScreenClass = new SiteClipperScreenClass();
defaultScreenClass.setName("Default_screen_class");
defaultScreenClass.hasChanged = true;
defaultScreenClass.bNew = true;
siteClipperConnector.setDefaultScreenClass(defaultScreenClass);
SiteClipperTransaction transaction = new SiteClipperTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("Default_transaction");
siteClipperConnector.add(transaction);
siteClipperConnector.setDefaultTransaction(transaction);
} else if (connector instanceof CouchDbConnector) {
CouchDbConnector couchDbConnector = (CouchDbConnector) connector;
String couchDbXsdPath = AbstractCouchDbTransaction.COUCHDB_XSD_LOCATION;
boolean existReference = false;
for (Reference reference : couchDbConnector.getProject().getReferenceList()) {
if (reference instanceof XsdSchemaReference) {
String urlPath = ((XsdSchemaReference) reference).getUrlpath();
if (urlPath.equals(couchDbXsdPath)) {
existReference = true;
break;
}
}
}
if (!existReference) {
ImportXsdSchemaReference reference = new ImportXsdSchemaReference();
reference.setName("CouchDb_schema");
reference.setUrlpath(couchDbXsdPath);
couchDbConnector.getProject().add(reference);
}
GetServerInfoTransaction transaction = new GetServerInfoTransaction();
couchDbConnector.add(transaction);
couchDbConnector.setDefaultTransaction(transaction);
}
}
Aggregations