当前位置: 首页>>代码示例>>Java>>正文


Java ColumnType.TIMESTAMP属性代码示例

本文整理汇总了Java中org.apache.metamodel.schema.ColumnType.TIMESTAMP属性的典型用法代码示例。如果您正苦于以下问题:Java ColumnType.TIMESTAMP属性的具体用法?Java ColumnType.TIMESTAMP怎么用?Java ColumnType.TIMESTAMP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.metamodel.schema.ColumnType的用法示例。


在下文中一共展示了ColumnType.TIMESTAMP属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rewriteFilterItem

@Override
public String rewriteFilterItem(FilterItem item) {
    if (!item.isCompoundFilter()) {
        final SelectItem selectItem = item.getSelectItem();
        final Column column = selectItem.getColumn();
        if (column != null) {
            if (column.getType() == ColumnType.TIMESTAMP) {
                // HSQLDB does not treat (TIMESTAMP 'yyyy-MM-dd hh:mm:ss')
                // tokens correctly
                String result = super.rewriteFilterItem(item);
                int indexOfTimestamp = result.lastIndexOf("TIMESTAMP");
                if (indexOfTimestamp != -1) {
                    result = result.substring(0, indexOfTimestamp)
                            + result.substring(indexOfTimestamp + "TIMESTAMP".length());
                }
                return result;
            }
        }
    }
    return super.rewriteFilterItem(item);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:21,代码来源:HsqldbQueryRewriter.java

示例2: getType

/**
 * Determines the best fitting type. For reference of ElasticSearch types,
 * see
 *
 * <pre>
 * http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html
 * </pre>
 *
 *
 * @param column
 * @return
 */
private static String getType(Column column) {
    String nativeType = column.getNativeType();
    if (!Strings.isNullOrEmpty(nativeType)) {
        return nativeType;
    }

    final ColumnType type = column.getType();
    if (type == null) {
        throw new IllegalStateException("No column type specified for '" + column.getName()
                + "' - cannot build ElasticSearch mapping without type.");
    }

    if (type.isLiteral()) {
        return "text";
    } else if (type == ColumnType.FLOAT) {
        return "float";
    } else if (type == ColumnType.DOUBLE || type == ColumnType.NUMERIC || type == ColumnType.NUMBER) {
        return "double";
    } else if (type == ColumnType.SMALLINT) {
        return "short";
    } else if (type == ColumnType.TINYINT) {
        return "byte";
    } else if (type == ColumnType.INTEGER) {
        return "integer";
    } else if (type == ColumnType.DATE || type == ColumnType.TIMESTAMP) {
        return "date";
    } else if (type == ColumnType.BINARY || type == ColumnType.VARBINARY) {
        return "binary";
    } else if (type == ColumnType.BOOLEAN || type == ColumnType.BIT) {
        return "boolean";
    } else if (type == ColumnType.MAP) {
        return "object";
    }

    throw new UnsupportedOperationException("Unsupported column type '" + type.getName() + "' of column '" + column
            .getName() + "' - cannot translate to an ElasticSearch type.");
}
 
开发者ID:apache,项目名称:metamodel,代码行数:49,代码来源:ElasticSearchUtils.java

示例3: toColumnType

protected static ColumnType toColumnType(FieldType type) {
    switch (type) {
    case _boolean:
        return ColumnType.BOOLEAN;
    case _int:
        return ColumnType.INTEGER;
    case _double:
    case currency:
        return ColumnType.DOUBLE;
    case date:
        return ColumnType.DATE;
    case datetime:
        return ColumnType.TIMESTAMP;
    case time:
        return ColumnType.TIME;
    case string:
    case email:
    case url:
    case phone:
    case reference:
    case textarea:
    case encryptedstring:
    case base64:
    case id:
    case picklist:
        return ColumnType.VARCHAR;
    default:
        return ColumnType.OTHER;
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:30,代码来源:SalesforceTable.java

示例4: getExpectedColumnType

@Override
public ColumnType getExpectedColumnType(ColumnType type) {
    if (type.isTimeBased()) {
        return type;
    }
    return ColumnType.TIMESTAMP;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:7,代码来源:ToDateFunction.java

示例5: testToStringTimeStamp

public void testToStringTimeStamp() throws Exception {
    Column timestampColumn = new MutableColumn("TimestampCol", ColumnType.TIMESTAMP);
    FilterItem c = new FilterItem(new SelectItem(timestampColumn), OperatorType.LESS_THAN,
            "2000-12-31 02:30:05.007");
    assertEquals("TimestampCol < TIMESTAMP '2000-12-31 02:30:05'", c.toString());

    c = new FilterItem(new SelectItem(timestampColumn), OperatorType.LESS_THAN, "2000-12-31 02:30:05");
    assertEquals("TimestampCol < TIMESTAMP '2000-12-31 02:30:05'", c.toString());

    Column dateColumn = new MutableColumn("DateCol", ColumnType.DATE);
    c = new FilterItem(new SelectItem(timestampColumn), OperatorType.GREATER_THAN, new SelectItem(dateColumn));
    assertEquals("TimestampCol > DateCol", c.toString());
}
 
开发者ID:apache,项目名称:metamodel,代码行数:13,代码来源:FilterItemTest.java

示例6: getAvailableColumnTypes

private ColumnType[] getAvailableColumnTypes() {
    return new ColumnType[] { ColumnType.VARCHAR, ColumnType.DECIMAL, ColumnType.INTEGER, ColumnType.BOOLEAN,
            ColumnType.DATE, ColumnType.TIME, ColumnType.TIMESTAMP, ColumnType.MAP, ColumnType.LIST,
            ColumnType.BINARY };
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:5,代码来源:SimpleTableDefPanel.java

示例7: getColumnTypeFromMetaDataField

private static ColumnType getColumnTypeFromMetaDataField(DataType.Name metaDataName) {
    switch (metaDataName) {
    case BIGINT:
    case COUNTER:
        return ColumnType.BIGINT;
    case BLOB:
        return ColumnType.BLOB;
    case BOOLEAN:
        return ColumnType.BOOLEAN;
    case DECIMAL:
        return ColumnType.DECIMAL;
    case DOUBLE:
        return ColumnType.DOUBLE;
    case FLOAT:
        return ColumnType.FLOAT;
    case INT:
        return ColumnType.INTEGER;
    case TEXT:
        return ColumnType.STRING;
    case TIMESTAMP:
        return ColumnType.TIMESTAMP;
    case UUID:
        return ColumnType.UUID;
    case VARCHAR:
        return ColumnType.VARCHAR;
    case VARINT:
        return ColumnType.BIGINT;
    case LIST:
        return ColumnType.LIST;
    case MAP:
        return ColumnType.MAP;
    case CUSTOM:
        return ColumnType.OTHER;
    case INET:
        return ColumnType.INET;
    case SET:
        return ColumnType.SET;
    default:
        return ColumnType.STRING;
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:41,代码来源:CassandraDataContext.java


注:本文中的org.apache.metamodel.schema.ColumnType.TIMESTAMP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。