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

UI and core modification for ObsCore creation

parent a29cf9e5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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);
                }
+4 −1
Original line number Diff line number Diff line
@@ -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;
+10 −2
Original line number Diff line number Diff line
@@ -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);
    }
+31 −1
Original line number Diff line number Diff line
@@ -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>
+17 −3
Original line number Diff line number Diff line
@@ -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;
    }
}
Loading