use of com.twinsoft.convertigo.beans.common.DefaultBlockFactory 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);
}
}
use of com.twinsoft.convertigo.beans.common.DefaultBlockFactory in project convertigo by convertigo.
the class JavelinTransaction method searchPanelsAndApplyExtractionRules.
public void searchPanelsAndApplyExtractionRules(JavelinScreenClass screenClass, BlockFactory blockFactory, iJavelin javelin, boolean bNotFirstLoop) throws EngineException {
// if there are panel type blocks, apply extraction rules on the panel block children
Block tmpBlock = null;
try {
tmpBlock = blockFactory.getFirstBlock();
} catch (NoSuchElementException e) {
Engine.logContext.trace("(JavelinTransaction) Cannot apply extraction rules in panels : no block left in block factory.");
return;
}
PanelBlockFactory bf = null;
while (tmpBlock != null) {
if (tmpBlock.type.equals("panel") || tmpBlock.type.equals("container") || tmpBlock.type.equals("tabBox")) {
// creation of a BlockFactory containing the child blocks
try {
bf = PanelBlockFactory.cloneBlockFactory((DefaultBlockFactory) blockFactory);
} catch (CloneNotSupportedException e) {
throw new EngineException("(JavelinTransaction) Exception when cloning blockFactory", e);
}
bf.setName("Panel_block_factory");
bf.make(tmpBlock);
if (tmpBlock.type.equals("panel")) {
// if type = panel, apply extraction rules
Engine.logContext.trace("(JavelinTransaction) Applying extraction rules in a panel.");
applyExtractionRules(screenClass, bf, javelin, bNotFirstLoop);
Engine.logContext.trace("(JavelinTransaction) End applying extraction rules in a panel.");
// replace panel content with blockFactory blocks
tmpBlock.clearOptionalChildren();
for (Block block : bf.list) tmpBlock.addOptionalChildren(block);
} else if (tmpBlock.type.equals("container") || tmpBlock.type.equals("tabBox")) {
// if type = container or tabBox, recurse on this method to find inside panels
searchPanelsAndApplyExtractionRules(screenClass, bf, javelin, bNotFirstLoop);
}
}
// go on the next block
tmpBlock = blockFactory.getNextBlock(tmpBlock);
}
}
Aggregations