Commit 78f330b0 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

UI and core modification for ObsCore creation

parent a29cf9e5
......@@ -684,12 +684,12 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable {
private void fillColumnDescriptionsAndStd(SchemaModel schemaModel, String schemaName) {
Schema schema = getChild(schemaName);
schema.setValue(DESCRIPTION_KEY, schemaModel.getDescription());
for (TableModel tableModel : getTapSchemaModel().getTables().values()) {
for (TableModel tableModel : schemaModel.getTables().values()) {
Table table = schema.getChild(tableModel.getName());
schema.setValue(DESCRIPTION_KEY, tableModel.getDescription());
table.setValue(DESCRIPTION_KEY, tableModel.getDescription());
for (PropertyModel propertyModel : tableModel.getProperties().values()) {
Column column = table.getChild(propertyModel.getName());
schema.setValue(DESCRIPTION_KEY, propertyModel.getDescription());
column.setValue(DESCRIPTION_KEY, propertyModel.getDescription());
if (propertyModel.isStandard()) {
column.setValue(STD_KEY, 1);
}
......
......@@ -22,6 +22,7 @@
*/
package it.inaf.ia2.tsm.model;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
......@@ -29,7 +30,9 @@ import javax.xml.bind.annotation.XmlTransient;
*
* @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
*/
public class PropertyModel {
public class PropertyModel implements Serializable {
private static final long serialVersionUID = -982004697900839996L;
private String name;
private String type;
......
......@@ -148,14 +148,22 @@ public class SchemaModels {
return getTapSchemaModel(version).getTables().get(tableName);
}
public static List<String> getAvailableTapSchemaVersions() {
private static List<String> getAvailableVersions(Map<String, SchemaModel> schemaModels) {
List<String> versions = new ArrayList<>();
for (SchemaModel tapSchemaModel : TAP_SCHEMA_MODELS.values()) {
for (SchemaModel tapSchemaModel : schemaModels.values()) {
versions.add(tapSchemaModel.getVersion());
}
return versions;
}
public static List<String> getAvailableTapSchemaVersions() {
return getAvailableVersions(TAP_SCHEMA_MODELS);
}
public static List<String> getAvailableIvoaSchemaVersions() {
return getAvailableVersions(IVOA_SCHEMA_MODELS);
}
public static SchemaModel getIvoaSchemaModel(String version) {
return IVOA_SCHEMA_MODELS.get(version);
}
......
......@@ -30,6 +30,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<size>255</size>
<updatable>true</updatable>
<description>Logical data product type (image etc.)</description>
<standard>true</standard>
</property>
<property>
<name>calib_level</name>
......@@ -37,6 +38,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<updatable>true</updatable>
<nullable>false</nullable>
<description>Calibration level {0, 1, 2, 3, 4}</description>
<standard>true</standard>
</property>
<property>
<name>obs_collection</name>
......@@ -45,6 +47,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<updatable>true</updatable>
<nullable>false</nullable>
<description>Name of the data collection</description>
<standard>true</standard>
</property>
<property>
<name>obs_id</name>
......@@ -53,6 +56,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<updatable>true</updatable>
<nullable>false</nullable>
<description>Observation ID</description>
<standard>true</standard>
</property>
<property>
<name>obs_publisher_did</name>
......@@ -61,13 +65,15 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<updatable>true</updatable>
<nullable>false</nullable>
<description>Dataset identifier given by the publisher</description>
<standard>true</standard>
</property>
<property>
<name>access_url</name>
<type>VARCHAR</type>
<type>CLOB</type>
<size>255</size>
<updatable>true</updatable>
<description>URL used to access (download) dataset</description>
<standard>true</standard>
</property>
<property>
<name>access_format</name>
......@@ -75,12 +81,14 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<size>255</size>
<updatable>true</updatable>
<description>File content format</description>
<standard>true</standard>
</property>
<property>
<name>access_estsize</name>
<type>INTEGER</type>
<updatable>true</updatable>
<description>Estimated size of dataset in kilo bytes</description>
<standard>true</standard>
<unit>kbyte</unit>
</property>
<property>
......@@ -89,12 +97,14 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<size>255</size>
<updatable>true</updatable>
<description>Astronomical object observed, if any</description>
<standard>true</standard>
</property>
<property>
<name>s_ra</name>
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Central right ascension, ICRS</description>
<standard>true</standard>
<unit>deg</unit>
</property>
<property>
......@@ -102,6 +112,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Central declination, ICRS</description>
<standard>true</standard>
<unit>deg</unit>
</property>
<property>
......@@ -109,6 +120,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Diameter (bounds) of the covered region</description>
<standard>true</standard>
<unit>deg</unit>
</property>
<property>
......@@ -117,24 +129,28 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<size>255</size>
<updatable>true</updatable>
<description>Sky region covered by the data product (expressed in ICRS frame)</description>
<standard>true</standard>
</property>
<property>
<name>s_xel1</name>
<type>INTEGER</type>
<updatable>true</updatable>
<description>Number of elements along the first spatial axis</description>
<standard>true</standard>
</property>
<property>
<name>s_xel2</name>
<type>INTEGER</type>
<updatable>true</updatable>
<description>Number of elements along the second spatial axis</description>
<standard>true</standard>
</property>
<property>
<name>s_resolution</name>
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Spatial resolution of data as FWHM</description>
<standard>true</standard>
<unit>arcsec</unit>
</property>
<property>
......@@ -142,6 +158,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Start time in MJD</description>
<standard>true</standard>
<unit>d</unit>
</property>
<property>
......@@ -149,6 +166,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Stop time in MJD</description>
<standard>true</standard>
<unit>d</unit>
</property>
<property>
......@@ -156,6 +174,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Total exposure time</description>
<standard>true</standard>
<unit>s</unit>
</property>
<property>
......@@ -163,6 +182,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Temporal resolution FWHM</description>
<standard>true</standard>
<unit>s</unit>
</property>
<property>
......@@ -170,12 +190,14 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>INTEGER</type>
<updatable>true</updatable>
<description>Number of elements along the time axis</description>
<standard>true</standard>
</property>
<property>
<name>em_min</name>
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Start in spectral coordinates</description>
<standard>true</standard>
<unit>m</unit>
</property>
<property>
......@@ -183,6 +205,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Stop in spectral coordinates</description>
<standard>true</standard>
<unit>m</unit>
</property>
<property>
......@@ -190,12 +213,14 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<type>DOUBLE</type>
<updatable>true</updatable>
<description>Spectral resolving power</description>
<standard>true</standard>
</property>
<property>
<name>em_xel</name>
<type>INTEGER</type>
<updatable>true</updatable>
<description>Number of elements along the spectral axis</description>
<standard>true</standard>
</property>
<property>
<name>o_ucd</name>
......@@ -203,6 +228,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<size>255</size>
<updatable>true</updatable>
<description>UCD of observable (e.g. phot.flux.density, phot.count, etc.)</description>
<standard>true</standard>
</property>
<property>
<name>pol_states</name>
......@@ -210,12 +236,14 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<size>255</size>
<updatable>true</updatable>
<description>List of polarization states or NULL if not applicable</description>
<standard>true</standard>
</property>
<property>
<name>pol_xel</name>
<type>INTEGER</type>
<updatable>true</updatable>
<description>Number of polarization samples</description>
<standard>true</standard>
</property>
<property>
<name>facility_name</name>
......@@ -223,6 +251,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<size>255</size>
<updatable>true</updatable>
<description>Name of the facility used for this observation</description>
<standard>true</standard>
</property>
<property>
<name>instrument_name</name>
......@@ -230,6 +259,7 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<size>255</size>
<updatable>true</updatable>
<description>Name of the instrument used for this observation</description>
<standard>true</standard>
</property>
</add>
</table>
......
......@@ -66,6 +66,7 @@ public class CredentialsEditing implements Serializable {
private boolean credentialsDialogOpened;
private List<String> tapSchemaVersions;
private List<String> obscoreVersions;
private boolean separateCredentials;
private Credentials sourceCredentials;
......@@ -73,10 +74,12 @@ public class CredentialsEditing implements Serializable {
private String tapSchemaName;
private String tapSchemaVersion;
private boolean hasObscore;
private String obscoreVersion;
@PostConstruct
public void init() {
this.tapSchemaVersions = SchemaModels.getAvailableTapSchemaVersions();
obscoreVersions = SchemaModels.getAvailableIvoaSchemaVersions();
}
public List<TapCredentials> getSavedCredentials() {
......@@ -106,6 +109,7 @@ public class CredentialsEditing implements Serializable {
tapSchemaName = credentials.getTapSchemaName();
tapSchemaVersion = credentials.getTapSchemaVersion();
hasObscore = credentials.isHasObscore();
obscoreVersion = credentials.getObscoreVersion();
}
public void addNewCredentialsInEditing() {
......@@ -116,6 +120,7 @@ public class CredentialsEditing implements Serializable {
tapSchemaName = "";
tapSchemaVersion = "";
hasObscore = false;
obscoreVersion = "";
}
public void loadTapSchema(TapCredentials tapCredentials) throws SQLException {
......@@ -174,9 +179,10 @@ public class CredentialsEditing implements Serializable {
editedCredentials = new JoinedCredentials(sourceCredentials);
}
editedCredentials.setHasObscore(hasObscore);
editedCredentials.setTapSchemaName(tapSchemaName);
editedCredentials.setTapSchemaVersion(tapSchemaVersion);
editedCredentials.setHasObscore(hasObscore);
editedCredentials.setObscoreVersion(obscoreVersion);
if (credentialsInEditing == null) {
// New credentials
......@@ -191,8 +197,8 @@ public class CredentialsEditing implements Serializable {
return tapSchemaVersions;
}
public void setTapSchemaVersions(List<String> tapSchemaVersions) {
this.tapSchemaVersions = tapSchemaVersions;
public List<String> getObscoreVersions() {
return obscoreVersions;
}
public boolean isSeparateCredentials() {
......@@ -250,4 +256,12 @@ public class CredentialsEditing implements Serializable {
public void setHasObscore(boolean hasObscore) {
this.hasObscore = hasObscore;
}
public String getObscoreVersion() {
return obscoreVersion;
}
public void setObscoreVersion(String obscoreVersion) {
this.obscoreVersion = obscoreVersion;
}
}
......@@ -23,6 +23,7 @@
package it.inaf.ia2.tsm.webapp;
import it.inaf.ia2.tsm.TapSchema;
import it.inaf.ia2.tsm.TapSchemaSettings;
import it.inaf.ia2.tsm.datalayer.DBBroker;
import it.inaf.ia2.tsm.datalayer.DBBrokerFactory;
import it.inaf.ia2.tsm.datalayer.DBWrapper;
......@@ -95,6 +96,15 @@ public class TapSchemaLoader implements Serializable {
// Otherwise create TAP_SCHEMA only if user press Ok on confirmation dialog
}
private TapSchemaSettings getTapSchemaSettings(TapCredentials tapCredentials) {
TapSchemaSettings settings = new TapSchemaSettings();
settings.setTapSchemaName(tapCredentials.getTapSchemaName());
settings.setTapSchemaVersion(tapCredentials.getTapSchemaVersion());
settings.setHasObscore(tapCredentials.isHasObscore());
settings.setObscoreVersion(tapCredentials.getObscoreVersion());
return settings;
}
public void edit() {
loadedTapSchema = null;
......@@ -105,7 +115,8 @@ public class TapSchemaLoader implements Serializable {
@Override
public void run() {
try {
loadedTapSchema = new TapSchema(tapCredentials.getTapSchemaVersion(), dbWrapper, tapCredentials.getTapSchemaName(), true);
loadedTapSchema = new TapSchema(dbWrapper, getTapSchemaSettings(tapCredentials), true);
} catch (Throwable e) {
LOG.error("Exception caught", e);
loadingError = e.getMessage();
......@@ -128,7 +139,7 @@ public class TapSchemaLoader implements Serializable {
@Override
public void run() {
try {
loadedTapSchema = new TapSchema(tapCredentials.getTapSchemaVersion(), dbWrapper, tapCredentials.getTapSchemaName(), false);
loadedTapSchema = new TapSchema(dbWrapper, getTapSchemaSettings(tapCredentials), false);
} catch (Throwable e) {
LOG.error("Exception caught", e);
if (e.getMessage() != null) {
......
......@@ -36,6 +36,7 @@ public abstract class TapCredentials implements Serializable {
private String tapSchemaName;
private String tapSchemaVersion;
private boolean hasObscore;
private String obscoreVersion;
public TapCredentials() {
}
......@@ -73,4 +74,13 @@ public abstract class TapCredentials implements Serializable {
public void setHasObscore(boolean hasObscore) {
this.hasObscore = hasObscore;
}
@XmlElement(name = "obscore_version")
public String getObscoreVersion() {
return obscoreVersion;
}
public void setObscoreVersion(String obscoreVersion) {
this.obscoreVersion = obscoreVersion;
}
}
......@@ -38,6 +38,7 @@
<th>TAP_SCHEMA name</th>
<th>Version</th>
<th>Obscore</th>
<th>Obscore version</th>
<th>Login</th>
</tr>
</thead>
......@@ -67,6 +68,7 @@
<td>#{c.tapSchemaName}</td>
<td>#{c.tapSchemaVersion}</td>
<td><span class="glyphicon glyphicon-#{c.hasObscore ? 'ok':'remove'}"></span></td>
<td><h:panelGroup rendered="#{c.hasObscore}">#{c.obscoreVersion}</h:panelGroup></td>
<td>
<h:commandLink action="#{credentialsInsertion.loadTapSchema(c)}" title="Login" immediate="true">
<span class="glyphicon glyphicon-log-in"></span>
......@@ -241,10 +243,20 @@
</div>
<div class="form-group">
<label class="col-xs-6 col-xs-offset-4">
<h:selectBooleanCheckbox value="#{credentialsInsertion.hasObscore}" id="has-obscore" />
<h:selectBooleanCheckbox value="#{credentialsInsertion.hasObscore}" id="has-obscore">
<f:ajax execute="@form" render=":main:credentials-modal-body" />
</h:selectBooleanCheckbox>
Has obscore
</label>
</div>
<h:panelGroup class="form-group" rendered="#{credentialsInsertion.hasObscore}" layout="block">
<h:outputLabel for="obscore_version" class="control-label col-xs-4">ObsCore version</h:outputLabel>
<div class="col-xs-6">
<h:selectOneMenu value="#{credentialsInsertion.obscoreVersion}" class="form-control">
<f:selectItems value="#{credentialsInsertion.obscoreVersions}" var="version" itemLabel="#{version}" itemDescription="#{version}" id="obscore_version" />
</h:selectOneMenu>
</div>
</h:panelGroup>
</div>
</h:panelGroup>
<div class="modal-footer">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment