mil.nga.geopackage.db.DateConverter Java Examples
The following examples show how to use
mil.nga.geopackage.db.DateConverter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeoPackageExample.java From geopackage-android with MIT License | 5 votes |
private static void createPropertiesExtension(GeoPackage geoPackage) { PropertiesExtension properties = new PropertiesExtension(geoPackage); String dateTime = DateConverter.dateTimeConverter().stringValue( new Date()); properties.addValue(PropertyNames.TITLE, "GeoPackage Android Example"); properties.addValue(PropertyNames.VERSION, "3.2.0"); properties.addValue(PropertyNames.CREATOR, "NGA"); properties.addValue(PropertyNames.PUBLISHER, "NGA"); properties.addValue(PropertyNames.CONTRIBUTOR, "Brian Osborn"); properties.addValue(PropertyNames.CONTRIBUTOR, "Dan Barela"); properties.addValue(PropertyNames.CREATED, dateTime); properties.addValue(PropertyNames.DATE, dateTime); properties.addValue(PropertyNames.MODIFIED, dateTime); properties .addValue( PropertyNames.DESCRIPTION, "GeoPackage example created by https://github.com/ngageoint/geopackage-android/blob/master/geopackage-sdk/src/androidTest/java/mil/nga/geopackage/test/GeoPackageExample.java"); properties.addValue(PropertyNames.IDENTIFIER, "geopackage-android"); properties.addValue(PropertyNames.LICENSE, "MIT"); properties .addValue( PropertyNames.SOURCE, "http://github.com/ngageoint/GeoPackage/blob/master/docs/examples/android/example.gpkg"); properties.addValue(PropertyNames.SUBJECT, "Examples"); properties.addValue(PropertyNames.TYPE, "Examples"); properties.addValue(PropertyNames.URI, "http://github.com/ngageoint/geopackage-android"); properties.addValue(PropertyNames.TAG, "NGA"); properties.addValue(PropertyNames.TAG, "Example"); properties.addValue(PropertyNames.TAG, "BIT Systems"); }
Example #2
Source File: DatePersister.java From geopackage-core-java with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) { Object defaultValue = null; if (DateConverter.DATETIME_FORMAT.equals(defaultStr)) { defaultValue = javaToSqlArg(null, new Date()); } return defaultValue; }
Example #3
Source File: OAPIFeatureCoreGenerator.java From geopackage-core-java with MIT License | 5 votes |
/** * Set the time * * @param time * time */ public void setTime(Date time) { if (time != null) { DateConverter dateConverter = DateConverter .dateConverter(DateConverter.DATETIME_FORMAT2); this.time = dateConverter.stringValue(time); } else { this.time = null; } }
Example #4
Source File: OAPIFeatureCoreGenerator.java From geopackage-core-java with MIT License | 5 votes |
/** * Set the time period * * @param period * period */ public void setPeriod(Date period) { if (period != null) { DateConverter dateConverter = DateConverter .dateConverter(DateConverter.DATETIME_FORMAT2); this.period = dateConverter.stringValue(period); } else { this.period = null; } }
Example #5
Source File: GeoPackageExample.java From geopackage-java with MIT License | 5 votes |
private static void createPropertiesExtension(GeoPackage geoPackage) { PropertiesExtension properties = new PropertiesExtension(geoPackage); String dateTime = DateConverter.dateTimeConverter() .stringValue(new Date()); properties.addValue(PropertyNames.TITLE, "GeoPackage Java Example"); properties.addValue(PropertyNames.VERSION, "3.2.0"); properties.addValue(PropertyNames.CREATOR, "NGA"); properties.addValue(PropertyNames.PUBLISHER, "NGA"); properties.addValue(PropertyNames.CONTRIBUTOR, "Brian Osborn"); properties.addValue(PropertyNames.CONTRIBUTOR, "Dan Barela"); properties.addValue(PropertyNames.CREATED, dateTime); properties.addValue(PropertyNames.DATE, dateTime); properties.addValue(PropertyNames.MODIFIED, dateTime); properties.addValue(PropertyNames.DESCRIPTION, "GeoPackage example created by http://github.com/ngageoint/geopackage-java/blob/master/src/test/java/mil/nga/geopackage/test/GeoPackageExample.java"); properties.addValue(PropertyNames.IDENTIFIER, "geopackage-java"); properties.addValue(PropertyNames.LICENSE, "MIT"); properties.addValue(PropertyNames.SOURCE, "http://github.com/ngageoint/GeoPackage/blob/master/docs/examples/java/example.gpkg"); properties.addValue(PropertyNames.SUBJECT, "Examples"); properties.addValue(PropertyNames.TYPE, "Examples"); properties.addValue(PropertyNames.URI, "http://github.com/ngageoint/geopackage-java"); properties.addValue(PropertyNames.TAG, "NGA"); properties.addValue(PropertyNames.TAG, "Example"); properties.addValue(PropertyNames.TAG, "BIT Systems"); }
Example #6
Source File: UserRow.java From geopackage-android with MIT License | 4 votes |
/** * Map the column to the content values * * @param contentValues content values * @param column column * @param value value */ protected void columnToContentValue(ContentValues contentValues, TColumn column, Object value) { String columnName = column.getName(); if (value instanceof Number) { if (value instanceof Byte) { validateValue(column, value, Byte.class, Short.class, Integer.class, Long.class); contentValues.put(columnName, (Byte) value); } else if (value instanceof Short) { validateValue(column, value, Short.class, Integer.class, Long.class); contentValues.put(columnName, (Short) value); } else if (value instanceof Integer) { validateValue(column, value, Integer.class, Long.class); contentValues.put(columnName, (Integer) value); } else if (value instanceof Long) { validateValue(column, value, Long.class, Double.class); contentValues.put(columnName, (Long) value); } else if (value instanceof Float) { validateValue(column, value, Float.class); contentValues.put(columnName, (Float) value); } else if (value instanceof Double) { validateValue(column, value, Double.class); contentValues.put(columnName, (Double) value); } else { throw new GeoPackageException("Unsupported Number type: " + value.getClass().getSimpleName()); } } else if (value instanceof String) { validateValue(column, value, String.class); String stringValue = (String) value; if (column.getMax() != null && stringValue.length() > column.getMax()) { throw new GeoPackageException( "String is larger than the column max. Size: " + stringValue.length() + ", Max: " + column.getMax() + ", Column: " + columnName); } contentValues.put(columnName, stringValue); } else if (value instanceof byte[]) { validateValue(column, value, byte[].class); byte[] byteValue = (byte[]) value; if (column.getMax() != null && byteValue.length > column.getMax()) { throw new GeoPackageException( "Byte array is larger than the column max. Size: " + byteValue.length + ", Max: " + column.getMax() + ", Column: " + columnName); } contentValues.put(columnName, byteValue); } else if (value instanceof Boolean) { validateValue(column, value, Boolean.class); Boolean booleanValue = (Boolean) value; short shortBoolean = booleanValue ? (short) 1 : (short) 0; contentValues.put(columnName, shortBoolean); } else if (value instanceof Date) { validateValue(column, value, Date.class, String.class); Date dateValue = (Date) value; DateConverter converter = DateConverter.converter(column .getDataType()); String dateString = converter.stringValue(dateValue); contentValues.put(columnName, dateString); } else { throw new GeoPackageException( "Unsupported update column value. column: " + columnName + ", value: " + value); } }
Example #7
Source File: RelatedTablesUtils.java From geopackage-android with MIT License | 4 votes |
/** * Populate the user row additional column values * * @param userTable user custom table * @param userRow user custom row * @param skipColumns columns to skip populating */ public static void populateUserRow(UserCustomTable userTable, UserCustomRow userRow, List<String> skipColumns) { Set<String> skipColumnsSet = new HashSet<>(skipColumns); for (UserCustomColumn column : userTable.getColumns()) { if (!skipColumnsSet.contains(column.getName())) { // Leave nullable columns null 20% of the time if (!column.isNotNull() && DublinCoreType.fromName(column.getName()) == null) { if (Math.random() < 0.2) { continue; } } Object value = null; switch (column.getDataType()) { case TEXT: String text = UUID.randomUUID().toString(); if (column.getMax() != null && text.length() > column.getMax()) { text = text.substring(0, column.getMax().intValue()); } value = text; break; case REAL: case DOUBLE: value = Math.random() * 5000.0; break; case BOOLEAN: value = Math.random() < .5 ? false : true; break; case INTEGER: case INT: value = (int) (Math.random() * 500); break; case BLOB: byte[] blob = UUID.randomUUID().toString().getBytes(); if (column.getMax() != null && blob.length > column.getMax()) { byte[] blobLimited = new byte[column.getMax() .intValue()]; ByteBuffer.wrap(blob, 0, column.getMax().intValue()) .get(blobLimited); blob = blobLimited; } value = blob; break; case DATE: case DATETIME: DateConverter converter = DateConverter.converter(column .getDataType()); Date date = new Date(); if (Math.random() < .5) { value = date; } else { value = converter.stringValue(date); } break; default: throw new UnsupportedOperationException( "Not implemented for data type: " + column.getDataType()); } userRow.setValue(column.getName(), value); } } }
Example #8
Source File: RelatedTablesUtils.java From geopackage-android with MIT License | 4 votes |
/** * Validate a user row * * @param columns array of columns * @param userRow user custom row */ public static void validateUserRow(String[] columns, UserCustomRow userRow) { TestCase.assertEquals(columns.length, userRow.columnCount()); for (int i = 0; i < userRow.columnCount(); i++) { UserCustomColumn column = userRow.getTable().getColumns().get(i); GeoPackageDataType dataType = column.getDataType(); TestCase.assertEquals(i, column.getIndex()); TestCase.assertEquals(columns[i], userRow.getColumnName(i)); TestCase.assertEquals(i, userRow.getColumnIndex(columns[i])); int rowType = userRow.getRowColumnType(i); Object value = userRow.getValue(i); switch (rowType) { case ResultUtils.FIELD_TYPE_INTEGER: TestUtils.validateIntegerValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_FLOAT: TestUtils.validateFloatValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_STRING: if (dataType == GeoPackageDataType.DATE || dataType == GeoPackageDataType.DATETIME) { TestCase.assertTrue(value instanceof Date); Date date = (Date) value; DateConverter converter = DateConverter.converter(dataType); String dateString = converter.stringValue(date); TestCase.assertEquals(date.getTime(), converter.dateValue(dateString).getTime()); } else { TestCase.assertTrue(value instanceof String); } break; case ResultUtils.FIELD_TYPE_BLOB: TestCase.assertTrue(value instanceof byte[]); break; case ResultUtils.FIELD_TYPE_NULL: TestCase.assertNull(value); break; } } }
Example #9
Source File: FeatureUtils.java From geopackage-android with MIT License | 4 votes |
/** * Validate a feature row * * @param columns * @param featureRow */ private static void validateFeatureRow(String[] columns, FeatureRow featureRow) { TestCase.assertEquals(columns.length, featureRow.columnCount()); for (int i = 0; i < featureRow.columnCount(); i++) { FeatureColumn column = featureRow.getTable().getColumns().get(i); GeoPackageDataType dataType = column.getDataType(); TestCase.assertEquals(i, column.getIndex()); TestCase.assertEquals(columns[i], featureRow.getColumnName(i)); TestCase.assertEquals(i, featureRow.getColumnIndex(columns[i])); int rowType = featureRow.getRowColumnType(i); Object value = featureRow.getValue(i); switch (rowType) { case Cursor.FIELD_TYPE_INTEGER: TestUtils.validateIntegerValue(value, column.getDataType()); break; case Cursor.FIELD_TYPE_FLOAT: TestUtils.validateFloatValue(value, column.getDataType()); break; case Cursor.FIELD_TYPE_STRING: if (dataType == GeoPackageDataType.DATE || dataType == GeoPackageDataType.DATETIME) { TestCase.assertTrue(value instanceof Date); Date date = (Date) value; DateConverter converter = DateConverter.converter(dataType); String dateString = converter.stringValue(date); TestCase.assertEquals(date.getTime(), converter.dateValue(dateString).getTime()); } else { TestCase.assertTrue(value instanceof String); } break; case Cursor.FIELD_TYPE_BLOB: if (featureRow.getGeometryColumnIndex() == i) { TestCase.assertTrue(value instanceof GeoPackageGeometryData); } else { TestCase.assertTrue(value instanceof byte[]); } break; case Cursor.FIELD_TYPE_NULL: TestCase.assertNull(value); break; } } TestCase.assertTrue(featureRow.getId() >= 0); }
Example #10
Source File: AttributesUtils.java From geopackage-android with MIT License | 4 votes |
/** * Validate an attributes row * * @param columns * @param attributesRow */ private static void validateAttributesRow(String[] columns, AttributesRow attributesRow) { TestCase.assertEquals(columns.length, attributesRow.columnCount()); for (int i = 0; i < attributesRow.columnCount(); i++) { AttributesColumn column = attributesRow.getTable().getColumns() .get(i); GeoPackageDataType dataType = column.getDataType(); TestCase.assertEquals(i, column.getIndex()); TestCase.assertEquals(columns[i], attributesRow.getColumnName(i)); TestCase.assertEquals(i, attributesRow.getColumnIndex(columns[i])); int rowType = attributesRow.getRowColumnType(i); Object value = attributesRow.getValue(i); switch (rowType) { case ResultUtils.FIELD_TYPE_INTEGER: TestUtils.validateIntegerValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_FLOAT: TestUtils.validateFloatValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_STRING: if (dataType == GeoPackageDataType.DATE || dataType == GeoPackageDataType.DATETIME) { TestCase.assertTrue(value instanceof Date); Date date = (Date) value; DateConverter converter = DateConverter.converter(dataType); String dateString = converter.stringValue(date); TestCase.assertEquals(date.getTime(), converter.dateValue(dateString).getTime()); } else { TestCase.assertTrue(value instanceof String); } break; case ResultUtils.FIELD_TYPE_BLOB: TestCase.assertTrue(value instanceof byte[]); break; case ResultUtils.FIELD_TYPE_NULL: TestCase.assertNull(value); break; } } TestCase.assertTrue(attributesRow.getId() >= 0); }
Example #11
Source File: TableInfo.java From geopackage-core-java with MIT License | 4 votes |
/** * Get the default object value for the string default value with the data * type * * @param defaultValue * default value * @param type * data type * @return default value */ public static Object getDefaultValue(String defaultValue, GeoPackageDataType type) { Object value = defaultValue; if (defaultValue != null && type != null && !defaultValue.equalsIgnoreCase(DEFAULT_NULL)) { switch (type) { case TEXT: break; case DATE: case DATETIME: if (!DateConverter.isFunction(defaultValue)) { DateConverter converter = DateConverter.converter(type); try { value = converter.dateValue(defaultValue); } catch (Exception e) { logger.log( Level.WARNING, "Invalid " + type + " format: " + defaultValue + ", String value used", e); } } break; case BOOLEAN: value = Integer.parseInt(defaultValue) == 0 ? Boolean.FALSE : Boolean.TRUE; break; case TINYINT: value = Byte.parseByte(defaultValue); break; case SMALLINT: value = Short.parseShort(defaultValue); break; case MEDIUMINT: value = Integer.parseInt(defaultValue); break; case INT: case INTEGER: value = Long.parseLong(defaultValue); break; case FLOAT: value = Float.parseFloat(defaultValue); break; case DOUBLE: case REAL: value = Double.parseDouble(defaultValue); break; case BLOB: value = defaultValue.getBytes(); break; default: throw new GeoPackageException("Unsupported Data Type " + type); } } return value; }
Example #12
Source File: UserRow.java From geopackage-java with MIT License | 4 votes |
/** * Map the column to the content values * * @param contentValues * content values * @param column * column * @param value * value */ protected void columnToContentValue(ContentValues contentValues, TColumn column, Object value) { String columnName = column.getName(); if (value instanceof Number) { if (value instanceof Byte) { validateValue(column, value, Byte.class, Short.class, Integer.class, Long.class); contentValues.put(columnName, (Byte) value); } else if (value instanceof Short) { validateValue(column, value, Short.class, Integer.class, Long.class); contentValues.put(columnName, (Short) value); } else if (value instanceof Integer) { validateValue(column, value, Integer.class, Long.class); contentValues.put(columnName, (Integer) value); } else if (value instanceof Long) { validateValue(column, value, Long.class, Double.class); contentValues.put(columnName, (Long) value); } else if (value instanceof Float) { validateValue(column, value, Float.class); contentValues.put(columnName, (Float) value); } else if (value instanceof Double) { validateValue(column, value, Double.class); contentValues.put(columnName, (Double) value); } else { throw new GeoPackageException("Unsupported Number type: " + value.getClass().getSimpleName()); } } else if (value instanceof String) { validateValue(column, value, String.class); String stringValue = (String) value; if (column.getMax() != null && stringValue.length() > column.getMax()) { throw new GeoPackageException( "String is larger than the column max. Size: " + stringValue.length() + ", Max: " + column.getMax() + ", Column: " + columnName); } contentValues.put(columnName, stringValue); } else if (value instanceof byte[]) { validateValue(column, value, byte[].class); byte[] byteValue = (byte[]) value; if (column.getMax() != null && byteValue.length > column.getMax()) { throw new GeoPackageException( "Byte array is larger than the column max. Size: " + byteValue.length + ", Max: " + column.getMax() + ", Column: " + columnName); } contentValues.put(columnName, byteValue); } else if (value instanceof Boolean) { validateValue(column, value, Boolean.class); Boolean booleanValue = (Boolean) value; short shortBoolean = booleanValue ? (short) 1 : (short) 0; contentValues.put(columnName, shortBoolean); } else if (value instanceof Date) { validateValue(column, value, Date.class, String.class); Date dateValue = (Date) value; DateConverter converter = DateConverter .converter(column.getDataType()); String dateString = converter.stringValue(dateValue); contentValues.put(columnName, dateString); } else { throw new GeoPackageException( "Unsupported update column value. column: " + columnName + ", value: " + value); } }
Example #13
Source File: RelatedTablesUtils.java From geopackage-java with MIT License | 4 votes |
/** * Populate the user row additional column values * * @param userTable * user custom table * @param userRow * user custom row * @param skipColumns * columns to skip populating */ public static void populateUserRow(UserCustomTable userTable, UserCustomRow userRow, List<String> skipColumns) { Set<String> skipColumnsSet = new HashSet<>(skipColumns); for (UserCustomColumn column : userTable.getColumns()) { if (!skipColumnsSet.contains(column.getName())) { // Leave nullable columns null 20% of the time if (!column.isNotNull() && DublinCoreType.fromName(column.getName()) == null) { if (Math.random() < 0.2) { continue; } } Object value = null; switch (column.getDataType()) { case TEXT: String text = UUID.randomUUID().toString(); if (column.getMax() != null && text.length() > column.getMax()) { text = text.substring(0, column.getMax().intValue()); } value = text; break; case REAL: case DOUBLE: value = Math.random() * 5000.0; break; case BOOLEAN: value = Math.random() < .5 ? false : true; break; case INTEGER: case INT: value = (int) (Math.random() * 500); break; case BLOB: byte[] blob = UUID.randomUUID().toString().getBytes(); if (column.getMax() != null && blob.length > column.getMax()) { byte[] blobLimited = new byte[column.getMax() .intValue()]; ByteBuffer.wrap(blob, 0, column.getMax().intValue()) .get(blobLimited); blob = blobLimited; } value = blob; break; case DATE: case DATETIME: DateConverter converter = DateConverter.converter(column .getDataType()); Date date = new Date(); if (Math.random() < .5) { value = date; } else { value = converter.stringValue(date); } break; default: throw new UnsupportedOperationException( "Not implemented for data type: " + column.getDataType()); } userRow.setValue(column.getName(), value); } } }
Example #14
Source File: RelatedTablesUtils.java From geopackage-java with MIT License | 4 votes |
/** * Validate a user row * * @param columns * array of columns * @param userRow * user custom row */ public static void validateUserRow(String[] columns, UserCustomRow userRow) { TestCase.assertEquals(columns.length, userRow.columnCount()); for (int i = 0; i < userRow.columnCount(); i++) { UserCustomColumn column = userRow.getTable().getColumns().get(i); GeoPackageDataType dataType = column.getDataType(); TestCase.assertEquals(i, column.getIndex()); TestCase.assertEquals(columns[i], userRow.getColumnName(i)); TestCase.assertEquals(i, userRow.getColumnIndex(columns[i])); int rowType = userRow.getRowColumnType(i); Object value = userRow.getValue(i); switch (rowType) { case ResultUtils.FIELD_TYPE_INTEGER: TestUtils.validateIntegerValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_FLOAT: TestUtils.validateFloatValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_STRING: if (dataType == GeoPackageDataType.DATE || dataType == GeoPackageDataType.DATETIME) { TestCase.assertTrue(value instanceof Date); Date date = (Date) value; DateConverter converter = DateConverter.converter(dataType); String dateString = converter.stringValue(date); TestCase.assertEquals(date.getTime(), converter.dateValue(dateString).getTime()); } else { TestCase.assertTrue(value instanceof String); } break; case ResultUtils.FIELD_TYPE_BLOB: TestCase.assertTrue(value instanceof byte[]); break; case ResultUtils.FIELD_TYPE_NULL: TestCase.assertNull(value); break; } } }
Example #15
Source File: FeatureUtils.java From geopackage-java with MIT License | 4 votes |
/** * Validate a feature row * * @param columns * @param featureRow */ private static void validateFeatureRow(String[] columns, FeatureRow featureRow) { TestCase.assertEquals(columns.length, featureRow.columnCount()); for (int i = 0; i < featureRow.columnCount(); i++) { FeatureColumn column = featureRow.getTable().getColumns().get(i); GeoPackageDataType dataType = column.getDataType(); TestCase.assertEquals(i, column.getIndex()); TestCase.assertEquals(columns[i], featureRow.getColumnName(i)); TestCase.assertEquals(i, featureRow.getColumnIndex(columns[i])); int rowType = featureRow.getRowColumnType(i); Object value = featureRow.getValue(i); switch (rowType) { case ResultUtils.FIELD_TYPE_INTEGER: TestUtils.validateIntegerValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_FLOAT: TestUtils.validateFloatValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_STRING: if (dataType == GeoPackageDataType.DATE || dataType == GeoPackageDataType.DATETIME) { TestCase.assertTrue(value instanceof Date); Date date = (Date) value; DateConverter converter = DateConverter.converter(dataType); String dateString = converter.stringValue(date); TestCase.assertEquals(date.getTime(), converter.dateValue(dateString).getTime()); } else { TestCase.assertTrue(value instanceof String); } break; case ResultUtils.FIELD_TYPE_BLOB: if (featureRow.getGeometryColumnIndex() == i) { TestCase.assertTrue(value instanceof GeoPackageGeometryData); } else { TestCase.assertTrue(value instanceof byte[]); } break; case ResultUtils.FIELD_TYPE_NULL: TestCase.assertNull(value); break; } } TestCase.assertTrue(featureRow.getId() >= 0); }
Example #16
Source File: AttributesUtils.java From geopackage-java with MIT License | 4 votes |
/** * Validate an attributes row * * @param columns * @param attributesRow */ private static void validateAttributesRow(String[] columns, AttributesRow attributesRow) { TestCase.assertEquals(columns.length, attributesRow.columnCount()); for (int i = 0; i < attributesRow.columnCount(); i++) { AttributesColumn column = attributesRow.getTable().getColumns() .get(i); GeoPackageDataType dataType = column.getDataType(); TestCase.assertEquals(i, column.getIndex()); TestCase.assertEquals(columns[i], attributesRow.getColumnName(i)); TestCase.assertEquals(i, attributesRow.getColumnIndex(columns[i])); int rowType = attributesRow.getRowColumnType(i); Object value = attributesRow.getValue(i); switch (rowType) { case ResultUtils.FIELD_TYPE_INTEGER: TestUtils.validateIntegerValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_FLOAT: TestUtils.validateFloatValue(value, column.getDataType()); break; case ResultUtils.FIELD_TYPE_STRING: if (dataType == GeoPackageDataType.DATE || dataType == GeoPackageDataType.DATETIME) { TestCase.assertTrue(value instanceof Date); Date date = (Date) value; DateConverter converter = DateConverter.converter(dataType); String dateString = converter.stringValue(date); TestCase.assertEquals(date.getTime(), converter.dateValue(dateString).getTime()); } else { TestCase.assertTrue(value instanceof String); } break; case ResultUtils.FIELD_TYPE_BLOB: TestCase.assertTrue(value instanceof byte[]); break; case ResultUtils.FIELD_TYPE_NULL: TestCase.assertNull(value); break; } } TestCase.assertTrue(attributesRow.getId() >= 0); }