Issue #1966 Added hooks for ArchiveRetentionDlg and changed CaseCreationDlg to extend AbstractArchiveDlg.

Change-Id: If485480b6d8727d830620464741c2e748f2209dd

Former-commit-id: a9dd52d07b3eb8fd616e24374f40197c4df9b105
This commit is contained in:
Roger Ferrel 2013-06-11 10:59:35 -05:00
parent 9156ec8c2d
commit 753f19b309
21 changed files with 1275 additions and 1048 deletions

View file

@ -1,108 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* Convenience class for taking retention hours and converting to days/hours.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 2, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class RetentionHours {
private int retentionHours;
/**
* Constructor with default 7 day retention.
*/
public RetentionHours() {
this(7 * TimeUtil.HOURS_PER_DAY);
}
/**
* Constructor specify retention hours.
*
* @param retentionHours
*/
public RetentionHours(int retentionHours) {
this.retentionHours = retentionHours;
}
/**
* Set retention to this number of days.
*
* @param days
*/
public void setDays(int days) {
retentionHours = days * TimeUtil.HOURS_PER_DAY;
}
/**
* Convert retention hours to days. Note values are truncated so a retention
* of 23 hours will return 0 days.
*
* @return days
*/
public int getDays() {
return retentionHours / TimeUtil.HOURS_PER_DAY;
}
/**
* Get retention in hours.
*
* @return
*/
public int getHours() {
return retentionHours;
}
/**
* Set number hours of retention.
*
* @param hours
*/
public void setHours(int hours) {
retentionHours = hours;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "RetentionHours [days:" + getDays() + ", hours:" + getHours()
+ "]";
}
}

View file

@ -21,7 +21,7 @@ package com.raytheon.uf.viz.archive.data;
import java.util.List;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.DisplayData;
/**
* This class used to maintain the state of a category so it can be restored
@ -42,17 +42,27 @@ import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
*/
public class CategoryInfo {
/** Archive name for the category. */
private final String archiveName;
/** Category's name. */
private final String categoryName;
private final List<ArchiveConfigManager.DisplayData> displayInfoList;
/** List of display items for the category. */
private final List<DisplayData> displayDataList;
/**
* Contructor.
*
* @param archiveName
* @param categoryName
* @param displayInfoList
*/
public CategoryInfo(String archiveName, String categoryName,
List<ArchiveConfigManager.DisplayData> displayInfoList) {
List<DisplayData> displayInfoList) {
this.archiveName = archiveName;
this.categoryName = categoryName;
this.displayInfoList = displayInfoList;
this.displayDataList = displayInfoList;
}
public String getArchiveName() {
@ -63,7 +73,7 @@ public class CategoryInfo {
return categoryName;
}
public List<ArchiveConfigManager.DisplayData> getDisplayInfoList() {
return displayInfoList;
public List<DisplayData> getDisplayDataList() {
return displayDataList;
}
}

View file

@ -1,217 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.archive.data;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.util.FileUtil;
/**
* This class uses a obtains information on a File in a Job in order to remove
* from the UI thread.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 15, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class DirInfo {
private static final SizeJob sizeJob = new DirInfo.SizeJob();
final private DisplayData displayInfo;
private final List<File> files = new ArrayList<File>();
private final Calendar startCal;
private final Calendar endCal;
public static void clearQueue() {
sizeJob.clearQueue();
}
public static void addUpdateListener(IUpdateListener listener) {
sizeJob.listeners.add(listener);
}
public static void removeUpdateListener(IUpdateListener listener) {
sizeJob.listeners.remove(listener);
}
public DirInfo(DisplayData displayInfo, Calendar startCal, Calendar endCal) {
this.displayInfo = displayInfo;
this.startCal = startCal;
this.endCal = endCal;
DirInfo.sizeJob.queue(this);
}
public DisplayData getDisplayInfo() {
return displayInfo;
}
/**
* Job to determine the size for a directory and its contents on a non-UI
* thread.
*/
static private class SizeJob extends Job {
private ConcurrentLinkedQueue<DirInfo> queue = new ConcurrentLinkedQueue<DirInfo>();
private final ConcurrentLinkedQueue<DisplayData> selectedQueue = new ConcurrentLinkedQueue<ArchiveConfigManager.DisplayData>();
private final AtomicBoolean stopComputeSize = new AtomicBoolean(false);
List<IUpdateListener> listeners = new ArrayList<IUpdateListener>();
/**
* Add entry to queue and if pending selected entries add them to the
* queue with same start/end times.
*
* @param fileInfo
*/
protected void queue(DirInfo fileInfo) {
queue.add(fileInfo);
if (getState() == Job.NONE) {
schedule();
}
}
/**
* Clear list off pending data but save selected entries still needing
* sizes.
*/
protected void clearQueue() {
List<DirInfo> pending = new ArrayList<DirInfo>();
// Drain queue queue.removeAll() doesn't work.
while (!queue.isEmpty()) {
pending.add(queue.remove());
}
if (getState() != NONE) {
cancel();
}
// Save selected items that do not have sizes.
for (DirInfo dirInfo : pending) {
DisplayData displayData = dirInfo.getDisplayInfo();
if (displayData.isSelected() && displayData.getSize() < 0L) {
if (!selectedQueue.contains(displayData)) {
selectedQueue.add(displayData);
}
}
}
}
public SizeJob() {
super("Size Job");
setSystem(true);
}
@Override
protected IStatus run(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
mainLoop: while (!queue.isEmpty()) {
DirInfo dirInfo = queue.remove();
stopComputeSize.set(false);
DisplayData displayData = dirInfo.displayInfo;
Calendar startCal = dirInfo.startCal;
Calendar endCal = dirInfo.endCal;
List<File> files = manager.getDisplayFiles(displayData,
startCal, endCal);
// Is size still needed.
if (!displayData.isSelected() && stopComputeSize.get()) {
continue;
}
dirInfo.files.clear();
dirInfo.files.addAll(files);
long size = 0L;
for (File file : dirInfo.files) {
// Skip when size no longer needed.
if (!displayData.isSelected() && stopComputeSize.get()) {
continue mainLoop;
}
if (file.isDirectory()) {
size += FileUtil.sizeOfDirectory(file);
} else {
size += file.length();
}
}
displayData.setSize(size);
List<DirInfo> list = new ArrayList<DirInfo>();
list.add(dirInfo);
for (IUpdateListener listener : listeners) {
listener.update(list);
}
if (!stopComputeSize.get()) {
// Place any pending selections at end of the queue.
while (!selectedQueue.isEmpty()) {
DisplayData data = selectedQueue.remove();
new DirInfo(data, startCal, endCal);
}
}
}
return Status.OK_STATUS;
}
@Override
protected void canceling() {
stopComputeSize.set(true);
}
}
}

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.uf.viz.archive.data;
import java.util.List;
import com.raytheon.uf.common.archive.config.DisplayData;
/**
* Interface for methods for getting totals needed by the ArchiveTableComp.
*
@ -40,5 +44,5 @@ public interface IArchiveTotals {
/**
* Update total selected items and sizes.
*/
public void updateTotals();
public void updateTotals(List<DisplayData> displayDatas);
}

View file

@ -43,5 +43,5 @@ public interface IUpdateListener {
*
* @param dirInfos
*/
public void update(List<DirInfo> dirInfos);
public void update(List<SizeJobRequest> request);
}

View file

@ -0,0 +1,206 @@
package com.raytheon.uf.viz.archive.data;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.util.FileUtil;
/**
* Job to determine the size for a directory and its contents on a non-UI
* thread.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 13, 2013 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class SizeJob extends Job {
/** The queue for requested sizes. */
private final ConcurrentLinkedQueue<SizeJobRequest> queue = new ConcurrentLinkedQueue<SizeJobRequest>();
/**
* Pending selected entries that still need to have the sizes determined.
*/
private final ConcurrentLinkedQueue<DisplayData> selectedQueue = new ConcurrentLinkedQueue<DisplayData>();
/**
* Indicates the job should stop computing the size of the current
* non-selected entry.
*/
private final AtomicBoolean stopComputeSize = new AtomicBoolean(false);
/**
* The listeners to inform when job is done with an entry.
*/
private final List<IUpdateListener> listeners = new ArrayList<IUpdateListener>();
/**
* Constructor.
*/
public SizeJob() {
super("Size Job");
setSystem(true);
}
/**
* Add a Listener to inform when job has completed information on an entry.
*
* @param listener
*/
public void addUpdateListener(IUpdateListener listener) {
listeners.add(listener);
}
/**
* Remove a listener.
*
* @param listener
*/
public void removeUpdateListener(IUpdateListener listener) {
listeners.remove(listener);
}
/**
* Add entry to queue and if pending selected entries add them to the queue
* with same start/end times.
*
* @param fileInfo
*/
public void queue(SizeJobRequest fileInfo) {
queue.add(fileInfo);
if (getState() == Job.NONE) {
schedule();
}
}
/**
* Clear queue but save selected entries still needing sizes.
*/
public void clearQueue() {
List<SizeJobRequest> pending = new ArrayList<SizeJobRequest>();
// Drain queue queue.removeAll() doesn't work.
while (!queue.isEmpty()) {
pending.add(queue.remove());
}
if (getState() != NONE) {
cancel();
}
// Save selected items that do not have sizes.
for (SizeJobRequest dirInfo : pending) {
DisplayData displayData = dirInfo.getDisplayData();
if (displayData.isSelected() && displayData.getSize() < 0L) {
if (!selectedQueue.contains(displayData)) {
selectedQueue.add(displayData);
}
}
}
}
/**
* Requeue pending entries.
*
* @param startCal
* @param endCal
*/
public void requeueSelected(Calendar startCal, Calendar endCal) {
if (!selectedQueue.isEmpty()) {
DisplayData displayData = selectedQueue.remove();
queue(new SizeJobRequest(displayData, startCal, endCal));
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
* IProgressMonitor)
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
mainLoop: while (!queue.isEmpty()) {
SizeJobRequest dirInfo = queue.remove();
stopComputeSize.set(false);
DisplayData displayData = dirInfo.displayData;
Calendar startCal = dirInfo.startCal;
Calendar endCal = dirInfo.endCal;
List<File> files = manager.getDisplayFiles(displayData, startCal,
endCal);
// Size no longer needed.
if (!displayData.isSelected() && stopComputeSize.get()) {
continue;
}
dirInfo.files.clear();
dirInfo.files.addAll(files);
long size = 0L;
for (File file : dirInfo.files) {
// Skip when size no longer needed.
if (!displayData.isSelected() && stopComputeSize.get()) {
continue mainLoop;
}
if (file.isDirectory()) {
size += FileUtil.sizeOfDirectory(file);
} else {
size += file.length();
}
}
displayData.setSize(size);
List<SizeJobRequest> list = new ArrayList<SizeJobRequest>();
list.add(dirInfo);
for (IUpdateListener listener : listeners) {
listener.update(list);
}
}
return Status.OK_STATUS;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.jobs.Job#canceling()
*/
@Override
protected void canceling() {
queue.clear();
stopComputeSize.set(true);
}
}

View file

@ -0,0 +1,82 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.archive.data;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.raytheon.uf.common.archive.config.DisplayData;
/**
* This class obtains information on a File in a Job in order to remove it from
* the UI thread.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 15, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class SizeJobRequest {
/** Information from archive configuration manager. */
final DisplayData displayData;
/** Files or directories to obtain information on. */
final List<File> files = new ArrayList<File>();
/** Start time inclusive. */
final Calendar startCal;
/** End time exclusive. */
final Calendar endCal;
/**
* Create and entry and place it on the queue.
*
* @param displayData
* @param startCal
* @param endCal
*/
public SizeJobRequest(DisplayData displayData, Calendar startCal,
Calendar endCal) {
this.displayData = displayData;
this.startCal = startCal;
this.endCal = endCal;
}
/**
*
* @return displayData
*/
public DisplayData getDisplayData() {
return displayData;
}
}

View file

@ -25,6 +25,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -38,16 +42,18 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.archive.config.ArchiveConfig;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.CategoryConfig;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.archive.data.ArchiveInfo;
import com.raytheon.uf.viz.archive.data.CategoryInfo;
import com.raytheon.uf.viz.archive.data.DirInfo;
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
import com.raytheon.uf.viz.archive.data.IUpdateListener;
import com.raytheon.uf.viz.archive.data.SizeJob;
import com.raytheon.uf.viz.archive.data.SizeJobRequest;
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
* Abstract base class for Archive dialogs. Contains and manages information
@ -61,6 +67,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 30, 2013 1965 bgonzale Initial creation
* Jun 10, 2013 1966 rferrel Change to allow Case Creation to extend.
*
* </pre>
*
@ -69,30 +76,35 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
*/
public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
IArchiveTotals {
private static final String UNKNOWN_SIZE_TEXT = "????MB";
IArchiveTotals, IUpdateListener {
/** Table composite that holds the table controls. */
private ArchiveTableComp tableComp;
/** Archive config combo box. */
/** Archive configuration combo box. */
private Combo archCfgCbo;
/** Category combo box. */
private Combo categoryCbo;
/** Information for populating the various table displays. */
private final Map<String, ArchiveInfo> archiveInfoMap = new HashMap<String, ArchiveInfo>();
protected final Map<String, ArchiveInfo> archiveInfoMap = new HashMap<String, ArchiveInfo>();
private Cursor busyCursor;
/**
* Boolean to indicate when DisplayData is created should its selection be
* set based on the information in the configuration files.
*/
protected boolean setSelect = false;
protected TableType tableType;
protected final SizeJob sizeJob = new SizeJob();
/**
* @param parentShell
*/
public AbstractArchiveDlg(Shell parentShell) {
super(parentShell);
setupCursor();
}
/**
@ -101,7 +113,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*/
public AbstractArchiveDlg(Shell parentShell, int swtStyle) {
super(parentShell, swtStyle);
setupCursor();
}
/**
@ -111,41 +122,16 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*/
public AbstractArchiveDlg(Shell parentShell, int style, int caveStyle) {
super(parentShell, style, caveStyle);
setupCursor();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.data.IArchiveTotals#getTotalSelectedItems()
*/
// @Override
public int getTotalSelectedItems() {
int totalSelected = 0;
for (ArchiveInfo archiveInfo : archiveInfoMap.values()) {
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayInfo : categoryInfo
.getDisplayInfoList()) {
if (displayInfo.isSelected()) {
++totalSelected;
}
}
}
}
updateTotalSizeLabel();
return totalSelected;
}
public List<DisplayData> getAllSelected() {
List<DisplayData> allSelected = new ArrayList<ArchiveConfigManager.DisplayData>();
List<DisplayData> allSelected = new ArrayList<DisplayData>();
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
.getDisplayDataList()) {
if (displayData.isSelected()) {
allSelected.add(displayData);
}
@ -201,30 +187,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
return null;
}
protected void updateTotalSizeLabel() {
long totalSize = 0;
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
if (displayData.isSelected()) {
long size = displayData.getSize();
if (size < 0) {
// Size still being computed.
setTotalSizeText(UNKNOWN_SIZE_TEXT);
return;
} else {
totalSize += size;
}
}
}
}
}
setTotalSizeText(SizeUtil.prettyByteSize(totalSize));
}
/**
* This method is called by the AbstractArchiveDlg to set the size text.
*
@ -232,6 +194,8 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*/
protected abstract void setTotalSizeText(String sizeStringText);
protected abstract void setTotalSelectedItems(int totalSize);
/**
* This method is called by the AbstractArchiveDlg to get the start of the
* time frame that bounds the data for the dialog.
@ -248,19 +212,13 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*/
protected abstract Calendar getEnd();
/**
* This method is called by the AbstractArchiveDlg when the combo boxes are
* updated.
*/
protected abstract void selectionsUpdated();
/**
* Create the Archive and Category combo controls.
*
* @param comp
* Composite to put the controls in.
*/
protected void createComboControls(Composite comp) {
protected Composite createComboControls(Composite comp) {
Composite comboComp = new Composite(comp, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
@ -277,9 +235,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
archCfgCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String archiveName = archCfgCbo.getItem(archCfgCbo
.getSelectionIndex());
populateCategoryCbo(archiveName);
archiveComboSelection();
}
});
@ -293,47 +249,68 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
categoryCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String archiveName = archCfgCbo.getItem(archCfgCbo
.getSelectionIndex());
String categoryName = categoryCbo.getItem(categoryCbo
.getSelectionIndex());
populateTableComp(archiveName, categoryName);
categoryComboSelection();
}
});
ArchiveConfigManager.getInstance().reset();
createTable();
populateComboBoxes();
updateTableComp();
return comboComp;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
*/
@Override
protected void preOpened() {
super.preOpened();
// Setup to display blank dialog with busy cursor while getting data.
Job job = new Job("setup") {
@Override
protected IStatus run(IProgressMonitor monitor) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
setCursorBusy(true);
initInfo();
populateComboBoxes();
updateTableComp();
}
});
return Status.OK_STATUS;
}
};
job.schedule();
}
/**
* Create the table control.
*/
protected void createTable() {
tableComp = new ArchiveTableComp(shell, TableType.Case, this);
tableComp = new ArchiveTableComp(shell, tableType, this);
sizeJob.addUpdateListener(this);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
sizeJob.removeUpdateListener(this);
sizeJob.cancel();
}
/**
* Update table based on current item selections in archive and category.
*/
protected void updateTableComp() {
populateTableComp(getSelectedArchiveName(), getSelectedCategoryName());
}
/**
* Init busyCursor. On close, make sure that cursor reverts back to unbusy
* state if it isn't already.
*/
private void setupCursor() {
busyCursor = getParent().getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
this.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
setCursorBusy(false);
}
});
populateTableComp();
}
/**
@ -349,63 +326,173 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
if (doSelect) {
archCfgCbo.select(0);
String archiveName = archCfgCbo.getItem(0);
populateCategoryCbo(archiveName);
archiveComboSelection();
}
}
/**
* Method invoked when archive combo selection is changed.
*/
protected void archiveComboSelection() {
populateCategoryCbo();
}
/**
* Populate the category combo based on the archive name and populate the
* table.
*
* @param archiveName
*/
private void populateCategoryCbo(String archiveName) {
private void populateCategoryCbo() {
String archiveName = getSelectedArchiveName();
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
categoryCbo.removeAll();
for (String categoryName : manager.getCategoryNames(archiveName)) {
categoryCbo.add(categoryName);
}
categoryCbo.select(0);
String categoryName = categoryCbo.getItem(0);
populateTableComp(archiveName, categoryName);
categoryComboSelection();
}
private void populateTableComp(String archiveName, String categoryName) {
/**
* Method invoked when the category combo selection is changed.
*/
protected void categoryComboSelection() {
populateTableComp();
}
/**
* Populates the archive/category combo boxes and obtains the display data.
*/
private void initInfo() {
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
Calendar startCal = getStart();
Calendar endCal = getEnd();
String[] archiveNames = manager.getArchiveDataNamesList();
for (String archiveName : archiveNames) {
ArchiveInfo archiveInfo = new ArchiveInfo();
archiveInfoMap.put(archiveName, archiveInfo);
String[] categoryNames = manager.getCategoryNames(manager
.getArchive(archiveName));
for (String categoryName : categoryNames) {
List<DisplayData> displayDatas = manager.getDisplayData(
archiveName, categoryName, setSelect);
CategoryInfo categoryInfo = new CategoryInfo(archiveName,
categoryName, displayDatas);
archiveInfo.add(categoryInfo);
for (DisplayData displayData : displayDatas) {
if (displayData.isSelected()) {
sizeJob.queue(new SizeJobRequest(displayData, startCal,
endCal));
}
}
}
}
}
/**
* Populate the table based on the currently selected archive, category and
* adjust sizes on the display table.
*/
protected void populateTableComp() {
String archiveName = getSelectedArchiveName();
String categoryName = getSelectedCategoryName();
Calendar startCal = getStart();
Calendar endCal = getEnd();
setCursorBusy(true);
DirInfo.clearQueue();
sizeJob.clearQueue();
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
if (archiveInfo == null) {
archiveInfo = new ArchiveInfo();
archiveInfoMap.put(archiveName, archiveInfo);
}
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
if (categoryInfo == null) {
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
List<DisplayData> displayInfos = manager.getDisplayInfo(
archiveName, categoryName);
categoryInfo = new CategoryInfo(archiveName, categoryName,
displayInfos);
archiveInfo.add(categoryInfo);
}
for (DisplayData displayInfo : categoryInfo.getDisplayInfoList()) {
new DirInfo(displayInfo, getStart(), getEnd());
for (DisplayData displayData : categoryInfo.getDisplayDataList()) {
sizeJob.queue(new SizeJobRequest(displayData, startCal, endCal));
}
sizeJob.requeueSelected(startCal, endCal);
tableComp.populateTable(categoryInfo.getDisplayInfoList());
selectionsUpdated();
tableComp.populateTable(categoryInfo.getDisplayDataList());
setCursorBusy(false);
}
private void setCursorBusy(boolean state) {
/**
* Set the shells cursor to the desire state.
*
* @param state
*/
protected void setCursorBusy(boolean state) {
Cursor cursor = null;
if (state) {
cursor = busyCursor;
cursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
}
shell.setCursor(cursor);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.data.IArchiveTotals#updateTotals(java.util
* .List)
*/
@Override
public void updateTotals(List<DisplayData> displayDatas) {
long totalSize = 0;
int totalSelected = 0;
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayDataList()) {
if (displayData.isSelected()) {
++totalSelected;
if (totalSize != DisplayData.UNKNOWN_SIZE) {
long size = displayData.getSize();
if (size >= 0) {
totalSize += size;
} else {
totalSize = DisplayData.UNKNOWN_SIZE;
}
}
}
}
}
}
String sizeMsg = null;
if (totalSize == DisplayData.UNKNOWN_SIZE) {
sizeMsg = DisplayData.UNKNOWN_SIZE_LABEL;
} else {
sizeMsg = SizeUtil.prettyByteSize(totalSize);
}
setTotalSizeText(sizeMsg);
setTotalSelectedItems(totalSelected);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.data.IUpdateListener#update(java.util.List)
*/
@Override
public void update(List<SizeJobRequest> dirInfos) {
final List<DisplayData> displayDatas = new ArrayList<DisplayData>(
dirInfos.size());
for (SizeJobRequest request : dirInfos) {
displayDatas.add(request.getDisplayData());
}
VizApp.runAsync(new Runnable() {
@Override
public void run() {
tableComp.updateSize(displayDatas);
updateTotals(null);
}
});
}
}

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.archive.ui;
import java.util.Calendar;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@ -34,12 +35,10 @@ import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.archive.config.ArchiveConfig;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.CategoryConfig;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
/**
* Archive retention dialog.
@ -52,6 +51,7 @@ import com.raytheon.uf.viz.archive.data.IArchiveTotals;
* ------------ ---------- ----------- --------------------------
* May 23, 2013 #1964 lvenable Initial creation
* May 31, 2013 #1965 bgonzale Initial work for updating retention configurations.
* Jun 10, 2013 #1966 rferrel Implemented hooks to get display and save to work.
*
* </pre>
*
@ -61,12 +61,17 @@ import com.raytheon.uf.viz.archive.data.IArchiveTotals;
public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
IArchiveTotals {
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ArchiveRetentionDlg.class);
/** Current Archive/Category selection's minimum retention hours. */
private RetentionHours minRetention;
private Spinner minRetentionSpnr;
/** Current Archive/Category selection's extended retention hours. */
private RetentionHours extRetention;
private Spinner extRetentionSpnr;
/** Displays the total number of selected items for all tables. */
private Label totalSelectedItems;
/** Displays the total size of selected items. */
private Label totalSizeLbl;
// TODO in the future, get this value from a user text box
protected static final String ARCHIVE_DIR = "/archive_dir";
@ -80,6 +85,8 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
public ArchiveRetentionDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.DO_NOT_BLOCK
| CAVE.MODE_INDEPENDENT | CAVE.INDEPENDENT_SHELL);
this.setSelect = true;
this.tableType = TableType.Retention;
}
@Override
@ -100,6 +107,8 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
gl.marginWidth = 0;
gl.horizontalSpacing = 0;
mainComp.setLayout(gl);
ArchiveConfigManager.getInstance().reset();
init();
}
@ -110,7 +119,6 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
createRetentionControls();
GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createBottomActionButtons();
selectionsUpdated();
}
/**
@ -118,7 +126,7 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
*/
private void createRetentionControls() {
Composite retentionComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(5, false);
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
retentionComp.setLayout(gl);
retentionComp.setLayoutData(gd);
@ -127,6 +135,7 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
* Top row of controls.
*/
createComboControls(retentionComp);
createTable();
// composite for retention time selection
Composite selectionComp = new Composite(retentionComp, SWT.NONE);
@ -141,38 +150,27 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
minRetentionLbl.setLayoutData(gd);
gd = new GridData(60, SWT.DEFAULT);
minRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
Spinner minRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
minRetentionSpnr.setIncrement(1);
minRetentionSpnr.setPageIncrement(5);
minRetentionSpnr.setMaximum(Integer.MAX_VALUE);
minRetentionSpnr.setMinimum(1);
minRetentionSpnr.setLayoutData(gd);
final Combo minRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
Combo minRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
| SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
minRetentionCbo.addSelectionListener(new SelectionAdapter() {
minRetention = new RetentionHours(1, minRetentionSpnr, minRetentionCbo) {
@Override
public void widgetSelected(SelectionEvent e) {
int retentionHours = handleRetentionSelection(minRetentionCbo,
minRetentionSpnr);
if (retentionHours != -1) {
ArchiveConfig archive = getSelectedArchive();
if (archive != null) {
archive.setRetentionHours(retentionHours);
}
}
protected void handleTimeSelection() {
super.handleTimeSelection();
getSelectedArchive().setRetentionHours(getHours());
}
});
minRetentionCbo.add("Hours");
minRetentionCbo.add("Days");
minRetentionCbo.select(0);
minRetentionCbo.setData(minRetentionCbo.getItem(minRetentionCbo
.getSelectionIndex()));
};
/*
* Bottom row of controls.
*/
gd = new GridData();
gd.horizontalIndent = 20;
Label extRetentionLbl = new Label(selectionComp, SWT.NONE);
@ -180,33 +178,23 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
extRetentionLbl.setLayoutData(gd);
gd = new GridData(60, SWT.DEFAULT);
extRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
Spinner extRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
extRetentionSpnr.setIncrement(1);
extRetentionSpnr.setPageIncrement(5);
extRetentionSpnr.setMaximum(Integer.MAX_VALUE);
extRetentionSpnr.setMinimum(1);
extRetentionSpnr.setMinimum(0);
extRetentionSpnr.setLayoutData(gd);
final Combo extRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
Combo extRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
| SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
extRetentionCbo.addSelectionListener(new SelectionAdapter() {
extRetention = new RetentionHours(1, extRetentionSpnr, extRetentionCbo) {
@Override
public void widgetSelected(SelectionEvent e) {
int retentionHours = handleRetentionSelection(extRetentionCbo,
extRetentionSpnr);
if (retentionHours != -1) {
CategoryConfig category = getSelectedCategory();
if (category != null) {
category.setRetentionHours(retentionHours);
}
}
protected void handleTimeSelection() {
super.handleTimeSelection();
getSelectedCategory().setRetentionHours(getHours());
}
});
extRetentionCbo.add("Hours");
extRetentionCbo.add("Days");
extRetentionCbo.select(0);
extRetentionCbo.setData(extRetentionCbo.getItem(extRetentionCbo
.getSelectionIndex()));
};
}
/**
@ -215,32 +203,31 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
private void createBottomActionButtons() {
Composite actionControlComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(3, false);
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
actionControlComp.setLayout(gl);
actionControlComp.setLayoutData(gd);
Button calcSizeBtn = new Button(actionControlComp, SWT.PUSH);
calcSizeBtn.setText(" Calculate Sizes ");
calcSizeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// TODO : add calculate size functionality
// With Roger's automated size calculation code, this doesn't
// seem relevant unless it is for calculating compressed size
}
});
// TODO - For the future ?
// Button calcSizeBtn = new Button(actionControlComp, SWT.PUSH);
// calcSizeBtn.setText(" Calculate Sizes ");
// calcSizeBtn.addSelectionListener(new SelectionAdapter() {
// @Override
// public void widgetSelected(SelectionEvent e) {
// // TODO : add calculate size functionality
// // With Roger's automated size calculation code, this doesn't
// // seem relevant unless it is for calculating compressed size
// }
// });
Button saveBtn = new Button(actionControlComp, SWT.PUSH);
saveBtn.setText(" Save... ");
saveBtn.setText(" Save ");
saveBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
ArchiveConfigManager manager = ArchiveConfigManager
.getInstance();
// TODO
// List<DisplayData> allSelected = getAllSelected();
// manager.save();
manager.save();
}
});
@ -256,58 +243,32 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
});
}
/**
* Handle the retention selection for both minimum and extended retention.
/*
* (non-Javadoc)
*
* @param comboBox
* Retention combo box.
* @param spinner
* Retention spinner.
* @return hours entered if changed; -1 if not changed
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#setTotalSizeText(java
* .lang.String)
*/
private int handleRetentionSelection(Combo comboBox, Spinner spinner) {
// If the selection didn't change then just return.
if (comboBox.getItem(comboBox.getSelectionIndex()).equals(
(String) comboBox.getData())) {
return -1;
}
int time = 0;
if (comboBox.getItem(comboBox.getSelectionIndex()).equals("Hours")) {
time = convertTime(true, spinner.getSelection());
} else {
time = convertTime(false, spinner.getSelection());
}
spinner.setSelection(time);
comboBox.setData(comboBox.getItem(comboBox.getSelectionIndex()));
return time;
}
/**
* Covert time from either hours to days or days to hours.
*
* @param daysToHours
* Flag indicating how to convert the time.
* @param time
* Time to be converted.
* @return The converted time.
*/
private int convertTime(boolean daysToHours, int time) {
int convertedTime = 0;
if (daysToHours) {
convertedTime = time * 24;
} else {
convertedTime = time / 24;
}
return convertedTime;
}
@Override
protected void setTotalSizeText(String sizeStringText) {
// TODO Auto-generated method stub
if (totalSizeLbl != null && !totalSizeLbl.isDisposed()) {
totalSizeLbl.setText(sizeStringText);
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#setTotalSelectedItems
* (int)
*/
@Override
protected void setTotalSelectedItems(int totalSize) {
if (totalSelectedItems != null && !totalSelectedItems.isDisposed()) {
totalSelectedItems.setText("" + totalSize);
}
}
/*
@ -332,23 +293,45 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
return null;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#updateTotals(java.util
* .List)
*/
@Override
public void updateTotals() {
ArchiveConfig archive = getSelectedArchive();
if (archive != null) {
if (minRetentionSpnr != null) {
minRetentionSpnr.setSelection(archive.getRetentionHours());
CategoryConfig category = getSelectedCategory();
if (category != null) {
extRetentionSpnr.setSelection(category.getRetentionHours());
}
public void updateTotals(List<DisplayData> displayDatas) {
super.updateTotals(displayDatas);
if (displayDatas != null) {
for (DisplayData displayData : displayDatas) {
displayData.updateCategory();
}
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#archiveComboSelection()
*/
@Override
protected void selectionsUpdated() {
// Not used.
protected void archiveComboSelection() {
super.archiveComboSelection();
minRetention.setHours(getSelectedArchive().getRetentionHours());
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#categoryComboSelection
* ()
*/
@Override
protected void categoryComboSelection() {
super.categoryComboSelection();
extRetention.setHours(getSelectedCategory().getRetentionHours());
}
}

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.viz.archive.ui;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
@ -37,7 +38,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
@ -59,8 +60,8 @@ import com.raytheon.uf.viz.archive.data.IArchiveTotals;
*/
public class ArchiveTableComp extends Composite {
/** Key for getting Display Information state. */
private final String DISPLAY_INFO_KEY = "displayInfo";
/** Key for getting Display Data. */
private final String DISPLAY_DATA_KEY = "displayData";
/** Table control. */
private Table table;
@ -80,9 +81,10 @@ public class ArchiveTableComp extends Composite {
};
/** Current table type. */
private TableType tableType = TableType.Retention;
private final TableType type;
private IArchiveTotals iArchiveTotals;
/** Allows the parent dialog log to update other total displays. */
private final IArchiveTotals iArchiveTotals;
/**
* Constructor.
@ -96,7 +98,7 @@ public class ArchiveTableComp extends Composite {
IArchiveTotals iTotalSelectedSize) {
super(parent, 0);
tableType = type;
this.type = type;
this.iArchiveTotals = iTotalSelectedSize;
init();
}
@ -114,9 +116,10 @@ public class ArchiveTableComp extends Composite {
this.setLayoutData(gd);
createTable();
createTableLabels();
updateSelectionLabels();
if (type != TableType.Retention) {
createTableLabels();
}
}
/**
@ -138,9 +141,9 @@ public class ArchiveTableComp extends Composite {
pathColumn.setText("Label");
TableColumn sizeColumn = new TableColumn(table, SWT.CENTER);
if (tableType == TableType.Retention) {
if (type == TableType.Retention) {
sizeColumn.setText("Current Size");
} else if (tableType == TableType.Case) {
} else if (type == TableType.Case) {
sizeColumn.setText("Size");
}
@ -159,7 +162,9 @@ public class ArchiveTableComp extends Composite {
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSelectionLabels();
if (e.detail == SWT.CHECK) {
updateSelectionLabels();
}
}
});
}
@ -190,15 +195,17 @@ public class ArchiveTableComp extends Composite {
TableItem[] itemArray = table.getItems();
int count = 0;
long tableTotalSize = 0;
List<DisplayData> displayDatas = new ArrayList<DisplayData>(
itemArray.length);
for (TableItem ti : itemArray) {
DisplayData displayInfo = (DisplayData) ti
.getData(DISPLAY_INFO_KEY);
DisplayData displayData = (DisplayData) ti
.getData(DISPLAY_DATA_KEY);
if (ti.getChecked()) {
++count;
displayInfo.setSelected(true);
displayData.setSelected(true);
if (tableTotalSize >= 0) {
long diSize = displayInfo.getSize();
long diSize = displayData.getSize();
if (diSize < 0) {
tableTotalSize = diSize;
} else {
@ -206,18 +213,21 @@ public class ArchiveTableComp extends Composite {
}
}
} else {
displayInfo.setSelected(false);
displayData.setSelected(false);
}
displayDatas.add(displayData);
}
selectedLbl.setText("Table Selected Items: " + count);
if (selectedLbl != null) {
selectedLbl.setText("Table Selected Items: " + count);
String sizeString = DisplayData.UNKNOWN_SIZE_LABEL;
if (tableTotalSize >= 0) {
sizeString = SizeUtil.prettyByteSize(tableTotalSize);
String sizeString = DisplayData.UNKNOWN_SIZE_LABEL;
if (tableTotalSize >= 0) {
sizeString = SizeUtil.prettyByteSize(tableTotalSize);
}
sizeLbl.setText("Table Selected Size: " + sizeString);
}
sizeLbl.setText("Table Selected Size: " + sizeString);
iArchiveTotals.updateTotals();
iArchiveTotals.updateTotals(displayDatas);
}
/**
@ -283,7 +293,6 @@ public class ArchiveTableComp extends Composite {
*/
private void handleCheckSelectedRow(boolean check) {
TableItem[] itemArray = table.getSelection();
System.out.println("handleCheckSelectedRow: " + check);
for (TableItem ti : itemArray) {
ti.setChecked(check);
}
@ -307,12 +316,12 @@ public class ArchiveTableComp extends Composite {
updateSelectionLabels();
}
public void updateSize(List<DisplayData> displayInfos) {
public void updateSize(List<DisplayData> displayDatas) {
TableItem[] itemArray = table.getItems();
for (DisplayData displayInfo : displayInfos) {
for (DisplayData displayData : displayDatas) {
for (TableItem ti : itemArray) {
if (displayInfo.equals(ti.getData(DISPLAY_INFO_KEY))) {
if (displayData.equals(ti.getData(DISPLAY_DATA_KEY))) {
setItemSize(ti);
}
}
@ -325,15 +334,15 @@ public class ArchiveTableComp extends Composite {
* TODO : this is just for display purposes. This will go away when the
* functionality is implemented.
*/
protected void populateTable(List<DisplayData> displayInfoArray) {
protected void populateTable(List<DisplayData> displayDataArray) {
table.removeAll();
for (DisplayData displayInfo : displayInfoArray) {
for (DisplayData displayData : displayDataArray) {
TableItem item = new TableItem(table, SWT.NONE);
item.setData(DISPLAY_INFO_KEY, displayInfo);
item.setChecked(displayInfo.isSelected());
item.setText(0, displayInfo.getDisplayLabel());
item.setData(DISPLAY_DATA_KEY, displayData);
item.setChecked(displayData.isSelected());
item.setText(0, displayData.getDisplayLabel());
item.setChecked(displayInfo.isSelected());
item.setChecked(displayData.isSelected());
setItemSize(item);
}
for (int i = 0; i < 2; i++) {
@ -345,8 +354,13 @@ public class ArchiveTableComp extends Composite {
updateSelectionLabels();
}
/**
* Update table items size column.
*
* @param item
*/
private void setItemSize(TableItem item) {
long size = ((DisplayData) item.getData(DISPLAY_INFO_KEY)).getSize();
long size = ((DisplayData) item.getData(DISPLAY_DATA_KEY)).getSize();
if (size < 0L) {
item.setText(1, DisplayData.UNKNOWN_SIZE_LABEL);
} else {

View file

@ -24,9 +24,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
@ -35,7 +33,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
@ -52,18 +49,17 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.archive.data.ArchiveInfo;
import com.raytheon.uf.viz.archive.data.CategoryInfo;
import com.raytheon.uf.viz.archive.data.DirInfo;
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
import com.raytheon.uf.viz.archive.data.IUpdateListener;
import com.raytheon.uf.viz.archive.data.SizeJobRequest;
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.dialogs.AwipsCalendar;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
@ -76,18 +72,17 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 23, 2013 #1964 lvenable Initial creation
* May 23, 2013 #1964 lvenable Initial creation
* Jun 10, 2013 #1966 rferrel Implemented back in hooks for display
* and generation of cases.
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
IUpdateListener {
/** Table control */
private ArchiveTableComp tableComp;
public class CaseCreationDlg extends AbstractArchiveDlg implements
IArchiveTotals, IUpdateListener {
/** Start time label. */
private Label startTimeLbl;
@ -101,12 +96,6 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
/** End date. */
private Date endDate;
/** Archive configuration combo box. */
private Combo archCfgCbo;
/** Category combo box. */
private Combo categoryCbo;
/** Action to bring up the case name dialog. */
private Button caseNameCreate;
@ -150,9 +139,6 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
/** Archive configuration manager */
private ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
/** Information for populating the various table displays. */
private final Map<String, ArchiveInfo> archiveInfoMap = new HashMap<String, ArchiveInfo>();
/** Number of selected items. */
private int selectedItemsSize = 0;
@ -165,8 +151,15 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
public CaseCreationDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.DO_NOT_BLOCK
| CAVE.MODE_INDEPENDENT | CAVE.INDEPENDENT_SHELL);
this.setSelect = false;
this.tableType = TableType.Case;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
@ -177,6 +170,13 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell shell) {
setText("Archive Case Creation");
@ -192,16 +192,10 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
init();
}
@Override
protected void disposed() {
DirInfo.removeUpdateListener(this);
}
/**
* Initialize method to create all of the composite & controls.
*/
private void init() {
DirInfo.addUpdateListener(this);
createTimeControls();
GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createCaseCompressionControls();
@ -210,8 +204,6 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
createTable();
GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createBottomActionButtons();
populateComboBoxes();
}
/**
@ -276,46 +268,15 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
createCompressionControls(caseCompressionComp);
}
/**
* Create the Archive and Category combo controls.
/*
* (non-Javadoc)
*
* @param comp
* Composite to put the controls in.
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#createComboControls
* (org.eclipse.swt.widgets.Composite)
*/
private void createComboControls(Composite comp) {
Composite comboComp = new Composite(comp, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
comboComp.setLayout(gl);
comboComp.setLayoutData(gd);
Label archCfgLbl = new Label(comboComp, SWT.NONE);
archCfgLbl.setText("Archive Config: ");
gd = new GridData(200, SWT.DEFAULT);
archCfgCbo = new Combo(comboComp, SWT.VERTICAL | SWT.DROP_DOWN
| SWT.BORDER | SWT.READ_ONLY);
archCfgCbo.setLayoutData(gd);
archCfgCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
populateCategoryCbo(getSelectedArchiveName());
}
});
Label catLbl = new Label(comboComp, SWT.NONE);
catLbl.setText("Category: ");
gd = new GridData(200, SWT.DEFAULT);
categoryCbo = new Combo(comboComp, SWT.VERTICAL | SWT.DROP_DOWN
| SWT.BORDER | SWT.READ_ONLY);
categoryCbo.setLayoutData(gd);
categoryCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
populateTableComp();
}
});
protected Composite createComboControls(Composite comp) {
Composite comboComp = super.createComboControls(comp);
caseNameCreate = new Button(comboComp, SWT.PUSH);
caseNameCreate.setText(" Case Name... ");
@ -328,9 +289,10 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
});
caseNameCreate.setToolTipText("Must first select \"Case Location\".");
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
caseNameLbl = new Label(comboComp, SWT.BORDER);
caseNameLbl.setLayoutData(gd);
return comboComp;
}
/**
@ -423,6 +385,9 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
handleFileSizeChangeSelection();
}
});
fileSizeCbo.add("MB");
fileSizeCbo.add("GB");
fileSizeCbo.select(0);
}
/**
@ -460,13 +425,6 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
locationStateLbl.setLayoutData(gd);
}
/**
* Create the table control.
*/
private void createTable() {
tableComp = new ArchiveTableComp(shell, TableType.Case, this);
}
/**
* Create the bottom action buttons.
*/
@ -478,15 +436,16 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
actionControlComp.setLayout(gl);
actionControlComp.setLayoutData(gd);
Button exportBtn = new Button(actionControlComp, SWT.PUSH);
exportBtn.setText(" Export Case Config... ");
exportBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
}
});
// TODO - Future implementation.
// Button exportBtn = new Button(actionControlComp, SWT.PUSH);
// exportBtn.setText(" Export Case Config... ");
// exportBtn.addSelectionListener(new SelectionAdapter() {
//
// @Override
// public void widgetSelected(SelectionEvent e) {
//
// }
// });
generateBtn = new Button(actionControlComp, SWT.PUSH);
generateBtn.setText(" Generate ");
@ -514,14 +473,11 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
* Display modal dialog that performs the Generation of the case.
*/
private void generateCase() {
setBusy(true);
setCursorBusy(true);
File targetDir = (File) locationLbl.getData();
File caseDir = (File) caseNameLbl.getData();
// TODO investigate using just Date or long values for start/end
Calendar startCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(startDate.getTime());
Calendar endCal = TimeUtil.newCalendar();
endCal.setTimeInMillis(endDate.getTime());
Calendar startCal = getStart();
Calendar endCal = getEnd();
List<DisplayData> displayDatas = getSelectedData();
boolean doCompress = compressChk.getSelection();
@ -549,7 +505,7 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
@Override
public void dialogClosed(Object returnValue) {
setBusy(false);
setCursorBusy(false);
}
});
dialog.open();
@ -791,170 +747,12 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
return str;
}
/**
* Initial set up of the combo boxes.
*/
private void populateComboBoxes() {
boolean doSelect = false;
for (String archiveName : manager.getArchiveDataNamesList()) {
archCfgCbo.add(archiveName);
doSelect = true;
}
if (doSelect) {
archCfgCbo.select(0);
String archiveName = archCfgCbo.getItem(0);
populateCategoryCbo(archiveName);
}
fileSizeCbo.add("MB");
fileSizeCbo.add("GB");
fileSizeCbo.select(0);
fileSizeCbo
.setData(fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()));
protected void setTotalSizeText(String text) {
uncompressSizeLbl.setText(text);
}
/**
* Populate the category combo based on the archive name and populate the
* table.
*
* @param archiveName
*/
private void populateCategoryCbo(String archiveName) {
categoryCbo.removeAll();
for (String categoryName : manager.getCategoryNames(archiveName)) {
categoryCbo.add(categoryName);
}
categoryCbo.select(0);
populateTableComp();
}
private void populateTableComp() {
String archiveName = getSelectedArchiveName();
String categoryName = getSelectedCategoryName();
setBusy(true);
DirInfo.clearQueue();
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
if (archiveInfo == null) {
archiveInfo = new ArchiveInfo();
archiveInfoMap.put(archiveName, archiveInfo);
}
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
if (categoryInfo == null) {
List<DisplayData> displayInfos = manager.getDisplayInfo(
archiveName, categoryName);
categoryInfo = new CategoryInfo(archiveName, categoryName,
displayInfos);
archiveInfo.add(categoryInfo);
}
// TODO investigate using just Date or long values for start/end
Calendar startCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(startDate.getTime());
Calendar endCal = TimeUtil.newCalendar();
endCal.setTimeInMillis(endDate.getTime());
List<DisplayData> recomputList = new ArrayList<ArchiveConfigManager.DisplayData>();
for (DisplayData displayInfo : categoryInfo.getDisplayInfoList()) {
// Queue unknown sizes first
if (displayInfo.getSize() < 0L) {
new DirInfo(displayInfo, startCal, endCal);
} else {
recomputList.add(displayInfo);
}
}
// Recompute sizes
for (DisplayData displayData : recomputList) {
new DirInfo(displayData, startCal, endCal);
}
tableComp.populateTable(categoryInfo.getDisplayInfoList());
updateTotals();
setBusy(false);
}
private void setBusy(boolean state) {
Cursor cursor = null;
if (state) {
cursor = getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
}
shell.setCursor(cursor);
}
@Override
public void update(List<DirInfo> dirInfos) {
final List<DisplayData> displayInfos = new ArrayList<ArchiveConfigManager.DisplayData>();
for (DirInfo dirInfo : dirInfos) {
displayInfos.add(dirInfo.getDisplayInfo());
}
VizApp.runAsync(new Runnable() {
@Override
public void run() {
tableComp.updateSize(displayInfos);
updateTotals();
}
});
}
/**
* Obtain the selected archive name.
*
* @return archiveName
*/
private String getSelectedArchiveName() {
return archCfgCbo.getItem(archCfgCbo.getSelectionIndex());
}
/**
* Obtain the selected category name.
*
* @return categoryName
*/
private String getSelectedCategoryName() {
return categoryCbo.getItem(categoryCbo.getSelectionIndex());
}
/**
* Updates the estimated uncompressed size of selected entries.
*/
public void updateTotals() {
long totalSize = 0;
int totalSelected = 0;
boolean unknownSize = false;
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
if (displayData.isSelected()) {
++totalSelected;
if (!unknownSize) {
long size = displayData.getSize();
if (size >= 0) {
totalSize += size;
} else {
unknownSize = true;
}
}
}
}
}
}
protected void setTotalSelectedItems(int totalSelected) {
selectedItemsSize = totalSelected;
String sizeMsg = null;
if (unknownSize) {
sizeMsg = DisplayData.UNKNOWN_SIZE_LABEL;
} else {
sizeMsg = SizeUtil.prettyByteSize(totalSize);
}
uncompressSizeLbl.setText(sizeMsg);
totalSelectedItemsLbl.setText("" + totalSelected);
checkGenerateButton();
}
@ -964,13 +762,13 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
* display table and and other selected entries.
*/
private void resetSizes() {
List<DisplayData> selectedDatas = new ArrayList<ArchiveConfigManager.DisplayData>();
List<DisplayData> selectedDatas = new ArrayList<DisplayData>();
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
.getDisplayDataList()) {
displayData.setSize(DisplayData.UNKNOWN_SIZE);
if (displayData.isSelected()) {
selectedDatas.add(displayData);
@ -984,15 +782,14 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
if (selectedDatas.size() > 0) {
String archiveName = getSelectedArchiveName();
String categoryName = getSelectedCategoryName();
Calendar startCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(startDate.getTime());
Calendar endCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(endDate.getTime());
Calendar startCal = getStart();
Calendar endCal = getEnd();
for (DisplayData displayData : selectedDatas) {
if (!displayData.isArchive(archiveName)
|| !displayData.isCategory(categoryName)) {
new DirInfo(displayData, startCal, endCal);
sizeJob.queue(new SizeJobRequest(displayData, startCal,
endCal));
}
}
}
@ -1005,13 +802,13 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
* @return selectedDatas
*/
private List<DisplayData> getSelectedData() {
List<DisplayData> selectedDatas = new ArrayList<ArchiveConfigManager.DisplayData>();
List<DisplayData> selectedDatas = new ArrayList<DisplayData>();
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
.getDisplayDataList()) {
if (displayData.isSelected()) {
selectedDatas.add(displayData);
}
@ -1020,4 +817,28 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
}
return selectedDatas;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getStart()
*/
// @Override
protected Calendar getStart() {
Calendar startCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(startDate.getTime());
return startCal;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getEnd()
*/
// @Override
protected Calendar getEnd() {
Calendar endCal = TimeUtil.newCalendar();
endCal.setTimeInMillis(endDate.getTime());
return endCal;
}
}

View file

@ -45,7 +45,7 @@ import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;

View file

@ -0,0 +1,188 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.archive.ui;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* Convenience class for taking retention hours and converting to days/hours.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 2, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class RetentionHours {
/** Minimum value for the spinner. */
private final int minUnit;
/** The retention hours. */
private int retentionHours;
/** Spinner for the time assume hours or days. */
private Spinner timeSpnr;
/** Combo box assume to determine use of Hours or Days. */
private Combo timeUnitCombo;
/**
* Constructor with default 7 day retention.
*/
public RetentionHours(int minUnit, Spinner timeSpnr, Combo timeUnitCombo) {
this.minUnit = minUnit;
this.timeSpnr = timeSpnr;
this.timeUnitCombo = timeUnitCombo;
init();
}
/**
* Set up Listeners on the combo boxes for time conversion.
*/
private void init() {
timeSpnr.setMinimum(minUnit);
timeSpnr.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleTimeSelection();
}
});
timeUnitCombo.removeAll();
timeUnitCombo.add("Hours");
timeUnitCombo.add("Days");
timeUnitCombo.select(0);
timeUnitCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleTimeUnitSelection();
handleTimeSelection();
}
});
timeUnitCombo.setData(timeUnitCombo.getItem(timeUnitCombo
.getSelectionIndex()));
}
/**
* Get retention in hours.
*
* @return
*/
public int getHours() {
return retentionHours;
}
/**
* Set number hours of retention.
*
* @param hours
*/
public void setHours(int hours) {
if (hours < minUnit) {
hours = minUnit;
}
retentionHours = hours;
int time = retentionHours;
if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
"Days")) {
time /= TimeUtil.HOURS_PER_DAY;
}
timeSpnr.setSelection(time);
// Based on the time unit retentionHours and GUI may need updating.
handleTimeSelection();
}
/**
* Handle the retention selection for both minimum and extended retention.
*
* @param timeUnitCombo
* Retention combo box.
* @param timeSpinner
* Retention spinner.
* @return hours entered if changed; -1 if not changed
*/
private void handleTimeUnitSelection() {
int time = 0;
if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
"Hours")) {
time = convertTime(true, timeSpnr.getSelection());
} else {
time = convertTime(false, timeSpnr.getSelection());
}
timeSpnr.setSelection(time);
timeUnitCombo.setData(timeUnitCombo.getItem(timeUnitCombo
.getSelectionIndex()));
}
/**
* Covert time from either hours to days or days to hours.
*
* @param daysToHours
* Flag indicating how to convert the time.
* @param time
* Time to be converted.
* @return The converted time.
*/
private int convertTime(boolean daysToHours, int time) {
int convertedTime = 0;
if (daysToHours) {
convertedTime = time * TimeUtil.HOURS_PER_DAY;
retentionHours = convertedTime;
} else {
convertedTime = time / TimeUtil.HOURS_PER_DAY;
retentionHours = convertedTime * TimeUtil.HOURS_PER_DAY;
}
return convertedTime;
}
/**
* Adjust retention hours based on combo boxes current values.
*/
protected void handleTimeSelection() {
int time = timeSpnr.getSelection();
if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
"Days")) {
time *= TimeUtil.HOURS_PER_DAY;
}
retentionHours = time;
}
}

View file

@ -36,7 +36,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* &lt;name>Raw&lt;/name>
* &lt;rootDir>/data_store/&lt;/rootDir>
* &lt;!-- default retention hours for a category. -->
* &lt;retentionHours>168&lt;/retentionHours>
* &lt;minRetentionHours>168&lt;/minRetentionHours>
* &lt;category>
* &lt;name>Model grib&lt;/name>
* ...
@ -83,7 +83,7 @@ public class ArchiveConfig implements Comparable<ArchiveConfig> {
* Minimum number of hours the purger should retain data. May be overridden
* for a given category.
*/
@XmlElement(name = "retentionHours")
@XmlElement(name = "minRetentionHours")
private int retentionHours;
/**
@ -168,7 +168,7 @@ public class ArchiveConfig implements Comparable<ArchiveConfig> {
public List<CategoryConfig> getCategoryList() {
return new ArrayList<CategoryConfig>(categoryList);
}
/**
* @param categoryName
* @return The named CategoryConfig; null if not found

View file

@ -46,6 +46,9 @@ import org.apache.commons.io.filefilter.RegexFileFilter;
import com.raytheon.uf.common.archive.exception.ArchiveException;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationFileInputStream;
import com.raytheon.uf.common.localization.LocalizationFileOutputStream;
@ -270,8 +273,8 @@ public class ArchiveConfigManager {
for (CategoryConfig category : archive.getCategoryList()) {
Calendar purgeTime = calculateExpiration(archive, category);
for (DisplayData display : getDisplayInfo(archive.getName(),
category.getName())) {
for (DisplayData display : getDisplayData(archive.getName(),
category.getName(), true)) {
List<File> displayFiles = getDisplayFiles(display, null,
purgeTime);
for (File file : displayFiles) {
@ -355,10 +358,18 @@ public class ArchiveConfigManager {
* Save the cached configuration.
*/
public void save() {
LocalizationContext siteContext = pathMgr.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
for (String archiveName : archiveMap.keySet()) {
ArchiveConfig archiveConfig = archiveMap.get(archiveName);
LocalizationFile lFile = archiveNameToLocalizationFileMap
.get(archiveName);
if (lFile.getContext().getLocalizationLevel() != LocalizationLevel.SITE) {
// Modify the site not the base file.
LocalizationFile tlFile = pathMgr.getLocalizationFile(
siteContext, lFile.getName());
lFile = tlFile;
}
saveArchiveConfig(lFile, archiveConfig);
}
}
@ -555,8 +566,13 @@ public class ArchiveConfigManager {
* @param categoryName
* @return displayInfoList order by display label
*/
public List<DisplayData> getDisplayInfo(String archiveName,
public List<DisplayData> getDisplayData(String archiveName,
String categoryName) {
return getDisplayData(archiveName, categoryName, false);
}
public List<DisplayData> getDisplayData(String archiveName,
String categoryName, boolean setSelect) {
Map<String, List<File>> displayMap = new HashMap<String, List<File>>();
ArchiveConfig archiveConfig = archiveMap.get(archiveName);
@ -598,12 +614,16 @@ public class ArchiveConfigManager {
}
}
List<DisplayData> displayInfoList = new ArrayList<ArchiveConfigManager.DisplayData>();
List<DisplayData> displayInfoList = new ArrayList<DisplayData>();
for (String displayLabel : displays) {
DisplayData displayInfo = new DisplayData(archiveConfig,
DisplayData displayData = new DisplayData(archiveConfig,
categoryConfig, displayLabel, displayMap.get(displayLabel));
displayInfoList.add(displayInfo);
if (setSelect) {
displayData.setSelected(categoryConfig
.getSelectedDisplayNames().contains(displayLabel));
}
displayInfoList.add(displayData);
}
return displayInfoList;
@ -671,149 +691,4 @@ public class ArchiveConfigManager {
return archiveConfig;
}
/**
* This class contains the information on directories that are associated
* with a display label. Allows a GUI to maintain the state of the display
* instead of the manager.
*/
public static class DisplayData {
/** Label to use when size not yet known. */
public static final String UNKNOWN_SIZE_LABEL = "????";
/** A negative value to indicate unknown size. */
public static final long UNKNOWN_SIZE = -1L;
/** The data's archive configuration. */
protected final ArchiveConfig archiveConfig;
/** The data's category configration. */
protected final CategoryConfig categoryConfig;
/** The display label for this data. */
protected final String displayLabel;
/**
* List of directories for the display label matching the category's
* directory pattern and found under the archive's root directory.
*/
protected final List<File> dirs;
/**
* For use by GUI to indicate. Use to indicate selected for retention or
* for placing in a case.
*/
private boolean selected = false;
/** For use by GUI for indicating the size of the directories' contents. */
private long size = UNKNOWN_SIZE;
/**
* Constructor.
*
* @param archiveConfig
* @param categoryConfig
* @param displayLabel
* @param dirs
*/
public DisplayData(ArchiveConfig archiveConfig,
CategoryConfig categoryConfig, String displayLabel,
List<File> dirs) {
this.archiveConfig = archiveConfig;
this.categoryConfig = categoryConfig;
this.displayLabel = displayLabel;
this.dirs = dirs;
}
/**
* Is instance selected.
*
* @return selected
*/
public boolean isSelected() {
return selected;
}
/**
* Set selected state.
*
* @param selected
*/
public void setSelected(boolean selected) {
this.selected = selected;
}
/**
*
* @return displayLabel.
*/
public String getDisplayLabel() {
return displayLabel;
}
/**
* The size of the directories' contents.
*
* @return size
*/
public long getSize() {
return size;
}
/**
* Set the size of the directories' contents.
*
* @param size
*/
public void setSize(long size) {
this.size = size;
}
/**
* The archive's root directory name.
*
* @return rootDir
*/
public String getRootDir() {
return archiveConfig.getRootDir();
}
/**
* Determine if this is the name of the archive.
*
* @param archiveName
* @return
*/
public boolean isArchive(String archiveName) {
return archiveConfig.getName().equals(archiveName);
}
/**
* Determine if this is the name of the category.
*
* @param categoryName
* @return
*/
public boolean isCategory(String categoryName) {
return categoryConfig.getName().equals(categoryName);
}
/**
* Determine if the object contains the same data as the instance.
*/
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object instanceof DisplayData) {
DisplayData displayData = (DisplayData) object;
return (archiveConfig == displayData.archiveConfig
&& categoryConfig == displayData.categoryConfig && displayLabel
.equals(displayData.displayLabel));
}
return false;
}
}
}

View file

@ -19,6 +19,9 @@
**/
package com.raytheon.uf.common.archive.config;
import java.util.Collection;
import java.util.TreeSet;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@ -80,7 +83,7 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
* Minimum number of hours the purger should retain data. When 0 use the
* parent archive's value.
*/
@XmlElement(name = "retentionHours")
@XmlElement(name = "extRetentionHours")
private int retentionHours;
/**
@ -141,6 +144,9 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
@XmlElement(name = "filePattern")
private String filePattern;
@XmlElement(name = "selectedDisplayName")
private final Collection<String> selectedDisplayNames = new TreeSet<String>();
/*
* Constructor.
*/
@ -252,6 +258,24 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
this.filePattern = filePattern;
}
public Collection<String> getSelectedDisplayNames() {
return selectedDisplayNames;
}
public void setSelectedDisplayNames(
Collection<String> selectedDisplayNameList) {
selectedDisplayNames.clear();
selectedDisplayNameList.addAll(selectedDisplayNameList);
}
public void addSelectedDisplayName(String displayName) {
selectedDisplayNames.add(displayName);
}
public void removeSelectedDisplayName(String displayName) {
selectedDisplayNames.remove(displayName);
}
/*
* (non-Javadoc)
*
@ -276,6 +300,18 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
sb.append(", filePattern: ").append(getFilePattern());
sb.append(", displayLabel: ").append(getDisplay());
sb.append(", dateGroupIndices: ").append(getDateGroupIndices());
sb.append(", selectedDisplayNames: ");
if (selectedDisplayNames == null) {
sb.append("null");
} else {
sb.append("[");
String prefix = "\"";
for (String displayName : selectedDisplayNames) {
sb.append(prefix).append(displayName).append("\"");
prefix = " ,\"";
}
sb.append("]");
}
sb.append("]");
return sb.toString();
}

View file

@ -0,0 +1,189 @@
package com.raytheon.uf.common.archive.config;
import java.io.File;
import java.util.List;
/**
* This class contains the information on directories that are associated with a
* display label. Allows a GUI to maintain the state of the display instead of
* the manager.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 7, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class DisplayData implements Comparable<DisplayData> {
/** Label to use when size not yet known. */
public static final String UNKNOWN_SIZE_LABEL = "????";
/** A negative value to indicate unknown size. */
public static final long UNKNOWN_SIZE = -1L;
/** The data's archive configuration. */
protected final ArchiveConfig archiveConfig;
/** The data's category configuration. */
protected final CategoryConfig categoryConfig;
/** The display label for this data. */
protected final String displayLabel;
/**
* List of directories for the display label matching the category's
* directory pattern and found under the archive's root directory.
*/
protected final List<File> dirs;
/**
* For use by GUI to indicate. Use to indicate selected for retention or for
* placing in a case.
*/
private boolean selected = false;
/** For use by GUI for indicating the size of the directories' contents. */
private long size = UNKNOWN_SIZE;
/**
* Constructor.
*
* @param archiveConfig
* @param categoryConfig
* @param displayLabel
* @param dirs
*/
public DisplayData(ArchiveConfig archiveConfig,
CategoryConfig categoryConfig, String displayLabel, List<File> dirs) {
this.archiveConfig = archiveConfig;
this.categoryConfig = categoryConfig;
this.displayLabel = displayLabel;
this.dirs = dirs;
}
/**
* Is instance selected.
*
* @return selected
*/
public boolean isSelected() {
return selected;
}
/**
* Set selected state.
*
* @param selected
*/
public void setSelected(boolean selected) {
this.selected = selected;
}
/**
*
* @return displayLabel.
*/
public String getDisplayLabel() {
return displayLabel;
}
/**
* The size of the directories' contents.
*
* @return size
*/
public long getSize() {
return size;
}
/**
* Set the size of the directories' contents.
*
* @param size
*/
public void setSize(long size) {
this.size = size;
}
/**
* The archive's root directory name.
*
* @return rootDir
*/
public String getRootDir() {
return archiveConfig.getRootDir();
}
/**
* Determine if this is the name of the archive.
*
* @param archiveName
* @return
*/
public boolean isArchive(String archiveName) {
return archiveConfig.getName().equals(archiveName);
}
/**
* Determine if this is the name of the category.
*
* @param categoryName
* @return
*/
public boolean isCategory(String categoryName) {
return categoryConfig.getName().equals(categoryName);
}
/**
* Update the information for the category.
*/
public void updateCategory() {
if (isSelected()) {
categoryConfig.addSelectedDisplayName(displayLabel);
} else {
categoryConfig.removeSelectedDisplayName(displayLabel);
}
}
/**
* Determine if the object contains the same data as the instance.
*/
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object instanceof DisplayData) {
DisplayData displayData = (DisplayData) object;
return compareTo(displayData) == 0;
}
return false;
}
/*
* (non-Javadoc)
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override
public int compareTo(DisplayData o) {
int result = archiveConfig.getName().compareTo(
o.archiveConfig.getName());
if (result == 0) {
result = categoryConfig.getName().compareTo(
o.categoryConfig.getName());
if (result == 0) {
result = displayLabel.compareTo(o.displayLabel);
}
}
return result;
}
}

View file

@ -23,14 +23,14 @@
<name> - Required tag. The id for the archive such as Raw or Processed.
Used in the GUIs to filter which archive to display.
<rootDir> - Required tag. The root directory on the edex server for the archive.
<retentionHours> - Required tag. The default number of hours to retain data in the <rootDir>
<minRetentionHours> - Required tag. The default number of hours to retain data in the <rootDir>
<category> - Logical grouping of archive's sub-directories.
The <category> has six types of tags:
<name> - Required tag. The id for the category such as grib2 or redbook.
Used in the GUIs to filter what is the display in the table.
<retentionHours> - Optional tag. The retentionHours for this category.
Default is the archive's <retentionHours>.
<extRetentionHours> - Optional tag. The extended retentionHours for selected directories of this category.
Default is the archive's <minRetentionHours>.
<dirPattern> - Required tag. A regex pattern for finding directories for this category.
The pattern is relative to the archive's <rootDir>. Wildcard patterns do not cross directory
delimiter /. Thus to match 3 levels of directories you would need .*/.*/.* .
@ -47,6 +47,9 @@
This is used to determine what files/directories to retain or a range of directories/files to copy
for case creation. Note to get the group's index the <dirPattern> and <filePattern> are combined.
Thus if there are 5 groups in the <dirPattern> then the first group in the <filePattern> is index 6.
<selectedDisplayNames> - A directory matching <dirPattern>. These are selected directories from the Retention GUI. The purger
will used the category's <extRetentionHours> instead of the Arhivie's <minRetentionHours>.
An optional tag; may have more then one.
Patterns and groups.
The <dirPattern> and <filePattern> use Java regex expressions; similar to the ldm's pqact.conf file.
For more details see http://docs.oracle.com/javase/tutorial/essential/regex/
@ -81,21 +84,69 @@
<archive>
<name>Processed</name>
<rootDir>/awips2/edex/data/archive/</rootDir>
<retentionHours>168</retentionHours>
<minRetentionHours>24</minRetentionHours>
<category>
<name>binlightning</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(binlightning)</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>bufr</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(bufrascat|bufrhdw|bufrmosLAMP|bufrncwf|bufrsigwx|bufrssmi|bufrua)</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>bufrsigwx</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(bufrsigwx)/(.*)</dirPattern>
<displayLabel>{1} : {2}</displayLabel>
<dateGroupIndices>3,4,5,6</dateGroupIndices>
<filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>group</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(acars|airmet|airep|cwa|cwat)</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>grib</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>grib/(.*)/(.*)</dirPattern>
<displayLabel>{1} : {2}</displayLabel>
<dateGroupIndices>3,4,5,6</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})-.*</filePattern>
</category>
<category>
<name>grid</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>grid/(.*)/(.*)</dirPattern>
<displayLabel>{1} : {2}</displayLabel>
<dateGroupIndices>3,4,5,6</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})-.*</filePattern>
</category>
<category>
<name>redbook</name>
<retentionHours>0</retentionHours>
<dirPattern>hdf5/(redbook)</dirPattern>
<extRetentionHours>168</extRetentionHours>
<dirPattern>redbook/(.*)</dirPattern>
<displayLabel>{1}</displayLabel>
<filePattern>redbook-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>obs</name>
<retentionHours>0</retentionHours>
<dirPattern>hdf5/(obs)</dirPattern>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(fssobs|obs)</dirPattern>
<displayLabel>{1}</displayLabel>
<filePattern>metar-(\d{4})-(\d{2})-(\d{2})-(\d{2})\.*</filePattern>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
</archive>

View file

@ -23,14 +23,14 @@
<name> - Required tag. The id for the archive such as Raw or Processed.
Used in the GUIs to filter which archive to display.
<rootDir> - Required tag. The root directory on the edex server for the archive.
<retentionHours> - Required tag. The default number of hours to retain data in the <rootDir>
<minRetentionHours> - Required tag. The default number of hours to retain data in the <rootDir>
<category> - Logical grouping of archive's sub-directories.
The <category> has six types of tags:
<name> - Required tag. The id for the category such as grib2 or redbook.
Used in the GUIs to filter what is the display in the table.
<retentionHours> - Optional tag. The retentionHours for this category.
Default is the archive's <retentionHours>.
<extRetentionHours> - Optional tag. The extended retentionHours for selected directories of this category.
Default is the archive's <minRetentionHours>.
<dirPattern> - Required tag. A regex pattern for finding directories for this category.
The pattern is relative to the archive's <rootDir>. Wildcard patterns do not cross directory
delimiter /. Thus to match 3 levels of directories you would need .*/.*/.* .
@ -47,6 +47,9 @@
This is used to determine what files/directories to retain or a range of directories/files to copy
for case creation. Note to get the group's index the <dirPattern> and <filePattern> are combined.
Thus if there are 5 groups in the <dirPattern> then the first group in the <filePattern> is index 6.
<selectedDisplayNames> - A directory matching <dirPattern>. These are selected directories from the Retention GUI. The purger
will used the category's <extRetentionHours> instead of the Arhivie's <minRetentionHours>.
An optional tag; may have more then one.
Patterns and groups.
The <dirPattern> and <filePattern> use Java regex expressions; similar to the ldm's pqact.conf file.
For more details see http://docs.oracle.com/javase/tutorial/essential/regex/
@ -81,31 +84,31 @@
<archive>
<name>Raw</name>
<rootDir>/data_store/</rootDir>
<retentionHours>168</retentionHours>
<minRetentionHours>24</minRetentionHours>
<category>
<name>Model grib</name>
<retentionHours>0</retentionHours>
<extRetentionHours>168</extRetentionHours>
<dirPattern>grib/(\d{4})(\d{2})(\d{2})/(\d{2})/(.*)</dirPattern>
<displayLabel>{5}</displayLabel>
<dateGroupIndices>1,2,3,4</dateGroupIndices>
</category>
<category>
<name>Model grib2</name>
<retentionHours>0</retentionHours>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(grib2)/(\d{4})(\d{2})(\d{2})/(\d{2})/(.*)</dirPattern>
<displayLabel>{1} - {6}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
</category>
<category>
<name>Model other</name>
<retentionHours>0</retentionHours>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(acars|airmet|binlightning|bufrmos|bufrua|bufrsigwx|convsigmet|goessndg|manual|mdlsndg|poessndg|profiler|shef|text)/(\d{4})(\d{2})(\d{2})/(\d{2})</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
</category>
<category>
<name>Satellite</name>
<retentionHours>101</retentionHours>
<extRetentionHours>168</extRetentionHours>
<dirPattern>sat/(\d{4})(\d{2})(\d{2})/(\d{2})/(.*)</dirPattern>
<displayLabel>{5}</displayLabel>
<dateGroupIndices>1,2,3,4</dateGroupIndices>

View file

@ -91,6 +91,8 @@
<permission id="com.raytheon.localization.site/common_static/datadelivery"/>
<permission id="com.raytheon.localization.site/common_static/archive"/>
<user userId="ALL">
<userPermission>com.raytheon.localization.site/common_static/purge</userPermission>
<userPermission>com.raytheon.localization.site/cave_static/colormaps</userPermission>
@ -122,6 +124,7 @@
<userPermission>com.raytheon.localization.site/common_static/shef</userPermission>
<userPermission>com.raytheon.localization.site/common_static/roles</userPermission>
<userPermission>com.raytheon.localization.site/common_static/datadelivery</userPermission>
<userPermission>com.raytheon.localization.site/common_static/archive</userPermission>
</user>
</nwsRoleData>

View file

@ -43,8 +43,8 @@ import org.junit.Test;
import com.raytheon.uf.common.archive.config.ArchiveConfig;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.CategoryConfig;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.archive.exception.ArchiveException;
import com.raytheon.uf.common.localization.PathManagerFactoryTest;
import com.raytheon.uf.common.time.util.TimeUtil;
@ -294,8 +294,8 @@ public class ArchiveConfigManagerTest {
ArchiveException {
CategoryConfig satCategory = getCategory(archive, SAT_CAT_NAME);
List<DisplayData> displays =
manager.getDisplayInfo(archive.getName(), satCategory.getName());
List<DisplayData> selectedDisplays = new ArrayList<ArchiveConfigManager.DisplayData>();
manager.getDisplayData(archive.getName(), satCategory.getName());
List<DisplayData> selectedDisplays = new ArrayList<DisplayData>();
for (DisplayData displayData : displays) {
if (displayData.getDisplayLabel().equals(satNameForArchive)) {
selectedDisplays.add(displayData);