Issue #2352 - Data Browser Must Check For Subscriptions Belonging to the Local Site

Change-Id: I23392906a7d829852af2991dd096d4b5e76765aa

Former-commit-id: b8d2c6cffc [formerly 89342e59b9 [formerly 5b4c9794eb396f02cdf024d2df2089add4719910]]
Former-commit-id: 89342e59b9
Former-commit-id: b569410bc4
This commit is contained in:
Mike Duff 2013-09-11 09:47:04 -05:00
parent cee5788982
commit f20e2d7255
6 changed files with 33 additions and 13 deletions

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datadelivery.common.ui.IDialogClosed;
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
@ -83,6 +84,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jan 10, 2013 1346 mpduff Add additional information to the dataset details output.
* Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
*
* </pre>
*
@ -369,7 +371,8 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
for (String param : paramList) {
sb.append("--- ").append(param);
sb.append(getSpacing(max + 1, param));
sb.append(paramMap.get(param).getDefinition()).append(FileUtil.EOL);
sb.append(paramMap.get(param).getDefinition()).append(
FileUtil.EOL);
}
}
@ -623,7 +626,8 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
Set<String> datasetNames = Collections.emptySet();
try {
datasetNames = DataDeliveryHandlers.getSubscriptionHandler()
.getSubscribedToDataSetNames();
.getSubscribedToDataSetNames(
LocalizationManager.getInstance().getCurrentSite());
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to retrieve subscription dataset names!", e);

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* May 28, 2013 1650 djohnson Add getByNames.
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* Jul 18, 2013 2193 mpduff Changes for SubscriptionDataSetNameQuery.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
*
* </pre>
*
@ -126,10 +127,11 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
* {@inheritDoc}
*/
@Override
public Set<String> getSubscribedToDataSetNames()
public Set<String> getSubscribedToDataSetNames(String siteId)
throws RegistryHandlerException {
SubscriptionDataSetNameQuery query = new SubscriptionDataSetNameQuery();
query.setRegistryObjectClass(getRegistryObjectClass().getName());
query.setOfficeId(siteId);
RegistryQueryResponse<String> response = registryHandler
.getObjects(query);

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* Oct 10, 2012 0726 djohnson Add {@link #getActive()}.
* Feb 20, 2013 1543 djohnson Add ability to filter on routes.
* May 28, 2013 1650 djohnson Add getByNames.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
*
* </pre>
*
@ -108,13 +109,18 @@ public interface IBaseSubscriptionHandler<T extends Subscription> extends
throws RegistryHandlerException;
/**
* Get the {@link Set} of data set names that are subscribed to.
* Get the {@link Set} of data set names that are subscribed to for the
* provided site.
*
* @param siteId
* The site id
*
* @return the {@link Set} of data set names
* @throws RegistryHandlerException
* on error
*/
Set<String> getSubscribedToDataSetNames() throws RegistryHandlerException;
Set<String> getSubscribedToDataSetNames(String siteId)
throws RegistryHandlerException;
/**
* Retrieve all active subscriptions.

View file

@ -53,6 +53,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
* 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil
* May 28, 2013 1650 djohnson Add getByNames.
* May 29, 2013 1650 djohnson Fix ability to delete multiple types of subscriptions at once.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
*
* </pre>
*
@ -147,11 +148,13 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
* {@inheritDoc}
*/
@Override
public Set<String> getSubscribedToDataSetNames()
public Set<String> getSubscribedToDataSetNames(String siteId)
throws RegistryHandlerException {
Set<String> names = Sets.newHashSet();
names.addAll(siteSubscriptionHandler.getSubscribedToDataSetNames());
names.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames());
names.addAll(siteSubscriptionHandler
.getSubscribedToDataSetNames(siteId));
names.addAll(sharedSubscriptionHandler
.getSubscribedToDataSetNames(siteId));
return names;
}

View file

@ -57,6 +57,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
* May 28, 2013 1650 djohnson Add getByNames.
* May 29, 2013 1650 djohnson Fix ability to delete multiple types of subscriptions at once.
* May 31, 2013 1650 djohnson Fix ability to get shared subscriptions by id.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
*
* </pre>
*
@ -206,11 +207,12 @@ public class SubscriptionHandler implements ISubscriptionHandler {
* {@inheritDoc}
*/
@Override
public Set<String> getSubscribedToDataSetNames()
public Set<String> getSubscribedToDataSetNames(String siteId)
throws RegistryHandlerException {
Set<String> set = Sets.newHashSet();
set.addAll(siteSubscriptionHandler.getSubscribedToDataSetNames());
set.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames());
set.addAll(siteSubscriptionHandler.getSubscribedToDataSetNames(siteId));
set.addAll(sharedSubscriptionHandler
.getSubscribedToDataSetNames(siteId));
return set;
}

View file

@ -42,6 +42,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* Feb 20, 2013 1543 djohnson Implement route filtering.
* May 15, 2013 1040 mpduff Office Id now a set.
* May 28, 2013 1650 djohnson Add getByNames.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
*
* </pre>
*
@ -116,11 +117,13 @@ public class BaseMemorySubscriptionHandler<T extends Subscription> extends
* {@inheritDoc}
*/
@Override
public Set<String> getSubscribedToDataSetNames()
public Set<String> getSubscribedToDataSetNames(String siteId)
throws RegistryHandlerException {
Set<String> retVal = new HashSet<String>();
for (T obj : getAll()) {
retVal.add(obj.getDataSetName());
if (matches(siteId, obj.getOfficeIDs())) {
retVal.add(obj.getDataSetName());
}
}
return retVal;