Issue #1501 Include subscription on activation/deactivation notification, remove race condition of table update.
Change-Id: Ic3f8ff634136a9830cba42befc7f41c2554698aa Former-commit-id:0281da10cc
[formerly dd07cad3e6b2471fc4371471918078498f05d01e] Former-commit-id:2eda48aa0d
This commit is contained in:
parent
aa85e0c3ca
commit
c7189052e8
3 changed files with 24 additions and 22 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue