diff --git a/JAVA/CEP/jParmFacade/src/nl/astron/lofar/java/cep/jparmfacade/PlotDataAccessParmDBImpl.java b/JAVA/CEP/jParmFacade/src/nl/astron/lofar/java/cep/jparmfacade/PlotDataAccessParmDBImpl.java index 4f6a32b18ee5c9e1c23581529390b585e87d785f..2e96b756a29deb32db5218210c8378f86d339597 100644 --- a/JAVA/CEP/jParmFacade/src/nl/astron/lofar/java/cep/jparmfacade/PlotDataAccessParmDBImpl.java +++ b/JAVA/CEP/jParmFacade/src/nl/astron/lofar/java/cep/jparmfacade/PlotDataAccessParmDBImpl.java @@ -73,7 +73,7 @@ public class PlotDataAccessParmDBImpl implements IPlotDataAccess{ * * * @param constraints The constraints provided by the PlotPanel. - * These must be modelled as follows:<br><br> + * These must be modelled as follows in a String[] :<br><br> * -constraints[0]= the parameter name filter (for example parm*) (String)<br> * -constraints[1]= the startx variable (for example 0) (double)<br> * -constraints[2]= the endx variable (for example 5) (double)<br> @@ -86,24 +86,25 @@ public class PlotDataAccessParmDBImpl implements IPlotDataAccess{ * with the ParmDB interface and calls to it. * */ - public HashMap retrieveData(String[] constraints) throws PlotterDataAccessException{ + public HashMap retrieveData(Object constraints) throws PlotterDataAccessException{ if(parmDB == null){ this.initiateConnectionToParmDB(); } + String[] constraintsArray = (String[])constraints; HashMap<String,Object> returnMap = new HashMap<String, Object>(); LinkedList<HashMap> returnValues = new LinkedList<HashMap>(); if(parmDB != null){ Vector names; try{ - names = parmDB.getNames(constraints[0]); + names = parmDB.getNames(constraintsArray[0]); } catch (Exception ex) { //TODO LOG! PlotterDataAccessException exx = new PlotterDataAccessException("An invalid getNames() call was made to the ParmDB interface. Please check that all variables seem OK. Root cause: "+ex.getMessage()); exx.initCause(ex); throw exx; } - if(names != null && names.size()>=1 && constraints.length == this.requiredDataConstraints){ - returnMap.put(PlotConstants.DATASET_NAME,"ParmDB dataset '"+constraints[0]+"'"); + if(names != null && names.size()>=1 && constraintsArray.length == this.requiredDataConstraints){ + returnMap.put(PlotConstants.DATASET_NAME,"ParmDB dataset '"+constraintsArray[0]+"'"); TimeZone utcZone = TimeZone.getTimeZone("UTC"); utcZone.setDefault(utcZone); Calendar aCalendar = Calendar.getInstance(utcZone); @@ -134,12 +135,12 @@ public class PlotDataAccessParmDBImpl implements IPlotDataAccess{ exx.initCause(ex); throw exx; } - double startx = Double.parseDouble(constraints[1]); - double endx = Double.parseDouble(constraints[2]); - double starty = Double.parseDouble(constraints[4]); - double endy = Double.parseDouble(constraints[5]); - int numx = Integer.parseInt(constraints[3]); - int numy = Integer.parseInt(constraints[6]); + double startx = Double.parseDouble(constraintsArray[1]); + double endx = Double.parseDouble(constraintsArray[2]); + double starty = Double.parseDouble(constraintsArray[4]); + double endy = Double.parseDouble(constraintsArray[5]); + int numx = Integer.parseInt(constraintsArray[3]); + int numy = Integer.parseInt(constraintsArray[6]); if(paramValues != null && paramValues.size()==4){ //startx = Double.parseDouble(paramValues.get(0).toString()); @@ -191,10 +192,10 @@ public class PlotDataAccessParmDBImpl implements IPlotDataAccess{ } returnMap.put(PlotConstants.DATASET_VALUES,returnValues); - }else if (constraints.length != this.requiredDataConstraints){ - throw new PlotterDataAccessException("An invalid amount of parameters (" +constraints.length+" instead of " +this.requiredDataConstraints+") were passed to the ParmDB Data Access Interface"); + }else if (constraintsArray.length != this.requiredDataConstraints){ + throw new PlotterDataAccessException("An invalid amount of parameters (" +constraintsArray.length+" instead of " +this.requiredDataConstraints+") were passed to the ParmDB Data Access Interface"); }else if (names.size() < 1){ - throw new PlotterDataAccessException("No results were found in the ParmDB table(s) using the given parameter name filter ( "+constraints[0]+" )"); + throw new PlotterDataAccessException("No results were found in the ParmDB table(s) using the given parameter name filter ( "+constraintsArray[0]+" )"); } } diff --git a/JAVA/GUI/Plotter/src/nl/astron/lofar/java/gui/plotter/test/PlotDataAccessTestImpl.java b/JAVA/GUI/Plotter/src/nl/astron/lofar/java/gui/plotter/test/PlotDataAccessTestImpl.java index 1b3bea58a1c3c0862020ef7ed8fd27bb9d93b94e..91bd30b3913509ae43fcc6f2ebde87a761bdbf39 100644 --- a/JAVA/GUI/Plotter/src/nl/astron/lofar/java/gui/plotter/test/PlotDataAccessTestImpl.java +++ b/JAVA/GUI/Plotter/src/nl/astron/lofar/java/gui/plotter/test/PlotDataAccessTestImpl.java @@ -24,7 +24,6 @@ package nl.astron.lofar.java.gui.plotter.test; import java.util.HashMap; -import java.util.HashSet; import java.util.LinkedList; import nl.astron.lofar.java.gui.plotter.IPlotDataAccess; import nl.astron.lofar.java.gui.plotter.PlotConstants; @@ -54,16 +53,17 @@ public class PlotDataAccessTestImpl implements IPlotDataAccess{ /** * This method returns a test data set that can be plotted using the PlotSGTImpl plotter - * @param constraints The type of plot you would like to have data for:<br> + * @param constraints A String[] containing the type of plot you would like to have data for:<br> * -constraints[0] == "line" --> for a XYLINE plot<br> * -constraints[0] == "grid" --> for a GRID plot<br><br> * @throws PlotterDataAccessException will be thrown if something goes wrong during the making of the * test data set (not likely though as no other classes are called!) */ - public HashMap retrieveData(String[] constraints) throws PlotterDataAccessException{ + public HashMap retrieveData(Object constraints) throws PlotterDataAccessException{ //create the hashmap to be returned HashMap<String,Object> data = new HashMap<String,Object>(); - if(constraints[0].equalsIgnoreCase("line")){ + String[] constraintsArray = (String[])constraints; + if(constraintsArray[0].equalsIgnoreCase("line")){ String plotTitle = "Testset LOFAR Plotter | XYLine"; data.put(PlotConstants.DATASET_NAME,plotTitle); @@ -132,7 +132,7 @@ public class PlotDataAccessTestImpl implements IPlotDataAccess{ values.add(aLine2); data.put(PlotConstants.DATASET_VALUES,values); - }else if (constraints[0].equalsIgnoreCase("grid")){ + }else if (constraintsArray[0].equalsIgnoreCase("grid")){ String plotTitle = "Testset LOFAR Plotter | Grid"; data.put(PlotConstants.DATASET_NAME,plotTitle); diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotDataAccessParmDBImpl.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotDataAccessParmDBImpl.java index 4f6a32b18ee5c9e1c23581529390b585e87d785f..2e96b756a29deb32db5218210c8378f86d339597 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotDataAccessParmDBImpl.java +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotDataAccessParmDBImpl.java @@ -73,7 +73,7 @@ public class PlotDataAccessParmDBImpl implements IPlotDataAccess{ * * * @param constraints The constraints provided by the PlotPanel. - * These must be modelled as follows:<br><br> + * These must be modelled as follows in a String[] :<br><br> * -constraints[0]= the parameter name filter (for example parm*) (String)<br> * -constraints[1]= the startx variable (for example 0) (double)<br> * -constraints[2]= the endx variable (for example 5) (double)<br> @@ -86,24 +86,25 @@ public class PlotDataAccessParmDBImpl implements IPlotDataAccess{ * with the ParmDB interface and calls to it. * */ - public HashMap retrieveData(String[] constraints) throws PlotterDataAccessException{ + public HashMap retrieveData(Object constraints) throws PlotterDataAccessException{ if(parmDB == null){ this.initiateConnectionToParmDB(); } + String[] constraintsArray = (String[])constraints; HashMap<String,Object> returnMap = new HashMap<String, Object>(); LinkedList<HashMap> returnValues = new LinkedList<HashMap>(); if(parmDB != null){ Vector names; try{ - names = parmDB.getNames(constraints[0]); + names = parmDB.getNames(constraintsArray[0]); } catch (Exception ex) { //TODO LOG! PlotterDataAccessException exx = new PlotterDataAccessException("An invalid getNames() call was made to the ParmDB interface. Please check that all variables seem OK. Root cause: "+ex.getMessage()); exx.initCause(ex); throw exx; } - if(names != null && names.size()>=1 && constraints.length == this.requiredDataConstraints){ - returnMap.put(PlotConstants.DATASET_NAME,"ParmDB dataset '"+constraints[0]+"'"); + if(names != null && names.size()>=1 && constraintsArray.length == this.requiredDataConstraints){ + returnMap.put(PlotConstants.DATASET_NAME,"ParmDB dataset '"+constraintsArray[0]+"'"); TimeZone utcZone = TimeZone.getTimeZone("UTC"); utcZone.setDefault(utcZone); Calendar aCalendar = Calendar.getInstance(utcZone); @@ -134,12 +135,12 @@ public class PlotDataAccessParmDBImpl implements IPlotDataAccess{ exx.initCause(ex); throw exx; } - double startx = Double.parseDouble(constraints[1]); - double endx = Double.parseDouble(constraints[2]); - double starty = Double.parseDouble(constraints[4]); - double endy = Double.parseDouble(constraints[5]); - int numx = Integer.parseInt(constraints[3]); - int numy = Integer.parseInt(constraints[6]); + double startx = Double.parseDouble(constraintsArray[1]); + double endx = Double.parseDouble(constraintsArray[2]); + double starty = Double.parseDouble(constraintsArray[4]); + double endy = Double.parseDouble(constraintsArray[5]); + int numx = Integer.parseInt(constraintsArray[3]); + int numy = Integer.parseInt(constraintsArray[6]); if(paramValues != null && paramValues.size()==4){ //startx = Double.parseDouble(paramValues.get(0).toString()); @@ -191,10 +192,10 @@ public class PlotDataAccessParmDBImpl implements IPlotDataAccess{ } returnMap.put(PlotConstants.DATASET_VALUES,returnValues); - }else if (constraints.length != this.requiredDataConstraints){ - throw new PlotterDataAccessException("An invalid amount of parameters (" +constraints.length+" instead of " +this.requiredDataConstraints+") were passed to the ParmDB Data Access Interface"); + }else if (constraintsArray.length != this.requiredDataConstraints){ + throw new PlotterDataAccessException("An invalid amount of parameters (" +constraintsArray.length+" instead of " +this.requiredDataConstraints+") were passed to the ParmDB Data Access Interface"); }else if (names.size() < 1){ - throw new PlotterDataAccessException("No results were found in the ParmDB table(s) using the given parameter name filter ( "+constraints[0]+" )"); + throw new PlotterDataAccessException("No results were found in the ParmDB table(s) using the given parameter name filter ( "+constraintsArray[0]+" )"); } }