Issue #1501 Include subscription on activation/deactivation notification, remove race condition of table update.

Change-Id: Ic3f8ff634136a9830cba42befc7f41c2554698aa

Former-commit-id: 94a0cd5733 [formerly 0281da10cc] [formerly 94a0cd5733 [formerly 0281da10cc] [formerly 2eda48aa0d [formerly dd07cad3e6b2471fc4371471918078498f05d01e]]]
Former-commit-id: 2eda48aa0d
Former-commit-id: 58b3edd7df [formerly c7189052e8]
Former-commit-id: 2df1cb5d53
This commit is contained in:
Dustin Johnson 2013-01-21 21:24:42 -06:00
parent ce68428901
commit 6314e94764
3 changed files with 24 additions and 22 deletions

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* ------------ ---------- ----------- --------------------------
* Jan 04, 2013 1441 djohnson Initial creation
* Jan 17, 2013 1501 djohnson Route to datadelivery.
* Jan 21, 2013 1501 djohnson Include subscription on all requests.
*
* </pre>
*
@ -182,6 +183,7 @@ public class SendToServerSubscriptionNotificationService implements
req.setCategory("Subscription Approval Denied");
req.setPriority(2);
req.setId(subscription.getId());
req.setSubscription(subscription);
sendRequest(req);
}
@ -214,6 +216,7 @@ public class SendToServerSubscriptionNotificationService implements
req.setCategory("Subscription");
req.setPriority(3);
req.setMessage(subscription.getName() + " Activated");
req.setSubscription(subscription);
sendRequest(req);
}
@ -229,6 +232,7 @@ public class SendToServerSubscriptionNotificationService implements
req.setCategory("Subscription");
req.setPriority(3);
req.setMessage(subscription.getName() + " Deactivated");
req.setSubscription(subscription);
sendRequest(req);
}

View file

@ -58,7 +58,6 @@ import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
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.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction;
@ -112,6 +111,8 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Jan 02, 2013 1441 djohnson Add ability to delete groups.
* Jan 03, 2013 1437 bgonzale Moved configuration file management code to SubscriptionManagerConfigDlg
* and SubscriptionConfigurationManager.
* Jan 21, 2013 1501 djohnson Only send notification if subscription was actually activated/deactivated,
* remove race condition of GUI thread updating the table after notification.
* </pre>
*
* @author mpduff
@ -864,34 +865,23 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
SWT.OK, sub.getName() + " Activated",
response.getMessageToDisplay());
}
updatedList.add(sub);
if (activate) {
subscriptionNotificationService
.sendSubscriptionActivatedNotification(
sub,
username);
} else {
subscriptionNotificationService
.sendSubscriptionDeactivatedNotification(
sub, username);
if (!response.isAllowFurtherEditing()) {
if (activate) {
subscriptionNotificationService
.sendSubscriptionActivatedNotification(
sub, username);
} else {
subscriptionNotificationService
.sendSubscriptionDeactivatedNotification(
sub, username);
}
}
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
"Error processing request.", e);
}
}
VizApp.runAsync(new Runnable() {
@Override
public void run() {
if (isDisposed() == false) {
tableComp.updateTable(updatedList);
}
}
});
}
}
} catch (VizException e) {

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.common.status.UFStatus;
* Sep 06, 2012 687 mpduff Send a SubscriptionNotificationResponse object.
* Sep 24, 2012 1157 mpduff Changed to use BaseSubscriptionNotificationRequest.
* Jan 17, 2013 1501 djohnson If a subscription is still in the registry, use it for the notification response.
* Jan 21, 2013 1501 djohnson Throw an exception if subscription is not provided on the request.
* </pre>
*
* @author mpduff
@ -97,6 +98,13 @@ public class SubscriptionNotificationHandler<T extends Subscription> extends
final IBaseSubscriptionHandler<T> subscriptionHandler = response
.getSubscriptionHandler();
final T requestSubscription = request.getSubscription();
if (requestSubscription == null) {
throw new IllegalArgumentException(
"Unable to send a notification for a null subscription!",
new NullPointerException("requestSubscription"));
}
final T registryVersion = subscriptionHandler
.getByName(requestSubscription.getName());