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


Java GeoPackage.getDataColumnsDao方法代码示例

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


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

示例1: createFeatureTable

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * Create the feature table with data columns entry
 *
 * @param geoPackage
 * @param contents
 * @param geometryColumn
 * @param geometryType
 * @return
 * @throws SQLException
 */
public static FeatureTable createFeatureTable(GeoPackage geoPackage,
                                              Contents contents, String geometryColumn, GeometryType geometryType)
        throws SQLException {

    FeatureTable table = buildFeatureTable(contents.getTableName(),
            geometryColumn, geometryType);
    geoPackage.createFeatureTable(table);

    double random = Math.random();

    DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
    DataColumns dataColumns = new DataColumns();
    dataColumns.setContents(contents);
    dataColumns.setColumnName(TEST_INTEGER_COLUMN);
    dataColumns.setName(contents.getTableName());
    dataColumns.setTitle("TEST_TITLE");
    dataColumns.setDescription("TEST_DESCRIPTION");
    dataColumns.setMimeType("TEST_MIME_TYPE");

    if (random < (1.0 / 3.0)) {
        dataColumns.setConstraintName(SAMPLE_RANGE_CONSTRAINT);
    } else if (random < (2.0 / 3.0)) {
        dataColumns.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    } else {
        dataColumns.setConstraintName(SAMPLE_GLOB_CONSTRAINT);
    }

    dataColumnsDao.create(dataColumns);

    return table;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:42,代码来源:TestUtils.java

示例2: createFeatureTable

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * Create the feature table with data columns entry
 *
 * @param geoPackage
 * @param contents
 * @param geometryColumn
 * @param geometryType
 * @return
 * @throws SQLException
 */
public static FeatureTable createFeatureTable(GeoPackage geoPackage,
		Contents contents, String geometryColumn, GeometryType geometryType)
		throws SQLException {

	FeatureTable table = buildFeatureTable(contents.getTableName(),
			geometryColumn, geometryType);
	geoPackage.createFeatureTable(table);

	double random = Math.random();

	DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
	DataColumns dataColumns = new DataColumns();
	dataColumns.setContents(contents);
	dataColumns.setColumnName(TEST_INTEGER_COLUMN);
	dataColumns.setName(contents.getTableName());
	dataColumns.setTitle("TEST_TITLE");
	dataColumns.setDescription("TEST_DESCRIPTION");
	dataColumns.setMimeType("TEST_MIME_TYPE");

	if (random < (1.0 / 3.0)) {
		dataColumns.setConstraintName(SAMPLE_RANGE_CONSTRAINT);
	} else if (random < (2.0 / 3.0)) {
		dataColumns.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
	} else {
		dataColumns.setConstraintName(SAMPLE_GLOB_CONSTRAINT);
	}

	dataColumnsDao.create(dataColumns);

	return table;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:42,代码来源:TestUtils.java

示例3: createFeatureTable

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * Create the feature table with data columns entry
 * 
 * @param geoPackage
 * @param contents
 * @param geometryColumn
 * @param geometryType
 * @return feature table
 * @throws SQLException
 */
public static FeatureTable createFeatureTable(GeoPackage geoPackage,
		Contents contents, String geometryColumn, GeometryType geometryType)
		throws SQLException {

	FeatureTable table = buildFeatureTable(contents.getTableName(),
			geometryColumn, geometryType);
	geoPackage.createFeatureTable(table);

	double random = Math.random();

	DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
	DataColumns dataColumns = new DataColumns();
	dataColumns.setContents(contents);
	dataColumns.setColumnName(TEST_INTEGER_COLUMN);
	dataColumns.setName(contents.getTableName());
	dataColumns.setTitle("TEST_TITLE");
	dataColumns.setDescription("TEST_DESCRIPTION");
	dataColumns.setMimeType("TEST_MIME_TYPE");

	if (random < (1.0 / 3.0)) {
		dataColumns.setConstraintName(SAMPLE_RANGE_CONSTRAINT);
	} else if (random < (2.0 / 3.0)) {
		dataColumns.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
	} else {
		dataColumns.setConstraintName(SAMPLE_GLOB_CONSTRAINT);
	}

	dataColumnsDao.create(dataColumns);

	return table;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:42,代码来源:TestUtils.java

示例4: testDelete

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * Test delete
 *
 * @param geoPackage
 * @throws SQLException
 */
public static void testDelete(GeoPackage geoPackage) throws SQLException {

	DataColumnsDao dao = geoPackage.getDataColumnsDao();
	if (dao.isTableExists()) {
		List<DataColumns> results = dao.queryForAll();

		if (!results.isEmpty()) {

			// Choose random data columns
			int random = (int) (Math.random() * results.size());
			DataColumns dataColumns = results.get(random);

			// Delete the data columns
			dao.delete(dataColumns);

			// Verify deleted
			DataColumns queryDataColumns = dao.queryForId(dataColumns
					.getId());
			TestCase.assertNull(queryDataColumns);

			// Prepared deleted
			results = dao.queryForAll();
			if (!results.isEmpty()) {

				// Choose random data columns
				random = (int) (Math.random() * results.size());
				dataColumns = results.get(random);

				// Find which data columns to delete
				QueryBuilder<DataColumns, TableColumnKey> qb = dao
						.queryBuilder();
				qb.where().eq(DataColumns.COLUMN_TABLE_NAME,
						dataColumns.getTableName());
				PreparedQuery<DataColumns> query = qb.prepare();
				List<DataColumns> queryResults = dao.query(query);
				int count = queryResults.size();

				// Delete
				DeleteBuilder<DataColumns, TableColumnKey> db = dao
						.deleteBuilder();
				db.where().eq(DataColumns.COLUMN_TABLE_NAME,
						dataColumns.getTableName());
				PreparedDelete<DataColumns> deleteQuery = db.prepare();
				int deleted = dao.delete(deleteQuery);

				TestCase.assertEquals(count, deleted);

			}
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:58,代码来源:DataColumnsUtils.java

示例5: testDelete

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * Test delete
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testDelete(GeoPackage geoPackage) throws SQLException {

	DataColumnConstraintsDao dao = geoPackage.getDataColumnConstraintsDao();
	DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
	if (dao.isTableExists()) {
		List<DataColumnConstraints> results = dao.queryForAll();

		if (!results.isEmpty()) {

			// Choose random data column constraints
			int random = (int) (Math.random() * results.size());
			DataColumnConstraints dataColumnConstraints = results
					.get(random);

			int remainingConstraints = dao.queryByConstraintName(
					dataColumnConstraints.getConstraintName()).size();
			int dataColumns = dataColumnsDao.queryByConstraintName(
					dataColumnConstraints.getConstraintName()).size();

			// Delete the data column constraints
			dao.deleteCascade(dataColumnConstraints);

			// Verify deleted
			DataColumnConstraints queryDataColumns = dao.queryByUnique(
					dataColumnConstraints.getConstraintName(),
					dataColumnConstraints.getConstraintType(),
					dataColumnConstraints.getValue());
			TestCase.assertNull(queryDataColumns);

			// Verify cascade delete
			int afterRemainingConstraints = dao.queryByConstraintName(
					dataColumnConstraints.getConstraintName()).size();
			int afterDataColumns = dataColumnsDao.queryByConstraintName(
					dataColumnConstraints.getConstraintName()).size();

			TestCase.assertEquals(remainingConstraints - 1,
					afterRemainingConstraints);
			if (remainingConstraints == 1) {
				TestCase.assertEquals(0, afterDataColumns);
			} else {
				TestCase.assertEquals(dataColumns, afterDataColumns);
			}

			// Prepared deleted
			results = dao.queryForAll();
			if (!results.isEmpty()) {

				// Choose random data column constraints
				random = (int) (Math.random() * results.size());
				dataColumnConstraints = results.get(random);

				// Find which data column constraints to delete
				QueryBuilder<DataColumnConstraints, Void> qb = dao
						.queryBuilder();
				qb.where().eq(DataColumnConstraints.COLUMN_CONSTRAINT_NAME,
						dataColumnConstraints.getConstraintName());
				PreparedQuery<DataColumnConstraints> query = qb.prepare();
				List<DataColumnConstraints> queryResults = dao.query(query);
				int count = queryResults.size();

				// Delete
				DeleteBuilder<DataColumnConstraints, Void> db = dao
						.deleteBuilder();
				db.where().eq(DataColumnConstraints.COLUMN_CONSTRAINT_NAME,
						dataColumnConstraints.getConstraintName());
				PreparedDelete<DataColumnConstraints> deleteQuery = db
						.prepare();
				int deleted = dao.delete(deleteQuery);

				TestCase.assertEquals(count, deleted);

			}
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:82,代码来源:DataColumnConstraintsUtils.java

示例6: testDelete

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * Test delete
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testDelete(GeoPackage geoPackage) throws SQLException {

	DataColumnsDao dao = geoPackage.getDataColumnsDao();
	if (dao.isTableExists()) {
		List<DataColumns> results = dao.queryForAll();

		if (!results.isEmpty()) {

			// Choose random data columns
			int random = (int) (Math.random() * results.size());
			DataColumns dataColumns = results.get(random);

			// Delete the data columns
			dao.delete(dataColumns);

			// Verify deleted
			DataColumns queryDataColumns = dao.queryForId(dataColumns
					.getId());
			TestCase.assertNull(queryDataColumns);

			// Prepared deleted
			results = dao.queryForAll();
			if (!results.isEmpty()) {

				// Choose random data columns
				random = (int) (Math.random() * results.size());
				dataColumns = results.get(random);

				// Find which data columns to delete
				QueryBuilder<DataColumns, TableColumnKey> qb = dao
						.queryBuilder();
				qb.where().eq(DataColumns.COLUMN_TABLE_NAME,
						dataColumns.getTableName());
				PreparedQuery<DataColumns> query = qb.prepare();
				List<DataColumns> queryResults = dao.query(query);
				int count = queryResults.size();

				// Delete
				DeleteBuilder<DataColumns, TableColumnKey> db = dao
						.deleteBuilder();
				db.where().eq(DataColumns.COLUMN_TABLE_NAME,
						dataColumns.getTableName());
				PreparedDelete<DataColumns> deleteQuery = db.prepare();
				int deleted = dao.delete(deleteQuery);

				TestCase.assertEquals(count, deleted);

			}
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:58,代码来源:DataColumnsUtils.java


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