/** * {@inheritDoc} */ @Override public String getTableType(String table) { String tableType = null; Contents contents = getTableContents(table); if (contents != null) { tableType = contents.getDataTypeString(); } return tableType; }
/** * Set the contents * * @param contents * contents */ public void setContents(Contents contents) { this.contents = contents; if (contents != null) { // Verify the Contents have a relation name data type String contentsDataType = contents.getDataTypeString(); if (contentsDataType == null || !contentsDataType.equals(dataType)) { throw new GeoPackageException("The " + Contents.class.getSimpleName() + " of a " + getClass().getSimpleName() + " must have a data type of " + dataType); } } }
/** * {@inheritDoc} */ @Override public AttributesDao getAttributesDao(Contents contents) { if (contents == null) { throw new GeoPackageException("Non null " + Contents.class.getSimpleName() + " is required to create " + AttributesDao.class.getSimpleName()); } if (contents.getDataType() != ContentsDataType.ATTRIBUTES) { throw new GeoPackageException(Contents.class.getSimpleName() + " is required to be of type " + ContentsDataType.ATTRIBUTES + ". Actual: " + contents.getDataTypeString()); } // Read the existing table and create the dao AttributesTableReader tableReader = new AttributesTableReader( contents.getTableName()); AttributesConnection userDb = new AttributesConnection(database); final AttributesTable attributesTable = tableReader.readTable(userDb); attributesTable.setContents(contents); AttributesDao dao = new AttributesDao(getName(), database, userDb, attributesTable); return dao; }
+ " is required to be of type " + ContentsDataType.ATTRIBUTES + ". Actual: " + contents.getDataTypeString());
/** * Validate contents * * @param mediaTable media table * @param contents contents */ private static void validateContents(MediaTable mediaTable, Contents contents) { TestCase.assertNotNull(contents); TestCase.assertNotNull(contents.getDataType()); TestCase.assertEquals(MediaTable.RELATION_TYPE.getDataType(), contents .getDataType().getName()); TestCase.assertEquals(MediaTable.RELATION_TYPE.getDataType(), contents.getDataTypeString()); TestCase.assertEquals(mediaTable.getTableName(), contents.getTableName()); TestCase.assertNotNull(contents.getLastChange()); }
/** * Validate contents * * @param simpleAttributesTable simple attributes table * @param contents contents */ private static void validateContents( SimpleAttributesTable simpleAttributesTable, Contents contents) { TestCase.assertNotNull(contents); TestCase.assertNotNull(contents.getDataType()); TestCase.assertEquals( SimpleAttributesTable.RELATION_TYPE.getDataType(), contents .getDataType().getName()); TestCase.assertEquals( SimpleAttributesTable.RELATION_TYPE.getDataType(), contents.getDataTypeString()); TestCase.assertEquals(simpleAttributesTable.getTableName(), contents.getTableName()); TestCase.assertNotNull(contents.getLastChange()); }
attributesContents.getDataType()); TestCase.assertEquals(ContentsDataType.ATTRIBUTES.getName(), attributesContents.getDataTypeString()); TestCase.assertEquals(attributesTable.getTableName(), attributesContents.getTableName());
featureContents.getDataType()); TestCase.assertEquals(ContentsDataType.FEATURES.getName(), featureContents.getDataTypeString()); TestCase.assertEquals(featureTable.getTableName(), featureContents.getTableName());
contents.getDataType()); TestCase.assertEquals(ContentsDataType.GRIDDED_COVERAGE.getName(), contents.getDataTypeString()); TestCase.assertNotNull(contents.getLastChange());
contents.getDataType()); TestCase.assertEquals(ContentsDataType.GRIDDED_COVERAGE.getName(), contents.getDataTypeString()); TestCase.assertNotNull(contents.getLastChange());