From 2c9d603e5010bb7dbd37a9f87cea5e57e79ab3ff Mon Sep 17 00:00:00 2001 From: Mike Duff Date: Fri, 7 Feb 2014 16:08:29 -0600 Subject: [PATCH] Issue #2453 - Notification Center refactor Former-commit-id: f570a3945ad8e9e8bc4f88989a0ec10da191856a --- .../datadelivery/common/ui/ITableFind.java | 23 +- .../common/ui/TableDataManager.java | 15 +- .../datadelivery/notification/FindDlg.java | 277 ++----- .../notification/NotificationDlg.java | 12 +- .../notification/NotificationRowData.java | 5 + .../notification/NotificationTableComp.java | 719 +++++------------- .../utils/NotificationHandler.java | 19 +- 7 files changed, 302 insertions(+), 768 deletions(-) diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/ITableFind.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/ITableFind.java index 4098875b6c..3958e8d3e7 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/ITableFind.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/ITableFind.java @@ -19,6 +19,10 @@ **/ package com.raytheon.uf.viz.datadelivery.common.ui; +import java.util.List; + +import com.raytheon.uf.viz.datadelivery.notification.NotificationRowData; + /** * Table find interface. * @@ -30,6 +34,7 @@ package com.raytheon.uf.viz.datadelivery.common.ui; * ------------ ---------- ----------- -------------------------- * May 7, 2012 jpiatt Initial creation. * Sep 26, 2013 2417 mpduff Add clearSelection method. + * Feb 07, 2014 2453 mpduff Added getCurrentSelectionIndex method. * * * @author jpiatt @@ -38,26 +43,34 @@ package com.raytheon.uf.viz.datadelivery.common.ui; public interface ITableFind { /** - * handleFind call + * handle page selection */ void handlePageSelection(); /** - * handleFind call + * select a row * * @param index */ - void selectIndex(int index); + void selectRow(NotificationRowData row); /** - * handleFind call + * handle multiple rows * * @param indices */ - void selectIndices(int[] indices); + void selectRows(List rows); /** * Clear any table selections. */ void clearSelections(); + + /** + * Get the currently selected index within the data array, not the visible + * table. + * + * @return + */ + int getCurrentSelectionIndex(); } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/TableDataManager.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/TableDataManager.java index fd667a286e..0bc6aad030 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/TableDataManager.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/TableDataManager.java @@ -29,7 +29,8 @@ package com.raytheon.uf.viz.datadelivery.common.ui; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jun 06, 2012 lvenable Initial creation - * Apr 10, 2013 1891 djohnson Declare variable as List. + * Apr 10, 2013 1891 djohnson Declare variable as List. + * Feb 07, 2014 2453 mpduff Added getSize(). * * * @@ -132,8 +133,7 @@ public class TableDataManager> implements ISortTable { public T getDataRow(int index) { if (index >= 0 && index < tableData.size()) { return tableData.get(index); - } - else { + } else { return tableData.get(0); } } @@ -187,4 +187,13 @@ public class TableDataManager> implements ISortTable { public SortDirection getSortDirection() { return currentSortDirection; } + + /** + * Get the size of the data array. + * + * @return The size + */ + public int getSize() { + return this.tableData.size(); + } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/FindDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/FindDlg.java index dabeb4cc30..c520a2816f 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/FindDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/FindDlg.java @@ -20,21 +20,18 @@ package com.raytheon.uf.viz.datadelivery.notification; import java.util.ArrayList; +import java.util.List; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Layout; -import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; @@ -59,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Dec 12. 2012 1418 mpduff Change label. * Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs. * Sep 26, 2013 2417 mpduff Reset the highlight all indices on close. + * Feb 07, 2014 2453 mpduff Refactored dialog. * * * @@ -95,41 +93,20 @@ public class FindDlg extends CaveSWTDialog { /** ITableFind callback */ private final ITableFind callback; - /** Table row Index */ - int tableIndex = -1; - - /** Table row start Index */ - int startIndex = 0; - - /** Table row end Index */ - int endIndex = 0; - /** Table row selected Index */ - int selectedIndex = 0; + private int selectedIndex = 0; /** Message Checkbox flag */ - boolean msgFlag = false; + private boolean msgFlag = false; /** Category Checkbox flag */ - boolean categoryFlag = false; + private boolean categoryFlag = false; /** Case Sensitive flag */ - boolean caseFlag = false; - - /** Yes continue search flag */ - boolean yesFlag = false; - - /** Found Item flag */ - boolean exists = false; + private boolean caseFlag = false; /** Exclude search flag */ - boolean excludeFlag = false; - - /** Message string */ - String msg = null; - - /** Subscription string */ - String sub = null; + private boolean excludeFlag = false; /** * Constructor. @@ -150,13 +127,11 @@ public class FindDlg extends CaveSWTDialog { */ public FindDlg(Shell parent, TableDataManager filteredTableList, - int sIndex, int eIndex, int selected, ITableFind callback) { + int selected, ITableFind callback) { super(parent, SWT.DIALOG_TRIM, CAVE.NONE | CAVE.DO_NOT_BLOCK); this.setText("Find"); this.filteredTableList = filteredTableList; - sIndex = startIndex; - eIndex = endIndex; selectedIndex = selected; this.callback = callback; } @@ -185,12 +160,6 @@ public class FindDlg extends CaveSWTDialog { */ @Override protected void initializeComponents(Shell shell) { - shell.addListener(SWT.Close, new Listener() { - @Override - public void handleEvent(Event event) { - callback.selectIndices(null); - } - }); createFindLayout(); createBottomButtons(); } @@ -219,12 +188,6 @@ public class FindDlg extends CaveSWTDialog { findTxt.setLayoutData(gd); findTxt.selectAll(); findTxt.setLayoutData(gd); - findTxt.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - findText(); - } - }); gl = new GridLayout(2, false); gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); @@ -314,89 +277,16 @@ public class FindDlg extends CaveSWTDialog { closeBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - callback.selectIndices(null); close(); } }); } - /** - * Find text on key release. Check all pages of filtered list. Stop when - * match is found and don't move to the next. - */ - private void findText() { - - // Text in the find text box - String text = findTxt.getText(); - - // Get button selections - msgFlag = msgBtn.getSelection(); - categoryFlag = categoryBtn.getSelection(); - caseFlag = caseBtn.getSelection(); - excludeFlag = exclusionBtn.getSelection(); - - int itemCount = filteredTableList.getDataArray().size(); - tableIndex = 0; - - if (filteredTableList != null) { - - // Check rows in the entire filtered list - all pages - for (NotificationRowData row : filteredTableList.getDataArray()) { - - // Column data - msg = row.getMessage(); - sub = row.getCategory(); - - if (tableIndex <= itemCount) { - tableIndex++; - - if (caseFlag) { - if (excludeFlag) { - // Select index if does not match message or - // subscription - if ((!msg.contains(text) && msgFlag) - || (!sub.contains(text) && categoryFlag)) { - exists = true; - callback.selectIndex(tableIndex); - break; - } - // Select index if matches message or subscription - } else if ((msg.contains(text) && msgFlag) - || (sub.contains(text) && categoryFlag)) { - exists = true; - callback.selectIndex(tableIndex); - break; - } - } else { - if (excludeFlag) { - // Select index if matches non case sensitive - // message or subscription - if ((!msg.toUpperCase() - .contains(text.toUpperCase()) && msgFlag) - || (!sub.toLowerCase().contains( - text.toLowerCase()) && categoryFlag)) { - exists = true; - callback.selectIndex(tableIndex); - break; - } - } else if ((msg.toUpperCase().contains( - text.toUpperCase()) && msgFlag) - || (sub.toLowerCase().contains( - text.toLowerCase()) && categoryFlag)) { - exists = true; - callback.selectIndex(tableIndex); - break; - } - } - } - } - } - } - /** * Find Button action handler. Find the next matching row upon button click. */ private void handleFindBtn() { + int prevSelectedIndex = selectedIndex; // Text in the find text box String text = findTxt.getText(); @@ -420,56 +310,20 @@ public class FindDlg extends CaveSWTDialog { boolean continueSearch = true; boolean exists = false; boolean hitEnd = false; - selectedIndex = selectedIndex + 1; + selectedIndex = callback.getCurrentSelectionIndex() + 1; while (continueSearch) { - if (tableIndex < itemCount) { - // Get the row data starting at the currently highlighted row + if (selectedIndex < itemCount) { NotificationRowData row = filteredTableList.getDataArray().get( - tableIndex); + selectedIndex); - // Column data - msg = row.getMessage(); - sub = row.getCategory(); - - tableIndex++; - - if (caseFlag) { - if (excludeFlag) { - // Select index if does not match message or - // subscription - if ((!msg.contains(text) && msgFlag) - || (!sub.contains(text) && categoryFlag)) { - continueSearch = false; - callback.selectIndex(tableIndex); - } - } else if ((msg.contains(text) && msgFlag) - || (sub.contains(text) && categoryFlag)) { - // Select index if matches message or subscription - continueSearch = false; - callback.selectIndex(tableIndex); - } - } else { - if (excludeFlag) { - // Select index if matches non case sensitive message or - // subscription - if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag) - || (!sub.toLowerCase().contains( - text.toLowerCase()) && categoryFlag)) { - continueSearch = false; - callback.selectIndex(tableIndex); - } - } else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag) - || (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) { - continueSearch = false; - callback.selectIndex(tableIndex); - } - } - - // If the item was found set exists to true - if (!continueSearch) { + boolean matchFound = checkForMatch(text, row); + if (matchFound) { + continueSearch = false; exists = true; + callback.selectRow(row); } + selectedIndex++; } else { if (!hitEnd) { int answer = DataDeliveryUtils @@ -480,10 +334,11 @@ public class FindDlg extends CaveSWTDialog { "The end of the table has been reached. Would you like to search from the beginning of the table?"); if (answer == SWT.NO) { exists = true; + selectedIndex = prevSelectedIndex; break; - // Start search over at beginning of table } else if (answer == SWT.YES) { - tableIndex = 0; + // Start search over at beginning of table + selectedIndex = 0; continueSearch = true; } hitEnd = true; @@ -499,7 +354,7 @@ public class FindDlg extends CaveSWTDialog { mb.setText("Find Warning"); mb.setMessage("No item matching your search was found."); mb.open(); - tableIndex = 0; + selectedIndex = prevSelectedIndex; callback.clearSelections(); } } @@ -509,7 +364,6 @@ public class FindDlg extends CaveSWTDialog { * text. */ private void handleHighlightBtn() { - // Text in the find text box String text = findTxt.getText(); @@ -519,61 +373,54 @@ public class FindDlg extends CaveSWTDialog { caseFlag = caseBtn.getSelection(); excludeFlag = exclusionBtn.getSelection(); - ArrayList items = new ArrayList(); - int[] indices = new int[0]; - - // Start search at beginning of table - tableIndex = 0; + List items = new ArrayList(); if (filteredTableList != null) { - for (int i = 0; i < filteredTableList.getDataArray().size(); i++) { + for (int i = 0; i < filteredTableList.getSize(); i++) { NotificationRowData row = filteredTableList.getDataArray().get( i); - // Message Column - msg = row.getMessage(); - // Subscription Name column - sub = row.getCategory(); - if (caseFlag) { - if (excludeFlag) { - // Select index if does not match message or - // subscription - if ((!msg.contains(text) && msgFlag) - || (!sub.contains(text) && categoryFlag)) { - items.add(i); - } - } else if ((msg.contains(text) && msgFlag) - || (sub.contains(text) && categoryFlag)) { - // Select index if matches message or subscription - items.add(i); - } - - } else { - if (excludeFlag) { - // Select index if matches non case sensitive message or - // subscription - if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag) - || (!sub.toLowerCase().contains( - text.toLowerCase()) && categoryFlag)) { - items.add(i); - } - } else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag) - || (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) { - items.add(i); - } + boolean matchFound = checkForMatch(text, row); + if (matchFound) { + items.add(row); } - - tableIndex++; } - indices = new int[items.size()]; - - // Create an int array of the rows to highlight - for (int i = 0; i < items.size(); i++) { - indices[i] = items.get(i); - } - - callback.selectIndices(indices); + callback.selectRows(items); } } -} + + /** + * Check if the matchText matches the row. + * + * @param matchText + * The text to match + * @param row + * The row to check + * @return true if matches + */ + private boolean checkForMatch(String matchText, NotificationRowData row) { + boolean matchFound = false; + String msg = row.getMessage(); + String sub = row.getCategory(); + + if (!caseFlag) { + msg = msg.toUpperCase(); + sub = sub.toUpperCase(); + matchText = matchText.toUpperCase(); + } + + if (excludeFlag) { + if ((!msg.contains(matchText) && msgFlag) + || (!sub.contains(matchText) && categoryFlag)) { + matchFound = true; + } + } else { + if ((msg.contains(matchText) && msgFlag) + || (sub.contains(matchText) && categoryFlag)) { + matchFound = true; + } + } + return matchFound; + } +} \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationDlg.java index 86263fd6d7..572448bc97 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationDlg.java @@ -104,6 +104,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * Aug 30, 2013 2314 mpduff Change the reading of the xml. Make load config dlg non-blocking. * Sep 25, 2013 2408 mpduff Added a restore hidden notifications menu. * Sep 25, 2013 2410 mpduff Check type of localization file. + * Feb 07, 2013 2453 mpduff Support find dialog refactor.. * * * @@ -394,7 +395,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange, hideOlderMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - tableComp.handleDeleteOlderThan(); + tableComp.handleHideOlderThan(); } }); @@ -405,7 +406,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange, hideMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - tableComp.handleDeleteNotification(); + tableComp.handleHideNotification(); } }); @@ -493,7 +494,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange, mi.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - tableComp.handleDeleteByPriority((Integer) ((MenuItem) e + tableComp.handleHideByPriority((Integer) ((MenuItem) e .getSource()).getData()); } }); @@ -572,8 +573,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange, private void handleFind() { if (fnd == null || fnd.isDisposed()) { fnd = new FindDlg(shell, tableComp.getFilteredTableList(), - tableComp.getStartIndex(), tableComp.getEndIndex(), - tableComp.getSelectedIndex(), tableComp); + tableComp.getTable().getSelectionIndex(), tableComp); fnd.open(); } else { fnd.bringToTop(); @@ -839,7 +839,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange, if (isDisposed() == false && tableComp.passesFilter(records)) { tableComp.populateTableDataRows(records); tableComp.populateTable(); - + tableComp.handlePageSelection(); // update title display...... if (tableComp.isLocked()) { setText(TITLE_TEXT + tableComp.getPauseCountLabel()); diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationRowData.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationRowData.java index 7afa62d1c4..8d066e4bd1 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationRowData.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationRowData.java @@ -40,6 +40,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE; * Jun 07, 2012 687 lvenable Table data refactor. * Aug 30, 2013 2314 mpduff Fix formatting. * Sep 16, 2013 2375 mpduff Change date sort order. + * Feb 07, 2014 2453 mpduff Added toString() * * * @@ -299,4 +300,8 @@ public class NotificationRowData implements ITableData { } } + @Override + public String toString() { + return this.date.toString() + " - " + this.message; + } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationTableComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationTableComp.java index fbb1e671b5..bf7f980632 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationTableComp.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationTableComp.java @@ -22,7 +22,6 @@ package com.raytheon.uf.viz.datadelivery.notification; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.TimeZone; @@ -43,6 +42,7 @@ import org.eclipse.swt.widgets.TableItem; import com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord; import com.raytheon.uf.common.time.util.TimeUtil; +import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.viz.core.notification.NotificationMessage; import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange; import com.raytheon.uf.viz.datadelivery.common.ui.ITableFind; @@ -84,6 +84,7 @@ import com.raytheon.uf.viz.datadelivery.utils.NotificationHandler; * Sep 26, 2013 2417 mpduff Fix the find all row selection. * Oct 15, 2013 2451 skorolev Get highlighted rows after message update. * Nov 01, 2013 2431 skorolev Changed labels on the table. + * Feb 07, 2014 2453 mpduff Refactored. * * * @author lvenable @@ -104,14 +105,11 @@ public class NotificationTableComp extends TableComp implements ITableFind { TABLE_TYPE.NOTIFICATION); /** Filtered Table list object */ - private final ArrayList visibleTableList = new ArrayList(); + private final List visibleTableList = new ArrayList(); /** Notification rows */ private final String ROWS = "Rows "; - /** Notification rows */ - private final String ROW = "Row "; - private final String PAUSE_BUTTON_TEXT = "Pause"; private final String PAUSE_MSG_TEXT = " "; @@ -128,56 +126,14 @@ public class NotificationTableComp extends TableComp implements ITableFind { /** Page Combo box */ private Combo pageCbo; - /** The start index */ - private int startIndex = 0; - - /** The end index */ - private int endIndex = 0; - - /** The selected index */ - private int selectedIndex = 0; - - /** The index of the last row of the table */ - private int lastRow = 0; - /** Configured value per page */ - private int pageConfig = 100; - - /** The amount of necessary pages */ - private int pageAmt = 0; - - /** The number of rows in the table at that instance */ - private int numRows = 0; - - /** The index of the highlighted row */ - private int highlightIndex = 0; - - /** The number of deleted rows */ - private int deleteRows = 0; + private int rowsPerPage = 100; /** Highlight indices */ - private int[] indices = null; + private List highlightRows = null; /** Dual List Object */ - private final ArrayList pages = new ArrayList(); - - /** Find flag */ - private boolean findFlag = false; - - /** Delete flag */ - private boolean deleteFlag = false; - - /** All rows on page deleted flag */ - private boolean pageDeleteFlag = false; - - /** Init flag */ - private boolean initialized = false; - - /** The selected page */ - private int selectedPage = 1; - - /** Keeps track of present record ids **/ - private final Set currentRecordIds = new HashSet(); + private final List pages = new ArrayList(); /** Callback for the message loader */ private final IMessageLoad msgLoadCallback; @@ -186,13 +142,7 @@ public class NotificationTableComp extends TableComp implements ITableFind { private final ITableChange tableChangeCallback; /** Notification handler */ - private NotificationHandler handler; - - /** Name of the sorted column */ - private String sortedColumnName = null; - - /** Direction of the sort */ - private SortDirection sortedDirectionName = null; + private final NotificationHandler handler; /** Column List */ private ArrayList columnList = null; @@ -204,7 +154,16 @@ public class NotificationTableComp extends TableComp implements ITableFind { private int messageReceivedWhilePausedCount = 0; /** Highlighted row ids */ - private Set selectedRowIds = new HashSet(); + private final Set selectedRowIds = new HashSet(); + + /** Index of the first visible data row */ + private int tableDataStartIndex = 0; + + /** Index of the last visible data row */ + private int tableDataEndIndex = 20; + + /** The selected page */ + private int pageSelection; /** * Constructor. @@ -236,17 +195,11 @@ public class NotificationTableComp extends TableComp implements ITableFind { * Initialize the composite. */ private void init() { - pImage = new PriorityImages(this.getShell()); pImage.setPriorityDisplay(PriorityDisplay.ColorNumName); createColumns(); - - startIndex = 0; - endIndex = pageConfig - 1; - createBottomPageControls(); - } /** @@ -281,7 +234,6 @@ public class NotificationTableComp extends TableComp implements ITableFind { pageCbo.setLayoutData(comboData); pageCbo.select(0); pageCbo.addSelectionListener(new SelectionAdapter() { - @Override public void widgetSelected(SelectionEvent event) { handlePageSelection(); @@ -331,15 +283,6 @@ public class NotificationTableComp extends TableComp implements ITableFind { numRowsLbl.setLayoutData(gd); } - /** - * Get the entire table list. - * - * @return TableDataManager obj - */ - public TableDataManager getMasterTableList() { - return masterTableList; - } - /** * Get the table list with filters applied. * @@ -349,45 +292,27 @@ public class NotificationTableComp extends TableComp implements ITableFind { return filteredTableList; } - /** - * Get the table list for display. - * - * @return TableDataManager obj - */ - public ArrayList getVisibleTableList() { - return visibleTableList; - } - /** * Get the rows of data to display. * * @return list of Notification Row Data objects */ - private ArrayList getTableRows() { + private List gatherVisibleTableRows() { visibleTableList.clear(); - numRows = filteredTableList.getDataArray().size(); - if (startIndex == 0 && numRows > endIndex) { - endIndex = pageConfig - 1; - } + int numFilteredRows = filteredTableList.getSize(); - // Recalculate start/end indices for visible page - if (numRows > endIndex && endIndex - startIndex < pageConfig) { - endIndex = startIndex + pageConfig - 1;// numRows -1; - if (endIndex - startIndex > pageConfig - 1) { - startIndex = ((pageConfig * selectedPage) - (pageConfig - 1)) - 1; - } - } + calculateNumberOfPages(); - if (pageDeleteFlag) { - startIndex = 0; - endIndex = pageConfig - 1; + int pageNumber = pageCbo.getSelectionIndex(); + if (pageNumber == -1) { + pageNumber = 0; } - getNumberOfPages(); + tableDataStartIndex = pageNumber * rowsPerPage; + tableDataEndIndex = tableDataStartIndex + rowsPerPage - 1; // Add rows to the visible table list - for (int i = startIndex; i <= endIndex; i++) { - - if (i < filteredTableList.getDataArray().size()) { + for (int i = tableDataStartIndex; i <= tableDataEndIndex; i++) { + if (i < numFilteredRows) { NotificationRowData data = filteredTableList.getDataRow(i); if (data != null) { visibleTableList.add(data); @@ -395,7 +320,6 @@ public class NotificationTableComp extends TableComp implements ITableFind { } else { break; } - } return visibleTableList; @@ -406,17 +330,8 @@ public class NotificationTableComp extends TableComp implements ITableFind { * * @param deleteRecordIds */ - public void deleteTableDataRows(ArrayList deleteRecordIds) { - - ArrayList tmpDeleteArray = new ArrayList(); - - for (NotificationRowData rd : filteredTableList.getDataArray()) { - if (deleteRecordIds.contains(rd.getId()) == true) { - tmpDeleteArray.add(rd); - } - } - - filteredTableList.removeAll(tmpDeleteArray); + public void deleteTableDataRows(List deleteRecordIds) { + filteredTableList.removeAll(deleteRecordIds); } /** @@ -439,48 +354,28 @@ public class NotificationTableComp extends TableComp implements ITableFind { filteredTableList.sortData(); - selectedPage = pageCbo.getSelectionIndex() + 1; populateTable(); updateColumnSortImage(); } /** - * Action taken when deleting a notification from view. + * Action taken when hiding a notification from view. */ - public void handleDeleteNotification() { - - deleteFlag = true; - + public void handleHideNotification() { // Verify that at least one notification was selected. int[] indices = table.getSelectionIndices(); - if (indices.length == 0) { return; } - // Extract notification ids from the table - ArrayList ids = new ArrayList(); + List ids = new ArrayList(); for (int index : indices) { - - ids.add(index); NotificationRowData rowData = visibleTableList.get(index); - ids.add(rowData.getId()); + ids.add(rowData); } - if (ids.size() > 0) { - deleteRows = (ids.size() / 2); - if (deleteRows < visibleTableList.size()) { - selectedPage = pageCbo.getSelectionIndex() + 1; - - // If all rows on a page are deleted go to page 1 - } else { - selectedPage = 0; - pageCbo.select(selectedPage); - pageDeleteFlag = true; - } - - deleteRecords(ids); - } + deleteTableDataRows(ids); + populateTable(); } /** @@ -508,96 +403,40 @@ public class NotificationTableComp extends TableComp implements ITableFind { * Update labels on the table. */ private void updateLabels() { + int startRow = this.tableDataStartIndex + 1; + int endRow = this.tableDataEndIndex + 1; - int startRow = startIndex + 1; - int endRow = endIndex + 1; - String selection = null; + int numFilteredRows = filteredTableList.getSize(); - // Total number of enable rows - int numTotal = this.getMasterTableList().getDataArray().size(); + int numPages = calculateNumberOfPages(); - // Total number of rows in the filteredTableList used in bottom right - // hand corner - numRows = filteredTableList.getDataArray().size(); + pageAmtLbl.setText(" of " + numPages); - // Page calculations - getNumberOfPages(); - - // Set page label - pageAmtLbl.setText(" of " + pageAmt); - - // Set number of pages - pageCbo.setItems(pages.toArray(new String[0])); - - if (selectedPage > 0) { - pageCbo.select(selectedPage - 1); - } else { - pageCbo.select(selectedPage); - } - - if (pageCbo.getSelectionIndex() >= 0) { - selection = pageCbo.getItem(pageCbo.getSelectionIndex()); - } - - if (selection == null) { - selectedPage = 1; - } else { - selectedPage = pageCbo.getSelectionIndex() + 1; - } - - if (deleteFlag) { - if (endRow > numRows) { - endRow = numRows; - } else { - endRow = (endIndex + 1) - deleteRows; - } - } - - if (endIndex > numRows) { - endIndex = numRows; - endRow = endIndex; - } - - if (numRows < pageConfig) { - endRow = numRows; - } - - // Row text - if (numRows == 0) { + if (numFilteredRows == 0) { // No rows visible possibly due to filtering numRowsLbl .setText("No rows to display. Please check the configuration and " + "filtering options."); - } else if (startIndex == endIndex) { - numRowsLbl.setText(ROW + startRow + " from " + numRows + " of " - + numTotal); - // Initial Load with over the number of configured records per page - } else if (startIndex == 0 && (numRows > pageConfig)) { - numRowsLbl.setText(ROWS + startRow + " - " + pageConfig + " from " - + numRows + " of " + numTotal); - // Number of records are less than the page config - } else if (numRows < pageConfig) { - numRowsLbl.setText(ROWS + startRow + " - " + endRow + " from " - + numRows + " of " + numTotal); - } else if (numRowsLbl != null) { - numRowsLbl.setText(ROWS + startRow + " - " + endRow + " from " - + numRows + " of " + numTotal); + } else if (numFilteredRows < endRow) { + numRowsLbl.setText(ROWS + startRow + " - " + numFilteredRows + + " from " + numFilteredRows + " of " + + this.masterTableList.getSize()); + } else { + numRowsLbl + .setText(ROWS + startRow + " - " + endRow + " from " + + numFilteredRows + " of " + + this.masterTableList.getSize()); } - - deleteFlag = false; - pageDeleteFlag = false; } /** * Refresh table after configurations have changed. */ public void tableChangedAfterConfigLoad() { - startIndex = 0; - configChange = true; - - if (numRows > 0) { - getTableRows(); - } + rowsPerPage = NotificationConfigManager.getInstance().getConfigXml() + .getPaginationSetting(); + populateTableDataRows(null); + gatherVisibleTableRows(); table.setRedraw(false); @@ -610,31 +449,14 @@ public class NotificationTableComp extends TableComp implements ITableFind { createColumns(); table.setRedraw(true); - populateTableDataRows(null); - populateTable(); - - configChange = false; - } - - /** - * Delete record list. - */ - private void deleteRecords(ArrayList deleteList) { - - if (deleteList.size() > 0) { - deleteTableDataRows(deleteList); - populateTable(); - } + handlePageSelection(); } /** * Action taken when deleted notifications from view by time. */ - public void handleDeleteOlderThan() { - - deleteFlag = true; - + public void handleHideOlderThan() { // Verify that at least one notification was selected. int[] indices = table.getSelectionIndices(); @@ -648,61 +470,45 @@ public class NotificationTableComp extends TableComp implements ITableFind { return; } - NotificationRowData row = filteredTableList.getDataArray().get( - indices[0]); - ArrayList deleteList = new ArrayList(); + TableItem ti = table.getItem(indices[0]); + NotificationRowData rd = (NotificationRowData) ti.getData(); + + List deleteList = new ArrayList(); // Loop over rows and delete the matching rows for (NotificationRowData data : filteredTableList.getDataArray()) { - // Priority is 0 based, so must subtract 1 - if (data.getDate().before(row.getDate())) { - deleteList.add(data.getId()); + if (data.getDate().before(rd.getDate())) { + deleteList.add(data); } } - if (deleteList.size() > 0) { - - deleteRows = deleteList.size(); - if (deleteRows < visibleTableList.size()) { - selectedPage = pageCbo.getSelectionIndex() + 1; - - // If all rows on a page are deleted go to page 1 - } else { - selectedPage = 0; - pageCbo.select(selectedPage); - pageDeleteFlag = true; - } - - deleteRecords(deleteList); + if (!deleteList.isEmpty()) { + filteredTableList.removeAll(deleteList); + populateTable(); } } /** * Calculate number of pages needed */ - private int getNumberOfPages() { - + private int calculateNumberOfPages() { // Calculate number of pages needed - if (pageConfig != 0) { - pageAmt = (numRows / pageConfig); - } + int numFilteredRows = filteredTableList.getSize(); + int numPages = (numFilteredRows / rowsPerPage); // Add an extra page if excess rows - if (numRows > (pageAmt * pageConfig)) { - pageAmt = pageAmt + 1; + if (numFilteredRows > (numPages * rowsPerPage)) { + numPages = numPages + 1; } - // Clear pages array list - if (pages != null) { - pages.clear(); - } + pages.clear(); - // Add necessary pages - for (int i = 1; i <= pageAmt; i++) { + // Add pages for combo box + for (int i = 1; i <= numPages; i++) { pages.add(String.valueOf(i)); } - return pageAmt; + return numPages; } /** @@ -711,63 +517,23 @@ public class NotificationTableComp extends TableComp implements ITableFind { * @param priority * priority indicator */ - public void handleDeleteByPriority(int priority) { - - deleteFlag = true; - ArrayList deleteList = new ArrayList(); + public void handleHideByPriority(int priority) { + List deleteList = new ArrayList(); // Loop over rows and delete the matching rows for (NotificationRowData data : filteredTableList.getDataArray()) { // Priority is 0 based, so must subtract 1 if (data.getPriority() == priority - 1) { - deleteList.add(data.getId()); + deleteList.add(data); } } if (deleteList.size() > 0) { - - deleteRows = deleteList.size(); - if (deleteRows < visibleTableList.size()) { - selectedPage = pageCbo.getSelectionIndex() + 1; - - // If all rows on a page are deleted go to page 1 - } else { - selectedPage = 0; - pageCbo.select(selectedPage); - pageDeleteFlag = true; - } - - deleteRecords(deleteList); + deleteTableDataRows(deleteList); + populateTable(); } } - /** - * Get the start index. - * - * @return start index - */ - public int getStartIndex() { - return startIndex; - } - - /** - * Get the end index. - * - * @return end index - */ - public int getEndIndex() { - return endIndex; - } - - /** - * Get the selected index. - * - * @return selected index - */ - public int getSelectedIndex() { - return selectedIndex; - } - /** * Get the table cell text. * @@ -804,7 +570,7 @@ public class NotificationTableComp extends TableComp implements ITableFind { * list of notification records */ public void populateTableDataRows( - ArrayList notificationRecords) { + List notificationRecords) { List notificationList = new ArrayList(); MessageLoadXML messageLoad = null; NotificationConfigManager configMan = NotificationConfigManager @@ -812,22 +578,22 @@ public class NotificationTableComp extends TableComp implements ITableFind { ArrayList users = configMan.getFilterXml().getUserFilterXml() .getUserList(); - if (notificationRecords == null) { - messageLoad = msgLoadCallback.getMessageLoad(); - handler = new NotificationHandler(); + messageLoad = msgLoadCallback.getMessageLoad(); + + if (CollectionUtil.isNullOrEmpty(notificationRecords)) { notificationList = handler.intialLoad(messageLoad, users); masterTableList.clearAll(); - currentRecordIds.clear(); + filteredTableList.clearAll(); } else { for (NotificationRecord rec : notificationRecords) { // prevents duplicates - if (!currentRecordIds.contains(rec.getId())) { + if (!notificationList.contains(rec)) { notificationList.add(rec); } } } - if (notificationList == null || notificationList.isEmpty()) { + if (CollectionUtil.isNullOrEmpty(notificationList)) { return; } @@ -841,16 +607,7 @@ public class NotificationTableComp extends TableComp implements ITableFind { rd.setUser(record.getUsername()); // Master table list is filtered for user only masterTableList.addDataRow(rd); - currentRecordIds.add(rd.getId()); ++messageReceivedWhilePausedCount; - } - - resetTable(); - - filteredTableList.clearAll(); - - // Apply filters to the master list to get filteredTableList - for (NotificationRowData rd : this.masterTableList.getDataArray()) { // Apply filter if (passesFilter(rd.getUser(), rd.getPriority(), rd.getCategory())) { @@ -858,48 +615,60 @@ public class NotificationTableComp extends TableComp implements ITableFind { } } + resetTable(); + messageLoad = msgLoadCallback.getMessageLoad(); - if (messageLoad != null) { - if (!messageLoad.isLoadAllMessages()) { - // Sort data by time - sortByTime(filteredTableList); - int loadLast = messageLoad.getLoadLast(); + // ensure default values + if (messageLoad == null) { + messageLoad = new MessageLoadXML(); + } - // Keep only the specified number of rows - if (messageLoad.isNumMessages()) { - int numRecs = filteredTableList.getDataArray().size(); - List removeList = new ArrayList(); - if (numRecs > loadLast) { - for (int i = loadLast; i < numRecs; i++) { - removeList.add(filteredTableList.getDataRow(i)); - } - } - if (!removeList.isEmpty()) { - filteredTableList.removeAll(removeList); - } - } else { - long backTime = loadLast * TimeUtil.MILLIS_PER_HOUR; - long currentTime = TimeUtil.currentTimeMillis(); - List dataList = filteredTableList - .getDataArray(); - List indicesToRemove = new ArrayList(); - for (int i = 0; i < dataList.size(); i++) { - if (currentTime - dataList.get(i).getDate().getTime() > backTime) { - indicesToRemove.add(i); - } - } + if (!messageLoad.isLoadAllMessages()) { + // Sort data by time + sortByTime(masterTableList); - for (int i : indicesToRemove) { - filteredTableList.removeDataRow(i); + int loadLast = messageLoad.getLoadLast(); + List removeList = new ArrayList(); + + // Keep only the specified number of rows + if (messageLoad.isNumMessages()) { + // int numRecs = filteredTableList.getSize(); + int numRecs = masterTableList.getSize(); + if (numRecs > loadLast) { + removeList = masterTableList.getDataArray().subList( + loadLast, masterTableList.getSize()); + } + } else { + long backTime = loadLast * TimeUtil.MILLIS_PER_HOUR; + long currentTime = TimeUtil.currentTimeMillis(); + + List dataList = masterTableList + .getDataArray(); + for (int i = 0; i < dataList.size(); i++) { + if (currentTime - dataList.get(i).getDate().getTime() > backTime) { + removeList.add(dataList.get(i)); } } } + + if (!removeList.isEmpty()) { + filteredTableList.removeAll(removeList); + masterTableList.removeAll(removeList); + } } // Now do the configured sort updateSortDirection(this.sortedColumn, filteredTableList, false); filteredTableList.sortData(); + + calculateNumberOfPages(); + pageCbo.setItems(pages.toArray(new String[0])); + int numPages = filteredTableList.getSize() / rowsPerPage; + if (pageSelection > numPages) { + pageSelection = numPages; + } + pageCbo.select(this.pageSelection); } private void sortByTime(TableDataManager data) { @@ -1042,7 +811,11 @@ public class NotificationTableComp extends TableComp implements ITableFind { columnList = xml.getColumnList(); - pageConfig = xml.getPaginationSetting(); + rowsPerPage = xml.getPaginationSetting(); + if (rowsPerPage < 1) { + // default to 20 rows + rowsPerPage = 20; + } PrioritySettingXML pri = xml.getPrioritySetting(); PriorityDisplay pd = PriorityDisplay.ColorNumName; @@ -1113,25 +886,18 @@ public class NotificationTableComp extends TableComp implements ITableFind { return; } - int highlightIndex = 0; - int[] indicesArr = null; - - ArrayList items = new ArrayList(); - - sortedColumnName = sortedColumn.getText(); - sortedDirectionName = sortDirectionMap.get(sortedColumnName); - filteredTableList.sortData(); TableColumn[] columns = table.getColumns(); resetTable(); - getTableRows(); + gatherVisibleTableRows(); for (NotificationRowData rd : this.visibleTableList) { int idx = 0; TableItem item = new TableItem(table, SWT.NONE); + item.setData(rd); for (TableColumn column : columns) { ColumnXML columnXml = getColumnData(column.getText()); @@ -1156,84 +922,15 @@ public class NotificationTableComp extends TableComp implements ITableFind { // Update the bottom label values updateLabels(); - - // check indices array for highlight all - if (indices != null) { - if (indices.length > 0) { - for (int index : indices) { - if (index >= startIndex && index <= endIndex) { - if (startIndex == 0) { - highlightIndex = index; - } else if (selectedPage > 0) { - int extra = ((selectedPage - 1) * pageConfig); - highlightIndex = index - extra; - } else { - highlightIndex = index - pageConfig; - } - - items.add(highlightIndex); - } - - } - - indicesArr = new int[items.size()]; - - // Rows to highlight - for (int i = 0; i < items.size(); i++) { - indicesArr[i] = items.get(i); - } - - table.select(indicesArr); - } - } else { - // Highlight the rows which was selected on the table page. - if (!selectedRowIds.isEmpty()) { - Set ids = new HashSet(); - for (int i = 0; i < filteredTableList.getDataArray().size(); i++) { - NotificationRowData row = filteredTableList.getDataArray() - .get(i); - int idx = row.getId(); - if (selectedRowIds.contains(idx)) { - ids.add(i); - } - } - - int[] hlts = new int[ids.size()]; - int counter = 0; - - Iterator itr = ids.iterator(); - while (itr.hasNext()) { - hlts[counter] = itr.next(); - ++counter; - } - - table.select(hlts); - } - } - updateColumnSortImage(); - - initialized = true; + highlightRows(); } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.datadelivery.common.ui.TableComp#handleTableMouseClick - * (org.eclipse.swt.events.MouseEvent) - */ @Override protected void handleTableMouseClick(MouseEvent event) { - + // no op } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.viz.datadelivery.common.ui.TableComp# - * handleTableSelectionChange(org.eclipse.swt.events.SelectionEvent) - */ @Override protected void handleTableSelection(SelectionEvent e) { if (tableChangeCallback != null) { @@ -1249,19 +946,15 @@ public class NotificationTableComp extends TableComp implements ITableFind { } } - /* - * (non-Javadoc) + /** + * {@inheritDoc} * - * @see com.raytheon.uf.viz.core.notification.INotificationObserver# - * notificationArrived - * (com.raytheon.uf.viz.core.notification.NotificationMessage[]) + * This method is not used. The Notification dialog is using the + * NotificationHandler so this override method is not used. */ @Override public void notificationArrived(NotificationMessage[] messages) { - /* - * This method is not used. The Notification dialog is using the - * NotificationHandler so this override method is not used. - */ + // No op } /** @@ -1269,34 +962,14 @@ public class NotificationTableComp extends TableComp implements ITableFind { */ @Override public void handlePageSelection() { - // Page selection - if (findFlag) { - findFlag = false; - } else { - String selection = pageCbo.getItem(pageCbo.getSelectionIndex()); - selectedPage = Integer.parseInt(selection); - } + this.pageSelection = pageCbo.getSelectionIndex(); // Clean highlighted selections on the page selectedRowIds.clear(); // Calculate indices - if (selectedPage >= 1) { - - startIndex = ((pageConfig * selectedPage) - (pageConfig - 1)) - 1; - lastRow = filteredTableList.getDataArray().size(); - - endIndex = (pageConfig * selectedPage) - 1; - - if (lastRow < endIndex) { - endIndex = lastRow - 1; - } - - } else { - startIndex = 0; - endIndex = pageConfig - 1; - } - + this.tableDataStartIndex = rowsPerPage * pageSelection; + this.tableDataEndIndex = tableDataStartIndex + rowsPerPage; populateTable(); } @@ -1304,67 +977,39 @@ public class NotificationTableComp extends TableComp implements ITableFind { * Find the selected table row index. */ @Override - public void selectIndex(int index) { - findFlag = true; + public void selectRow(NotificationRowData row) { + int dataIndex = filteredTableList.getDataArray().indexOf(row); - TableItem item; + int selectedPage = dataIndex / rowsPerPage + 1; + int pageIndex = dataIndex % rowsPerPage; - int extra = 0; - highlightIndex = 0; - selectedIndex = index; - - // get what page index is on - if (index > pageConfig && (index != ((selectedPage + 1) * pageConfig))) { - selectedPage = (index / pageConfig) + 1; - } else { - selectedPage = (index / pageConfig); - } - - // switch pages + pageCbo.select(selectedPage - 1); handlePageSelection(); - - selectedPage = (index / pageConfig); - pageCbo.select(selectedPage); - - if (index > pageConfig) { - - // Calculate the index number for the current visible rows - extra = (selectedPage) * pageConfig; - if (index != extra) { - highlightIndex = index - extra; - } else { - highlightIndex = pageConfig; - } - - if (highlightIndex > 0) { - item = table.getItem(highlightIndex - 1); - } else { - item = table.getItem(highlightIndex); - } - - } else { - if (index > 0) { - item = table.getItem(index - 1); - } else { - item = table.getItem(index); - } - - } - + TableItem item = table.getItem(pageIndex); table.setSelection(item); - + this.pageSelection = pageCbo.getSelectionIndex(); } /** * Find the selected table row indices. */ @Override - public void selectIndices(int[] indices) { - this.indices = indices; - if (indices != null && indices.length > 0) { - // highlight table rows - table.select(indices); - handlePageSelection(); + public void selectRows(List rows) { + this.highlightRows = rows; + highlightRows(); + } + + /** + * Highlight the rows + */ + private void highlightRows() { + table.deselectAll(); + if (!CollectionUtil.isNullOrEmpty(highlightRows)) { + for (NotificationRowData row : highlightRows) { + if (visibleTableList.contains(row)) { + table.select(visibleTableList.indexOf(row)); + } + } } } @@ -1401,4 +1046,30 @@ public class NotificationTableComp extends TableComp implements ITableFind { public void clearSelections() { table.deselectAll(); } -} + + @Override + public int getCurrentSelectionIndex() { + return rowsPerPage * (pageCbo.getSelectionIndex()) + + table.getSelectionIndex(); + } + + /** + * Delete rows based on id. + * + * @param deleteRecordIds + * List of ids to delete. + */ + public void deleteTableDataRows(ArrayList deleteRecordIds) { + List deleteList = new ArrayList( + deleteRecordIds.size()); + + for (NotificationRowData rd : filteredTableList.getDataArray()) { + if (deleteRecordIds.contains(rd.getId())) { + deleteList.add(rd); + } + } + + filteredTableList.removeAll(deleteList); + populateTable(); + } +} \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/NotificationHandler.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/NotificationHandler.java index 92834e748e..12c1bfe9ce 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/NotificationHandler.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/NotificationHandler.java @@ -31,6 +31,7 @@ import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML; * Mar 12, 2012 jsanchez Initial creation * Jan 22, 2013 1501 djohnson Route requests to datadelivery. * Sep 05, 2013 2314 mpduff support the load all messages option. + * Feb 07, 2014 2453 mpduff Remove username query param. * * * @@ -84,10 +85,9 @@ public class NotificationHandler implements INotificationObserver { public List intialLoad(MessageLoadXML messageLoad, ArrayList users) { int loadAmount; - String username = null; Integer hours = null; Integer maxResults = null; - Boolean loadAll = false; + boolean loadAll = false; // Retrieve the message load configuration if (messageLoad != null) { loadAll = messageLoad.isLoadAllMessages(); @@ -100,22 +100,11 @@ public class NotificationHandler implements INotificationObserver { } } - // Set usernames from filter - if (users != null && users.isEmpty() == false) { - StringBuffer sb = new StringBuffer(); - for (String user : users) { - if (sb.length() > 0) { - sb.append(","); - } - sb.append(user); - } - username = sb.toString(); - } - // Request data from the notification table. + // Note: Removing username query parameter for front end label + // consistency try { GetNotificationRequest request = new GetNotificationRequest(); - request.setUsername(username); request.setHours(hours); request.setMaxResults(maxResults); request.setLoadAll(loadAll);