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


Java GeoPackage.getExtensionsDao方法代码示例

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


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

示例1: testCreate

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

	ExtensionsDao dao = geoPackage.getExtensionsDao();

	if (dao.isTableExists()) {
		// Get current count
		long count = dao.countOf();

		// Create new extensions
		String tableName = "CREATE_TABLE_NAME";
		String columnName = "CREATE_COLUMN_NAME";
		String author = "nga";
		String extension = "create_extension";
		String definition = "definition";
		ExtensionScopeType scopeType = ExtensionScopeType.READ_WRITE;

		Extensions extensions = new Extensions();
		extensions.setTableName(tableName);
		extensions.setColumnName(columnName);
		extensions.setExtensionName(author, extension);
		extensions.setDefinition(definition);
		extensions.setScope(scopeType);
		dao.create(extensions);

		// Verify count
		long newCount = dao.countOf();
		TestCase.assertEquals(count + 1, newCount);

		// Verify saved extensions
		Extensions queryExtensions = dao.queryByExtension(
				extensions.getExtensionName(), extensions.getTableName(),
				extensions.getColumnName());
		TestCase.assertNotNull(queryExtensions);
		TestCase.assertEquals(tableName, queryExtensions.getTableName());
		TestCase.assertEquals(columnName, queryExtensions.getColumnName());
		TestCase.assertEquals(author + Extensions.EXTENSION_NAME_DIVIDER
				+ extension, queryExtensions.getExtensionName());
		TestCase.assertEquals(author, queryExtensions.getAuthor());
		TestCase.assertEquals(extension,
				queryExtensions.getExtensionNameNoAuthor());
		TestCase.assertEquals(definition, queryExtensions.getDefinition());
		TestCase.assertEquals(scopeType, queryExtensions.getScope());
	}

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

示例2: testDelete

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

	ExtensionsDao dao = geoPackage.getExtensionsDao();

	if (dao.isTableExists()) {
		List<Extensions> results = dao.queryForAll();

		if (!results.isEmpty()) {

			// Choose random metadata
			int random = (int) (Math.random() * results.size());
			Extensions extensions = results.get(random);

			// Delete the extensions
			dao.delete(extensions);

			// Verify deleted
			Extensions queryExtensions = dao.queryByExtension(
					extensions.getExtensionName(),
					extensions.getTableName(), extensions.getColumnName());
			TestCase.assertNull(queryExtensions);

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

				// Choose random metadata
				random = (int) (Math.random() * results.size());
				extensions = results.get(random);

				// Find which metadata to delete
				QueryBuilder<Extensions, Void> qb = dao.queryBuilder();
				qb.where().eq(Extensions.COLUMN_EXTENSION_NAME,
						extensions.getExtensionName());
				PreparedQuery<Extensions> query = qb.prepare();
				List<Extensions> queryResults = dao.query(query);
				int count = queryResults.size();

				// Delete
				DeleteBuilder<Extensions, Void> db = dao.deleteBuilder();
				db.where().eq(Extensions.COLUMN_EXTENSION_NAME,
						extensions.getExtensionName());
				PreparedDelete<Extensions> deleteQuery = db.prepare();
				int deleted = dao.delete(deleteQuery);

				TestCase.assertEquals(count, deleted);

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

示例3: testDeleteAll

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

    // Test indexing each feature table
    List<String> featureTables = geoPackage.getFeatureTables();
    for (String featureTable : featureTables) {

        FeatureDao featureDao = geoPackage.getFeatureDao(featureTable);
        FeatureTableIndex featureTableIndex = new FeatureTableIndex(
                geoPackage, featureDao);

        TestCase.assertFalse(featureTableIndex.isIndexed());

        TestUtils.validateGeoPackage(geoPackage);

        // Test indexing
        featureTableIndex.index();
        TestUtils.validateGeoPackage(geoPackage);

        TestCase.assertTrue(featureTableIndex.isIndexed());

    }

    ExtensionsDao extensionsDao = geoPackage.getExtensionsDao();
    GeometryIndexDao geometryIndexDao = geoPackage.getGeometryIndexDao();
    TableIndexDao tableIndexDao = geoPackage.getTableIndexDao();

    TestCase.assertTrue(geometryIndexDao.isTableExists());
    TestCase.assertTrue(tableIndexDao.isTableExists());
    TestCase.assertTrue(extensionsDao.queryByExtension(
            FeatureTableIndex.EXTENSION_NAME).size() > 0);

    TestCase.assertTrue(geometryIndexDao.countOf() > 0);
    long count = tableIndexDao.countOf();
    TestCase.assertTrue(count > 0);

    int deleteCount = tableIndexDao.deleteAllCascade();
    TestCase.assertEquals(count, deleteCount);

    TestCase.assertTrue(geometryIndexDao.countOf() == 0);
    TestCase.assertTrue(tableIndexDao.countOf() == 0);
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:48,代码来源:FeatureTableIndexUtils.java

示例4: testDeleteAll

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

	// Test indexing each feature table
	List<String> featureTables = geoPackage.getFeatureTables();
	for (String featureTable : featureTables) {

		FeatureDao featureDao = geoPackage.getFeatureDao(featureTable);
		FeatureTableIndex featureTableIndex = new FeatureTableIndex(
				geoPackage, featureDao);

		TestCase.assertFalse(featureTableIndex.isIndexed());

		TestUtils.validateGeoPackage(geoPackage);

		// Test indexing
		featureTableIndex.index();
		TestUtils.validateGeoPackage(geoPackage);

		TestCase.assertTrue(featureTableIndex.isIndexed());

	}

	ExtensionsDao extensionsDao = geoPackage.getExtensionsDao();
	GeometryIndexDao geometryIndexDao = geoPackage.getGeometryIndexDao();
	TableIndexDao tableIndexDao = geoPackage.getTableIndexDao();

	TestCase.assertTrue(geometryIndexDao.isTableExists());
	TestCase.assertTrue(tableIndexDao.isTableExists());
	TestCase.assertTrue(extensionsDao.queryByExtension(
			FeatureTableIndex.EXTENSION_NAME).size() > 0);

	TestCase.assertTrue(geometryIndexDao.countOf() > 0);
	long count = tableIndexDao.countOf();
	TestCase.assertTrue(count > 0);

	int deleteCount = tableIndexDao.deleteAllCascade();
	TestCase.assertEquals(count, deleteCount);

	TestCase.assertTrue(geometryIndexDao.countOf() == 0);
	TestCase.assertTrue(tableIndexDao.countOf() == 0);
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:48,代码来源:FeatureTableIndexUtils.java


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