Search in sources :

Example 6 with ExasolView

use of org.jkiss.dbeaver.ext.exasol.model.ExasolView in project dbeaver by serge-rider.

the class ExasolViewManager method addObjectDeleteActions.

@Override
protected void addObjectDeleteActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectDeleteCommand command, Map<String, Object> options) {
    ExasolView view = command.getObject();
    actions.add(new SQLDatabasePersistAction("Drop view", "DROP VIEW " + view.getFullyQualifiedName(DBPEvaluationContext.DDL)));
}
Also used : ExasolView(org.jkiss.dbeaver.ext.exasol.model.ExasolView) SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Example 7 with ExasolView

use of org.jkiss.dbeaver.ext.exasol.model.ExasolView in project dbeaver by serge-rider.

the class ExasolExportTableTool method execute.

@Override
public void execute(IWorkbenchWindow window, IWorkbenchPart activePart, Collection<DBSObject> objects) throws DBException {
    List<ExasolTable> tables = CommonUtils.filterCollection(objects, ExasolTable.class);
    List<ExasolView> views = CommonUtils.filterCollection(objects, ExasolView.class);
    List<ExasolSchema> schemas = CommonUtils.filterCollection(objects, ExasolSchema.class);
    // add tables for all Schemas but ignore views in schema
    for (ExasolSchema schema : schemas) {
        tables.addAll(schema.getTables(new VoidProgressMonitor()));
    }
    // create TableBase Objects list
    @SuppressWarnings({ "unchecked", "rawtypes" }) HashSet<ExasolTableBase> tableBaseObjects = new HashSet();
    // add tables
    for (ExasolTable table : tables) {
        tableBaseObjects.add((ExasolTableBase) table);
    }
    // add views
    for (ExasolView view : views) {
        tableBaseObjects.add((ExasolTableBase) view);
    }
    if (!tableBaseObjects.isEmpty()) {
        ExasolExportTableToolDialog dialog = new ExasolExportTableToolDialog(activePart.getSite(), tableBaseObjects);
        dialog.open();
    }
}
Also used : ExasolSchema(org.jkiss.dbeaver.ext.exasol.model.ExasolSchema) ExasolView(org.jkiss.dbeaver.ext.exasol.model.ExasolView) ExasolTableBase(org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase) VoidProgressMonitor(org.jkiss.dbeaver.model.runtime.VoidProgressMonitor) ExasolTable(org.jkiss.dbeaver.ext.exasol.model.ExasolTable) HashSet(java.util.HashSet)

Example 8 with ExasolView

use of org.jkiss.dbeaver.ext.exasol.model.ExasolView in project dbeaver by dbeaver.

the class ExasolExportTableTool method execute.

@Override
public void execute(IWorkbenchWindow window, IWorkbenchPart activePart, Collection<DBSObject> objects) throws DBException {
    List<ExasolTable> tables = CommonUtils.filterCollection(objects, ExasolTable.class);
    List<ExasolView> views = CommonUtils.filterCollection(objects, ExasolView.class);
    List<ExasolSchema> schemas = CommonUtils.filterCollection(objects, ExasolSchema.class);
    // add tables for all Schemas but ignore views in schema
    for (ExasolSchema schema : schemas) {
        tables.addAll(schema.getTables(new VoidProgressMonitor()));
    }
    // create TableBase Objects list
    @SuppressWarnings({ "unchecked", "rawtypes" }) HashSet<ExasolTableBase> tableBaseObjects = new HashSet();
    // add tables
    for (ExasolTable table : tables) {
        tableBaseObjects.add((ExasolTableBase) table);
    }
    // add views
    for (ExasolView view : views) {
        tableBaseObjects.add((ExasolTableBase) view);
    }
    if (!tableBaseObjects.isEmpty()) {
        ExasolExportTableToolDialog dialog = new ExasolExportTableToolDialog(activePart.getSite(), tableBaseObjects);
        dialog.open();
    }
}
Also used : ExasolSchema(org.jkiss.dbeaver.ext.exasol.model.ExasolSchema) ExasolView(org.jkiss.dbeaver.ext.exasol.model.ExasolView) ExasolTableBase(org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase) VoidProgressMonitor(org.jkiss.dbeaver.model.runtime.VoidProgressMonitor) ExasolTable(org.jkiss.dbeaver.ext.exasol.model.ExasolTable) HashSet(java.util.HashSet)

Example 9 with ExasolView

use of org.jkiss.dbeaver.ext.exasol.model.ExasolView in project dbeaver by dbeaver.

the class ExasolViewManager method createDatabaseObject.

@Override
protected ExasolView createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, Object container, Object copyFrom, Map<String, Object> options) throws DBException {
    ExasolSchema schema = (ExasolSchema) container;
    ExasolView newView = new ExasolView(schema);
    newView.setName("new_view");
    setNewObjectName(monitor, schema, newView);
    newView.setObjectDefinitionText("CREATE OR REPLACE VIEW " + newView.getFullyQualifiedName(DBPEvaluationContext.DDL) + " AS\nSELECT");
    return newView;
}
Also used : ExasolSchema(org.jkiss.dbeaver.ext.exasol.model.ExasolSchema) ExasolView(org.jkiss.dbeaver.ext.exasol.model.ExasolView)

Example 10 with ExasolView

use of org.jkiss.dbeaver.ext.exasol.model.ExasolView in project dbeaver by dbeaver.

the class ExasolViewManager method addObjectDeleteActions.

@Override
protected void addObjectDeleteActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectDeleteCommand command, Map<String, Object> options) {
    ExasolView view = command.getObject();
    actions.add(new SQLDatabasePersistAction("Drop view", "DROP VIEW " + view.getFullyQualifiedName(DBPEvaluationContext.DDL)));
}
Also used : ExasolView(org.jkiss.dbeaver.ext.exasol.model.ExasolView) SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Aggregations

ExasolView (org.jkiss.dbeaver.ext.exasol.model.ExasolView)15 SQLDatabasePersistAction (org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)7 ExasolSchema (org.jkiss.dbeaver.ext.exasol.model.ExasolSchema)6 HashSet (java.util.HashSet)4 ExasolTable (org.jkiss.dbeaver.ext.exasol.model.ExasolTable)4 ExasolTableBase (org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase)4 VoidProgressMonitor (org.jkiss.dbeaver.model.runtime.VoidProgressMonitor)3