@Override public final List<Column> getPrimaryKeys() { final List<Column> primaryKeyColumns = new ArrayList<Column>(); final List<Column> columnsInTable = getColumns(); for (Column column : columnsInTable) { if (column.isPrimaryKey()) { primaryKeyColumns.add(column); } } return primaryKeyColumns; }
@Override public final List<Column> getPrimaryKeys() { final List<Column> primaryKeyColumns = new ArrayList<Column>(); final List<Column> columnsInTable = getColumns(); for (Column column : columnsInTable) { if (column.isPrimaryKey()) { primaryKeyColumns.add(column); } } return primaryKeyColumns; }
@Override public void configureForTransformedData(final AnalysisJobBuilder analysisJobBuilder, final TransformerDescriptor<?> descriptor) { final List<Table> tables = analysisJobBuilder.getSourceTables(); if (tables.size() == 1) { final List<MetaModelInputColumn> sourceColumns = analysisJobBuilder.getSourceColumnsOfTable(tables.get(0)); final List<InputColumn<?>> primaryKeys = new ArrayList<>(); for (final MetaModelInputColumn inputColumn : sourceColumns) { if (inputColumn.getPhysicalColumn().isPrimaryKey()) { primaryKeys.add(inputColumn); } } if (!primaryKeys.isEmpty()) { conditionValues = primaryKeys.toArray(new InputColumn[primaryKeys.size()]); } } }
@Override public void configureForTransformedData(final AnalysisJobBuilder analysisJobBuilder, final TransformerDescriptor<?> descriptor) { final List<Table> tables = analysisJobBuilder.getSourceTables(); if (tables.size() == 1) { final List<MetaModelInputColumn> sourceColumns = analysisJobBuilder.getSourceColumnsOfTable(tables.get(0)); final List<InputColumn<?>> primaryKeys = new ArrayList<>(); for (final MetaModelInputColumn inputColumn : sourceColumns) { if (inputColumn.getPhysicalColumn().isPrimaryKey()) { primaryKeys.add(inputColumn); } } if (!primaryKeys.isEmpty()) { conditionValues = primaryKeys.toArray(new InputColumn[primaryKeys.size()]); } } }
public static Icon getColumnIcon(final Column column, final int iconSize) { if (column.isPrimaryKey()) { return _imageManager.getImageIcon(MODEL_COLUMN_KEY, iconSize); } return _imageManager.getImageIcon(MODEL_COLUMN, iconSize); }
private Map<String, Object> createColumnMap(Column column) { final Map<String, Object> map = new HashMap<>(); map.put("name", column.getName()); map.put("number", column.getColumnNumber()); map.put("type", getTypeName(column)); map.put("size", column.getColumnSize()); map.put("nativeType", column.getNativeType()); map.put("nullable", column.isNullable()); map.put("remarks", column.getRemarks()); map.put("indexed", column.isIndexed()); map.put("quote", column.getQuote()); map.put("primaryKey", column.isPrimaryKey()); return map; }
final Object operand = whereItem.getOperand(); if (column == null || operand == null || !column.isPrimaryKey() || selectItem.hasFunction()) { throw new IllegalStateException( "HBase currently only supports deleting items by their row key. Violated by where item: "
final Object operand = whereItem.getOperand(); if (column == null || operand == null || !column.isPrimaryKey() || selectItem.hasFunction()) { throw new IllegalStateException( "HBase currently only supports deleting items by their row key. Violated by where item: "
@Override protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) { final Scan scan = new Scan(); for (Column column : columns) { if (!column.isPrimaryKey()) { final int colonIndex = column.getName().indexOf(':'); if (colonIndex != -1) { String family = column.getName().substring(0, colonIndex); scan.addFamily(family.getBytes()); } else { scan.addFamily(column.getName().getBytes()); } } } if (maxRows > 0) { setMaxRows(scan, maxRows); } final org.apache.hadoop.hbase.client.Table hTable = getHTable(table.getName()); try { final ResultScanner scanner = hTable.getScanner(scan); return new HBaseDataSet(columns, scanner, hTable); } catch (Exception e) { FileHelper.safeClose(hTable); throw new MetaModelException(e); } }
@Override protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) { final Scan scan = new Scan(); for (Column column : columns) { if (!column.isPrimaryKey()) { final int colonIndex = column.getName().indexOf(':'); if (colonIndex != -1) { String family = column.getName().substring(0, colonIndex); scan.addFamily(family.getBytes()); } else { scan.addFamily(column.getName().getBytes()); } } } if (maxRows > 0) { setMaxRows(scan, maxRows); } final org.apache.hadoop.hbase.client.Table hTable = getHTable(table.getName()); try { final ResultScanner scanner = hTable.getScanner(scan); return new HBaseDataSet(columns, scanner, hTable); } catch (Exception e) { FileHelper.safeClose(hTable); throw new MetaModelException(e); } }
@Override public void execute() throws MetaModelException { final Map<String, AttributeValue> itemValues = new HashMap<>(); final Column[] columns = getColumns(); final Object[] values = getValues(); for (int i = 0; i < columns.length; i++) { final Column column = columns[i]; final Object value = values[i]; if (column.isPrimaryKey() && value == null) { throw new IllegalArgumentException("Value for '" + column.getName() + "' cannot be null"); } final AttributeValue attributeValue = DynamoDbUtils.toAttributeValue(value); itemValues.put(column.getName(), attributeValue); } final AmazonDynamoDB dynamoDb = getUpdateCallback().getDataContext().getDynamoDb(); dynamoDb.putItem(getTable().getName(), itemValues); } }
protected ImmutableColumn(Column column, ImmutableTable table) { this(column.getName(), column.getType(), table, column.getColumnNumber(), column.getColumnSize(), column .getNativeType(), column.isNullable(), column.getRemarks(), column.isIndexed(), column.getQuote(), column.isPrimaryKey()); }
protected ImmutableColumn(Column column, ImmutableTable table) { this(column.getName(), column.getType(), table, column.getColumnNumber(), column.getColumnSize(), column .getNativeType(), column.isNullable(), column.getRemarks(), column.isIndexed(), column.getQuote(), column.isPrimaryKey()); }
assert selectItem.getScalarFunction() == null; if (column.isPrimaryKey()) { values[i] = documentId; } else {
@Override public final T like(Column column) { _column.setColumnSize(column.getColumnSize()); _column.setNativeType(column.getNativeType()); _column.setType(column.getType()); _column.setNullable(column.isNullable()); _column.setPrimaryKey(column.isPrimaryKey()); return getReturnObject(); }
assert selectItem.getScalarFunction() == null; if (column.isPrimaryKey()) { values[i] = documentId; } else {
@Override public final T like(Column column) { _column.setColumnSize(column.getColumnSize()); _column.setNativeType(column.getNativeType()); _column.setType(column.getType()); _column.setNullable(column.isNullable()); _column.setPrimaryKey(column.isPrimaryKey()); return getReturnObject(); }
/** * Constructs an {@link ImmutableColumn} based on an existing column and a * table. * * @param column * the column to immitate * @param table * the table that the constructed column will pertain to */ public ImmutableColumn(Column column, Table table) { this.name = column.getName(); this.type = column.getType(); this.table = table; this.columnNumber = column.getColumnNumber(); this.columnSize = column.getColumnSize(); this.nativeType = column.getNativeType(); this.nullable = column.isNullable(); this.remarks = column.getRemarks(); this.indexed = column.isIndexed(); this.quote = column.getQuote(); this.primaryKey = column.isPrimaryKey(); }
public CreateTableDialog(final WindowContext windowContext, final UpdateableDatastore datastore, final Schema schema, final Collection<InputColumn<?>> columnSuggestions) { super(windowContext, ImageManager.get().getImage("images/window/banner-tabledef.png")); _datastore = datastore; _schema = schema; _listeners = new ArrayList<>(1); _columnDefinitionPanels = new ArrayList<>(); _columnsListPanel = new DCPanel(); _columnsListPanel.setBorder(WidgetUtils.BORDER_EMPTY); _columnsListPanel.setLayout(new VerticalLayout()); if (columnSuggestions != null && !columnSuggestions.isEmpty()) { // add columns based on the suggestions for (final InputColumn<?> columnSuggestion : columnSuggestions) { final String name = columnSuggestion.getName(); if (columnSuggestion.isPhysicalColumn()) { final Column physicalColumn = columnSuggestion.getPhysicalColumn(); final ColumnType columnType = physicalColumn.getType(); final boolean isPrimaryKey = physicalColumn.isPrimaryKey(); addColumnDefinitionPanel(new CreateTableColumnDefintionPanel(this, name, columnType, isPrimaryKey)); } else { final ColumnType columnType = ColumnTypeImpl.convertColumnType(columnSuggestion.getDataType()); addColumnDefinitionPanel(new CreateTableColumnDefintionPanel(this, name, columnType, false)); } } } else { // add some columns to begin with addColumnDefinitionPanel(new CreateTableColumnDefintionPanel(this, "ID", ColumnType.INTEGER, true)); addColumnDefinitionPanel(); } }
/** * Constructs an {@link ImmutableColumn} based on an existing column and a * table. * * @param column * the column to immitate * @param table * the table that the constructed column will pertain to */ public ImmutableColumn(Column column, Table table) { this.name = column.getName(); this.type = column.getType(); this.table = table; this.columnNumber = column.getColumnNumber(); this.columnSize = column.getColumnSize(); this.nativeType = column.getNativeType(); this.nullable = column.isNullable(); this.remarks = column.getRemarks(); this.indexed = column.isIndexed(); this.quote = column.getQuote(); this.primaryKey = column.isPrimaryKey(); }