Issue #3891 Special overlap handling for promotion of sub from site to shared

Change-Id: Ifa8f4be3e9e0f172ee54c5ef7021b912d45c5de2

Former-commit-id: 8796705c6b [formerly 9a31befafe66a677b744fa9ae9ef7e134a758bd9]
Former-commit-id: d81e3b0efa
This commit is contained in:
Dave Hladky 2014-12-08 14:09:15 -06:00
parent b9081f0c0c
commit e897cb40df

View file

@ -28,6 +28,8 @@ import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription; import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
import com.raytheon.uf.common.datadelivery.registry.DataType; import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
@ -48,6 +50,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.RegistryIdUtil;
* Oct 24, 2013 2292 mpduff Initial creation * Oct 24, 2013 2292 mpduff Initial creation
* Nov 01, 2013 2292 dhladky Don't check against yourself for duplication * Nov 01, 2013 2292 dhladky Don't check against yourself for duplication
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site. * Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* Dec 08, 2014 3891 dhladky Allow for promotion of site subscriptions to shared.
* *
* </pre> * </pre>
* *
@ -80,9 +83,21 @@ public class SubscriptionOverlapHandler implements
DataType dataType = subscription.getDataSetType(); DataType dataType = subscription.getDataSetType();
Set<String> overlappingSubscriptions = new HashSet<String>(); Set<String> overlappingSubscriptions = new HashSet<String>();
for (Subscription potentialDuplicate : potentialDuplicates) { for (Subscription potentialDuplicate : potentialDuplicates) {
// don't check against yourself // Check for special promotion case
if (potentialDuplicate.getId().equals(subscription.getId())) { if (subscription instanceof SharedSubscription
continue; && potentialDuplicate instanceof SiteSubscription) {
// Not as stringent a check as the ID's won't be equal
// but the names still will
if (potentialDuplicate.getName().equals(
subscription.getName())) {
continue;
}
} else {
// Normal sequence, don't check self
if (potentialDuplicate.getId().equals(
subscription.getId())) {
continue;
}
} }
OverlapData od = OverlapDataFactory.getOverlapData( OverlapData od = OverlapDataFactory.getOverlapData(
subscription, potentialDuplicate); subscription, potentialDuplicate);