Issue #1273 product browser re-orders for all applicable data types
Change-Id: I8612578d239119e9df22724ebb0bc100cf7826af Former-commit-id:3ec3104feb
[formerly5fa5302739
] [formerly3f2c497286
] [formerly73a0b0da75
[formerly3f2c497286
[formerly c4e2ff5e1b4f22b1bf712f26dea71ab8d15a75f1]]] Former-commit-id:73a0b0da75
Former-commit-id: 009331e4c9c0ec761422e6c0b20ed4b8c91a5a2d [formerly1b2d3d642d
] Former-commit-id:7687db01f4
This commit is contained in:
parent
d1aeee2503
commit
d2fe46ce1a
15 changed files with 106 additions and 66 deletions
|
@ -75,8 +75,7 @@ public class GFEDataDefinition extends
|
|||
public GFEDataDefinition() {
|
||||
productName = "gfe";
|
||||
displayName = "GFE";
|
||||
order = new String[] { GFEUtil.PLUGIN_NAME, SITE_ID, MODEL_NAME,
|
||||
PARM_NAME, PARM_LEVEL };
|
||||
order = new String[] { SITE_ID, MODEL_NAME, PARM_NAME, PARM_LEVEL };
|
||||
order = getOrder();
|
||||
loadProperties = new GridLoadProperties();
|
||||
loadProperties.setResourceType(getResourceType());
|
||||
|
@ -116,9 +115,6 @@ public class GFEDataDefinition extends
|
|||
getProductParameters(new String[0], null));
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (String orderString : order) {
|
||||
if (orderString == order[0]) {
|
||||
continue;
|
||||
}
|
||||
List<ProductBrowserLabel> labels = formatData(orderString,
|
||||
parameters);
|
||||
for (ProductBrowserLabel label : labels) {
|
||||
|
@ -202,20 +198,23 @@ public class GFEDataDefinition extends
|
|||
String parmLevel = "%";
|
||||
|
||||
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
|
||||
queryList.put(order[0], new RequestConstraint(productName));
|
||||
for (int i = 1; i < selection.length; i++) {
|
||||
if (order[i].equals(SITE_ID)) {
|
||||
siteId = selection[i];
|
||||
} else if (order[i].equals(MODEL_NAME)) {
|
||||
modelName = selection[i];
|
||||
} else if (order[i].equals(MODEL_TIME)) {
|
||||
modelTime = selection[i];
|
||||
} else if (order[i].equals(DB_TYPE)) {
|
||||
dbType = selection[i];
|
||||
} else if (order[i].equals(PARM_NAME)) {
|
||||
parmName = selection[i];
|
||||
} else if (order[i].equals(PARM_LEVEL)) {
|
||||
parmLevel = selection[i];
|
||||
queryList.put(PLUGIN_NAME, new RequestConstraint(productName));
|
||||
if (selection.length > 1) {
|
||||
String[] usedSelection = realignSelection(selection);
|
||||
for (int i = 0; i < usedSelection.length; i++) {
|
||||
if (order[i].equals(SITE_ID)) {
|
||||
siteId = usedSelection[i];
|
||||
} else if (order[i].equals(MODEL_NAME)) {
|
||||
modelName = usedSelection[i];
|
||||
} else if (order[i].equals(MODEL_TIME)) {
|
||||
modelTime = usedSelection[i];
|
||||
} else if (order[i].equals(DB_TYPE)) {
|
||||
dbType = usedSelection[i];
|
||||
} else if (order[i].equals(PARM_NAME)) {
|
||||
parmName = usedSelection[i];
|
||||
} else if (order[i - 1].equals(PARM_LEVEL)) {
|
||||
parmLevel = usedSelection[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
String parmId = String.format(GFEUtil.PARM_ID_FORMAT, parmName,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<page
|
||||
class="com.raytheon.uf.viz.productbrowser.DataTypePreferencePage"
|
||||
id="com.raytheon.uf.viz.productbrowser.productbrowserdatapreferencepage"
|
||||
name="CRiMSS"
|
||||
name="CrIMSS"
|
||||
category="com.raytheon.uf.viz.productbrowser.productbrowserpreferencespage"/>
|
||||
</extension>
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class CrimssDataDefinition
|
|||
public CrimssDataDefinition() {
|
||||
productName = "crimss";
|
||||
displayName = "CrIMSS";
|
||||
order = new String[] { "pluginName", POINT };
|
||||
order = new String[] { POINT };
|
||||
order = getOrder();
|
||||
loadProperties = new LoadProperties();
|
||||
loadProperties.setResourceType(getResourceType());
|
||||
|
|
|
@ -35,4 +35,12 @@
|
|||
name="com.raytheon.uf.viz.npp.viirs.viirsProductBrowserDefinition">
|
||||
</dataDefinition>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.preferencePages">
|
||||
<page
|
||||
class="com.raytheon.uf.viz.productbrowser.DataTypePreferencePage"
|
||||
id="com.raytheon.uf.viz.productbrowser.productbrowserdatapreferencepage"
|
||||
name="VIIRS"
|
||||
category="com.raytheon.uf.viz.productbrowser.productbrowserpreferencespage"/>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -46,8 +46,7 @@ public class VIIRSProductBrowserDefinition extends
|
|||
public VIIRSProductBrowserDefinition() {
|
||||
productName = "viirs";
|
||||
displayName = "VIIRS";
|
||||
order = new String[] { "pluginName", "region", "channelType",
|
||||
"wavelength" };
|
||||
order = new String[] { "region", "channelType", "wavelength" };
|
||||
order = getOrder();
|
||||
loadProperties = new LoadProperties();
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class PrecipRateDataDefinition extends
|
|||
public PrecipRateDataDefinition() {
|
||||
productName = "preciprate";
|
||||
displayName = "Precipitation Rate";
|
||||
order = new String[] { "pluginName", "icao" };
|
||||
order = new String[] { "icao" };
|
||||
order = getOrder();
|
||||
loadProperties = new LoadProperties();
|
||||
loadProperties.setResourceType(getResourceType());
|
||||
|
|
|
@ -79,6 +79,9 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AbstractRequestableProductBrowserDataDefinition.class);
|
||||
|
||||
// for requestable products, pluginName must be part of the request
|
||||
public String PLUGIN_NAME = "pluginName";
|
||||
|
||||
// name of the product for the request constraints
|
||||
public String productName;
|
||||
|
||||
|
@ -100,7 +103,7 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
|||
return null;
|
||||
}
|
||||
List<Object[]> parameters = null;
|
||||
if (order.length > 1) {
|
||||
if (order.length >= 1) {
|
||||
try {
|
||||
DbQuery query = new DbQuery(productName);
|
||||
query.setMaxResults(1);
|
||||
|
@ -135,10 +138,10 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
|||
long time = System.currentTimeMillis();
|
||||
List<ProductBrowserLabel> parameters = null;
|
||||
boolean product = false;
|
||||
String param = order[selection.length];
|
||||
String param = order[selection.length - 1];
|
||||
HashMap<String, RequestConstraint> queryList = getProductParameters(
|
||||
selection, order);
|
||||
product = (selection.length + 1) == order.length;
|
||||
product = selection.length == order.length;
|
||||
|
||||
String[] temp = queryData(param, queryList);
|
||||
if (temp != null) {
|
||||
|
@ -154,6 +157,7 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
|||
parameters.get(i).setProduct(product);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Time to query for "
|
||||
+ selection[selection.length - 1] + ": "
|
||||
+ (System.currentTimeMillis() - time) + "ms");
|
||||
|
@ -227,8 +231,8 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
|||
historyList.add(displayName);
|
||||
Map<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
|
||||
RequestConstraint contstraint = new RequestConstraint(productName);
|
||||
queryList.put(order[0], contstraint);
|
||||
for (int i = 1; i < order.length; i++) {
|
||||
queryList.put(PLUGIN_NAME, contstraint);
|
||||
for (int i = 0; i < order.length; i++) {
|
||||
try {
|
||||
String[] items = CatalogQuery.performQuery(order[i], queryList);
|
||||
List<ProductBrowserLabel> labels = formatData(order[i], items);
|
||||
|
@ -254,13 +258,29 @@ public abstract class AbstractRequestableProductBrowserDataDefinition<T extends
|
|||
public HashMap<String, RequestConstraint> getProductParameters(
|
||||
String[] selection, String[] order) {
|
||||
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
|
||||
queryList.put(order[0], new RequestConstraint(productName));
|
||||
for (int i = 1; i < selection.length; i++) {
|
||||
queryList.put(order[i], new RequestConstraint(selection[i]));
|
||||
queryList.put(PLUGIN_NAME, new RequestConstraint(productName));
|
||||
|
||||
String[] usedSelection = realignSelection(selection);
|
||||
for (int i = 0; i < usedSelection.length; i++) {
|
||||
queryList.put(order[i], new RequestConstraint(usedSelection[i]));
|
||||
}
|
||||
return queryList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorder the selection so that it lines up with the order
|
||||
*
|
||||
* @param selection
|
||||
* @return
|
||||
*/
|
||||
protected final String[] realignSelection(String[] selection) {
|
||||
String[] usedSelection = new String[selection.length - 1];
|
||||
for (int i = 1; i < selection.length; i++) {
|
||||
usedSelection[i - 1] = selection[i];
|
||||
}
|
||||
return usedSelection;
|
||||
}
|
||||
|
||||
public ResourceType getResourceType() {
|
||||
return ResourceType.PLAN_VIEW;
|
||||
}
|
||||
|
|
|
@ -574,7 +574,7 @@ public class ProductBrowserView extends ViewPart {
|
|||
ti.setData(((AbstractRequestableProductBrowserDataDefinition<?>) prod).productName);
|
||||
ti.setData(
|
||||
"product",
|
||||
((AbstractRequestableProductBrowserDataDefinition<?>) prod).order.length == 1 ? true
|
||||
((AbstractRequestableProductBrowserDataDefinition<?>) prod).order.length == 0 ? true
|
||||
: false);
|
||||
} else {
|
||||
ti.setData(prod.displayName);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class QPFProductBrowserDataDefinition extends
|
|||
public QPFProductBrowserDataDefinition() {
|
||||
productName = "qpf";
|
||||
displayName = "QPF";
|
||||
order = new String[] { "pluginName", "icao", "fieldName" };
|
||||
order = new String[] { "icao", "fieldName" };
|
||||
order = getOrder();
|
||||
loadProperties = new LoadProperties();
|
||||
loadProperties.setResourceType(getResourceType());
|
||||
|
@ -76,7 +76,8 @@ public class QPFProductBrowserDataDefinition extends
|
|||
if ("fieldName".equals(param)) {
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
labels.add(new ProductBrowserLabel(DATA_TYPE.valueOf(
|
||||
parameters[i]).getFieldName(), parameters[i]));
|
||||
parameters[i]).getFieldName()
|
||||
+ " (" + parameters[i] + ")", parameters[i]));
|
||||
}
|
||||
Collections.sort(labels);
|
||||
} else {
|
||||
|
@ -95,7 +96,6 @@ public class QPFProductBrowserDataDefinition extends
|
|||
*/
|
||||
@Override
|
||||
public Map<ResourceType, List<DisplayType>> getDisplayTypes() {
|
||||
// TODO Auto-generated method stub
|
||||
Map<ResourceType, List<DisplayType>> type = new HashMap<ResourceType, List<DisplayType>>();
|
||||
List<DisplayType> types = new ArrayList<DisplayType>();
|
||||
types.add(DisplayType.CONTOUR);
|
||||
|
|
|
@ -109,8 +109,8 @@ public class GridProductBrowserDataDefinition extends
|
|||
public GridProductBrowserDataDefinition() {
|
||||
productName = GridInventory.PLUGIN_NAME;
|
||||
displayName = "Grid";
|
||||
order = new String[] { GridInventory.PLUGIN_NAME_QUERY,
|
||||
GridInventory.MODEL_NAME_QUERY, GridInventory.PARAMETER_QUERY,
|
||||
order = new String[] { GridInventory.MODEL_NAME_QUERY,
|
||||
GridInventory.PARAMETER_QUERY,
|
||||
GridInventory.MASTER_LEVEL_QUERY, GridInventory.LEVEL_ID_QUERY };
|
||||
order = getOrder();
|
||||
loadProperties = new LoadProperties();
|
||||
|
|
|
@ -63,7 +63,7 @@ public class LightningProductBrowserDataDefinition extends
|
|||
public LightningProductBrowserDataDefinition() {
|
||||
productName = "binlightning";
|
||||
displayName = "Lightning";
|
||||
order = new String[] { "pluginName", "startTime", "type" };
|
||||
order = new String[] { "startTime", "type" };
|
||||
order = getOrder();
|
||||
loadProperties = new LoadProperties();
|
||||
loadProperties.setResourceType(getResourceType());
|
||||
|
@ -78,17 +78,26 @@ public class LightningProductBrowserDataDefinition extends
|
|||
*/
|
||||
@Override
|
||||
public List<ProductBrowserLabel> populateData(String[] selection) {
|
||||
if (selection.length == 1) {
|
||||
List<ProductBrowserLabel> labels = null;
|
||||
if (order[selection.length - 1].equals("startTime")) {
|
||||
String[] strings = new String[offsets.length];
|
||||
for (int i = 0; i < offsets.length; i++) {
|
||||
strings[i] = String.valueOf(offsets[i]);
|
||||
}
|
||||
return formatData("pluginName", strings);
|
||||
} else if (selection.length == 2) {
|
||||
return formatData("startTime", types);
|
||||
} else {
|
||||
return formatData("type", types);
|
||||
|
||||
labels = formatData("startTime", strings);
|
||||
} else if (order[selection.length - 1].equals("type")) {
|
||||
labels = formatData("type", types);
|
||||
}
|
||||
|
||||
for (ProductBrowserLabel label : labels) {
|
||||
if (selection.length == order.length) {
|
||||
label.setProduct(true);
|
||||
} else {
|
||||
label.setProduct(false);
|
||||
}
|
||||
}
|
||||
return labels;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -101,24 +110,21 @@ public class LightningProductBrowserDataDefinition extends
|
|||
@Override
|
||||
public List<ProductBrowserLabel> formatData(String param,
|
||||
String[] parameters) {
|
||||
if ("pluginName".equals(param)) {
|
||||
if ("startTime".equals(param)) {
|
||||
List<ProductBrowserLabel> labels = new ArrayList<ProductBrowserLabel>();
|
||||
for (int i = 0; i < offsets.length; i++) {
|
||||
labels.add(new ProductBrowserLabel((offsets[i] / 60) + " min",
|
||||
"" + offsets[i]));
|
||||
labels.get(i).setProduct(false);
|
||||
}
|
||||
return labels;
|
||||
} else if ("startTime".equals(param)) {
|
||||
} else if ("type".equals(param)) {
|
||||
List<ProductBrowserLabel> labels = new ArrayList<ProductBrowserLabel>();
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
labels.add(new ProductBrowserLabel(types[i], types[i]));
|
||||
labels.get(i).setProduct(true);
|
||||
}
|
||||
return labels;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -153,8 +159,17 @@ public class LightningProductBrowserDataDefinition extends
|
|||
@Override
|
||||
public void constructResource(String[] selection, ResourceType type) {
|
||||
String[] sel = new String[] { selection[0] };
|
||||
negativeOffset = Integer.parseInt(selection[1]);
|
||||
lightningType = selection[selection.length - 1];
|
||||
int timeOffset = 0;
|
||||
int posNegOffset = 0;
|
||||
for (int i = 0; i < order.length; i++) {
|
||||
if ("startTime".equals(order[i])) {
|
||||
timeOffset = i;
|
||||
} else if ("type".equals(order[i])) {
|
||||
posNegOffset = i;
|
||||
}
|
||||
}
|
||||
negativeOffset = Integer.parseInt(selection[timeOffset + 1]);
|
||||
lightningType = selection[posNegOffset + 1];
|
||||
super.constructResource(sel, type);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class PlotModelDataDefinition extends
|
|||
public PlotModelDataDefinition() {
|
||||
productName = "plotModels";
|
||||
displayName = "Plot Models";
|
||||
order = new String[] { "pluginName", "type", "svg", "level" };
|
||||
order = new String[] { "type", "svg", "level" };
|
||||
loadProperties = new LoadProperties();
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class PlotModelDataDefinition extends
|
|||
public HashMap<String, RequestConstraint> getProductParameters(
|
||||
String[] selection, String[] order) {
|
||||
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
|
||||
queryList.put(order[0], new RequestConstraint(selection[1]));
|
||||
queryList.put(PLUGIN_NAME, new RequestConstraint(selection[1]));
|
||||
PointDataInventory inv = getInventory();
|
||||
if (!inv.getTypeKey(selection[1])
|
||||
.equals(PointDataInventory.PLUGIN_NAME)) {
|
||||
|
@ -129,7 +129,7 @@ public class PlotModelDataDefinition extends
|
|||
String param = null;
|
||||
if (selection.length == 1) {
|
||||
results = inv.getPlugins().toArray(new String[0]);
|
||||
param = order[0];
|
||||
param = PLUGIN_NAME;
|
||||
return formatData(param, results);
|
||||
}
|
||||
String source = selection[1];
|
||||
|
@ -151,13 +151,13 @@ public class PlotModelDataDefinition extends
|
|||
}
|
||||
if ((hasType && selection.length == 3) || selection.length == 2) {
|
||||
results = getModels(source);
|
||||
param = order[2];
|
||||
param = order[1];
|
||||
return formatData(param, results);
|
||||
}
|
||||
|
||||
if ((hasType && selection.length == 4) || selection.length == 3) {
|
||||
results = getLevels(source, selection[selection.length - 1]);
|
||||
param = order[3];
|
||||
param = order[2];
|
||||
return formatData(param, results);
|
||||
}
|
||||
return null;
|
||||
|
@ -169,13 +169,13 @@ public class PlotModelDataDefinition extends
|
|||
Arrays.sort(parameters);
|
||||
List<ProductBrowserLabel> labels = new ArrayList<ProductBrowserLabel>();
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
if (param == order[2]) {
|
||||
if (param == order[1]) {
|
||||
labels.add(new ProductBrowserLabel(parameters[i].replace(
|
||||
".svg", ""), parameters[i]));
|
||||
} else {
|
||||
labels.add(new ProductBrowserLabel(parameters[i], parameters[i]));
|
||||
}
|
||||
labels.get(i).setProduct(param == order[3]);
|
||||
labels.get(i).setProduct(param == order[2]);
|
||||
}
|
||||
return labels;
|
||||
}
|
||||
|
|
|
@ -86,8 +86,7 @@ public class RadarProductBrowserDataDefinition extends
|
|||
}
|
||||
productName = "radar";
|
||||
displayName = "Radar";
|
||||
order = new String[] { "pluginName", "icao", "productCode",
|
||||
"primaryElevationAngle" };
|
||||
order = new String[] { "icao", "productCode", "primaryElevationAngle" };
|
||||
order = getOrder();
|
||||
loadProperties = new LoadProperties();
|
||||
loadProperties.getCapabilities().addCapability(ImagingCapability.class);
|
||||
|
@ -131,7 +130,8 @@ public class RadarProductBrowserDataDefinition extends
|
|||
.getResolution() / 1000) + " km ";
|
||||
}
|
||||
labels.add(new ProductBrowserLabel(infoDict.getInfo(tmp)
|
||||
.getName() + "::" + parm, parameters[i]));
|
||||
.getName() + " (" + tmp + ")" + "::" + parm,
|
||||
parameters[i]));
|
||||
}
|
||||
Collections.sort(labels);
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
|
|
|
@ -65,7 +65,7 @@ public class RedbookProductBrowserDataDefinition extends
|
|||
public RedbookProductBrowserDataDefinition() {
|
||||
productName = "redbook";
|
||||
displayName = "Redbook";
|
||||
order = new String[] { "pluginName", "wmoTTAAii" };
|
||||
order = new String[] { "wmoTTAAii" };
|
||||
order = getOrder();
|
||||
try {
|
||||
mapping = null;
|
||||
|
|
|
@ -48,8 +48,7 @@ public class SatelliteProductBrowserDataDefinition extends
|
|||
public SatelliteProductBrowserDataDefinition() {
|
||||
productName = "satellite";
|
||||
displayName = "Satellite";
|
||||
order = new String[] { "pluginName", "creatingEntity", "sectorID",
|
||||
"physicalElement" };
|
||||
order = new String[] { "creatingEntity", "sectorID", "physicalElement" };
|
||||
order = getOrder();
|
||||
loadProperties = new LoadProperties();
|
||||
loadProperties.setResourceType(getResourceType());
|
||||
|
|
Loading…
Add table
Reference in a new issue