Commit 585536b2afdf3dcb01c4f0c6b8f15a1ca673f9a5
1 parent
c60d0aec
Exists in
master
Use right column names.
Showing
2 changed files
with
42 additions
and
43 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java
... | ... | @@ -35,12 +35,6 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane |
35 | 35 | /** The separator used between each services in the custom service text fields. */ |
36 | 36 | private static final String CUSTOM_SERVICES_SEPARATOR = ";"; |
37 | 37 | |
38 | - /** The position of the column displaying the services target URLs in the service table. */ | |
39 | - private static final int SERVICE_URL_COLUMN_POSITION = 1; | |
40 | - | |
41 | - /** The position of the column displaying the table names in the service table. */ | |
42 | - private static final int TABLE_NAME_COLUMN_POSITION = 4; | |
43 | - | |
44 | 38 | /** The listener of the main panel. */ |
45 | 39 | private MainPanelListener listener; |
46 | 40 | |
... | ... | @@ -84,9 +78,12 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane |
84 | 78 | List<String> newTablesNames = new ArrayList<>(); |
85 | 79 | List<String> newServicesUrls = new ArrayList<>(); |
86 | 80 | |
81 | + int idxServiceUrl = view.getTable().getColumn("access_url").getModelIndex(); | |
82 | + int idxTableName = view.getTable().getColumn("table_name").getModelIndex(); | |
83 | + | |
87 | 84 | for (int row : view.getSelectedRows()) { |
88 | - newTablesNames.add((String) view.getValueAt(TABLE_NAME_COLUMN_POSITION, row)); | |
89 | - newServicesUrls.add((String) view.getValueAt(SERVICE_URL_COLUMN_POSITION, row)); | |
85 | + newTablesNames.add((String) view.getValueAt(idxServiceUrl, row)); | |
86 | + newServicesUrls.add((String) view.getValueAt(idxTableName, row)); | |
90 | 87 | } |
91 | 88 | services.updateSelectedServices(newTablesNames, newServicesUrls); |
92 | 89 | listener.updateQuery(); | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/service/Queries.java
... | ... | @@ -23,16 +23,6 @@ package eu.omp.irap.vespa.epntapclient.service; |
23 | 23 | */ |
24 | 24 | public final class Queries { |
25 | 25 | |
26 | - /** | |
27 | - * The default SELECT keyword content of the query, which select standard service column names. | |
28 | - */ | |
29 | - private static final String SELECT_SERVICE = "SELECT DISTINCT ivoid, access_url, res_title, " | |
30 | - + "short_name, table_name, content_type, res_description, creator_seq, content_level, " | |
31 | - + "reference_url, created, updated "; | |
32 | - | |
33 | - /** The default SELECT keyword */ | |
34 | - private static final String SELECT = "SELECT DISTINCT "; | |
35 | - | |
36 | 26 | /** The default FROM keyword content of the query, which links all required tables. */ |
37 | 27 | private static final String FROM = "FROM rr.resource " |
38 | 28 | + "NATURAL JOIN rr.res_schema " |
... | ... | @@ -44,47 +34,59 @@ public final class Queries { |
44 | 34 | /** The default ORDER BY keyword content of the query. */ |
45 | 35 | private static final String ORDER_BY = "ORDER BY short_name, table_name"; |
46 | 36 | |
37 | + /** The default SELECT keyword */ | |
38 | + private static final String SELECT = "SELECT DISTINCT "; | |
39 | + | |
40 | + /** | |
41 | + * The default SELECT keyword content of the query, which select standard service column names. | |
42 | + */ | |
43 | + private static final String SELECT_SERVICE = "SELECT DISTINCT res_title, ivoid, access_url, " | |
44 | + + " short_name, table_name, content_type, res_description, creator_seq, content_level, " | |
45 | + + "reference_url, created, updated "; | |
46 | + | |
47 | 47 | /** The default WHERE keyword content of the query, in order to get only TAP services. */ |
48 | 48 | private static final String WHERE_TAP = "WHERE " |
49 | 49 | + "standard_id='ivo://ivoa.net/std/tap' AND " |
50 | 50 | + "intf_type='vs:paramhttp' AND " |
51 | 51 | + "detail_xpath='/capability/dataModel/@ivo-id' "; |
52 | - | |
53 | - //@noformat | |
52 | + | |
53 | + /** Query to select all columns of any table. */ | |
54 | + public static final String SELECT_ALL = "SELECT DISTINCT * FROM %s"; | |
54 | 55 | |
55 | 56 | /** Query to get all TAP services. */ |
56 | - public static final String SELECT_ALL_TAP_SERVICES = | |
57 | - SELECT_SERVICE + FROM + WHERE_TAP + ORDER_BY; | |
58 | - | |
59 | - /** Query to get the specified columns (%s #1) of all TAP services. */ | |
60 | - public static final String SELECT_TAP_SERVICES = | |
61 | - SELECT + "%s " + FROM + WHERE_TAP; | |
57 | + public static final String SELECT_ALL_TAP_SERVICES = SELECT_SERVICE + FROM + WHERE_TAP | |
58 | + + ORDER_BY; | |
62 | 59 | |
63 | 60 | /** Query to get TAP services which implement the specified core (%s #1). */ |
64 | - public static final String SELECT_ALL_TAP_SERVICES_WHERE_CORE = | |
65 | - SELECT_SERVICE + FROM + WHERE_TAP | |
61 | + public static final String SELECT_ALL_TAP_SERVICES_WHERE_CORE = SELECT_SERVICE + FROM | |
62 | + + WHERE_TAP | |
66 | 63 | + "AND 1=ivo_nocasematch(detail_value, 'ivo://vopdc.obspm/std/%s%%') " + ORDER_BY; |
67 | 64 | |
68 | 65 | /** Query to get the TAP service with the specified ivoid (%s #1). */ |
69 | - public static final String SELECT_ALL_TAP_SERVICES_WHERE_IVOID = | |
70 | - SELECT_SERVICE + FROM + WHERE_TAP + "AND ivoid = '%s'"; | |
66 | + public static final String SELECT_ALL_TAP_SERVICES_WHERE_IVOID = SELECT_SERVICE + FROM | |
67 | + + WHERE_TAP + "AND ivoid = '%s'"; | |
71 | 68 | |
72 | - /** Query to get the specified column names (%s #1) of TAP service with the specified ivoid (%s #2). */ | |
73 | - public static final String SELECT_TAP_SERVICES_WHERE_IVOID = | |
74 | - SELECT + "%s " + FROM + WHERE_TAP + "AND ivoid = '%s'"; | |
69 | + /** Query to get the specified column names (%s #1) of any table. */ | |
70 | + public static final String SELECT_FROM = SELECT + "%s FROM %s"; | |
75 | 71 | |
76 | - /** Query to get the specified column names (%s #1) of TAP service with the specified subject (%s #2). */ | |
77 | - public static final String SELECT_TAP_SERVICES_WHERE_SUBJECT = | |
78 | - SELECT + "%s " + FROM + "NATURAL JOIN rr.res_subject " + WHERE_TAP + "AND (%s)"; | |
72 | + /** Query to get the specified columns (%s #1) of all TAP services. */ | |
73 | + public static final String SELECT_TAP_SERVICES = SELECT + "%s " + FROM + WHERE_TAP; | |
74 | + | |
75 | + /** | |
76 | + * Query to get the specified column names (%s #1) of TAP service with the specified ivoid (%s | |
77 | + * #2). | |
78 | + */ | |
79 | + public static final String SELECT_TAP_SERVICES_WHERE_IVOID = SELECT + "%s " + FROM + WHERE_TAP | |
80 | + + "AND ivoid = '%s'"; | |
81 | + | |
82 | + /** | |
83 | + * Query to get the specified column names (%s #1) of TAP service with the specified subject (%s | |
84 | + * #2). | |
85 | + */ | |
86 | + public static final String SELECT_TAP_SERVICES_WHERE_SUBJECT = SELECT + "%s " + FROM | |
87 | + + "NATURAL JOIN rr.res_subject " + WHERE_TAP + "AND (%s)"; | |
79 | 88 | |
80 | - /** Query to get the specified column names (%s #1) of any table. */ | |
81 | - public static final String SELECT_FROM = | |
82 | - SELECT + "%s FROM %s"; | |
83 | 89 | |
84 | - /** Query to select all columns of any table. */ | |
85 | - public static final String SELECT_ALL = | |
86 | - "SELECT DISTINCT * FROM %s"; | |
87 | - //@format | |
88 | 90 | |
89 | 91 | |
90 | 92 | /** Constructor to hide the implicit public one. */ | ... | ... |