本文整理汇总了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);
}
示例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.");
}
示例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;
}
}
示例4: getExpectedColumnType
@Override
public ColumnType getExpectedColumnType(ColumnType type) {
if (type.isTimeBased()) {
return type;
}
return ColumnType.TIMESTAMP;
}
示例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());
}
示例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 };
}
示例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;
}
}