Package com.dci.intellij.dbn.object

Examples of com.dci.intellij.dbn.object.DBColumn


        private DBConstraint constraint;
        ConstraintColumnComparator(DBConstraint constraint) {
            this.constraint = constraint;
        }
        public int compare(Object o1, Object o2) {
            DBColumn column1 = (DBColumn) o1;
            DBColumn column2 = (DBColumn) o2;
            return column1.getConstraintPosition(constraint)-
                    column2.getConstraintPosition(constraint);
        }
View Full Code Here


    @Override
    public List<PresentableProperty> getPresentableProperties() {
        List<PresentableProperty> properties = super.getPresentableProperties();

        if (isForeignKey()) {
            DBColumn foreignKeyColumn = getForeignKeyColumn();
            if (foreignKeyColumn != null) {
                properties.add(0, new DBObjectPresentableProperty("Foreign key column", foreignKeyColumn, true));
            }
        }
View Full Code Here

        return BrowserTreeNode.EMPTY_LIST;
    }

    public int compareTo(@NotNull Object o) {
        if (o instanceof DBColumn)  {
            DBColumn column = (DBColumn) o;
            if (getDataset().equals(column.getDataset())) {
                if (isPrimaryKey() && column.isPrimaryKey()) {
                    return super.compareTo(o);
                } else if (isPrimaryKey()) {
                    return -1;
                } else if (column.isPrimaryKey()){
                    return 1;
                } else {
                    return super.compareTo(o);
                }
            }
View Full Code Here

        statement.append(table.getName());
        statement.append(" (\n");

        Iterator<DBColumn> columnIterator = table.getColumns().iterator();
        while (columnIterator.hasNext()) {
            DBColumn column = columnIterator.next();
            statement.append("    ");
            statement.append(column.getName());
            if (columnIterator.hasNext()) {
                statement.append(",\n");
            } else {
                statement.append(")\n");
            }
        }
        statement.append("values (\n");

        columnIterator = table.getColumns().iterator();
        while (columnIterator.hasNext()) {
            DBColumn column = columnIterator.next();
            statement.append("    :");
            statement.append(column.getName().toLowerCase());
            if (columnIterator.hasNext()) {
                statement.append(",\n");
            } else {
                statement.append(")\n");
            }
View Full Code Here

    private void joinByReference(DBDataset dataset1, DBDataset dataset2) {
        if (mappings == null) {
            for (DBColumn column1 : dataset1.getColumns()) {
                if (column1.isForeignKey()) {
                    DBColumn column2 = column1.getForeignKeyColumn();
                    if (column2.getDataset().equals(dataset2)) {
                        createMapping(column1, column2);
                    }
                }
            }
        }
View Full Code Here

        Set<DBDataset> datasets = new TreeSet<DBDataset>(DATASET_COMPARATOR);
        Set<DBColumn> columns = new TreeSet<DBColumn>(COLUMN_COMPARATOR);

        for (DBObject object : objects) {
            if (object instanceof DBColumn) {
                DBColumn column = (DBColumn) object;
                columns.add(column);
                datasets.add(column.getDataset());
            } else if (object instanceof DBDataset) {
                DBDataset dataset = (DBDataset) object;
                datasets.add(dataset);
                columns.addAll(dataset.getColumns());
            } else {
View Full Code Here

        StringBuilder statement = new StringBuilder();
        statement.append("select\n");
        Iterator<DBColumn> columnIterator = columns.iterator();
        while (columnIterator.hasNext()) {
            DBColumn column = columnIterator.next();
            statement.append("    ");
            if (useAliases) {
                statement.append(aliases.getAlias(column.getDataset()));
                statement.append(".");
            }
            statement.append(column.getName());
            if (columnIterator.hasNext()) {
                statement.append(",");
            }
            statement.append("\n");
        }

        statement.append("from\n");
        Iterator<DBDataset> datasetIterator = datasets.iterator();
        while (datasetIterator.hasNext()) {
            DBDataset dataset = datasetIterator.next();

            statement.append("    ");
            statement.append(dataset.getName());
            if (useAliases) {
                statement.append(" ");
                statement.append(aliases.getAlias(dataset));
            }
            if (datasetIterator.hasNext()) {
                statement.append(",\n");
            }
        }

        if (joinBundle != null && !joinBundle.isEmpty()) {
            statement.append("\nwhere\n");

            Iterator<DatasetJoin> joinIterator = joinBundle.getJoins().iterator();
            while (joinIterator.hasNext()) {
                DatasetJoin join = joinIterator.next();


                if (!join.isEmpty()) {
                    Map<DBColumn,DBColumn> mappings = join.getMappings();
                    Iterator<DBColumn> joinColumnIterator = mappings.keySet().iterator();
                    while (joinColumnIterator.hasNext()) {
                        DBColumn column1 = joinColumnIterator.next();
                        DBColumn column2 = mappings.get(column1);
                        statement.append("    ");
                        if (useAliases) {
                            statement.append(aliases.getAlias(column1.getDataset()));
                            statement.append(".");
                        }
                        statement.append(column1.getName());
                        statement.append(" = ");

                        if (useAliases) {
                            statement.append(aliases.getAlias(column2.getDataset()));
                            statement.append(".");
                        }
                        statement.append(column2.getName());
                        if (joinIterator.hasNext() || joinColumnIterator.hasNext()) {
                            statement.append(" and\n");
                        }
                    }
                }
View Full Code Here

                "DBNavigator.DataEditor.SimpleFilter.Condition", true,
                new EnableDisableBasicFilterConditionAction(this),
                new DeleteBasicFilterConditionAction(this));
        actionsPanel.add(actionToolbar.getComponent(), BorderLayout.CENTER);

        DBColumn column = dataset.getColumn(condition.getColumnName());
        if (column == null) {
            for (DBColumn col : dataset.getColumns()) {
                if (col.getDataType().getNativeDataType() != null) {
                    column = col;
                    break;
                }
            }
        }
        GenericDataType dataType = column.getDataType().getNativeDataType().getBasicDataType();


        columnSelector = new ColumnSelector(column);
        columnPanel.add(columnSelector, BorderLayout.CENTER);
View Full Code Here

        return mainPanel;
    }

    public void applyChanges() throws ConfigurationException {
        DatasetBasicFilterCondition condition = getConfiguration();
        DBColumn column = getSelectedColumn();
        ConditionOperator operator = getSelectedOperator();
        String value = editorComponent.getText();

        condition.setColumnName(column == null ? "" : column.getName());
        condition.setOperator(operator == null ? "" : operator.toString());
        condition.setValue(value == null ? "" : value);
        condition.setActive(isActive());
    }
View Full Code Here

            super("", selectedOperator, true);
        }

        @Override
        public List<ConditionOperator> loadValues() {
            DBColumn column = getSelectedColumn();
            if (column != null) {
                return Arrays.asList(ConditionOperator.getConditionOperators(column.getDataType().getTypeClass()));
            }
            return new ArrayList<ConditionOperator>();
        }
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.object.DBColumn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.