Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/Table.java +5 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ package it.inaf.ia2.tsm; import it.inaf.ia2.tsm.datalayer.DBBroker; import it.inaf.ia2.tsm.model.ColumnModel; import it.inaf.ia2.tsm.model.TableModel; import java.sql.SQLException; import java.util.List; Loading Loading @@ -148,7 +149,10 @@ public class Table extends ChildEntity<Schema> implements EntitiesContainer<Colu private boolean isMandatory(String columnName) { if (tableTableModel != null) { return tableTableModel.get(columnName).isMandatory(); ColumnModel columnModel = tableTableModel.get(columnName); if (columnModel != null) { return columnModel.isMandatory(); } } return false; } Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java +5 −1 Original line number Diff line number Diff line Loading @@ -627,7 +627,11 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { * Returns the {@link SchemaModel} for the TAP_SCHEMA schema. */ public final SchemaModel getTapSchemaModel() { return SchemaModels.getTapSchemaModel(getVersion()); SchemaModel tapSchemaModel = SchemaModels.getTapSchemaModel(getVersion()); if (tapSchemaModel == null) { throw new IllegalStateException("TAP_SCHEMA model is null for version " + getVersion()); } return tapSchemaModel; } /** Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchemaLoader.java +32 −8 Original line number Diff line number Diff line Loading @@ -159,19 +159,43 @@ public class TapSchemaLoader { if (!ep.isUpdatable()) { return true; } // Here we check fixed values for columns having a XML model. // We need to be aware that the user could alter these structures // adding custom tables and columns, so we have to check for null // parts of the models. // Schema parentSchema = column.getParent().getParent(); SchemaModel schemaModel; if (parentSchema.getName().equals(tapSchema.getName())) { if (parentSchema.getName().equals(tapSchema.getName())) { schemaModel = tapSchema.getTapSchemaModel(); } else { schemaModel = tapSchema.getIvoaSchemaModel(); } if (schemaModel != null) { TableModel tableModel = schemaModel.getTable(column.getParent().getName()); if (tableModel != null) { ColumnModel columnModel = tableModel.get(column.getName()); if (columnModel != null) { if (parentSchema.getName().equals(tapSchema.getName())) { // is a TAP_SCHEMA column return equalsOneOf(key, Column.STD_KEY, Column.PRINCIPAL_KEY); } else { SchemaModel ivoaSchemaModel = tapSchema.getIvoaSchemaModel(); if (ivoaSchemaModel != null && parentSchema.getName().equals(ivoaSchemaModel.getName())) { // is an obscore column return equalsOneOf(key, Column.STD_KEY, Column.PRINCIPAL_KEY, Column.UCD_KEY, Column.UNIT_KEY, Column.UTYPE_KEY, Column.DATATYPE_KEY); } return false; } } } } return false; } private Object getCompatibleIntOrBoolValue(String key, boolean value) { if (tapSchema.getTapSchemaModel().getTable(COLUMNS_TABLE).get(key).getJavaType() == Integer.class) { Loading TASMAN-core/src/main/resources/schema_definition/tap_schema-1_1-IA2.xml +0 −5 Original line number Diff line number Diff line Loading @@ -23,11 +23,6 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --> <schema name="TAP_SCHEMA" version="1.1-IA2" extends="1.1" datatype="VOTable"> <table name="schemas"> <column name="schemaID"> <type>BIGINT</type> <updatable>true</updatable> <standard>false</standard> </column> <column name="schemaID"> <type>BIGINT</type> <updatable>true</updatable> Loading Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/Table.java +5 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ package it.inaf.ia2.tsm; import it.inaf.ia2.tsm.datalayer.DBBroker; import it.inaf.ia2.tsm.model.ColumnModel; import it.inaf.ia2.tsm.model.TableModel; import java.sql.SQLException; import java.util.List; Loading Loading @@ -148,7 +149,10 @@ public class Table extends ChildEntity<Schema> implements EntitiesContainer<Colu private boolean isMandatory(String columnName) { if (tableTableModel != null) { return tableTableModel.get(columnName).isMandatory(); ColumnModel columnModel = tableTableModel.get(columnName); if (columnModel != null) { return columnModel.isMandatory(); } } return false; } Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java +5 −1 Original line number Diff line number Diff line Loading @@ -627,7 +627,11 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { * Returns the {@link SchemaModel} for the TAP_SCHEMA schema. */ public final SchemaModel getTapSchemaModel() { return SchemaModels.getTapSchemaModel(getVersion()); SchemaModel tapSchemaModel = SchemaModels.getTapSchemaModel(getVersion()); if (tapSchemaModel == null) { throw new IllegalStateException("TAP_SCHEMA model is null for version " + getVersion()); } return tapSchemaModel; } /** Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchemaLoader.java +32 −8 Original line number Diff line number Diff line Loading @@ -159,19 +159,43 @@ public class TapSchemaLoader { if (!ep.isUpdatable()) { return true; } // Here we check fixed values for columns having a XML model. // We need to be aware that the user could alter these structures // adding custom tables and columns, so we have to check for null // parts of the models. // Schema parentSchema = column.getParent().getParent(); SchemaModel schemaModel; if (parentSchema.getName().equals(tapSchema.getName())) { if (parentSchema.getName().equals(tapSchema.getName())) { schemaModel = tapSchema.getTapSchemaModel(); } else { schemaModel = tapSchema.getIvoaSchemaModel(); } if (schemaModel != null) { TableModel tableModel = schemaModel.getTable(column.getParent().getName()); if (tableModel != null) { ColumnModel columnModel = tableModel.get(column.getName()); if (columnModel != null) { if (parentSchema.getName().equals(tapSchema.getName())) { // is a TAP_SCHEMA column return equalsOneOf(key, Column.STD_KEY, Column.PRINCIPAL_KEY); } else { SchemaModel ivoaSchemaModel = tapSchema.getIvoaSchemaModel(); if (ivoaSchemaModel != null && parentSchema.getName().equals(ivoaSchemaModel.getName())) { // is an obscore column return equalsOneOf(key, Column.STD_KEY, Column.PRINCIPAL_KEY, Column.UCD_KEY, Column.UNIT_KEY, Column.UTYPE_KEY, Column.DATATYPE_KEY); } return false; } } } } return false; } private Object getCompatibleIntOrBoolValue(String key, boolean value) { if (tapSchema.getTapSchemaModel().getTable(COLUMNS_TABLE).get(key).getJavaType() == Integer.class) { Loading
TASMAN-core/src/main/resources/schema_definition/tap_schema-1_1-IA2.xml +0 −5 Original line number Diff line number Diff line Loading @@ -23,11 +23,6 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --> <schema name="TAP_SCHEMA" version="1.1-IA2" extends="1.1" datatype="VOTable"> <table name="schemas"> <column name="schemaID"> <type>BIGINT</type> <updatable>true</updatable> <standard>false</standard> </column> <column name="schemaID"> <type>BIGINT</type> <updatable>true</updatable> Loading