Change-Id: I38481ba78e4547b72c52d4bd3336898463bd2552 Former-commit-id: ae89dbcbd65f4d606859e93efd93b3a7dee9aaae
This commit is contained in:
parent
326e1ed879
commit
16cfa9918d
3 changed files with 80 additions and 2 deletions
|
@ -84,6 +84,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Both not existing, set as MISSING
|
||||
* Dec 07, 2012 1353 rferrel Make dialog non-blocking.
|
||||
* Feb 05, 2013 1578 rferrel Changes for non-blocking singleton TimeSeriesDlg.
|
||||
* Jun 15, 2015 16579 wkwock Add HSA filter.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -116,6 +117,11 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
private Combo exceedingCbo;
|
||||
|
||||
/**
|
||||
* HSA combo box.
|
||||
*/
|
||||
private Combo hsaCbo;
|
||||
|
||||
/**
|
||||
* Sort by time radio button.
|
||||
*/
|
||||
|
@ -263,7 +269,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
private void createTopControls() {
|
||||
Composite topControlComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout topControlGl = new GridLayout(6, false);
|
||||
GridLayout topControlGl = new GridLayout(8, false);
|
||||
topControlComp.setLayout(topControlGl);
|
||||
|
||||
Label showLbl = new Label(topControlComp, SWT.NONE);
|
||||
|
@ -326,6 +332,25 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
GridData hsagd = new GridData(100, SWT.DEFAULT);
|
||||
Label hsaLbl = new Label(topControlComp, SWT.RIGHT);
|
||||
hsaLbl.setText("HSA");
|
||||
hsaLbl.setLayoutData(hsagd);
|
||||
|
||||
hsaCbo = new Combo(topControlComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
populateHsa();
|
||||
hsaCbo.select(0);
|
||||
hsaCbo.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
queryAlertalarmval();
|
||||
super.widgetSelected(e);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
gd = new GridData(370, SWT.DEFAULT);
|
||||
Label noteLbl = new Label(topControlComp, SWT.CENTER);
|
||||
noteLbl.setText("Note: SupVal is ObsValue for forecast diff threats\n"
|
||||
|
@ -333,6 +358,28 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
|
|||
noteLbl.setLayoutData(gd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the HsaCbo
|
||||
*/
|
||||
private void populateHsa() {
|
||||
hsaCbo.add("All HSAs");
|
||||
String hsaSql = "select distinct(hsa) from location order by hsa";
|
||||
|
||||
java.util.List<Object[]> rs;
|
||||
try {
|
||||
rs = (java.util.List<Object[]>) DirectDbQuery.executeQuery(
|
||||
hsaSql , HydroConstants.IHFS, QueryLanguage.SQL);
|
||||
if (rs.size() > 0) {
|
||||
for (Object[] oa : rs) {
|
||||
hsaCbo.add((String) oa[0]);
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the controls for sorting the data.
|
||||
*/
|
||||
|
@ -499,6 +546,11 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
|
|||
myQuery.append(DIFF_CHECKSTR);
|
||||
}
|
||||
|
||||
//HSA filter
|
||||
if (!hsaCbo.getItem(hsaCbo.getSelectionIndex()).equalsIgnoreCase("All HSAs")) {
|
||||
myQuery.append(" and hsa='"+hsaCbo.getItem(hsaCbo.getSelectionIndex())+"'");
|
||||
}
|
||||
|
||||
// Build 'sort' options based on toggle buttons on the dialog.
|
||||
|
||||
if (locationRdo.getSelection()) {
|
||||
|
|
|
@ -46,7 +46,7 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
|
|||
* Feb 13, 2014 #2783 dgilling Refactored to support running as part
|
||||
* of an EDEX service.
|
||||
* Jan 07, 2015 3692 bclement AlertalarmRecord is no longer a singleton
|
||||
*
|
||||
* Jul 02, 2015 16579 wkwock Add hsa filter
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -66,6 +66,8 @@ class RecordMgr {
|
|||
|
||||
static final int PEFILTER = 105;
|
||||
|
||||
static final int HSAFILTER = 106;
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RecordMgr.class);
|
||||
|
||||
|
@ -98,6 +100,7 @@ class RecordMgr {
|
|||
.append(whereSubClauseFor(AA_CAT, opt))
|
||||
.append(whereSubClauseFor(AA_CHCK, opt))
|
||||
.append(whereSubClauseFor(PEFILTER, opt))
|
||||
.append(whereSubClauseFor(HSAFILTER,opt))
|
||||
.append(" AND (aav.ts NOT LIKE 'F%' OR aav.validtime >= current_timestamp) ")
|
||||
.append(" ORDER BY aav.lid ASC, aav.pe, aav.ts, aav.aa_check, aav.validtime DESC ");
|
||||
|
||||
|
@ -132,6 +135,8 @@ class RecordMgr {
|
|||
return aaCheckSubClause(options.getFilter());
|
||||
case PEFILTER:
|
||||
return peFilterSubClause(options.getPEfilter());
|
||||
case HSAFILTER:
|
||||
return hsaFilterSubClause(options.getHsa());
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -147,6 +152,10 @@ class RecordMgr {
|
|||
return pe == null ? "" : " AND pe = " + pe;
|
||||
}
|
||||
|
||||
private static String hsaFilterSubClause (String hsa) {
|
||||
return hsa == null ? "" : " AND hsa = '" + hsa + "'";
|
||||
}
|
||||
|
||||
private static String modeSubClause(ReportMode mode) {
|
||||
if (mode == ReportMode.UNREPORTED) {
|
||||
return " AND action_time IS NULL ";
|
||||
|
|
|
@ -40,6 +40,7 @@ import com.raytheon.uf.common.util.StringUtil;
|
|||
* Jun 15, 2011 9377 jnjanga Initial creation
|
||||
* Jul 12, 2013 15711 wkwock Fix verbose, observe mode, etc
|
||||
* Feb 12, 2014 #2783 dgilling Major refactor, cleanup.
|
||||
* Jul 02, 2015 16579 wkwock Add hsa filter
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,6 +66,8 @@ class ReportOptions {
|
|||
|
||||
private static final String VERBOSE_MODE_KEY = "alarm_verbose";
|
||||
|
||||
private static final String HSA_KEY = "alarm_hsa_filter";
|
||||
|
||||
private static final EnumSet<ReportMode> IGNORE_MINS = EnumSet.of(
|
||||
ReportMode.ALL, ReportMode.UNREPORTED, ReportMode.NEAREST,
|
||||
ReportMode.LATEST_MAXFCST);
|
||||
|
@ -86,6 +89,8 @@ class ReportOptions {
|
|||
|
||||
private boolean verboseFlag;
|
||||
|
||||
private String hsa = null;
|
||||
|
||||
/**
|
||||
* @param appsDefaults
|
||||
* @throws IllegalArgumentException
|
||||
|
@ -119,6 +124,10 @@ class ReportOptions {
|
|||
if (isMinutesGiven() && IGNORE_MINS.contains(this.mode)) {
|
||||
statusHandler.warn("Minutes value ignored for this report mode.");
|
||||
}
|
||||
|
||||
if (appsDefaults.getTokens().contains(HSA_KEY)) {
|
||||
setHsa(appsDefaults.getToken(HSA_KEY));
|
||||
}
|
||||
}
|
||||
|
||||
public String getProductId() {
|
||||
|
@ -218,6 +227,14 @@ class ReportOptions {
|
|||
this.verboseFlag = verboseFlg;
|
||||
}
|
||||
|
||||
public String getHsa() {
|
||||
return hsa;
|
||||
}
|
||||
|
||||
private void setHsa(String hsa) {
|
||||
this.hsa = hsa;
|
||||
}
|
||||
|
||||
public String getDbname() {
|
||||
return DB_NAME;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue