Issue #1841 Split up PendingSubscription hierarchy in support of shared subscriptions.
Add ability to store/approve shared subscriptions. Back out generics on subscription/pending subscriptions until guis are updated. Change-Id: I84e1651ebcad0d398396752529981f28dbc341bf Former-commit-id: 5a8249a78daaeed19079e78f6c4f07b08e817ff0
This commit is contained in:
parent
52be309cac
commit
61346b1388
45 changed files with 2182 additions and 522 deletions
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.notification;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.util.IConditionMatcher;
|
||||
|
||||
/**
|
||||
* Checks for a notification message to contain one of the specified types of
|
||||
* payload.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 02, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class NotificationMessageContainsType implements
|
||||
IConditionMatcher<NotificationMessage[]> {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(NotificationMessageContainsType.class);
|
||||
|
||||
private final Class<?>[] classTypes;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param classTypes
|
||||
* the class types to check for, if the notification message
|
||||
* contains any of the types then true will be returned
|
||||
*/
|
||||
public NotificationMessageContainsType(Class<?>... classTypes) {
|
||||
this.classTypes = classTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean matchesCondition(NotificationMessage[] item) {
|
||||
boolean matches = false;
|
||||
try {
|
||||
for (NotificationMessage msg : item) {
|
||||
Object obj = msg.getMessagePayload();
|
||||
for (Class<?> classType : classTypes) {
|
||||
if (classType.isAssignableFrom(obj.getClass())) {
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.error("Error when checking notification", e);
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +1,32 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
|
||||
<!-- Creation of the handlers -->
|
||||
|
||||
<bean name="UserSubscriptionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.UserSubscriptionHandler" />
|
||||
|
||||
<bean name="SubscriptionHandler"
|
||||
class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler">
|
||||
<constructor-arg ref="UserSubscriptionHandler" />
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.UserSubscriptionHandler" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SharedSubscriptionHandler" />
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean name="PendingSubscriptionHandler"
|
||||
class="com.raytheon.uf.viz.datadelivery.handlers.VizPendingSubscriptionHandler" />
|
||||
class="com.raytheon.uf.viz.datadelivery.handlers.VizPendingSubscriptionHandler">
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingUserSubscriptionHandler" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSharedSubscriptionHandler" />
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean name="GroupDefinitionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GroupDefinitionHandler" />
|
||||
|
|
|
@ -22,7 +22,9 @@ package com.raytheon.uf.viz.datadelivery.handlers;
|
|||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSharedSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingUserSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
@ -41,15 +43,26 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 27, 2012 1187 djohnson Initial creation
|
||||
* Nov 15, 2012 1286 djohnson Use server-keyed routing.
|
||||
* Apr 05, 2013 1841 djohnson Add shared subscription support.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class VizPendingSubscriptionHandler extends PendingSubscriptionHandler {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param userSubscriptionHandler
|
||||
*/
|
||||
public VizPendingSubscriptionHandler(
|
||||
IPendingUserSubscriptionHandler userSubscriptionHandler,
|
||||
IPendingSharedSubscriptionHandler sharedSubscriptionHandler) {
|
||||
super(userSubscriptionHandler, sharedSubscriptionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.datadelivery.handlers;
|
|||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISharedSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IUserSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler;
|
||||
|
@ -43,23 +44,25 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
|
|||
* Sep 27, 2012 1187 djohnson Initial creation
|
||||
* Nov 15, 2012 1286 djohnson Use server-keyed routing.
|
||||
* Mar 29, 2013 1841 djohnson Composes a userSubscriptionsHandler.
|
||||
* Apr 05, 2013 1841 djohnson Add shared subscription support.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class VizSubscriptionHandler extends SubscriptionHandler {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param userSubscriptionHandler
|
||||
* @param sharedSubscriptionHandler
|
||||
*/
|
||||
public VizSubscriptionHandler(
|
||||
IUserSubscriptionHandler userSubscriptionHandler) {
|
||||
super(userSubscriptionHandler);
|
||||
IUserSubscriptionHandler userSubscriptionHandler,
|
||||
ISharedSubscriptionHandler sharedSubscriptionHandler) {
|
||||
super(userSubscriptionHandler, sharedSubscriptionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,7 +52,7 @@ 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.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.datadelivery.service.SubscriptionNotificationResponse;
|
||||
import com.raytheon.uf.common.datadelivery.service.BaseSubscriptionNotificationResponse;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -61,8 +61,8 @@ 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.core.notification.NotificationException;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessage;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessageContainsType;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.TableComp;
|
||||
|
@ -126,6 +126,10 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
/** TableDataManager object. */
|
||||
private TableDataManager<SubscriptionManagerRowData> subManagerData;
|
||||
|
||||
/** Checks for the notification message to be those we care about. **/
|
||||
private final NotificationMessageContainsType notificationMessageChecker = new NotificationMessageContainsType(
|
||||
BaseSubscriptionNotificationResponse.class);
|
||||
|
||||
/**
|
||||
* Enumeration to determine the type of subscription dialog this class is
|
||||
* used with.
|
||||
|
@ -828,28 +832,14 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
*/
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
final ArrayList<Subscription> updatedSubscriptions = new ArrayList<Subscription>();
|
||||
try {
|
||||
for (NotificationMessage msg : messages) {
|
||||
Object obj = msg.getMessagePayload();
|
||||
if (obj instanceof SubscriptionNotificationResponse) {
|
||||
SubscriptionNotificationResponse response = (SubscriptionNotificationResponse) obj;
|
||||
Subscription sub = response.getSubscription();
|
||||
if (sub != null) {
|
||||
updatedSubscriptions.add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.error("Error when receiving notification", e);
|
||||
}
|
||||
|
||||
if (updatedSubscriptions.isEmpty() == false) {
|
||||
if (notificationMessageChecker.matchesCondition(messages)) {
|
||||
// Just refresh the whole table on a notification arriving
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isDisposed() == false) {
|
||||
updateTable(updatedSubscriptions);
|
||||
if (!isDisposed()) {
|
||||
handleRefresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -38,7 +38,6 @@ import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.service.ApprovedPendingSubscriptionNotificationResponse;
|
||||
import com.raytheon.uf.common.datadelivery.service.BaseSubscriptionNotificationResponse;
|
||||
import com.raytheon.uf.common.datadelivery.service.DeniedPendingSubscriptionNotificationResponse;
|
||||
import com.raytheon.uf.common.datadelivery.service.PendingSubscriptionNotificationResponse;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
@ -46,8 +45,8 @@ 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.notification.NotificationException;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessage;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessageContainsType;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.TableComp;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
|
||||
|
@ -74,6 +73,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
|||
* Nov 28, 2012 1286 djohnson Remove sysout.
|
||||
* Dec 19, 2012 1413 bgonzale In the notificationArrived method, check for approved or
|
||||
* denied pending messages.
|
||||
* Apr 05, 2013 1841 djohnson Refresh entire table on receiving a notification of the correct type.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -98,10 +98,15 @@ public class SubApprovalTableComp extends TableComp {
|
|||
private Action(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.action;
|
||||
}
|
||||
}
|
||||
|
||||
/** Status Handler */
|
||||
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SubApprovalTableComp.class);
|
||||
|
||||
/** Pending Subscription Manager Data object */
|
||||
|
@ -113,6 +118,13 @@ public class SubApprovalTableComp extends TableComp {
|
|||
/** Callback to the main dialog */
|
||||
private final ISubscriptionApprovalAction callback;
|
||||
|
||||
/** Checks notification message for types we care about. **/
|
||||
private final NotificationMessageContainsType notificationMessageChecker = new NotificationMessageContainsType(
|
||||
PendingSubscription.class,
|
||||
PendingSubscriptionNotificationResponse.class,
|
||||
ApprovedPendingSubscriptionNotificationResponse.class,
|
||||
DeniedPendingSubscriptionNotificationResponse.class);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -219,7 +231,7 @@ public class SubApprovalTableComp extends TableComp {
|
|||
* Updated subscriptions.
|
||||
*/
|
||||
public synchronized void updateTable(
|
||||
ArrayList<InitialPendingSubscription> updatedSubscriptions) {
|
||||
List<InitialPendingSubscription> updatedSubscriptions) {
|
||||
for (Subscription s : updatedSubscriptions) {
|
||||
if (s != null) {
|
||||
if (s.isDeleted()) {
|
||||
|
@ -515,42 +527,12 @@ public class SubApprovalTableComp extends TableComp {
|
|||
*/
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
final ArrayList<InitialPendingSubscription> updatedSubscriptions = new ArrayList<InitialPendingSubscription>();
|
||||
try {
|
||||
for (NotificationMessage msg : messages) {
|
||||
Object obj = msg.getMessagePayload();
|
||||
if (obj instanceof PendingSubscription) {
|
||||
updatedSubscriptions.add((PendingSubscription) obj);
|
||||
} else if (obj instanceof PendingSubscriptionNotificationResponse) {
|
||||
PendingSubscriptionNotificationResponse response = (PendingSubscriptionNotificationResponse) obj;
|
||||
InitialPendingSubscription sub = response.getSubscription();
|
||||
updatedSubscriptions.add(sub);
|
||||
} else if (obj instanceof ApprovedPendingSubscriptionNotificationResponse) {
|
||||
BaseSubscriptionNotificationResponse<InitialPendingSubscription> response = (BaseSubscriptionNotificationResponse<InitialPendingSubscription>) obj;
|
||||
InitialPendingSubscription dummySubForApproved = response
|
||||
.getSubscription();
|
||||
dummySubForApproved.setDeleted(true);
|
||||
updatedSubscriptions.add(dummySubForApproved);
|
||||
} else if (obj instanceof DeniedPendingSubscriptionNotificationResponse) {
|
||||
DeniedPendingSubscriptionNotificationResponse response = (DeniedPendingSubscriptionNotificationResponse) obj;
|
||||
InitialPendingSubscription dummySubForDenied = new InitialPendingSubscription();
|
||||
dummySubForDenied.setId(response.getId());
|
||||
dummySubForDenied.setDeleted(true);
|
||||
updatedSubscriptions.add(dummySubForDenied);
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.error("Error when receiving notification", e);
|
||||
} catch (RuntimeException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
if (updatedSubscriptions.isEmpty() == false) {
|
||||
if (notificationMessageChecker.matchesCondition(messages)) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isDisposed() == false) {
|
||||
updateTable(updatedSubscriptions);
|
||||
if (!isDisposed()) {
|
||||
repopulate();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -38,7 +38,6 @@ import com.raytheon.uf.common.auth.user.IUser;
|
|||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
|
||||
|
@ -90,6 +89,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
|||
* Nov 28, 2012 1286 djohnson Use subscriptionService for notification, and only notify when actually approved.
|
||||
* Dec 12, 2012 1433 bgonzale Use new subscription copy ctor method for approval of pending subscription.
|
||||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -492,8 +492,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
|
|||
String username = System.getenv().get("LOGNAME");
|
||||
for (SubscriptionApprovalRowData rd: subList) {
|
||||
InitialPendingSubscription ps = rd.getSubscription();
|
||||
// TODO: Add support for pending shared subscriptions
|
||||
UserSubscription s = new UserSubscription(ps);
|
||||
|
||||
Subscription s = ps.subscription();
|
||||
|
||||
IPendingSubscriptionHandler pendingSubHandler = RegistryObjectHandlers
|
||||
.get(IPendingSubscriptionHandler.class);
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
|
@ -105,6 +106,7 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
|
|||
* only send notification of subscription creation on OK status.
|
||||
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers, default to existing priority on edit.
|
||||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -526,8 +528,9 @@ public class CreateSubscriptionDlgPresenter {
|
|||
subscription.setLatencyInMinutes(view.getLatencyValue());
|
||||
|
||||
IUser user = UserController.getUserObject();
|
||||
ISubscriptionHandler handler = RegistryObjectHandlers
|
||||
.get(ISubscriptionHandler.class);
|
||||
|
||||
IPendingSubscriptionHandler handler = DataDeliveryHandlers
|
||||
.getPendingSubscriptionHandler();
|
||||
|
||||
String currentUser = LocalizationManager.getInstance().getCurrentUser();
|
||||
final String username = user.uniqueId().toString();
|
||||
|
@ -689,7 +692,7 @@ public class CreateSubscriptionDlgPresenter {
|
|||
} else {
|
||||
setSubscriptionId(subscription);
|
||||
try {
|
||||
handler.update(pendingSub);
|
||||
pendingSubHandler.update(pendingSub);
|
||||
|
||||
subscriptionNotificationService
|
||||
.sendCreatedPendingSubscriptionForSubscriptionNotification(
|
||||
|
|
|
@ -19,7 +19,8 @@ com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet
|
|||
com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData
|
||||
com.raytheon.uf.common.datadelivery.registry.Parameter
|
||||
com.raytheon.uf.common.datadelivery.registry.ParameterLevel
|
||||
com.raytheon.uf.common.datadelivery.registry.PendingSubscription
|
||||
com.raytheon.uf.common.datadelivery.registry.PendingSharedSubscription
|
||||
com.raytheon.uf.common.datadelivery.registry.PendingUserSubscription
|
||||
com.raytheon.uf.common.datadelivery.registry.Projection
|
||||
com.raytheon.uf.common.datadelivery.registry.Provider
|
||||
com.raytheon.uf.common.datadelivery.registry.Time
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Initial Pending Shared Subscription.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 02, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject(value = { Subscription.PROVIDER_NAME_SLOT,
|
||||
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
|
||||
Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT })
|
||||
public class InitialPendingSharedSubscription extends SharedSubscription
|
||||
implements InitialPendingSubscription {
|
||||
private static final long serialVersionUID = 2779084460608459754L;
|
||||
|
||||
/** ID of the user requesting the change */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
@SlotAttribute(InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT)
|
||||
private String changeReqId;
|
||||
|
||||
/** Reason for requesting the change */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String changeReason;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public InitialPendingSharedSubscription() {
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param subscription
|
||||
* subscription object
|
||||
* @param user
|
||||
* user
|
||||
*/
|
||||
public InitialPendingSharedSubscription(SharedSubscription subscription,
|
||||
String user) {
|
||||
super(subscription);
|
||||
|
||||
this.setChangeReqId(user);
|
||||
this.setDeleted(subscription.isDeleted());
|
||||
this.setId(RegistryUtil.getRegistryObjectKey(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param changeReqId
|
||||
* the changeReqId to set
|
||||
*/
|
||||
@Override
|
||||
public void setChangeReqId(String changeReqId) {
|
||||
this.changeReqId = changeReqId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the changeReqId
|
||||
*/
|
||||
@Override
|
||||
public String getChangeReqId() {
|
||||
return changeReqId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the changeReason
|
||||
*/
|
||||
@Override
|
||||
public String getChangeReason() {
|
||||
return changeReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param changeReason
|
||||
* the changeReason to set
|
||||
*/
|
||||
@Override
|
||||
public void setChangeReason(String changeReason) {
|
||||
this.changeReason = changeReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Subscription subscription() {
|
||||
return new SharedSubscription(this);
|
||||
}
|
||||
}
|
|
@ -19,16 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Initial Pending Subscription Object.
|
||||
|
@ -39,89 +29,51 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 24, 2012 mpduff Initial creation
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor.
|
||||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Apr 02, 2013 1841 djohsnon Converted to interface
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject(value = { Subscription.PROVIDER_NAME_SLOT,
|
||||
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
|
||||
Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT })
|
||||
public class InitialPendingSubscription extends UserSubscription {
|
||||
private static final long serialVersionUID = 2779084460608459754L;
|
||||
public interface InitialPendingSubscription extends Subscription {
|
||||
|
||||
public static final String CHANGE_REQUEST_ID_SLOT = "changeReqId";
|
||||
|
||||
/** ID of the user requesting the change */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
@SlotAttribute(CHANGE_REQUEST_ID_SLOT)
|
||||
private String changeReqId;
|
||||
|
||||
/** Reason for requesting the change */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String changeReason;
|
||||
String CHANGE_REQUEST_ID_SLOT = "changeReqId";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Set the change request id
|
||||
*
|
||||
* @param changeReqId
|
||||
* the changeReqId to set
|
||||
*/
|
||||
public InitialPendingSubscription() {
|
||||
//empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param subscription
|
||||
* subscription object
|
||||
* @param user
|
||||
* user
|
||||
*/
|
||||
public InitialPendingSubscription(UserSubscription subscription, String user) {
|
||||
super(subscription);
|
||||
|
||||
this.setChangeReqId(user);
|
||||
this.setDeleted(subscription.isDeleted());
|
||||
this.setId(RegistryUtil.getRegistryObjectKey(this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param changeReqId the changeReqId to set
|
||||
*/
|
||||
public void setChangeReqId(String changeReqId) {
|
||||
this.changeReqId = changeReqId;
|
||||
}
|
||||
void setChangeReqId(String changeReqId);
|
||||
|
||||
/**
|
||||
* Retrieve the change request id
|
||||
*
|
||||
* @return the changeReqId
|
||||
*/
|
||||
public String getChangeReqId() {
|
||||
return changeReqId;
|
||||
}
|
||||
String getChangeReqId();
|
||||
|
||||
/**
|
||||
* Get the change reason.
|
||||
*
|
||||
* @return the changeReason
|
||||
*/
|
||||
public String getChangeReason() {
|
||||
return changeReason;
|
||||
}
|
||||
String getChangeReason();
|
||||
|
||||
/**
|
||||
* @param changeReason the changeReason to set
|
||||
* Set the change reason.
|
||||
*
|
||||
* @param changeReason
|
||||
* the changeReason to set
|
||||
*/
|
||||
public void setChangeReason(String changeReason) {
|
||||
this.changeReason = changeReason;
|
||||
}
|
||||
void setChangeReason(String changeReason);
|
||||
|
||||
/**
|
||||
* Create the subscription this pending subscription represents.
|
||||
*
|
||||
* @return the subscription
|
||||
*/
|
||||
Subscription subscription();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Initial Pending User Subscription Object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 24, 2012 mpduff Initial creation
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor.
|
||||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Apr 02, 2013 1841 djohnson InitialPendingSubscription is now InitialPendingUserSubscription.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject(value = { Subscription.PROVIDER_NAME_SLOT,
|
||||
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
|
||||
Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT })
|
||||
public class InitialPendingUserSubscription extends UserSubscription implements
|
||||
InitialPendingSubscription {
|
||||
private static final long serialVersionUID = 2779084460608459754L;
|
||||
|
||||
/** ID of the user requesting the change */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
@SlotAttribute(InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT)
|
||||
private String changeReqId;
|
||||
|
||||
/** Reason for requesting the change */
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String changeReason;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public InitialPendingUserSubscription() {
|
||||
//empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param subscription
|
||||
* subscription object
|
||||
* @param user
|
||||
* user
|
||||
*/
|
||||
public InitialPendingUserSubscription(UserSubscription subscription, String user) {
|
||||
super(subscription);
|
||||
|
||||
this.setChangeReqId(user);
|
||||
this.setDeleted(subscription.isDeleted());
|
||||
this.setId(RegistryUtil.getRegistryObjectKey(this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param changeReqId the changeReqId to set
|
||||
*/
|
||||
@Override
|
||||
public void setChangeReqId(String changeReqId) {
|
||||
this.changeReqId = changeReqId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the changeReqId
|
||||
*/
|
||||
@Override
|
||||
public String getChangeReqId() {
|
||||
return changeReqId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the changeReason
|
||||
*/
|
||||
@Override
|
||||
public String getChangeReason() {
|
||||
return changeReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param changeReason the changeReason to set
|
||||
*/
|
||||
@Override
|
||||
public void setChangeReason(String changeReason) {
|
||||
this.changeReason = changeReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Subscription subscription() {
|
||||
return new UserSubscription(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.registry.annotations.AssociationMapping;
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
* Pending Subscription for shared subscriptions.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject(objectType = InitialPendingSharedSubscription.class,
|
||||
value = { Subscription.PROVIDER_NAME_SLOT,
|
||||
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
|
||||
Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = RegistryUtil.ASSOCIATION_RELATED_TO, keyFields = {
|
||||
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
|
||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = SharedSubscription.class) })
|
||||
public class PendingSharedSubscription extends InitialPendingSharedSubscription
|
||||
implements PendingSubscription, ISerializableObject {
|
||||
|
||||
private static final long serialVersionUID = 7607153845750089310L;
|
||||
|
||||
public PendingSharedSubscription() {
|
||||
|
||||
}
|
||||
|
||||
public PendingSharedSubscription(SharedSubscription subscription,
|
||||
String currentUser) {
|
||||
super(subscription, currentUser);
|
||||
}
|
||||
|
||||
}
|
|
@ -19,18 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.registry.annotations.AssociationMapping;
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
* Pending Subscription Object.
|
||||
* Pending Subscription definition.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -38,42 +28,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 8, 2012 mpduff Initial creation
|
||||
* Aug 27, 2012 0743 djohnson Fix copy constructor, add association annotations.
|
||||
* Sep 14, 2012 1169 djohnson Include owner in the registry id and association.
|
||||
* Sep 24, 2012 1157 mpduff Changed to extend IniitialPendingSubscription.
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Apr 04, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject(objectType = InitialPendingSubscription.class,
|
||||
value = { Subscription.PROVIDER_NAME_SLOT,
|
||||
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
|
||||
Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = RegistryUtil.ASSOCIATION_RELATED_TO, keyFields = {
|
||||
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
|
||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = UserSubscription.class) })
|
||||
public class PendingSubscription extends InitialPendingSubscription
|
||||
implements ISerializableObject {
|
||||
|
||||
private static final long serialVersionUID = 7607153845750089310L;
|
||||
|
||||
public PendingSubscription() {
|
||||
|
||||
}
|
||||
|
||||
public PendingSubscription(UserSubscription subscription,
|
||||
String currentUser) {
|
||||
super(subscription, currentUser);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public interface PendingSubscription extends InitialPendingSubscription {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.registry.annotations.AssociationMapping;
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
* Pending Subscription Object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 8, 2012 mpduff Initial creation
|
||||
* Aug 27, 2012 0743 djohnson Fix copy constructor, add association annotations.
|
||||
* Sep 14, 2012 1169 djohnson Include owner in the registry id and association.
|
||||
* Sep 24, 2012 1157 mpduff Changed to extend IniitialPendingSubscription.
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject(objectType = InitialPendingUserSubscription.class,
|
||||
value = { Subscription.PROVIDER_NAME_SLOT,
|
||||
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
|
||||
Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = RegistryUtil.ASSOCIATION_RELATED_TO, keyFields = {
|
||||
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
|
||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = UserSubscription.class) })
|
||||
public class PendingUserSubscription extends InitialPendingUserSubscription
|
||||
implements PendingSubscription, ISerializableObject {
|
||||
|
||||
private static final long serialVersionUID = 7607153845750089310L;
|
||||
|
||||
public PendingUserSubscription() {
|
||||
|
||||
}
|
||||
|
||||
public PendingUserSubscription(UserSubscription subscription,
|
||||
String currentUser) {
|
||||
super(subscription, currentUser);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -60,8 +60,9 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlSeeAlso({ PendingSubscription.class, AdhocSubscription.class,
|
||||
UserSubscription.class, SharedSubscription.class })
|
||||
@XmlSeeAlso({ PendingUserSubscription.class, PendingSharedSubscription.class,
|
||||
AdhocSubscription.class, UserSubscription.class,
|
||||
SharedSubscription.class })
|
||||
public abstract class RecurringSubscription implements ISerializableObject,
|
||||
Serializable, Subscription {
|
||||
|
||||
|
|
|
@ -104,8 +104,7 @@ public class SharedSubscription extends RecurringSubscription {
|
|||
*/
|
||||
@Override
|
||||
public InitialPendingSubscription initialPending(String currentUser) {
|
||||
// TODO: Implement pending subscription types for shared subscriptions
|
||||
return null;
|
||||
return new InitialPendingSharedSubscription(this, currentUser);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,7 +112,6 @@ public class SharedSubscription extends RecurringSubscription {
|
|||
*/
|
||||
@Override
|
||||
public PendingSubscription pending(String currentUser) {
|
||||
// TODO: Implement pending subscription types for shared subscriptions
|
||||
return null;
|
||||
return new PendingSharedSubscription(this, currentUser);
|
||||
}
|
||||
}
|
|
@ -149,7 +149,7 @@ public class UserSubscription extends RecurringSubscription {
|
|||
*/
|
||||
@Override
|
||||
public InitialPendingSubscription initialPending(String currentUser) {
|
||||
return new InitialPendingSubscription(this, currentUser);
|
||||
return new InitialPendingUserSubscription(this, currentUser);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,6 +157,6 @@ public class UserSubscription extends RecurringSubscription {
|
|||
*/
|
||||
@Override
|
||||
public PendingSubscription pending(String currentUser) {
|
||||
return new PendingSubscription(this, currentUser);
|
||||
return new PendingUserSubscription(this, currentUser);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.ebxml;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSharedSubscription;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
* Implementation of {@link SubscriptionFilterableQuery} to retrieve
|
||||
* {@link InitialPendingSharedSubscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class PendingSharedSubscriptionQuery extends
|
||||
SubscriptionFilterableQuery<InitialPendingSharedSubscription> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<InitialPendingSharedSubscription> getResultType() {
|
||||
return InitialPendingSharedSubscription.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<InitialPendingSharedSubscription> getObjectType() {
|
||||
return InitialPendingSharedSubscription.class;
|
||||
}
|
||||
}
|
|
@ -22,48 +22,47 @@ package com.raytheon.uf.common.datadelivery.registry.ebxml;
|
|||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
* Implementation of {@link SubscriptionFilterableQuery} to retrieve
|
||||
* {@link PendingSubscription}s.
|
||||
*
|
||||
* {@link InitialPendingSubscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 8, 2012 mpduff Initial creation
|
||||
* Jun 21, 2012 736 djohnson Add thrift serialization annotations.
|
||||
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
|
||||
* Sep 24, 2012 1157 mpduff Extends InitialPendingSubscriptionQuery.
|
||||
*
|
||||
* Sep 24, 2012 1157 mpduff Extends InitialPendingUserSubscriptionQuery.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class PendingSubscriptionQuery extends
|
||||
SubscriptionFilterableQuery<InitialPendingSubscription> {
|
||||
public class PendingUserSubscriptionQuery extends
|
||||
SubscriptionFilterableQuery<InitialPendingUserSubscription> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<InitialPendingSubscription> getResultType() {
|
||||
return InitialPendingSubscription.class;
|
||||
public Class<InitialPendingUserSubscription> getResultType() {
|
||||
return InitialPendingUserSubscription.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<InitialPendingSubscription> getObjectType() {
|
||||
return InitialPendingSubscription.class;
|
||||
public Class<InitialPendingUserSubscription> getObjectType() {
|
||||
return InitialPendingUserSubscription.class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.ebxml;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
* Implementation of {@link SubscriptionFilterableQuery} to retrieve
|
||||
* {@link SharedSubscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 05, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class SharedSubscriptionQuery extends
|
||||
SubscriptionFilterableQuery<SharedSubscription> {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<SharedSubscription> getResultType() {
|
||||
return SharedSubscription.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<SharedSubscription> getObjectType() {
|
||||
return SharedSubscription.class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for
|
||||
* {@link InitialPendingSubscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2013 1841 djohnson Extracted from PendingSubscriptionHandler and genericized.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class BasePendingSubscriptionHandler<T extends InitialPendingSubscription, QUERY extends SubscriptionFilterableQuery<T>>
|
||||
extends BaseSubscriptionHandler<T, QUERY> implements
|
||||
IBasePendingSubscriptionHandler<T> {
|
||||
|
||||
/**
|
||||
* Overridden because pending subscriptions must also have their
|
||||
* associations to their {@link Subscription} objects deleted.
|
||||
*
|
||||
* @param username
|
||||
* the username
|
||||
* @param objects
|
||||
* the objects to delete
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(String username, List<String> ids)
|
||||
throws RegistryHandlerException {
|
||||
|
||||
for (String id : ids) {
|
||||
deleteAssociationToSubscription(id);
|
||||
}
|
||||
|
||||
super.deleteByIds(username, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the association from a {@link InitialPendingSubscription} to a
|
||||
* {@link Subscription}.
|
||||
*
|
||||
* @param id
|
||||
* the pending subscription id
|
||||
* @throws RegistryHandlerException
|
||||
* on unsuccessful response from the registry
|
||||
*/
|
||||
private void deleteAssociationToSubscription(String id)
|
||||
throws RegistryHandlerException {
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setSourceObjectId(id);
|
||||
query.setReturnObjects(false);
|
||||
|
||||
// Delete associations
|
||||
RegistryResponse<Object> removalResponse = RegistryManager
|
||||
.removeRegistyObjects(query);
|
||||
|
||||
checkResponse(removalResponse, "deleteAssociationToSubscription");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public T getBySubscription(Subscription subscription)
|
||||
throws RegistryHandlerException {
|
||||
return getBySubscriptionId(RegistryUtil
|
||||
.getRegistryObjectKey(subscription));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public T getBySubscriptionId(final String id)
|
||||
throws RegistryHandlerException {
|
||||
// Checks for the existence of a pending subscription
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setTargetObjectId(id);
|
||||
query.setReturnObjects(true);
|
||||
|
||||
RegistryQueryResponse<Object> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
|
||||
checkResponse(response, "getBySubscriptionId");
|
||||
|
||||
List<Object> results = response.getResults();
|
||||
// Currently only InitialPendingSubscriptions are associated to
|
||||
// Subscriptions,
|
||||
// but there could be other types of objects in the future
|
||||
Class<T> registryObjectClass = getRegistryObjectClass();
|
||||
for (Object obj : results) {
|
||||
if (registryObjectClass.isAssignableFrom(obj.getClass())) {
|
||||
return registryObjectClass.cast(obj);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public List<T> getBySubscriptions(Collection<Subscription> subscriptions)
|
||||
throws RegistryHandlerException {
|
||||
List<String> ids = new ArrayList<String>(subscriptions.size());
|
||||
for (Subscription subscription : subscriptions) {
|
||||
ids.add(RegistryUtil.getRegistryObjectKey(subscription));
|
||||
}
|
||||
|
||||
return getBySubscriptionIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<T> getBySubscriptionIds(final List<String> ids)
|
||||
throws RegistryHandlerException {
|
||||
List<T> pending = new ArrayList<T>();
|
||||
|
||||
for (String id : ids) {
|
||||
T possiblePending = getBySubscriptionId(id);
|
||||
if (possiblePending != null) {
|
||||
pending.add(possiblePending);
|
||||
}
|
||||
}
|
||||
|
||||
return pending;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* The {@link IRegistryObjectHandler} interface for
|
||||
* {@link InitialPendingSubscription}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2012 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IBasePendingSubscriptionHandler<T extends InitialPendingSubscription>
|
||||
extends IBaseSubscriptionHandler<T> {
|
||||
|
||||
/**
|
||||
* Get the {@link InitialPendingSubscription} associated with a
|
||||
* {@link Subscription}.
|
||||
*
|
||||
* @param subscription
|
||||
* the subscription
|
||||
* @return the pending subscription
|
||||
* @throws RegistryHandlerException
|
||||
* if an unsuccessful response is received from the registry
|
||||
*/
|
||||
T getBySubscription(Subscription subscription)
|
||||
throws RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* Get the {@link InitialPendingSubscription} associated with a
|
||||
* {@link Subscription} by the subscription id.
|
||||
*
|
||||
* @param id
|
||||
* the subscription's id
|
||||
* @return the pending subscription
|
||||
* @throws RegistryHandlerException
|
||||
* if an unsuccessful response is received from the registry
|
||||
*/
|
||||
T getBySubscriptionId(String id)
|
||||
throws RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* Get the {@link InitialPendingSubscription}s associated with a collection
|
||||
* of {@link Subscription}s.
|
||||
*
|
||||
* @param subscriptions
|
||||
* the subscriptions
|
||||
* @return the pending subscriptions
|
||||
* @throws RegistryHandlerException
|
||||
* if an unsuccessful response is received from the registry
|
||||
*/
|
||||
List<T> getBySubscriptions(
|
||||
Collection<Subscription> subscriptions)
|
||||
throws RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* Get the {@link InitialPendingSubscription}s associated with a collection
|
||||
* of {@link Subscription} ids.
|
||||
*
|
||||
* @param ids
|
||||
* the ids
|
||||
* @return the pending subscriptions
|
||||
* @throws RegistryHandlerException
|
||||
* if an unsuccessful response is received from the registry
|
||||
*/
|
||||
List<T> getBySubscriptionIds(List<String> ids)
|
||||
throws RegistryHandlerException;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSharedSubscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
||||
/**
|
||||
* The {@link IRegistryObjectHandler} interface for
|
||||
* {@link InitialPendingSharedSubscription}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2012 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IPendingSharedSubscriptionHandler extends
|
||||
IBasePendingSubscriptionHandler<InitialPendingSharedSubscription> {
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
||||
/**
|
||||
* The {@link IRegistryObjectHandler} interface for
|
||||
* {@link InitialPendingUserSubscription}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 18, 2012 1169 djohnson Initial creation
|
||||
* Sep 24, 2012 1157 mpduff Change to use InitialPendingUserSubscription.
|
||||
* Sep 28, 2012 1187 djohnson Extend {@link IBaseSubscriptionHandler}.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface IPendingUserSubscriptionHandler extends
|
||||
IBasePendingSubscriptionHandler<InitialPendingUserSubscription> {
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
||||
/**
|
||||
* The {@link IRegistryObjectHandler} interface for {@link SharedSubscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 05, 2013 1841 djohnson Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface ISharedSubscriptionHandler extends
|
||||
ISubscriptionTypeHandler<SharedSubscription> {
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* The {@link IRegistryObjectHandler} interface for {@link Subscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 05, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface ISubscriptionTypeHandler<T extends Subscription> extends
|
||||
IBaseSubscriptionHandler<T> {
|
||||
|
||||
/**
|
||||
* Retrieve a subscription that a {@link PendingSubscription} is associated
|
||||
* to.
|
||||
*
|
||||
* @param pending
|
||||
* the pending subscription
|
||||
* @return the subscription, or null if not found
|
||||
* @throws RegistryHandlerException
|
||||
*/
|
||||
T getByPendingSubscription(
|
||||
PendingSubscription pending)
|
||||
throws RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* Retrieve a subscription that a {@link PendingSubscription} is associated
|
||||
* to by the pending subscription's id.
|
||||
*
|
||||
* @param id
|
||||
* the pending subscription id
|
||||
* @return the subscription, or null if not found
|
||||
* @throws RegistryHandlerException
|
||||
*/
|
||||
T getByPendingSubscriptionId(String id)
|
||||
throws RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* Retrieve active subscriptions for the dataset name and provider.
|
||||
*
|
||||
* @param dataSetName
|
||||
* the dataset name
|
||||
* @param providerName
|
||||
* the provider name
|
||||
*/
|
||||
List<T> getActiveByDataSetAndProvider(String dataSetName,
|
||||
String providerName) throws RegistryHandlerException;
|
||||
}
|
|
@ -19,13 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* The {@link IRegistryObjectHandler} interface for {@link Subscription}s.
|
||||
|
@ -46,41 +42,5 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
* @version 1.0
|
||||
*/
|
||||
public interface IUserSubscriptionHandler extends
|
||||
IBaseSubscriptionHandler<UserSubscription> {
|
||||
|
||||
/**
|
||||
* Retrieve a subscription that a {@link PendingSubscription} is associated
|
||||
* to.
|
||||
*
|
||||
* @param pending
|
||||
* the pending subscription
|
||||
* @return the subscription, or null if not found
|
||||
* @throws RegistryHandlerException
|
||||
*/
|
||||
UserSubscription getByPendingSubscription(
|
||||
PendingSubscription pending)
|
||||
throws RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* Retrieve a subscription that a {@link PendingSubscription} is associated
|
||||
* to by the pending subscription's id.
|
||||
*
|
||||
* @param id
|
||||
* the pending subscription id
|
||||
* @return the subscription, or null if not found
|
||||
* @throws RegistryHandlerException
|
||||
*/
|
||||
UserSubscription getByPendingSubscriptionId(String id)
|
||||
throws RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* Retrieve active subscriptions for the dataset name and provider.
|
||||
*
|
||||
* @param dataSetName
|
||||
* the dataset name
|
||||
* @param providerName
|
||||
* the provider name
|
||||
*/
|
||||
List<UserSubscription> getActiveByDataSetAndProvider(String dataSetName,
|
||||
String providerName) throws RegistryHandlerException;
|
||||
ISubscriptionTypeHandler<UserSubscription> {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSharedSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.PendingSharedSubscriptionQuery;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for
|
||||
* {@link InitialPendingSharedSubscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PendingSharedSubscriptionHandler extends
|
||||
BasePendingSubscriptionHandler<InitialPendingSharedSubscription, PendingSharedSubscriptionQuery>
|
||||
implements IPendingSharedSubscriptionHandler {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected PendingSharedSubscriptionQuery getQuery() {
|
||||
return new PendingSharedSubscriptionQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class<InitialPendingSharedSubscription> getRegistryObjectClass() {
|
||||
return InitialPendingSharedSubscription.class;
|
||||
}
|
||||
}
|
|
@ -21,18 +21,21 @@ package com.raytheon.uf.common.datadelivery.registry.handlers;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSharedSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.PendingSubscriptionQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for
|
||||
|
@ -52,140 +55,329 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PendingSubscriptionHandler extends
|
||||
BaseSubscriptionHandler<InitialPendingSubscription, PendingSubscriptionQuery>
|
||||
implements
|
||||
IPendingSubscriptionHandler {
|
||||
public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
|
||||
|
||||
private final IPendingUserSubscriptionHandler userSubscriptionHandler;
|
||||
|
||||
private final IPendingSharedSubscriptionHandler sharedSubscriptionHandler;
|
||||
|
||||
/**
|
||||
* Overridden because pending subscriptions must also have their
|
||||
* associations to their {@link Subscription} objects deleted.
|
||||
*
|
||||
* @param username
|
||||
* the username
|
||||
* @param objects
|
||||
* the objects to delete
|
||||
* Constructor.
|
||||
*
|
||||
* @param userSubscriptionHandler
|
||||
* the user subscription handler
|
||||
* @param sharedSubscriptionHandler
|
||||
* the shared subscription handler
|
||||
*/
|
||||
public PendingSubscriptionHandler(
|
||||
IPendingUserSubscriptionHandler userSubscriptionHandler,
|
||||
IPendingSharedSubscriptionHandler sharedSubscriptionHandler) {
|
||||
this.userSubscriptionHandler = userSubscriptionHandler;
|
||||
this.sharedSubscriptionHandler = sharedSubscriptionHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(String username, List<String> ids)
|
||||
public InitialPendingSubscription getByName(String name)
|
||||
throws RegistryHandlerException {
|
||||
|
||||
for (String id : ids) {
|
||||
deleteAssociationToSubscription(id);
|
||||
InitialPendingSubscription value = userSubscriptionHandler
|
||||
.getByName(name);
|
||||
if (value == null) {
|
||||
value = sharedSubscriptionHandler.getByName(name);
|
||||
}
|
||||
|
||||
super.deleteByIds(username, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the association from a {@link InitialPendingSubscription} to a
|
||||
* {@link Subscription}.
|
||||
*
|
||||
* @param id
|
||||
* the pending subscription id
|
||||
* @throws RegistryHandlerException
|
||||
* on unsuccessful response from the registry
|
||||
*/
|
||||
private void deleteAssociationToSubscription(String id)
|
||||
throws RegistryHandlerException {
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setSourceObjectId(id);
|
||||
query.setReturnObjects(false);
|
||||
|
||||
// Delete associations
|
||||
RegistryResponse<Object> removalResponse = RegistryManager
|
||||
.removeRegistyObjects(query);
|
||||
|
||||
checkResponse(removalResponse, "deleteAssociationToSubscription");
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public InitialPendingSubscription getBySubscription(Subscription subscription)
|
||||
public List<InitialPendingSubscription> getByOwner(String owner)
|
||||
throws RegistryHandlerException {
|
||||
return getBySubscriptionId(RegistryUtil
|
||||
.getRegistryObjectKey(subscription));
|
||||
List<InitialPendingSubscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getByOwner(owner));
|
||||
subs.addAll(userSubscriptionHandler.getByOwner(owner));
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public InitialPendingSubscription getBySubscriptionId(final String id)
|
||||
public List<InitialPendingSubscription> getByGroupName(String group)
|
||||
throws RegistryHandlerException {
|
||||
// Checks for the existence of a pending subscription
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setTargetObjectId(id);
|
||||
query.setReturnObjects(true);
|
||||
List<InitialPendingSubscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getByGroupName(group));
|
||||
subs.addAll(sharedSubscriptionHandler.getByGroupName(group));
|
||||
return subs;
|
||||
}
|
||||
|
||||
RegistryQueryResponse<Object> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<InitialPendingSubscription> getByFilters(String group,
|
||||
String officeId) throws RegistryHandlerException {
|
||||
List<InitialPendingSubscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getByFilters(group, officeId));
|
||||
subs.addAll(sharedSubscriptionHandler.getByFilters(group, officeId));
|
||||
return subs;
|
||||
}
|
||||
|
||||
checkResponse(response, "getBySubscriptionId");
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getSubscribedToDataSetNames()
|
||||
throws RegistryHandlerException {
|
||||
Set<String> names = Sets.newHashSet();
|
||||
names.addAll(userSubscriptionHandler.getSubscribedToDataSetNames());
|
||||
names.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames());
|
||||
return names;
|
||||
}
|
||||
|
||||
List<Object> results = response.getResults();
|
||||
// Currently only InitialPendingSubscriptions are associated to Subscriptions,
|
||||
// but there could be other types of objects in the future
|
||||
for (Object obj : results) {
|
||||
if (obj instanceof InitialPendingSubscription) {
|
||||
return InitialPendingSubscription.class.cast(obj);
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<InitialPendingSubscription> getActive()
|
||||
throws RegistryHandlerException {
|
||||
List<InitialPendingSubscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getActive());
|
||||
subs.addAll(sharedSubscriptionHandler.getActive());
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<InitialPendingSubscription> getActiveForRoute(Network route)
|
||||
throws RegistryHandlerException {
|
||||
List<InitialPendingSubscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getActiveForRoute(route));
|
||||
subs.addAll(sharedSubscriptionHandler.getActiveForRoute(route));
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<InitialPendingSubscription> getActiveForRoutes(
|
||||
Network... routes) throws RegistryHandlerException {
|
||||
List<InitialPendingSubscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getActiveForRoutes(routes));
|
||||
subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes));
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public InitialPendingSubscription getById(String id)
|
||||
throws RegistryHandlerException {
|
||||
InitialPendingSubscription value = userSubscriptionHandler.getById(id);
|
||||
if (value == null) {
|
||||
value = sharedSubscriptionHandler.getById(id);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<InitialPendingSubscription> getAll()
|
||||
throws RegistryHandlerException {
|
||||
List<InitialPendingSubscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getAll());
|
||||
subs.addAll(sharedSubscriptionHandler.getAll());
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void store(InitialPendingSubscription obj)
|
||||
throws RegistryHandlerException {
|
||||
if (obj instanceof InitialPendingUserSubscription) {
|
||||
userSubscriptionHandler.store((InitialPendingUserSubscription) obj);
|
||||
} else {
|
||||
sharedSubscriptionHandler
|
||||
.store((InitialPendingSharedSubscription) obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void update(InitialPendingSubscription obj)
|
||||
throws RegistryHandlerException {
|
||||
if (obj instanceof InitialPendingUserSubscription) {
|
||||
userSubscriptionHandler
|
||||
.update((InitialPendingUserSubscription) obj);
|
||||
} else {
|
||||
sharedSubscriptionHandler
|
||||
.update((InitialPendingSharedSubscription) obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void delete(InitialPendingSubscription obj)
|
||||
throws RegistryHandlerException {
|
||||
if (obj instanceof InitialPendingUserSubscription) {
|
||||
userSubscriptionHandler
|
||||
.delete((InitialPendingUserSubscription) obj);
|
||||
} else {
|
||||
sharedSubscriptionHandler
|
||||
.delete((InitialPendingSharedSubscription) obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String username, String registryId)
|
||||
throws RegistryHandlerException {
|
||||
userSubscriptionHandler.deleteById(username, registryId);
|
||||
sharedSubscriptionHandler.deleteById(username, registryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(String username, List<String> registryIds)
|
||||
throws RegistryHandlerException {
|
||||
userSubscriptionHandler.deleteByIds(username, registryIds);
|
||||
sharedSubscriptionHandler.deleteByIds(username, registryIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void delete(String username, InitialPendingSubscription obj)
|
||||
throws RegistryHandlerException {
|
||||
if (obj instanceof InitialPendingUserSubscription) {
|
||||
userSubscriptionHandler.delete(username,
|
||||
(InitialPendingUserSubscription) obj);
|
||||
} else {
|
||||
sharedSubscriptionHandler.delete(username,
|
||||
(InitialPendingSharedSubscription) obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void delete(Collection<InitialPendingSubscription> objects)
|
||||
throws RegistryHandlerException {
|
||||
if (!CollectionUtil.isNullOrEmpty(objects)) {
|
||||
final Collection asSubtype = objects;
|
||||
if (objects.iterator().next() instanceof InitialPendingUserSubscription) {
|
||||
userSubscriptionHandler.delete(asSubtype);
|
||||
} else {
|
||||
sharedSubscriptionHandler.delete(asSubtype);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void delete(String username,
|
||||
Collection<InitialPendingSubscription> objects)
|
||||
throws RegistryHandlerException {
|
||||
if (!CollectionUtil.isNullOrEmpty(objects)) {
|
||||
final Collection asSubtype = objects;
|
||||
if (objects.iterator().next() instanceof UserSubscription) {
|
||||
userSubscriptionHandler.delete(username, asSubtype);
|
||||
} else {
|
||||
sharedSubscriptionHandler.delete(username, asSubtype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public InitialPendingSubscription getBySubscription(
|
||||
Subscription subscription) throws RegistryHandlerException {
|
||||
if (subscription instanceof UserSubscription) {
|
||||
return userSubscriptionHandler.getBySubscription(subscription);
|
||||
} else {
|
||||
return sharedSubscriptionHandler.getBySubscription(subscription);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public InitialPendingSubscription getBySubscriptionId(String id)
|
||||
throws RegistryHandlerException {
|
||||
InitialPendingSubscription value = userSubscriptionHandler.getById(id);
|
||||
if (value == null) {
|
||||
value = sharedSubscriptionHandler.getById(id);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public List<InitialPendingSubscription> getBySubscriptions(
|
||||
Collection<Subscription> subscriptions)
|
||||
throws RegistryHandlerException {
|
||||
List<String> ids = new ArrayList<String>(subscriptions.size());
|
||||
for (Subscription subscription : subscriptions) {
|
||||
ids.add(RegistryUtil.getRegistryObjectKey(subscription));
|
||||
}
|
||||
|
||||
return getBySubscriptionIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<InitialPendingSubscription> getBySubscriptionIds(final List<String> ids)
|
||||
throws RegistryHandlerException {
|
||||
List<InitialPendingSubscription> pending = new ArrayList<InitialPendingSubscription>();
|
||||
|
||||
for (String id : ids) {
|
||||
InitialPendingSubscription possiblePending = getBySubscriptionId(id);
|
||||
if (possiblePending != null) {
|
||||
pending.add(possiblePending);
|
||||
if (!CollectionUtil.isNullOrEmpty(subscriptions)) {
|
||||
final Collection asSubtype = subscriptions;
|
||||
if (subscriptions.iterator().next() instanceof UserSubscription) {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler
|
||||
.getBySubscriptions(asSubtype));
|
||||
} else {
|
||||
return nullOrSubscriptionList(sharedSubscriptionHandler
|
||||
.getBySubscriptions(asSubtype));
|
||||
}
|
||||
}
|
||||
|
||||
return pending;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected PendingSubscriptionQuery getQuery() {
|
||||
return new PendingSubscriptionQuery();
|
||||
public List<InitialPendingSubscription> getBySubscriptionIds(
|
||||
List<String> ids) throws RegistryHandlerException {
|
||||
List<InitialPendingSubscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getBySubscriptionIds(ids));
|
||||
subs.addAll(sharedSubscriptionHandler.getBySubscriptionIds(ids));
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class<InitialPendingSubscription> getRegistryObjectClass() {
|
||||
return InitialPendingSubscription.class;
|
||||
private List<InitialPendingSubscription> nullOrSubscriptionList(
|
||||
List<? extends InitialPendingSubscription> subscriptionList) {
|
||||
if (subscriptionList == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new ArrayList<InitialPendingSubscription>(subscriptionList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.PendingUserSubscriptionQuery;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for
|
||||
* {@link InitialPendingUserSubscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 18, 2012 1169 djohnson Initial creation
|
||||
* Sep 24, 2012 1157 mpduff Changed to use InitialPendingUserSubscription.
|
||||
* Apr 04, 2013 1841 djohnson Extracted most methods to base class.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PendingUserSubscriptionHandler extends
|
||||
BasePendingSubscriptionHandler<InitialPendingUserSubscription, PendingUserSubscriptionQuery>
|
||||
implements IPendingUserSubscriptionHandler {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected PendingUserSubscriptionQuery getQuery() {
|
||||
return new PendingUserSubscriptionQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class<InitialPendingUserSubscription> getRegistryObjectClass() {
|
||||
return InitialPendingUserSubscription.class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SharedSubscriptionQuery;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for {@link SharedSubscription}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 05, 2013 1841 djohnson Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SharedSubscriptionHandler extends
|
||||
SubscriptionTypeHandler<SharedSubscription, SharedSubscriptionQuery>
|
||||
implements ISharedSubscriptionHandler {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected SharedSubscriptionQuery getQuery() {
|
||||
return new SharedSubscriptionQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class<SharedSubscription> getRegistryObjectClass() {
|
||||
return SharedSubscription.class;
|
||||
}
|
||||
}
|
|
@ -19,24 +19,24 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingUserSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for {@link Subscription}.
|
||||
* Currently only handles {@link UserSubscription} types.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -45,6 +45,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 28, 2013 1841 djohnson Initial creation
|
||||
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -53,21 +54,23 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
*/
|
||||
public class SubscriptionHandler implements ISubscriptionHandler {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SubscriptionHandler.class);
|
||||
|
||||
private static final String SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED = "Shared subscriptions are not currently supported.";
|
||||
|
||||
private final IUserSubscriptionHandler userSubscriptionHandler;
|
||||
|
||||
private final ISharedSubscriptionHandler sharedSubscriptionHandler;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param userSubscriptionHandler
|
||||
* the user subscription handler
|
||||
* @param sharedSubscriptionHandler
|
||||
* the shared subscription handler
|
||||
*/
|
||||
public SubscriptionHandler(IUserSubscriptionHandler userSubscriptionHandler) {
|
||||
public SubscriptionHandler(
|
||||
IUserSubscriptionHandler userSubscriptionHandler,
|
||||
ISharedSubscriptionHandler sharedSubscriptionHandler) {
|
||||
this.userSubscriptionHandler = userSubscriptionHandler;
|
||||
this.sharedSubscriptionHandler = sharedSubscriptionHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +79,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public Subscription getByPendingSubscription(PendingSubscription pending)
|
||||
throws RegistryHandlerException {
|
||||
return userSubscriptionHandler.getByPendingSubscription(pending);
|
||||
if (pending instanceof PendingUserSubscription) {
|
||||
return userSubscriptionHandler.getByPendingSubscription(pending);
|
||||
} else {
|
||||
return sharedSubscriptionHandler.getByPendingSubscription(pending);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,7 +92,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public Subscription getByPendingSubscriptionId(final String id)
|
||||
throws RegistryHandlerException {
|
||||
return userSubscriptionHandler.getByPendingSubscriptionId(id);
|
||||
Subscription value = userSubscriptionHandler.getById(id);
|
||||
if (value == null) {
|
||||
value = sharedSubscriptionHandler.getById(id);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +105,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public void deleteByIds(String username, List<String> ids)
|
||||
throws RegistryHandlerException {
|
||||
this.userSubscriptionHandler.deleteByIds(username, ids);
|
||||
userSubscriptionHandler.deleteByIds(username, ids);
|
||||
sharedSubscriptionHandler.deleteByIds(username, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,8 +115,13 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public List<Subscription> getActiveByDataSetAndProvider(String dataSetName,
|
||||
String providerName) throws RegistryHandlerException {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler
|
||||
.getActiveByDataSetAndProvider(dataSetName, providerName));
|
||||
List<Subscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getActiveByDataSetAndProvider(
|
||||
dataSetName, providerName));
|
||||
subs.addAll(sharedSubscriptionHandler.getActiveByDataSetAndProvider(
|
||||
dataSetName, providerName));
|
||||
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,7 +129,12 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
*/
|
||||
@Override
|
||||
public Subscription getByName(String name) throws RegistryHandlerException {
|
||||
return userSubscriptionHandler.getByName(name);
|
||||
Subscription value = userSubscriptionHandler
|
||||
.getByName(name);
|
||||
if (value == null) {
|
||||
value = sharedSubscriptionHandler.getByName(name);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,7 +143,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public List<Subscription> getByOwner(String owner)
|
||||
throws RegistryHandlerException {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler.getByOwner(owner));
|
||||
List<Subscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getByOwner(owner));
|
||||
subs.addAll(sharedSubscriptionHandler.getByOwner(owner));
|
||||
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,8 +156,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public List<Subscription> getByGroupName(String group)
|
||||
throws RegistryHandlerException {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler
|
||||
.getByGroupName(group));
|
||||
List<Subscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getByGroupName(group));
|
||||
subs.addAll(sharedSubscriptionHandler.getByGroupName(group));
|
||||
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,8 +169,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public List<Subscription> getByFilters(String group, String officeId)
|
||||
throws RegistryHandlerException {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler.getByFilters(
|
||||
group, officeId));
|
||||
List<Subscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getByFilters(group, officeId));
|
||||
subs.addAll(sharedSubscriptionHandler.getByFilters(group, officeId));
|
||||
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,7 +182,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public Set<String> getSubscribedToDataSetNames()
|
||||
throws RegistryHandlerException {
|
||||
return userSubscriptionHandler.getSubscribedToDataSetNames();
|
||||
Set<String> set = Sets.newHashSet();
|
||||
set.addAll(userSubscriptionHandler.getSubscribedToDataSetNames());
|
||||
set.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames());
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,7 +194,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
*/
|
||||
@Override
|
||||
public List<Subscription> getActive() throws RegistryHandlerException {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler.getActive());
|
||||
List<Subscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getActive());
|
||||
subs.addAll(sharedSubscriptionHandler.getActive());
|
||||
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,8 +207,10 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public List<Subscription> getActiveForRoute(Network route)
|
||||
throws RegistryHandlerException {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler
|
||||
.getActiveForRoute(route));
|
||||
List<Subscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getActiveForRoute(route));
|
||||
subs.addAll(sharedSubscriptionHandler.getActiveForRoute(route));
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,8 +219,10 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
@Override
|
||||
public List<Subscription> getActiveForRoutes(Network... routes)
|
||||
throws RegistryHandlerException {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler
|
||||
.getActiveForRoutes(routes));
|
||||
List<Subscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getActiveForRoutes(routes));
|
||||
subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes));
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +230,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
*/
|
||||
@Override
|
||||
public Subscription getById(String id) throws RegistryHandlerException {
|
||||
return userSubscriptionHandler.getById(id);
|
||||
Subscription value = userSubscriptionHandler.getById(id);
|
||||
if (value == null) {
|
||||
value = sharedSubscriptionHandler.getById(id);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -194,7 +242,10 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
*/
|
||||
@Override
|
||||
public List<Subscription> getAll() throws RegistryHandlerException {
|
||||
return nullOrSubscriptionList(userSubscriptionHandler.getAll());
|
||||
List<Subscription> subs = Lists.newArrayList();
|
||||
subs.addAll(userSubscriptionHandler.getAll());
|
||||
subs.addAll(sharedSubscriptionHandler.getAll());
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,8 +256,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
if (obj instanceof UserSubscription) {
|
||||
userSubscriptionHandler.store((UserSubscription) obj);
|
||||
} else {
|
||||
statusHandler
|
||||
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
|
||||
sharedSubscriptionHandler.store((SharedSubscription) obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,8 +268,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
if (obj instanceof UserSubscription) {
|
||||
userSubscriptionHandler.update((UserSubscription) obj);
|
||||
} else {
|
||||
statusHandler
|
||||
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
|
||||
sharedSubscriptionHandler.update((SharedSubscription) obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,8 +280,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
if (obj instanceof UserSubscription) {
|
||||
userSubscriptionHandler.delete((UserSubscription) obj);
|
||||
} else {
|
||||
statusHandler
|
||||
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
|
||||
sharedSubscriptionHandler.delete((SharedSubscription) obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,6 +291,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
public void deleteById(String username, String registryId)
|
||||
throws RegistryHandlerException {
|
||||
userSubscriptionHandler.deleteById(username, registryId);
|
||||
sharedSubscriptionHandler.deleteById(username, registryId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,8 +303,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
if (obj instanceof UserSubscription) {
|
||||
userSubscriptionHandler.delete(username, (UserSubscription) obj);
|
||||
} else {
|
||||
statusHandler
|
||||
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
|
||||
sharedSubscriptionHandler
|
||||
.delete(username, (SharedSubscription) obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,12 +316,11 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
public void delete(Collection<Subscription> objects)
|
||||
throws RegistryHandlerException {
|
||||
if (!CollectionUtil.isNullOrEmpty(objects)) {
|
||||
final Collection asSubtype = objects;
|
||||
if (objects.iterator().next() instanceof UserSubscription) {
|
||||
final Collection asSubtype = objects;
|
||||
userSubscriptionHandler.delete(asSubtype);
|
||||
} else {
|
||||
statusHandler
|
||||
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
|
||||
sharedSubscriptionHandler.delete(asSubtype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,22 +333,12 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
public void delete(String username, Collection<Subscription> objects)
|
||||
throws RegistryHandlerException {
|
||||
if (!CollectionUtil.isNullOrEmpty(objects)) {
|
||||
final Collection asSubtype = objects;
|
||||
if (objects.iterator().next() instanceof UserSubscription) {
|
||||
final Collection asSubtype = objects;
|
||||
userSubscriptionHandler.delete(username, asSubtype);
|
||||
} else {
|
||||
statusHandler
|
||||
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
|
||||
sharedSubscriptionHandler.delete(username, asSubtype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Subscription> nullOrSubscriptionList(
|
||||
List<? extends Subscription> subscriptionList) {
|
||||
if (subscriptionList == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new ArrayList<Subscription>(subscriptionList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for {@link Subscription}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 05, 2013 1841 djohnson Extracted and genericized from UserSubscriptionHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class SubscriptionTypeHandler<T extends Subscription, QUERY extends SubscriptionFilterableQuery<T>>
|
||||
extends BaseSubscriptionHandler<T, QUERY> implements
|
||||
ISubscriptionTypeHandler<T> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public T getByPendingSubscription(PendingSubscription pending)
|
||||
throws RegistryHandlerException {
|
||||
return getByPendingSubscriptionId(RegistryUtil
|
||||
.getRegistryObjectKey(pending));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public T getByPendingSubscriptionId(final String id)
|
||||
throws RegistryHandlerException {
|
||||
// Checks for the existence of the subscription
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setSourceObjectId(id);
|
||||
query.setReturnObjects(true);
|
||||
|
||||
RegistryQueryResponse<Object> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
|
||||
checkResponse(response, "getByPendingSubscriptionId");
|
||||
|
||||
List<Object> results = response.getResults();
|
||||
// Currently only Subscriptions are associated to
|
||||
// PendingSubscriptions, but there could be other types of objects in
|
||||
// the future
|
||||
Class<T> registryObjectClass = getRegistryObjectClass();
|
||||
for (Object obj : results) {
|
||||
if (registryObjectClass.isAssignableFrom(obj.getClass())) {
|
||||
return registryObjectClass.cast(obj);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden because subscriptions must also have their
|
||||
* {@link PendingSubscription} object deleted.
|
||||
*
|
||||
* @param username
|
||||
* the username of the requester
|
||||
* @param ids
|
||||
* the registry ids of the subscription objects
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(String username, List<String> ids)
|
||||
throws RegistryHandlerException {
|
||||
IPendingSubscriptionHandler handler = RegistryObjectHandlers
|
||||
.get(IPendingSubscriptionHandler.class);
|
||||
|
||||
List<InitialPendingSubscription> pending = handler
|
||||
.getBySubscriptionIds(ids);
|
||||
if (!CollectionUtil.isNullOrEmpty(pending)) {
|
||||
handler.delete(username, pending);
|
||||
}
|
||||
|
||||
super.deleteByIds(username, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<T> getActiveByDataSetAndProvider(
|
||||
String dataSetName, String providerName)
|
||||
throws RegistryHandlerException {
|
||||
SubscriptionFilterableQuery<T> query = getQuery();
|
||||
query.setDataSetName(dataSetName);
|
||||
query.setProviderName(providerName);
|
||||
query.setActive(true);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
|
||||
checkResponse(response, "getActiveByDataSetAndProvider");
|
||||
|
||||
return response.getResults();
|
||||
}
|
||||
}
|
|
@ -19,24 +19,12 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.UserSubscriptionQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for {@link Subscription}.
|
||||
* {@link IRegistryObjectHandler} implementation for {@link UserSubscription}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -48,6 +36,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* Sep 24, 2012 1157 mpduff Change to use InitialPendingSubscription.
|
||||
* Oct 17, 2012 0726 djohnson Add {@link #getActiveByDataSetAndProvider}.
|
||||
* Mar 29, 2013 1841 djohnson Renamed from SubscriptionHandler.
|
||||
* Apr 05, 2013 1841 djohnson Extracted core logic to superclass.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -55,72 +44,9 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class UserSubscriptionHandler extends
|
||||
BaseSubscriptionHandler<UserSubscription, UserSubscriptionQuery>
|
||||
SubscriptionTypeHandler<UserSubscription, UserSubscriptionQuery>
|
||||
implements IUserSubscriptionHandler {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public UserSubscription getByPendingSubscription(PendingSubscription pending)
|
||||
throws RegistryHandlerException {
|
||||
return getByPendingSubscriptionId(RegistryUtil
|
||||
.getRegistryObjectKey(pending));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public UserSubscription getByPendingSubscriptionId(final String id)
|
||||
throws RegistryHandlerException {
|
||||
// Checks for the existence of the subscription
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setSourceObjectId(id);
|
||||
query.setReturnObjects(true);
|
||||
|
||||
RegistryQueryResponse<Object> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
|
||||
checkResponse(response, "getByPendingSubscriptionId");
|
||||
|
||||
List<Object> results = response.getResults();
|
||||
// Currently only Subscriptions are associated to
|
||||
// PendingSubscriptions, but there could be other types of objects in
|
||||
// the future
|
||||
for (Object obj : results) {
|
||||
if (obj instanceof Subscription) {
|
||||
return UserSubscription.class.cast(obj);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden because subscriptions must also have their
|
||||
* {@link PendingSubscription} object deleted.
|
||||
*
|
||||
* @param username
|
||||
* the username of the requester
|
||||
* @param ids
|
||||
* the registry ids of the subscription objects
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(String username, List<String> ids)
|
||||
throws RegistryHandlerException {
|
||||
IPendingSubscriptionHandler handler = RegistryObjectHandlers
|
||||
.get(IPendingSubscriptionHandler.class);
|
||||
|
||||
List<InitialPendingSubscription> pending = handler
|
||||
.getBySubscriptionIds(ids);
|
||||
if (!CollectionUtil.isNullOrEmpty(pending)) {
|
||||
handler.delete(username, pending);
|
||||
}
|
||||
|
||||
super.deleteByIds(username, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -136,24 +62,4 @@ public class UserSubscriptionHandler extends
|
|||
protected Class<UserSubscription> getRegistryObjectClass() {
|
||||
return UserSubscription.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<UserSubscription> getActiveByDataSetAndProvider(
|
||||
String dataSetName, String providerName)
|
||||
throws RegistryHandlerException {
|
||||
UserSubscriptionQuery query = getQuery();
|
||||
query.setDataSetName(dataSetName);
|
||||
query.setProviderName(providerName);
|
||||
query.setActive(true);
|
||||
|
||||
RegistryQueryResponse<UserSubscription> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
|
||||
checkResponse(response, "getActiveByDataSetAndProvider");
|
||||
|
||||
return response.getResults();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.service;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
|
@ -39,7 +40,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*/
|
||||
@DynamicSerialize
|
||||
public class DeniedPendingSubscriptionNotificationRequest extends
|
||||
SubscriptionNotificationRequest {
|
||||
BaseSubscriptionNotificationRequest<InitialPendingSubscription> {
|
||||
|
||||
/**
|
||||
* Id of the denied subscription.
|
||||
|
@ -54,7 +55,7 @@ public class DeniedPendingSubscriptionNotificationRequest extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public SubscriptionNotificationResponse getResponse() {
|
||||
public DeniedPendingSubscriptionNotificationResponse getResponse() {
|
||||
return new DeniedPendingSubscriptionNotificationResponse(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.service;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
|
@ -39,7 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*/
|
||||
@DynamicSerialize
|
||||
public class DeniedPendingSubscriptionNotificationResponse extends
|
||||
SubscriptionNotificationResponse {
|
||||
BaseSubscriptionNotificationResponse<InitialPendingSubscription> {
|
||||
/**
|
||||
* Id of the denied subscription.
|
||||
*/
|
||||
|
@ -73,4 +76,12 @@ public class DeniedPendingSubscriptionNotificationResponse extends
|
|||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public IBaseSubscriptionHandler<InitialPendingSubscription> getSubscriptionHandler() {
|
||||
return DataDeliveryHandlers.getPendingSubscriptionHandler();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.util;
|
||||
|
||||
/**
|
||||
* Interface for defining a condition matcher.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 02, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface IConditionMatcher<T> {
|
||||
|
||||
/**
|
||||
* Check whether an item matches a condition.
|
||||
*
|
||||
* @param item
|
||||
* the item
|
||||
* @return true if the item matches the condition
|
||||
*/
|
||||
boolean matchesCondition(T item);
|
||||
}
|
|
@ -6,16 +6,29 @@
|
|||
|
||||
<!-- Moved in to an EDEX specific file so that the registration of handlers
|
||||
Spring file can be reused for automated testing -->
|
||||
<bean name="UserSubscriptionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.UserSubscriptionHandler" />
|
||||
|
||||
<bean name="SubscriptionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler">
|
||||
<constructor-arg ref="UserSubscriptionHandler" />
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.UserSubscriptionHandler" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SharedSubscriptionHandler" />
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean name="PendingSubscriptionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler">
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingUserSubscriptionHandler" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSharedSubscriptionHandler" />
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean name="GroupDefinitionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GroupDefinitionHandler" />
|
||||
|
|
|
@ -86,5 +86,6 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.common.datadelivery.harvester"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/javax.jms"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -42,7 +42,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
|
|||
*/
|
||||
|
||||
public class PendingSubscriptionFixture extends
|
||||
BaseUserSubscriptionFixture<PendingSubscription> {
|
||||
BaseUserSubscriptionFixture<PendingUserSubscription> {
|
||||
|
||||
public static final PendingSubscriptionFixture INSTANCE = new PendingSubscriptionFixture();
|
||||
|
||||
|
@ -56,8 +56,8 @@ public class PendingSubscriptionFixture extends
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public PendingSubscription getInstance(long seedValue, Random random) {
|
||||
PendingSubscription sub = super.getInstance(seedValue, random);
|
||||
public PendingUserSubscription getInstance(long seedValue, Random random) {
|
||||
PendingUserSubscription sub = super.getInstance(seedValue, random);
|
||||
sub.setChangeReqId("change" + seedValue);
|
||||
|
||||
return sub;
|
||||
|
@ -67,8 +67,8 @@ public class PendingSubscriptionFixture extends
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected PendingSubscription getSubscription() {
|
||||
return new PendingSubscription();
|
||||
protected PendingUserSubscription getSubscription() {
|
||||
return new PendingUserSubscription();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class PendingSubscriptionTest {
|
|||
public void testCopyConstructorSetsOriginalSubNameAsName() {
|
||||
UserSubscription subscription = SubscriptionFixture.INSTANCE.get();
|
||||
|
||||
PendingSubscription pendingSubscription = new PendingSubscription(
|
||||
PendingUserSubscription pendingSubscription = new PendingUserSubscription(
|
||||
subscription, "djohnson");
|
||||
assertEquals(
|
||||
"The original subscription name should have been used for the pending subscription!",
|
||||
|
@ -58,7 +58,7 @@ public class PendingSubscriptionTest {
|
|||
public void testCopyConstructorSetsSubscriptionValuesOnPendingSubscription() {
|
||||
UserSubscription subscription = SubscriptionFixture.INSTANCE.get();
|
||||
|
||||
PendingSubscription copied = new PendingSubscription(
|
||||
PendingUserSubscription copied = new PendingUserSubscription(
|
||||
subscription, "djohnson");
|
||||
|
||||
assertEquals(subscription.getActivePeriodEnd(),
|
||||
|
|
|
@ -73,7 +73,8 @@ public class TestJaxbableClassesLocator implements IJaxbableClassesLocator {
|
|||
com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData.class,
|
||||
com.raytheon.uf.common.datadelivery.registry.Parameter.class,
|
||||
com.raytheon.uf.common.datadelivery.registry.ParameterLevel.class,
|
||||
com.raytheon.uf.common.datadelivery.registry.PendingSubscription.class,
|
||||
com.raytheon.uf.common.datadelivery.registry.PendingSharedSubscription.class,
|
||||
com.raytheon.uf.common.datadelivery.registry.PendingUserSubscription.class,
|
||||
com.raytheon.uf.common.datadelivery.registry.Projection.class,
|
||||
com.raytheon.uf.common.datadelivery.registry.Provider.class,
|
||||
com.raytheon.uf.common.datadelivery.registry.SharedSubscription.class,
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.notification;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.TextMessage;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
|
||||
/**
|
||||
* Test {@link NotificationMessageContainsType}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 05, 2013 1841 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class NotificationMessageContainsTypeTest {
|
||||
|
||||
private static final TextMessage message = mock(TextMessage.class);
|
||||
|
||||
private static final NotificationMessage notificationMessage = new NotificationMessage(
|
||||
message);
|
||||
|
||||
@BeforeClass
|
||||
public static void classSetUp() throws JMSException, JAXBException {
|
||||
when(message.getText()).thenReturn(
|
||||
SerializationUtil.marshalToXml(new UserSubscription()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsTrueWhenPayloadIsOneOfSeveralExpectedTypes()
|
||||
throws JMSException, JAXBException {
|
||||
|
||||
NotificationMessageContainsType condition = new NotificationMessageContainsType(
|
||||
String.class, UserSubscription.class);
|
||||
assertThat(
|
||||
condition
|
||||
.matchesCondition(new NotificationMessage[] { notificationMessage }),
|
||||
is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsTrueWhenPayloadIsOnlyExpectedType() throws JMSException,
|
||||
JAXBException {
|
||||
|
||||
NotificationMessageContainsType condition = new NotificationMessageContainsType(
|
||||
UserSubscription.class);
|
||||
assertThat(
|
||||
condition
|
||||
.matchesCondition(new NotificationMessage[] { notificationMessage }),
|
||||
is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsFalseWhenPayloadIsNotAnExpectedType()
|
||||
throws JMSException, JAXBException {
|
||||
|
||||
NotificationMessageContainsType condition = new NotificationMessageContainsType(
|
||||
String.class, SharedSubscription.class);
|
||||
assertThat(
|
||||
condition
|
||||
.matchesCondition(new NotificationMessage[] { notificationMessage }),
|
||||
is(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsFalseWhenPayloadIsNotTheOnlyExpectedType()
|
||||
throws JMSException, JAXBException {
|
||||
|
||||
NotificationMessageContainsType condition = new NotificationMessageContainsType(
|
||||
String.class);
|
||||
assertThat(
|
||||
condition
|
||||
.matchesCondition(new NotificationMessage[] { notificationMessage }),
|
||||
is(false));
|
||||
}
|
||||
|
||||
}
|
|
@ -37,7 +37,7 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription;
|
||||
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.ISubscriptionHandler;
|
||||
|
@ -340,6 +340,6 @@ public class SubscriptionServiceMassUpdateTest extends
|
|||
when(
|
||||
DataDeliveryHandlers.getPendingSubscriptionHandler()
|
||||
.getBySubscription(subscription)).thenReturn(
|
||||
new InitialPendingSubscription());
|
||||
new InitialPendingUserSubscription());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue