Commit 4f76f423abcc40bdc28c3882d7db92a5545d3174

Authored by Nathanael Jourdane
2 parents 70b98e7e 385482f3
Exists in master

Merge modifications

pom.xml
... ... @@ -22,7 +22,60 @@
22 22 </roles>
23 23 </developer>
24 24 </developers>
25   -
  25 + <reporting>
  26 + <outputDirectory>${basedir}/target/site</outputDirectory>
  27 + <plugins>
  28 + <plugin>
  29 + <groupId>org.apache.maven.plugins</groupId>
  30 + <artifactId>maven-jxr-plugin</artifactId>
  31 + <version>2.5</version>
  32 + </plugin>
  33 + <plugin>
  34 + <artifactId>maven-project-info-reports-plugin</artifactId>
  35 + <version>2.8</version>
  36 + <configuration>
  37 + <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
  38 + </configuration>
  39 + </plugin>
  40 + <plugin>
  41 + <groupId>org.apache.maven.plugins</groupId>
  42 + <artifactId>maven-javadoc-plugin</artifactId>
  43 + <version>2.10.3</version>
  44 + <configuration>
  45 + <quiet>true</quiet>
  46 + </configuration>
  47 + </plugin>
  48 + <plugin>
  49 + <groupId>org.apache.maven.plugins</groupId>
  50 + <artifactId>maven-surefire-report-plugin</artifactId>
  51 + <version>2.18.1</version>
  52 + </plugin>
  53 + <plugin>
  54 + <groupId>org.codehaus.mojo</groupId>
  55 + <artifactId>findbugs-maven-plugin</artifactId>
  56 + <version>2.5.5</version>
  57 + <configuration>
  58 + <onlyAnalyze>eu.omp.irap.cassis.-</onlyAnalyze>
  59 + </configuration>
  60 + </plugin>
  61 + <plugin>
  62 + <groupId>org.apache.maven.plugins</groupId>
  63 + <artifactId>maven-pmd-plugin</artifactId>
  64 + <version>3.4</version>
  65 + <configuration>
  66 + <includes>
  67 + <include>**/eu/omp/irap/**</include>
  68 + </includes>
  69 + </configuration>
  70 + </plugin>
  71 + <plugin>
  72 + <groupId>org.codehaus.mojo</groupId>
  73 + <artifactId>cobertura-maven-plugin</artifactId>
  74 + <version>2.6</version>
  75 +
  76 + </plugin>
  77 + </plugins>
  78 + </reporting>
26 79 <!-- The files encoding. -->
27 80 <properties>
28 81 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainPanel/MainPanelController.java
... ... @@ -47,6 +47,8 @@ public class MainPanelController extends EpnTapController implements ViewListene
47 47 /** The URL of the service corresponding to the selected table. */
48 48 private String selectedTableServiceURL;
49 49  
  50 + private int nbMaxResult = 10;
  51 +
50 52  
51 53 public MainPanelController() {
52 54 super();
... ... @@ -128,10 +130,24 @@ public class MainPanelController extends EpnTapController implements ViewListene
128 130 * Update the query area with a working ADQL query, based on the parameters list.
129 131 */
130 132 private void updateQueryArea() {
131   - String query = Queries.getQuery(selectedTableName, paramValues, 10);
  133 + String query = Queries.getQuery(selectedTableName, paramValues, getNbMaxResult());
132 134 mainView.getRequestPanel().updateQueryArea(query);
133 135 }
134 136  
  137 + /**
  138 + * @return the nb max of result
  139 + */
  140 + public int getNbMaxResult() {
  141 + return nbMaxResult;
  142 + }
  143 +
  144 + /**
  145 + * set the nb max of result for a query
  146 + */
  147 + public void setNbMaxResult(int nb) {
  148 + nbMaxResult = nb;
  149 + }
  150 +
135 151 public void updateService(String serviceURL, String tableName) {
136 152 if (!tableName.equals(selectedTableName)) {
137 153 selectedTableServiceURL = serviceURL;
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java
... ... @@ -57,6 +57,14 @@ public class RequestPanelView extends JPanel {
57 57 */
58 58 private List<ParamField> paramFields;
59 59  
  60 + private TargetNameField targetNameField;
  61 +
  62 + private DateRangeField timeRangeField;
  63 +
  64 + private FloatRangeField spectralRangeField;
  65 +
  66 + private DataProductTypeField dataProductTypeField;
  67 +
60 68 /** The height of the buttons panel. */
61 69 private static final int BUTTON_PANEL_HEIGHT = 20;
62 70  
... ... @@ -84,12 +92,12 @@ public class RequestPanelView extends JPanel {
84 92 *
85 93 * @return The JPanel.
86 94 */
87   - private JPanel buildParamPanel() {
  95 + public JPanel buildParamPanel() {
88 96 paramFields = new ArrayList<>();
89   - paramFields.add(new TargetNameField(viewListener, "target_name"));
90   - paramFields.add(new DateRangeField(viewListener, "time_"));
91   - paramFields.add(new FloatRangeField(viewListener, "spectral_range_"));
92   - paramFields.add(new DataProductTypeField(viewListener, "dataproduct_type"));
  97 + paramFields.add(getTargetNameField());
  98 + paramFields.add(getTimeRangeField());
  99 + paramFields.add(getSpectralRangeField());
  100 + paramFields.add(getDataProductTypeField());
93 101 JPanel paramPanel = new JPanel();
94 102 paramPanel.setLayout(new BoxLayout(paramPanel, BoxLayout.Y_AXIS));
95 103 paramPanel.setBorder(BorderFactory.createTitledBorder("Query parameters"));
... ... @@ -102,6 +110,50 @@ public class RequestPanelView extends JPanel {
102 110 }
103 111  
104 112 /**
  113 + * @return the data product field
  114 + */
  115 + public DataProductTypeField getDataProductTypeField() {
  116 + if(dataProductTypeField == null){
  117 + dataProductTypeField = new DataProductTypeField(viewListener, "dataproduct_type");
  118 + }
  119 +
  120 + return dataProductTypeField;
  121 + }
  122 +
  123 + /**
  124 + * @return the spectral range field
  125 + */
  126 + public FloatRangeField getSpectralRangeField() {
  127 + if (spectralRangeField == null){
  128 + spectralRangeField = new FloatRangeField(viewListener, "spectral_range_");
  129 + }
  130 +
  131 + return spectralRangeField;
  132 + }
  133 +
  134 + /**
  135 + * @return the time range field
  136 + */
  137 + public DateRangeField getTimeRangeField() {
  138 + if (timeRangeField == null){
  139 + timeRangeField = new DateRangeField(viewListener, "time_");
  140 + }
  141 +
  142 + return timeRangeField;
  143 + }
  144 +
  145 + /**
  146 + * @return the target name field
  147 + */
  148 + public TargetNameField getTargetNameField() {
  149 + if(targetNameField == null){
  150 + targetNameField = new TargetNameField(viewListener, "target_name");
  151 + }
  152 +
  153 + return targetNameField;
  154 + }
  155 +
  156 + /**
105 157 * Build a JPanel containing a text-area where the query is displayed.
106 158 *
107 159 * @return The JPanel.
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/service/Queries.java
... ... @@ -28,6 +28,8 @@ import eu.omp.irap.vespa.votable.utils.StringJoiner;
28 28 * @author N. Jourdane
29 29 */
30 30 public final class Queries {
  31 +
  32 + public static String RETURN_PARAMETERS = "target_name, target_class";
31 33  
32 34 private static final String SELECT = "SELECT DISTINCT short_name, res_title, "
33 35 + "table_name, schema_name, ivoid, access_url ";
... ... @@ -113,7 +115,11 @@ public final class Queries {
113 115 }
114 116 }
115 117 String where = addJoin.isEmpty() ? "" : " WHERE " + addJoin;
116   - return "SELECT TOP " + nbRow + " target_name, target_class FROM " + tableName + where;
  118 +
  119 + return "SELECT TOP " + nbRow + " "
  120 + + RETURN_PARAMETERS
  121 + + " "
  122 + + "FROM " + tableName + where;
117 123 }
118 124  
119 125 }
... ...