Issue #2459 - Remove unscheduled status from UI
Former-commit-id:9360dd8efa
[formerlye6efbf5663
] [formerly0cfa9ee36c
] [formerly0cfa9ee36c
[formerly93cb80cfc7
]] [formerly9360dd8efa
[formerlye6efbf5663
] [formerly0cfa9ee36c
] [formerly0cfa9ee36c
[formerly93cb80cfc7
]] [formerly25d1d39fc2
[formerly0cfa9ee36c
[formerly93cb80cfc7
] [formerly25d1d39fc2
[formerly ddbef8fd122a6be6c32ff9a58659e712c2912a07]]]]] Former-commit-id:25d1d39fc2
Former-commit-id:a62c110a07
[formerly5097ed2ad7
] [formerlya492ec6a4d
] [formerly b639e01bb0ba3d0707df48d0ff31c2b7e837ca30 [formerly 77ea703f0626d7ff1caa2689bf5deb3e8b0b0c00] [formerlya492ec6a4d
[formerlya04430e334
]]] Former-commit-id: 36881858df5e671565ef061a6a747e417a884238 [formerly 8d18315d712b7d954433a4d91c196a329a74eeaa] [formerly45bef29f75
[formerlydcb5b4a111
]] Former-commit-id:45bef29f75
Former-commit-id:67bab78c2f
This commit is contained in:
parent
8e9c9d5a00
commit
d109280017
6 changed files with 59 additions and 16 deletions
|
@ -39,6 +39,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceA
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 4, 2012 1286 djohnson Initial creation
|
||||
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
|
||||
* Jan 17, 2014 2459 mpduff Change gui usage of unscheduled to deactivated.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -88,7 +89,7 @@ public class CancelForceApplyAndIncreaseLatencyDisplayText implements
|
|||
if (singleSubscription
|
||||
&& wouldBeUnscheduledSubscriptions.contains(name)) {
|
||||
return titleCaseActionText + " " + name
|
||||
+ " and leave in an unscheduled status";
|
||||
+ " and leave in a Deactivated status";
|
||||
}
|
||||
return titleCaseActionText + " " + name
|
||||
+ " and unschedule the others";
|
||||
|
|
|
@ -216,7 +216,6 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
|
|||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
@SlotAttribute
|
||||
private boolean unscheduled;
|
||||
|
||||
@XmlAttribute
|
||||
|
@ -266,7 +265,7 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
|
|||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
@SlotAttribute(Subscription.SUBSCRIPTION_STATE_SLOT)
|
||||
private SubscriptionState subscriptionState;
|
||||
private SubscriptionState subscriptionState = SubscriptionState.ON;
|
||||
|
||||
/** Flag stating if the object should be updated */
|
||||
private boolean shouldUpdate = false;
|
||||
|
@ -918,9 +917,7 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
|
|||
Calendar cal = TimeUtil.newGmtCalendar();
|
||||
Date today = cal.getTime();
|
||||
|
||||
if (unscheduled) {
|
||||
return SubscriptionStatus.UNSCHEDULED;
|
||||
} else if (inWindow(today)) {
|
||||
if (inWindow(today)) {
|
||||
return SubscriptionStatus.ACTIVE;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* Feb 20, 2011 218 dhladky Initial creation.
|
||||
* Oct 1, 2012 1103 jpiatt Added invalid subscription status.
|
||||
* Nov 20, 2012 1286 djohnson Add UNSCHEDULED.
|
||||
* Jan 14, 2014 2459 mpduff Change Subscription status code
|
||||
* Jan 14, 2014 2459 mpduff Change Subscription status code.
|
||||
* Jan 17, 2014 2459 mpduff Remove unscheduled status, not just deactivated.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -87,7 +88,6 @@ public class Utils {
|
|||
* Deactivated - Do not schedule
|
||||
* Active - Currently scheduled
|
||||
* Inactive - Not currently scheduled (outside of active period)
|
||||
* Unscheduled - Not currently scheduled due to bandwidth limitations
|
||||
* Invalid - Subscription does not match the available data set
|
||||
* </pre>
|
||||
*/
|
||||
|
@ -99,8 +99,6 @@ public class Utils {
|
|||
INACTIVE("Inactive"),
|
||||
/** Expired Subscription Status */
|
||||
EXPIRED("Expired"),
|
||||
/** Unscheduled Subscription Status */
|
||||
UNSCHEDULED("Unscheduled"),
|
||||
/** Deactivated Subscription Status */
|
||||
DEACTIVATED("Deactivated"),
|
||||
/** Invalid Subscription Status */
|
||||
|
|
|
@ -25,6 +25,8 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.RecurringSubscription;
|
||||
|
@ -34,6 +36,10 @@ import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterable
|
|||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base subscription handler.
|
||||
|
@ -53,6 +59,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
* Jul 18, 2013 2193 mpduff Changes for SubscriptionDataSetNameQuery.
|
||||
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
|
||||
* Jan 14, 2014 2459 mpduff Validate subs should be scheduled before returning them.
|
||||
* Jan 17, 2014 2459 mpduff Persist the state of the expired subs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -63,6 +70,11 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY extends SubscriptionFilterableQuery<T>>
|
||||
extends BaseRegistryObjectHandler<T, QUERY> implements
|
||||
IBaseSubscriptionHandler<T> {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(BaseSubscriptionHandler.class);
|
||||
|
||||
private final List<T> updateList = new ArrayList<T>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
@ -207,8 +219,37 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
for (T sub : response.getResults()) {
|
||||
if (((RecurringSubscription) sub).shouldSchedule()) {
|
||||
returnList.add(sub);
|
||||
} else if (((RecurringSubscription) sub).shouldUpdate()) {
|
||||
updateList.add(sub);
|
||||
}
|
||||
}
|
||||
|
||||
// Save updated objects back to registry
|
||||
if (!updateList.isEmpty()) {
|
||||
ExecutorService executor = Executors.newFixedThreadPool(1);
|
||||
executor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (updateList) {
|
||||
ISubscriptionHandler sh = RegistryObjectHandlers
|
||||
.get(ISubscriptionHandler.class);
|
||||
for (T s : updateList) {
|
||||
try {
|
||||
sh.update(s);
|
||||
statusHandler.info("Subscription "
|
||||
+ s.getName() + " is expired.");
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Unable to set subscription to expired ["
|
||||
+ s.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
updateList.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|||
* Jun 24, 2013 2106 djohnson Use IDENTIFIER generic for method signature.
|
||||
* 10/8/2013 1682 bphillip Added the createCriteria method
|
||||
* 12/9/2013 2613 bphillip Added flushAndClearSession method
|
||||
* Jan 17, 2014 2459 mpduff Added null check to prevent NPE.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -127,8 +128,10 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
*/
|
||||
@Override
|
||||
public void delete(final ENTITY obj) {
|
||||
Object toDelete = template.merge(obj);
|
||||
template.delete(toDelete);
|
||||
if (obj != null) {
|
||||
Object toDelete = template.merge(obj);
|
||||
template.delete(toDelete);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.uf.common.datadelivery.registry.DataType;
|
|||
import com.raytheon.uf.common.datadelivery.registry.GriddedTime;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointTime;
|
||||
import com.raytheon.uf.common.datadelivery.registry.RecurringSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
|
@ -591,11 +592,13 @@ public abstract class BandwidthManager<T extends Time, C extends Coverage>
|
|||
|
||||
// If BandwidthManager does not know about the subscription, and
|
||||
// it's active, attempt to add it..
|
||||
if (bandwidthSubscriptions.isEmpty() && subscription.isActive()) {
|
||||
if (bandwidthSubscriptions.isEmpty()
|
||||
&& ((RecurringSubscription) subscription).shouldSchedule()
|
||||
&& !subscription.isUnscheduled()) {
|
||||
return schedule(subscription);
|
||||
} else if (subscription.isUnscheduled()
|
||||
|| subscription.getStatus() == SubscriptionStatus.DEACTIVATED) {
|
||||
// See if the subscription was inactivated or unscheduled..
|
||||
} else if (subscription.getStatus() == SubscriptionStatus.DEACTIVATED
|
||||
|| subscription.isUnscheduled()) {
|
||||
// See if the subscription was deactivated or unscheduled..
|
||||
// Need to remove BandwidthReservations for this
|
||||
// subscription.
|
||||
return remove(bandwidthSubscriptions);
|
||||
|
|
Loading…
Add table
Reference in a new issue