mil.nga.geopackage.extension.ExtensionScopeType Java Examples
The following examples show how to use
mil.nga.geopackage.extension.ExtensionScopeType.
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: WebPExtensionTest.java From geopackage-android with MIT License | 6 votes |
/** * Test the WebP Extension creation */ @Test public void testWebPExtension() throws Exception { WebPExtension webpExtension = new WebPExtension(geoPackage); String tableName = "table"; Extensions extension = webpExtension.getOrCreate(tableName); assertNotNull(extension); assertTrue(webpExtension.has(tableName)); assertEquals(extension.getExtensionName(), WebPExtension.EXTENSION_NAME); assertEquals(extension.getAuthor(), GeoPackageConstants.EXTENSION_AUTHOR); assertEquals(extension.getExtensionNameNoAuthor(), WebPExtension.NAME); assertEquals(extension.getTableName(), tableName); assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_DATA); assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE); assertEquals(extension.getDefinition(), WebPExtension.DEFINITION); GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName); assertFalse(webpExtension.has(tableName)); }
Example #2
Source File: CoverageDataCore.java From geopackage-core-java with MIT License | 6 votes |
/** * Get or create the extension * * @return extensions list */ public List<Extensions> getOrCreate() { // Create tables geoPackage.createGriddedCoverageTable(); geoPackage.createGriddedTileTable(); List<Extensions> extensionList = new ArrayList<>(); Extensions coverage = getOrCreate(EXTENSION_NAME, GriddedCoverage.TABLE_NAME, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); Extensions tile = getOrCreate(EXTENSION_NAME, GriddedTile.TABLE_NAME, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); Extensions table = getOrCreate(EXTENSION_NAME, tileMatrixSet.getTableName(), TileTable.COLUMN_TILE_DATA, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); extensionList.add(coverage); extensionList.add(tile); extensionList.add(table); return extensionList; }
Example #3
Source File: WebPExtensionTest.java From geopackage-java with MIT License | 6 votes |
/** * Test the WebP Extension creation */ @Test public void testWebPExtension() throws Exception { WebPExtension webpExtension = new WebPExtension(geoPackage); String tableName = "table"; Extensions extension = webpExtension.getOrCreate(tableName); assertNotNull(extension); assertTrue(webpExtension.has(tableName)); assertEquals(extension.getExtensionName(), WebPExtension.EXTENSION_NAME); assertEquals(extension.getAuthor(), GeoPackageConstants.EXTENSION_AUTHOR); assertEquals(extension.getExtensionNameNoAuthor(), WebPExtension.NAME); assertEquals(extension.getTableName(), tableName); assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_DATA); assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE); assertEquals(extension.getDefinition(), WebPExtension.DEFINITION); GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName); assertFalse(webpExtension.has(tableName)); }
Example #4
Source File: ZoomOtherExtensionTest.java From geopackage-android with MIT License | 5 votes |
/** * Test the Zoom Other Extension creation */ @Test public void testZoomOtherExtension() throws Exception { ZoomOtherExtension zoomOtherExtension = new ZoomOtherExtension( geoPackage); String tableName = "table"; Extensions extension = zoomOtherExtension.getOrCreate(tableName); assertNotNull(extension); assertTrue(zoomOtherExtension.has(tableName)); assertEquals(extension.getExtensionName(), ZoomOtherExtension.EXTENSION_NAME); assertEquals(extension.getAuthor(), GeoPackageConstants.EXTENSION_AUTHOR); assertEquals(extension.getExtensionNameNoAuthor(), ZoomOtherExtension.NAME); assertEquals(extension.getTableName(), tableName); assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_DATA); assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE); assertEquals(extension.getDefinition(), ZoomOtherExtension.DEFINITION); GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName); assertFalse(zoomOtherExtension.has(tableName)); }
Example #5
Source File: FeatureTileTableCoreLinker.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create if needed the extension * * @return extensions object */ private Extensions getOrCreateExtension() { Extensions extension = getOrCreate(EXTENSION_NAME, null, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); return extension; }
Example #6
Source File: ContentsIdExtension.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create if needed the extension * * @return extensions object */ public Extensions getOrCreateExtension() { // Create table geoPackage.createContentsIdTable(); Extensions extension = getOrCreate(EXTENSION_NAME, null, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); ContentsDao contentsDao = geoPackage.getContentsDao(); try { if (contentsDao.queryForId(ContentsId.TABLE_NAME) == null) { Contents contents = new Contents(); contents.setTableName(ContentsId.TABLE_NAME); contents.setDataTypeString(Extensions.TABLE_NAME); contents.setIdentifier(ContentsId.TABLE_NAME); contentsDao.create(contents); } } catch (SQLException e) { throw new GeoPackageException( "Failed to create contents entry for contents id. GeoPackage: " + geoPackage.getName(), e); } return extension; }
Example #7
Source File: FeatureCoreStyleExtension.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create the extension * * @param featureTable * feature table * @return extension */ private Extensions getOrCreate(String featureTable) { Extensions extension = getOrCreate(EXTENSION_NAME, featureTable, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); return extension; }
Example #8
Source File: FeatureTableCoreIndex.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create if needed the extension * * @return extensions object */ private Extensions getOrCreateExtension() { Extensions extension = getOrCreate(EXTENSION_NAME, tableName, columnName, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); return extension; }
Example #9
Source File: PropertiesCoreExtension.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create the extension * * @return extension */ public Extensions getOrCreate() { // Create the attributes table if (!geoPackage.isTable(TABLE_NAME)) { AttributesColumn propertyColumn = AttributesColumn.createColumn( COLUMN_PROPERTY, GeoPackageDataType.TEXT, true, null); AttributesColumn valueColumn = AttributesColumn .createColumn(COLUMN_VALUE, GeoPackageDataType.TEXT); List<AttributesColumn> additionalColumns = new ArrayList<>(); additionalColumns.add(propertyColumn); additionalColumns.add(valueColumn); List<Constraint> constraints = new ArrayList<>(); constraints.add(new UniqueConstraint(propertyColumn, valueColumn)); geoPackage.createAttributesTableWithId(TABLE_NAME, additionalColumns, constraints); } Extensions extension = getOrCreate(EXTENSION_NAME, TABLE_NAME, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); return extension; }
Example #10
Source File: RelatedTablesCoreExtension.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create the extension * * @return extension */ private Extensions getOrCreate() { // Create table geoPackage.createExtendedRelationsTable(); Extensions extension = getOrCreate(EXTENSION_NAME, ExtendedRelation.TABLE_NAME, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); return extension; }
Example #11
Source File: TileTableScaling.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create if needed the extension * * @return extensions object */ private Extensions getOrCreateExtension() { Extensions extension = getOrCreate(EXTENSION_NAME, tableName, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); return extension; }
Example #12
Source File: ZoomOtherExtensionTest.java From geopackage-java with MIT License | 5 votes |
/** * Test the Zoom Other Extension creation */ @Test public void testZoomOtherExtension() throws Exception { ZoomOtherExtension zoomOtherExtension = new ZoomOtherExtension( geoPackage); String tableName = "table"; Extensions extension = zoomOtherExtension.getOrCreate(tableName); assertNotNull(extension); assertTrue(zoomOtherExtension.has(tableName)); assertEquals(extension.getExtensionName(), ZoomOtherExtension.EXTENSION_NAME); assertEquals(extension.getAuthor(), GeoPackageConstants.EXTENSION_AUTHOR); assertEquals(extension.getExtensionNameNoAuthor(), ZoomOtherExtension.NAME); assertEquals(extension.getTableName(), tableName); assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_DATA); assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE); assertEquals(extension.getDefinition(), ZoomOtherExtension.DEFINITION); GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName); assertFalse(zoomOtherExtension.has(tableName)); }
Example #13
Source File: ExtensionsUtils.java From geopackage-android with MIT License | 4 votes |
/** * 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()); } }
Example #14
Source File: ExtensionsUtils.java From geopackage-java with MIT License | 4 votes |
/** * 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()); } }
Example #15
Source File: RelatedTablesCoreExtension.java From geopackage-core-java with MIT License | 3 votes |
/** * Get or create the extension * * @param mappingTable * mapping table name * @return extension */ private Extensions getOrCreate(String mappingTable) { getOrCreate(); Extensions extension = getOrCreate(EXTENSION_NAME, mappingTable, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); return extension; }