Search in sources :

Example 36 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class Biller method insertCariocaBilling.

public void insertCariocaBilling(Context context, Object data) throws EngineException {
    String sSqlRequest = null;
    try {
        Engine.logBillers.debug("[Biller] Trying to insert the billing into a Carioca database ");
        sqlRequester.checkConnection();
        int cache = 0;
        double cost = getCost(context, data);
        if (cost == -1) {
            Engine.logBillers.debug("[Biller] Billing aborted because the returned cost is -1, i.e. do not need to bill.");
            return;
        } else if (cost == -2) {
            Engine.logBillers.debug("[Biller] Billing zero cost because the response was in cache.");
            cost = 0;
            cache = 1;
        }
        Connector connector = context.getConnector();
        CertificateManager certificateManager = null;
        if (connector instanceof HttpConnector) {
            certificateManager = ((HttpConnector) connector).certificateManager;
        } else if (connector instanceof SiteClipperConnector) {
            certificateManager = ((SiteClipperConnector) connector).certificateManager;
        }
        if (!certificateManager.storeInformationCollected) {
            certificateManager.collectStoreInformation(context);
        }
        String certificate = new File(certificateManager.keyStore).getName();
        int idx = certificate.indexOf('.');
        if (idx != -1) {
            certificate = certificate.substring(0, idx);
        }
        Statement statement = null;
        long startBilling = System.currentTimeMillis();
        try {
            Engine.logBillers.debug("[Biller] Replacements from the context done");
            StringEx sqlRequest = new StringEx(sqlRequester.getProperty(Biller.PROPERTIES_SQL_REQUEST_INSERT_BILLING));
            try {
                Engine.logBillers.debug("[Biller] Replacing TAS IDs");
                sqlRequest.replace("{IDSVR}", context.get("IDSVR").toString());
                sqlRequest.replace("{IDSERV}", context.get("IDSERV").toString());
                sqlRequest.replace("{IDUSER}", context.get("IDUSER").toString());
                sqlRequest.replace("{IDPROF}", context.get("IDPROF").toString());
                sqlRequest.replace("{IDEMUL}", context.get("IDEMUL").toString());
                Engine.logBillers.debug("[Biller] Replacing TAS variables");
                sqlRequest.replaceSQL("{NomSv}", context.tasVirtualServerName, '\'');
                sqlRequest.replaceSQL("{UserName}", context.tasUserName, '\'');
                sqlRequest.replaceSQL("{UserGroup}", context.tasUserGroup, '\'');
                sqlRequest.replaceSQL("{Service}", getService(context, data), '\'');
                Engine.logBillers.debug("[Biller] Replacing POBI variables");
                sqlRequest.replace("{cdbanque}", context.get("cdbanque").toString());
                sqlRequest.replace("{cdguichet}", context.get("cdguichet").toString());
                sqlRequest.replaceSQL("{certificat}", certificate, '\'');
                sqlRequest.replace("{cache}", Integer.toString(cache));
                sqlRequest.replaceSQL("{module}", getModule(context, data), '\'');
                sqlRequest.replaceSQL("{userdata}", context.get("userdata").toString(), '\'');
                sqlRequest.replaceSQL("{BDFKey}", getDataKey(context, data), '\'');
                sqlRequest.replaceSQL("{UserGroupAuto}", context.get("UserGroupAuto").toString(), '\'');
            } catch (NullPointerException e) {
                throw new EngineException("One parameter for SQL replacement is missing.", e);
            }
            Calendar rightNow = Calendar.getInstance();
            SimpleDateFormat df = new SimpleDateFormat(sqlRequester.getProperty(Biller.PROPERTIES_SQL_DATE_FORMAT));
            String date = df.format(rightNow.getTime());
            sqlRequest.replace("{StartHour}", date);
            sqlRequest.replace("{EndHour}", date);
            Engine.logBillers.debug("[Biller] Start and End hour computed");
            sqlRequest.replace("{Cost}", Double.toString(cost));
            Engine.logBillers.debug("[Biller] Cost computed");
            sSqlRequest = sqlRequest.toString();
            Engine.logBillers.debug("[Biller] SQL: " + sSqlRequest);
            statement = sqlRequester.connection.createStatement();
            int nResult = statement.executeUpdate(sSqlRequest);
            Engine.logBillers.debug("[Biller] " + nResult + " row(s) inserted.");
        } finally {
            if (statement != null) {
                statement.close();
            }
            Engine.logBillers.info("[Biller] insertCariocaBilling, 1 request in " + (System.currentTimeMillis() - startBilling) + " ms");
        }
    } catch (SQLException e) {
        Engine.logBillers.warn("[Biller] Unable to insert the billing.\n" + e.getMessage() + " (error code: " + e.getErrorCode() + ")\nSQL: " + sSqlRequest);
    } catch (Exception e) {
        Engine.logBillers.error("[Biller] Unable to insert the billing", e);
    }
}
Also used : SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) SQLException(java.sql.SQLException) Statement(java.sql.Statement) Calendar(java.util.Calendar) IOException(java.io.IOException) SQLException(java.sql.SQLException) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) StringEx(com.twinsoft.util.StringEx) File(java.io.File) SimpleDateFormat(java.text.SimpleDateFormat)

Example 37 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class NgxPickerContentProvider method addFsObjects.

private void addFsObjects(Map<String, Set<String>> map, TVObject tvd, Object object, boolean isReferenced) {
    if (object != null) {
        if (object instanceof Project) {
            Project project = (Project) object;
            for (Connector c : project.getConnectorsList()) {
                if (c instanceof FullSyncConnector) {
                    String label = isReferenced ? c.getQName() : c.getName();
                    TVObject tvc = tvd.add(new TVObject(label));
                    for (Document d : c.getDocumentsList()) {
                        if (d instanceof DesignDocument) {
                            TVObject tdd = tvc.add(new TVObject(d.getName()));
                            JSONObject views = CouchKey.views.JSONObject(((DesignDocument) d).getJSONObject());
                            if (views != null) {
                                for (Iterator<String> it = GenericUtils.cast(views.keys()); it.hasNext(); ) {
                                    try {
                                        Set<String> infos = null;
                                        String view = it.next();
                                        String key = c.getQName() + "." + d.getName() + "." + view;
                                        TVObject tvv = tdd.add(new TVObject(view));
                                        SourceData sd = null;
                                        try {
                                            sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "get"));
                                        } catch (JSONException e) {
                                            e.printStackTrace();
                                        }
                                        tvv.add(new TVObject("get", d, sd));
                                        infos = map.get(key + ".get");
                                        if (infos == null) {
                                            infos = map.get(c.getQName() + ".get");
                                        }
                                        if (infos != null) {
                                            for (String info : infos) {
                                                try {
                                                    JSONObject jsonInfo = new JSONObject(info);
                                                    boolean includeDocs = false;
                                                    if (jsonInfo.has("include_docs")) {
                                                        includeDocs = Boolean.valueOf(jsonInfo.getString("include_docs")).booleanValue();
                                                    }
                                                    if (jsonInfo.has("marker")) {
                                                        String marker = jsonInfo.getString("marker");
                                                        if (!marker.isEmpty()) {
                                                            String name = "get" + "#" + marker;
                                                            sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "get").put("marker", marker).put("includeDocs", includeDocs));
                                                            tvv.add(new TVObject(name, d, sd, jsonInfo));
                                                        }
                                                    }
                                                } catch (JSONException e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                        }
                                        try {
                                            sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "view"));
                                        } catch (JSONException e) {
                                            e.printStackTrace();
                                        }
                                        tvv.add(new TVObject("view", d, sd));
                                        infos = map.get(key + ".view");
                                        if (infos != null) {
                                            for (String info : infos) {
                                                try {
                                                    JSONObject jsonInfo = new JSONObject(info);
                                                    boolean includeDocs = false;
                                                    if (jsonInfo.has("include_docs")) {
                                                        includeDocs = Boolean.valueOf(jsonInfo.getString("include_docs")).booleanValue();
                                                    }
                                                    if (jsonInfo.has("marker")) {
                                                        String marker = jsonInfo.getString("marker");
                                                        if (!marker.isEmpty()) {
                                                            String name = "view" + "#" + marker;
                                                            sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "view").put("marker", marker).put("includeDocs", includeDocs));
                                                            tvv.add(new TVObject(name, d, sd, jsonInfo));
                                                        }
                                                    }
                                                } catch (JSONException e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                        }
                                    } catch (Exception e) {
                                        e.printStackTrace();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : Connector(com.twinsoft.convertigo.beans.core.Connector) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) JSONException(org.codehaus.jettison.json.JSONException) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) DesignDocument(com.twinsoft.convertigo.beans.couchdb.DesignDocument) Document(com.twinsoft.convertigo.beans.core.Document) SourceData(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData) JSONException(org.codehaus.jettison.json.JSONException) Project(com.twinsoft.convertigo.beans.core.Project) JSONObject(org.codehaus.jettison.json.JSONObject) DesignDocument(com.twinsoft.convertigo.beans.couchdb.DesignDocument)

Example 38 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class ClipboardManager method cutAndPaste.

public void cutAndPaste(final DatabaseObject object, DatabaseObject parentDatabaseObject) throws ConvertigoException {
    // Verifying if a sheet with the same browser does not already exist
    if (object instanceof Sheet) {
        String browser = ((Sheet) object).getBrowser();
        Sheet sheet = null;
        if (parentDatabaseObject instanceof ScreenClass) {
            sheet = ((ScreenClass) parentDatabaseObject).getLocalSheet(browser);
        } else if (parentDatabaseObject instanceof RequestableObject) {
            sheet = ((RequestableObject) parentDatabaseObject).getSheet(browser);
        }
        if (sheet != null) {
            throw new EngineException("You cannot cut and paste the sheet because a sheet is already defined for the browser \"" + browser + "\" in the screen class \"" + parentDatabaseObject.getName() + "\".");
        }
    }
    if (object instanceof Step) {
        if (object instanceof ThenStep) {
            throw new EngineException("You cannot cut the \"Then\" step");
        }
        if (object instanceof ElseStep) {
            throw new EngineException("You cannot cut the \"Else\" step");
        }
    }
    if (object instanceof Statement) {
        if (object instanceof ThenStatement)
            throw new EngineException("You cannot cut the \"Then\" statement");
        if (object instanceof ElseStatement)
            throw new EngineException("You cannot cut the \"Else\" statement");
    }
    // Verify object is accepted for paste
    if (!DatabaseObjectsManager.acceptDatabaseObjects(parentDatabaseObject, object)) {
        throw new EngineException("You cannot cut and paste to a " + parentDatabaseObject.getClass().getSimpleName() + " a database object of type " + object.getClass().getSimpleName());
    }
    if (parentDatabaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.MobileComponent) {
        if (!com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.acceptDatabaseObjects(parentDatabaseObject, object)) {
            throw new EngineException("You cannot cut and paste to a " + parentDatabaseObject.getClass().getSimpleName() + " a database object of type " + object.getClass().getSimpleName());
        }
        if (!com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.isTplCompatible(parentDatabaseObject, object)) {
            String tplVersion = com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.getTplRequired(object);
            throw new EngineException("Template project " + tplVersion + " compatibility required");
        }
    } else if (parentDatabaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.MobileComponent) {
        if (!com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.acceptDatabaseObjects(parentDatabaseObject, object)) {
            throw new EngineException("You cannot cut and paste to a " + parentDatabaseObject.getClass().getSimpleName() + " a database object of type " + object.getClass().getSimpleName());
        }
        if (!com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.isTplCompatible(parentDatabaseObject, object)) {
            String tplVersion = com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.getTplRequired(object);
            throw new EngineException("Template project " + tplVersion + " compatibility required");
        }
    }
    // Verify if a child object with same name exist
    boolean bContinue = true;
    boolean bIncName = false;
    String dboName = object.getName();
    while (bContinue) {
        try {
            if (bIncName) {
                dboName = DatabaseObject.incrementName(dboName);
                object.setName(dboName);
            }
            new WalkHelper() {

                boolean root = true;

                boolean find = false;

                @Override
                protected boolean before(DatabaseObject databaseObject, Class<? extends DatabaseObject> dboClass) {
                    boolean isInstance = dboClass.isInstance(object);
                    find |= isInstance;
                    return isInstance;
                }

                @Override
                protected void walk(DatabaseObject databaseObject) throws Exception {
                    if (root) {
                        root = false;
                        if (databaseObject instanceof Project) {
                            if (object instanceof Connector && ((Connector) object).isDefault) {
                                throw new EngineException("You cannot cut the default connector to another project");
                            }
                        } else if (databaseObject instanceof Connector) {
                            if (object instanceof ScreenClass) {
                                throw new EngineException("You cannot cut the default screen class to another connector");
                            } else if (object instanceof Transaction && ((Transaction) object).isDefault) {
                                throw new EngineException("You cannot cut the default transaction to another connector");
                            }
                        } else if (databaseObject instanceof ScreenClass) {
                            if (object instanceof Criteria && databaseObject.getParent() instanceof Connector) {
                                throw new EngineException("You cannot cut the criterion of default screen class");
                            }
                        } else if (databaseObject instanceof MobileObject) {
                            if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) {
                                if (object instanceof com.twinsoft.convertigo.beans.mobile.components.PageComponent) {
                                    com.twinsoft.convertigo.beans.mobile.components.PageComponent pc = GenericUtils.cast(object);
                                    if (pc.isRoot) {
                                        throw new EngineException("You cannot cut the root page to another application");
                                    }
                                }
                            } else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) {
                                if (object instanceof com.twinsoft.convertigo.beans.ngx.components.PageComponent) {
                                    com.twinsoft.convertigo.beans.ngx.components.PageComponent pc = GenericUtils.cast(object);
                                    if (pc.isRoot) {
                                        throw new EngineException("You cannot cut the root page to another application");
                                    }
                                }
                            }
                        }
                        super.walk(databaseObject);
                        if (!find) {
                            throw new EngineException("You cannot cut and paste to a " + databaseObject.getClass().getSimpleName() + " a database object of type " + object.getClass().getSimpleName());
                        }
                    } else {
                        if (object != databaseObject && object.getName().equalsIgnoreCase(databaseObject.getName())) {
                            throw new ObjectWithSameNameException("Unable to cut the object because an object with the same name already exists in target.");
                        }
                    }
                }
            }.init(parentDatabaseObject);
            bContinue = false;
        } catch (ObjectWithSameNameException e) {
            bIncName = true;
        } catch (EngineException e) {
            throw e;
        } catch (Exception e) {
            throw new EngineException("Exception in cutAndPaste", e);
        }
    }
    move(object, parentDatabaseObject);
}
Also used : Connector(com.twinsoft.convertigo.beans.core.Connector) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) JavelinScreenClass(com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass) ScreenClass(com.twinsoft.convertigo.beans.core.ScreenClass) EngineException(com.twinsoft.convertigo.engine.EngineException) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) WalkHelper(com.twinsoft.convertigo.engine.helpers.WalkHelper) Criteria(com.twinsoft.convertigo.beans.core.Criteria) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) MobileObject(com.twinsoft.convertigo.beans.core.MobileObject) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) ElseStatement(com.twinsoft.convertigo.beans.statements.ElseStatement) FunctionStatement(com.twinsoft.convertigo.beans.statements.FunctionStatement) HTTPStatement(com.twinsoft.convertigo.beans.statements.HTTPStatement) Statement(com.twinsoft.convertigo.beans.core.Statement) ThenStatement(com.twinsoft.convertigo.beans.statements.ThenStatement) ThenStatement(com.twinsoft.convertigo.beans.statements.ThenStatement) SAXException(org.xml.sax.SAXException) EngineException(com.twinsoft.convertigo.engine.EngineException) ConvertigoException(com.twinsoft.convertigo.engine.ConvertigoException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException) InvalidOperationException(com.twinsoft.convertigo.engine.InvalidOperationException) ObjectWithSameNameException(com.twinsoft.convertigo.engine.ObjectWithSameNameException) Project(com.twinsoft.convertigo.beans.core.Project) ObjectWithSameNameException(com.twinsoft.convertigo.engine.ObjectWithSameNameException) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) ElseStatement(com.twinsoft.convertigo.beans.statements.ElseStatement) Sheet(com.twinsoft.convertigo.beans.core.Sheet)

Example 39 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class ConnectorTreeObject 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;
    Connector connector = this.getObject();
    if (databaseObject instanceof Transaction) {
        Transaction transaction = (Transaction) databaseObject;
        if (transaction.getConnector().equals(connector)) {
            if (connector.getEndTransactionName().equals(oldValue)) {
                connector.setEndTransactionName((String) newValue);
                try {
                    getProjectExplorerView().refreshTreeObject(this);
                } catch (Exception e) {
                    ConvertigoPlugin.logWarning(e, "Could not refresh in tree Connector \"" + databaseObject.getName() + "\" !");
                }
            }
        }
    } else if (databaseObject instanceof JsonIndex && connector.equals(databaseObject.getParent())) {
        CouchDbManager.syncDocument(connector);
    }
    // Case of this connector rename : update all transaction schemas
    if (treeObject.equals(this)) {
        String path = Project.XSD_FOLDER_NAME + "/" + Project.XSD_INTERNAL_FOLDER_NAME;
        String oldPath = path + "/" + (String) oldValue;
        String newPath = path + "/" + (String) newValue;
        IFolder folder = getProjectTreeObject().getFolder(oldPath);
        try {
            folder.getParent().refreshLocal(IResource.DEPTH_ONE, null);
            if (folder.exists()) {
                // rename folder (xsd/internal/connector)
                folder.move(new Path((String) newValue), true, null);
                // make replacements in schema file
                List<Replacement> replacements = new ArrayList<Replacement>();
                replacements.add(new Replacement((String) oldValue + "__", (String) newValue + "__"));
                IFolder newFolder = folder.getParent().getFolder(new Path((String) newValue));
                for (Transaction transaction : getObject().getTransactionsList()) {
                    IFile file = newFolder.getFile(new Path(transaction.getName() + ".xsd"));
                    if (file.exists()) {
                        String filePath = file.getLocation().makeAbsolute().toString();
                        try {
                            ProjectUtils.makeReplacementsInFile(replacements, filePath);
                        } catch (Exception e) {
                            ConvertigoPlugin.logWarning(e, "Could rename \"" + oldValue + "\" to \"" + newValue + "\" in schema file \"" + filePath + "\" !");
                        }
                    }
                }
                // refresh folder
                folder.refreshLocal(IResource.DEPTH_ONE, null);
                Engine.theApp.schemaManager.clearCache(getProjectTreeObject().getName());
            }
        } catch (Exception e) {
            ConvertigoPlugin.logWarning(e, "Could not rename folder from \"" + oldPath + "\" to \"" + newPath + "\" !");
        }
        if (connector instanceof CouchDbConnector) {
            CouchDbManager.syncDocument(connector);
            try {
                getProjectExplorerView().reloadTreeObject(this);
            } catch (Exception e) {
                ConvertigoPlugin.logWarning(e, "Could not reload connector \"" + connector.getName() + "\" in tree !");
            }
        }
    }
}
Also used : Path(org.eclipse.core.runtime.Path) Connector(com.twinsoft.convertigo.beans.core.Connector) SapJcoConnector(com.twinsoft.convertigo.beans.connectors.SapJcoConnector) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) IFile(org.eclipse.core.resources.IFile) ArrayList(java.util.ArrayList) Replacement(com.twinsoft.convertigo.engine.util.Replacement) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) Transaction(com.twinsoft.convertigo.beans.core.Transaction) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) JsonIndex(com.twinsoft.convertigo.beans.couchdb.JsonIndex) IFolder(org.eclipse.core.resources.IFolder)

Example 40 with Connector

use of com.twinsoft.convertigo.beans.core.Connector in project convertigo by convertigo.

the class ConnectorTreeObject method treeObjectPropertyChanged.

@Override
public void treeObjectPropertyChanged(TreeObjectEvent treeObjectEvent) {
    super.treeObjectPropertyChanged(treeObjectEvent);
    String propertyName = (String) treeObjectEvent.propertyName;
    propertyName = ((propertyName == null) ? "" : propertyName);
    TreeObject treeObject = (TreeObject) treeObjectEvent.getSource();
    Connector connector = getObject();
    if (treeObject instanceof DatabaseObjectTreeObject) {
        // If a bean name has changed
        if (propertyName.equals("name")) {
            handlesBeanNameChanged(treeObjectEvent);
        } else if (treeObject.equals(this)) {
            // if this connector has changed
            if (connector instanceof SapJcoConnector) {
                try {
                    ((SapJcoConnector) connector).getSapJCoProvider().updateDestination();
                } catch (Exception e) {
                    ConvertigoPlugin.logWarning(e, "Could not update SAP destination !");
                }
            } else if (connector instanceof CouchDbConnector) {
                if (propertyName.equals("https") || propertyName.equals("port") || propertyName.equals("server") || propertyName.equals("couchUsername") || propertyName.equals("couchPassword")) {
                    ((CouchDbConnector) connector).release();
                    CouchDbManager.syncDocument(connector);
                    try {
                        getProjectExplorerView().reloadTreeObject(this);
                    } catch (Exception e) {
                        ConvertigoPlugin.logWarning(e, "Could not reload connector \"" + connector.getName() + "\" in tree !");
                    }
                } else if (propertyName.equals("databaseName")) {
                    CouchDbManager.syncDocument(connector);
                    try {
                        getProjectExplorerView().reloadTreeObject(this);
                    } catch (Exception e) {
                        ConvertigoPlugin.logWarning(e, "Could not reload connector \"" + connector.getName() + "\" in tree !");
                    }
                }
            }
        } else if (connector instanceof CouchDbConnector) {
            DatabaseObject dbo = ((DatabaseObjectTreeObject) treeObject).getObject();
            if (dbo instanceof JsonIndex && connector.equals(dbo.getParent()) && (propertyName.equals("fields") || propertyName.equals("ascending") || propertyName.equals("name"))) {
                CouchDbManager.syncDocument(getObject());
            }
        }
    }
}
Also used : Connector(com.twinsoft.convertigo.beans.core.Connector) SapJcoConnector(com.twinsoft.convertigo.beans.connectors.SapJcoConnector) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) SapJcoConnector(com.twinsoft.convertigo.beans.connectors.SapJcoConnector) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) JsonIndex(com.twinsoft.convertigo.beans.couchdb.JsonIndex) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

Connector (com.twinsoft.convertigo.beans.core.Connector)72 Transaction (com.twinsoft.convertigo.beans.core.Transaction)43 Project (com.twinsoft.convertigo.beans.core.Project)32 EngineException (com.twinsoft.convertigo.engine.EngineException)28 JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)22 Sequence (com.twinsoft.convertigo.beans.core.Sequence)21 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)17 Step (com.twinsoft.convertigo.beans.core.Step)17 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)16 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)15 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)14 ScreenClass (com.twinsoft.convertigo.beans.core.ScreenClass)14 HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)14 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)12 CouchDbConnector (com.twinsoft.convertigo.beans.connectors.CouchDbConnector)11 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)11 Statement (com.twinsoft.convertigo.beans.core.Statement)11 ElseStep (com.twinsoft.convertigo.beans.steps.ElseStep)11 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)11 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)11