Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/api/Dao.java +9 −6 Original line number Diff line number Diff line Loading @@ -624,11 +624,14 @@ public class Dao { keyColumns = false; String query; if (dbType == DatabaseType.MYSQL) { switch (dbType) { case MYSQL: query = "SHOW TABLES FROM `" + schemaName + "`"; } else if (dbType == DatabaseType.POSTGRES) { break; case POSTGRES: query = "SELECT tablename FROM pg_catalog.pg_tables where schemaname = '" + schemaName + "'"; } else { break; default: throw new UnsupportedOperationException("Database type " + dbType + " not supported"); } Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/api/DaoColumn.java +9 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ package it.inaf.ia2.tsm.api; import it.inaf.ia2.tsm.api.contract.DatabaseType; import it.inaf.ia2.tsm.api.contract.Column; import it.inaf.ia2.tsm.api.contract.Schema; import it.inaf.ia2.tsm.api.contract.Status; import it.inaf.ia2.tsm.api.contract.Table; import it.inaf.ia2.tsm.api.contract.TapSchema; Loading Loading @@ -248,11 +249,18 @@ public class DaoColumn { String schemaName = tableNameSplit[0]; String tableSimpleName = tableNameSplit[1]; Table table = tapSchema.getChild(schemaName).getChild(tableSimpleName); Schema schema = tapSchema.getChild(schemaName); if (schema == null) { return null; } Table table = schema.getChild(tableSimpleName); if (table == null) { return null; } Column column = table.addChild(columnName); if (column == null) { return null; } column.setStatus(Status.ADDED_PERSISTED); return column; } Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/api/DaoTable.java +32 −22 Original line number Diff line number Diff line Loading @@ -66,11 +66,14 @@ public class DaoTable { DatabaseType dbType = TSMUtil.getSchemaDatabaseType(dbWrapper, tapSchema, schemaName); String query; if (dbType == DatabaseType.MYSQL) { switch (dbType) { case MYSQL: query = "SHOW TABLES FROM `" + schemaName + "`"; } else if (dbType == DatabaseType.POSTGRES) { break; case POSTGRES: query = "SELECT tablename FROM pg_catalog.pg_tables where schemaname = '" + schemaName + "'"; } else { break; default: throw new UnsupportedOperationException("Database type " + dbType + " not supported"); } Loading Loading @@ -106,16 +109,19 @@ public class DaoTable { DatabaseType dbType = TSMUtil.getSchemaDatabaseType(dbWrapper, tapSchema, schemaName); String query; if (dbType == DatabaseType.MYSQL) { switch (dbType) { case MYSQL: query = "SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = '" + schemaName + "'"; } else if (dbType == DatabaseType.POSTGRES) { break; case POSTGRES: query = "SELECT tablename AS table_name, 'table' AS table_type\n" + "FROM pg_catalog.pg_tables WHERE schemaname = '" + schemaName + "'\n" + "UNION\n" + "SELECT table_name AS table_name, 'view' AS table_type\n" + "FROM INFORMATION_SCHEMA.views\n" + "WHERE table_schema = '" + schemaName + "'"; } else { break; default: throw new UnsupportedOperationException("Database type " + dbType + " not supported"); } Loading Loading @@ -151,6 +157,7 @@ public class DaoTable { Schema schema = tapSchema.getChild(schemaName); if (schema != null) { Table table = schema.addChild(completeTableName.split(Pattern.quote("."))[1]); if (table == null) { return null; Loading @@ -158,6 +165,9 @@ public class DaoTable { table.setStatus(Status.ADDED_PERSISTED); return table; } // Schema was marked for removal in the ConsistencyChecks return null; } }; selectQueryBuilder.executeQuery(dbWrapper.getTapSchemaConnection()); Loading TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConsistencyChecksBean.java +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ public class ConsistencyChecksBean implements Serializable { this.tapSchema = tapSchema; } public boolean isTapSchemaContainsOnlyTapSchema() { return tapSchema.getChildren().size() == 1 && tapSchema.getChildren().get(0).getName().equals(tapSchema.getName()); } public String proceed() throws SQLException { tapSchema.getConsistencyChecks().amendTapSchema(dbWrapper, tapSchema); tapSchema.save(); Loading TASMAN-webapp/src/main/webapp/consistencyChecks.xhtml +5 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,11 @@ </h:panelGroup> <br/> <h:panelGroup rendered="#{consistency.tapSchemaContainsOnlyTapSchema}" layout="block" class="alert alert-danger text-center"> <span class="glyphicon glyphicon-warning-sign"></span> <strong>If you proceed this TAP_SCHEMA will contain only itself! You may have selected wrong source credentials.</strong> </h:panelGroup> <div class="alert alert-warning text-center"> <span class="glyphicon glyphicon-warning-sign"></span> <strong>If you proceed the TAP_SCHEMA Manager will fix these values.</strong> Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/api/contract/TapSchema.java +2 −2 File changed.Contains only whitespace changes. Show changes Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/api/Dao.java +9 −6 Original line number Diff line number Diff line Loading @@ -624,11 +624,14 @@ public class Dao { keyColumns = false; String query; if (dbType == DatabaseType.MYSQL) { switch (dbType) { case MYSQL: query = "SHOW TABLES FROM `" + schemaName + "`"; } else if (dbType == DatabaseType.POSTGRES) { break; case POSTGRES: query = "SELECT tablename FROM pg_catalog.pg_tables where schemaname = '" + schemaName + "'"; } else { break; default: throw new UnsupportedOperationException("Database type " + dbType + " not supported"); } Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/api/DaoColumn.java +9 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ package it.inaf.ia2.tsm.api; import it.inaf.ia2.tsm.api.contract.DatabaseType; import it.inaf.ia2.tsm.api.contract.Column; import it.inaf.ia2.tsm.api.contract.Schema; import it.inaf.ia2.tsm.api.contract.Status; import it.inaf.ia2.tsm.api.contract.Table; import it.inaf.ia2.tsm.api.contract.TapSchema; Loading Loading @@ -248,11 +249,18 @@ public class DaoColumn { String schemaName = tableNameSplit[0]; String tableSimpleName = tableNameSplit[1]; Table table = tapSchema.getChild(schemaName).getChild(tableSimpleName); Schema schema = tapSchema.getChild(schemaName); if (schema == null) { return null; } Table table = schema.getChild(tableSimpleName); if (table == null) { return null; } Column column = table.addChild(columnName); if (column == null) { return null; } column.setStatus(Status.ADDED_PERSISTED); return column; } Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/api/DaoTable.java +32 −22 Original line number Diff line number Diff line Loading @@ -66,11 +66,14 @@ public class DaoTable { DatabaseType dbType = TSMUtil.getSchemaDatabaseType(dbWrapper, tapSchema, schemaName); String query; if (dbType == DatabaseType.MYSQL) { switch (dbType) { case MYSQL: query = "SHOW TABLES FROM `" + schemaName + "`"; } else if (dbType == DatabaseType.POSTGRES) { break; case POSTGRES: query = "SELECT tablename FROM pg_catalog.pg_tables where schemaname = '" + schemaName + "'"; } else { break; default: throw new UnsupportedOperationException("Database type " + dbType + " not supported"); } Loading Loading @@ -106,16 +109,19 @@ public class DaoTable { DatabaseType dbType = TSMUtil.getSchemaDatabaseType(dbWrapper, tapSchema, schemaName); String query; if (dbType == DatabaseType.MYSQL) { switch (dbType) { case MYSQL: query = "SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = '" + schemaName + "'"; } else if (dbType == DatabaseType.POSTGRES) { break; case POSTGRES: query = "SELECT tablename AS table_name, 'table' AS table_type\n" + "FROM pg_catalog.pg_tables WHERE schemaname = '" + schemaName + "'\n" + "UNION\n" + "SELECT table_name AS table_name, 'view' AS table_type\n" + "FROM INFORMATION_SCHEMA.views\n" + "WHERE table_schema = '" + schemaName + "'"; } else { break; default: throw new UnsupportedOperationException("Database type " + dbType + " not supported"); } Loading Loading @@ -151,6 +157,7 @@ public class DaoTable { Schema schema = tapSchema.getChild(schemaName); if (schema != null) { Table table = schema.addChild(completeTableName.split(Pattern.quote("."))[1]); if (table == null) { return null; Loading @@ -158,6 +165,9 @@ public class DaoTable { table.setStatus(Status.ADDED_PERSISTED); return table; } // Schema was marked for removal in the ConsistencyChecks return null; } }; selectQueryBuilder.executeQuery(dbWrapper.getTapSchemaConnection()); Loading
TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConsistencyChecksBean.java +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ public class ConsistencyChecksBean implements Serializable { this.tapSchema = tapSchema; } public boolean isTapSchemaContainsOnlyTapSchema() { return tapSchema.getChildren().size() == 1 && tapSchema.getChildren().get(0).getName().equals(tapSchema.getName()); } public String proceed() throws SQLException { tapSchema.getConsistencyChecks().amendTapSchema(dbWrapper, tapSchema); tapSchema.save(); Loading
TASMAN-webapp/src/main/webapp/consistencyChecks.xhtml +5 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,11 @@ </h:panelGroup> <br/> <h:panelGroup rendered="#{consistency.tapSchemaContainsOnlyTapSchema}" layout="block" class="alert alert-danger text-center"> <span class="glyphicon glyphicon-warning-sign"></span> <strong>If you proceed this TAP_SCHEMA will contain only itself! You may have selected wrong source credentials.</strong> </h:panelGroup> <div class="alert alert-warning text-center"> <span class="glyphicon glyphicon-warning-sign"></span> <strong>If you proceed the TAP_SCHEMA Manager will fix these values.</strong> Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/api/contract/TapSchema.java +2 −2 File changed.Contains only whitespace changes. Show changes