Search in sources :

Example 1 with DefaultBlockFactory

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);
    }
}
Also used : EmulatorTechnology(com.twinsoft.convertigo.beans.common.EmulatorTechnology) HttpTransaction(com.twinsoft.convertigo.beans.transactions.HttpTransaction) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) SapJcoLogonTransaction(com.twinsoft.convertigo.beans.transactions.SapJcoLogonTransaction) SiteClipperScreenClass(com.twinsoft.convertigo.beans.screenclasses.SiteClipperScreenClass) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) ImportXsdSchemaReference(com.twinsoft.convertigo.beans.references.ImportXsdSchemaReference) HtmlScreenClass(com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass) JavelinScreenClass(com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) SapJcoTransaction(com.twinsoft.convertigo.beans.transactions.SapJcoTransaction) XsdSchemaReference(com.twinsoft.convertigo.beans.references.XsdSchemaReference) ImportXsdSchemaReference(com.twinsoft.convertigo.beans.references.ImportXsdSchemaReference) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) SiteClipperTransaction(com.twinsoft.convertigo.beans.transactions.SiteClipperTransaction) XsdSchemaReference(com.twinsoft.convertigo.beans.references.XsdSchemaReference) ImportXsdSchemaReference(com.twinsoft.convertigo.beans.references.ImportXsdSchemaReference) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) SqlTransaction(com.twinsoft.convertigo.beans.transactions.SqlTransaction) DefaultBlockFactory(com.twinsoft.convertigo.beans.common.DefaultBlockFactory) CicsTransaction(com.twinsoft.convertigo.beans.transactions.CicsTransaction) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) GetServerInfoTransaction(com.twinsoft.convertigo.beans.transactions.couchdb.GetServerInfoTransaction) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SapJcoConnector(com.twinsoft.convertigo.beans.connectors.SapJcoConnector)

Example 2 with DefaultBlockFactory

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);
    }
}
Also used : PanelBlockFactory(com.twinsoft.convertigo.beans.common.PanelBlockFactory) EngineException(com.twinsoft.convertigo.engine.EngineException) Block(com.twinsoft.convertigo.beans.core.Block) DefaultBlockFactory(com.twinsoft.convertigo.beans.common.DefaultBlockFactory) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

DefaultBlockFactory (com.twinsoft.convertigo.beans.common.DefaultBlockFactory)2 EmulatorTechnology (com.twinsoft.convertigo.beans.common.EmulatorTechnology)1 PanelBlockFactory (com.twinsoft.convertigo.beans.common.PanelBlockFactory)1 CicsConnector (com.twinsoft.convertigo.beans.connectors.CicsConnector)1 CouchDbConnector (com.twinsoft.convertigo.beans.connectors.CouchDbConnector)1 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)1 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)1 JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)1 SapJcoConnector (com.twinsoft.convertigo.beans.connectors.SapJcoConnector)1 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)1 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)1 Block (com.twinsoft.convertigo.beans.core.Block)1 ImportXsdSchemaReference (com.twinsoft.convertigo.beans.references.ImportXsdSchemaReference)1 XsdSchemaReference (com.twinsoft.convertigo.beans.references.XsdSchemaReference)1 HtmlScreenClass (com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass)1 JavelinScreenClass (com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass)1 SiteClipperScreenClass (com.twinsoft.convertigo.beans.screenclasses.SiteClipperScreenClass)1 CicsTransaction (com.twinsoft.convertigo.beans.transactions.CicsTransaction)1 HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)1 HttpTransaction (com.twinsoft.convertigo.beans.transactions.HttpTransaction)1