Issue #2677 - Don't do overlap checks when updating subs to deactivated.

Change-Id: Ia974111d9810f27ef2b073304cd248de292275bd

Former-commit-id: bafe19bbd5 [formerly 101c08818d] [formerly 6b01c2957f [formerly 2e406f02b0abbdeee0f553df430f5a58977d9af2]]
Former-commit-id: 6b01c2957f
Former-commit-id: 6a2f75e8d5
This commit is contained in:
Mike Duff 2014-02-04 14:59:41 -06:00
parent 99a7c7afd7
commit 9edf591218
2 changed files with 51 additions and 19 deletions

View file

@ -97,6 +97,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Oct 22, 2013 2292 mpduff Removed subscriptionOverlapService.
* Nov 07, 2013 2291 skorolev Used showText() method for "Shared Subscription" message.
* Jan 26, 2014 2259 mpduff Turn off subs to be deactivated.
* Feb 04, 2014 2677 mpduff Don't do overlap checks when deactivating subs.
*
* </pre>
*
@ -542,6 +543,17 @@ public class SubscriptionService implements ISubscriptionService {
final IForceApplyPromptDisplayText displayTextStrategy)
throws RegistryHandlerException {
if (subscriptions == null || subscriptions.isEmpty()) {
return new SubscriptionServiceResult(false,
"No subscriptions submitted.");
}
/*
* If activating the subscriptions check for overlaps.
*
* Only need to check one because all are being updated the same way.
*/
if (subscriptions.get(0).getSubscriptionState() == SubscriptionState.ON) {
SubscriptionOverlapRequest request = new SubscriptionOverlapRequest(
subscriptions);
@ -558,13 +570,16 @@ public class SubscriptionService implements ISubscriptionService {
if (response.isOverlap()) {
List<String> subNames = response.getSubscriptionNameList();
Collections.sort(subNames);
forceApplyPrompt.displayMessage(displayTextStrategy, StringUtil
.createMessage(OVERLAPPING_SUBSCRIPTIONS, subNames));
forceApplyPrompt.displayMessage(displayTextStrategy,
StringUtil.createMessage(OVERLAPPING_SUBSCRIPTIONS,
subNames));
}
} catch (Exception e) {
statusHandler.error("Error checking subscription overlapping", e);
statusHandler.error("Error checking subscription overlapping",
e);
return new SubscriptionServiceResult(false);
}
}
try {
final ProposeResult result = proposeScheduleAndAction(

View file

@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
/**
* Definition of a subscription.
*
@ -47,6 +48,7 @@ import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
* Jan 08, 2014 2615 bgonzale Added calculate start and calculate end methods.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Jan 24, 2013 2709 bgonzale Added method inActivePeriodWindow.
* Feb 05, 2014 2677 mpduff Add subscription state getter/setter.
*
* </pre>
*
@ -704,4 +706,19 @@ public interface Subscription<T extends Time, C extends Coverage> {
* Deactivate the subscription
*/
void deactivate();
/**
* Set the subscription's state
*
* @param state
* The state to set
*/
void setSubscriptionState(SubscriptionState state);
/**
* Get the subscription's state
*
* @return This subscrition's state
*/
SubscriptionState getSubscriptionState();
}