use of com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass in project convertigo by convertigo.
the class HtmlTransaction method generateWsdlType.
/* (non-Javadoc)
* @see com.twinsoft.convertigo.beans.core.Transaction#generateWsdlType(org.w3c.dom.Document)
*/
@Override
public String generateWsdlType(Document document) throws Exception {
HtmlConnector connector = (HtmlConnector) getParent();
String prefix = getXsdTypePrefix();
// First regenerates wsdltype for default transaction : will contains all types!!
if (!isDefault) {
HtmlTransaction defaultTransaction = (HtmlTransaction) connector.getDefaultTransaction();
defaultTransaction.generateWsdlType(document);
defaultTransaction.hasChanged = true;
}
// Retrieve extraction rules schemas
List<HtmlScreenClass> screenClasses = connector.getAllScreenClasses();
Map<String, ScreenClass> ht = new HashMap<String, ScreenClass>(screenClasses.size());
String normalizedScreenClassName;
int i;
for (ScreenClass screenClass : screenClasses) {
normalizedScreenClassName = StringUtils.normalize(screenClass.getName());
ht.put(normalizedScreenClassName, screenClass);
}
Map<String, String> names = new HashMap<String, String>();
Map<String, String> types = new HashMap<String, String>();
List<String> schemas = new LinkedList<String>();
screenClass = connector.getDefaultScreenClass();
if (screenClass != null) {
addExtractionRuleShemas(names, types, schemas, screenClass);
}
// Retrieve statements schemas
for (Statement statement : getStatements()) {
addStatementSchemas(schemas, statement);
}
// Construct transaction schema
String transactionName = StringUtils.normalize(prefix + getName(), true) + "Response";
String schema = "<?xml version=\"1.0\" encoding=\"" + getEncodingCharSet() + "\" ?>\n";
schema += "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n";
String all, obSchema;
all = "";
for (i = 0; i < schemas.size(); i++) {
obSchema = schemas.get(i);
all += obSchema;
}
if (isDefault) {
String group = "";
String groupName = StringUtils.normalize(connector.getName(), true) + "Types";
group += "<xsd:group name=\"" + groupName + "\">\n";
group += "<xsd:sequence>\n";
group += all;
group += "</xsd:sequence>\n";
group += "</xsd:group>\n";
schema += "<xsd:complexType name=\"" + transactionName + "\">\n";
schema += "<xsd:sequence>\n";
schema += "<xsd:element minOccurs=\"0\" maxOccurs=\"1\" name=\"error\" type=\"p_ns:ConvertigoError\"/>\n";
schema += "<xsd:group minOccurs=\"0\" maxOccurs=\"1\" ref=\"p_ns:" + groupName + "\"/>\n";
schema += "</xsd:sequence>\n";
schema += "</xsd:complexType>\n";
schema += group;
for (Enumeration<String> e = Collections.enumeration(types.keySet()); e.hasMoreElements(); ) {
String typeSchema = (String) types.get(e.nextElement());
schema += typeSchema;
}
} else {
schema += "<xsd:complexType name=\"" + transactionName + "\">\n";
schema += "<xsd:sequence>\n";
schema += "<xsd:element minOccurs=\"0\" maxOccurs=\"1\" name=\"error\" type=\"p_ns:ConvertigoError\"/>\n";
schema += all;
schema += "</xsd:sequence>\n";
schema += "</xsd:complexType>\n";
}
schema += "</xsd:schema>\n";
String prettyPrintedText = XMLUtils.prettyPrintDOM(schema);
int index = prettyPrintedText.indexOf("<xsd:schema") + "<xsd:schema".length();
index = prettyPrintedText.indexOf('\n', index);
prettyPrintedText = prettyPrintedText.substring(index + 1);
prettyPrintedText = prettyPrintedText.substring(0, prettyPrintedText.indexOf("</xsd:schema>"));
// prettyPrintedText = removeTab(prettyPrintedText);
return prettyPrintedText;
}
use of com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass in project convertigo by convertigo.
the class TreeDropAdapter method createHtmlScreenClass.
private HtmlScreenClass createHtmlScreenClass(long priority) throws EngineException {
HtmlScreenClass htmlSc = new HtmlScreenClass();
htmlSc.priority = priority;
htmlSc.hasChanged = true;
htmlSc.bNew = true;
return htmlSc;
}
use of com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass 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