Issue #2020 - Implement Shared Subscriptions Cave-side.

Change-Id: I96e156043ec34e7ec98c2d8c3aafb6916c31e7cf

Former-commit-id: 1e00c7f935cf22ac5064060069164af6044f2150
This commit is contained in:
Mike Duff 2013-05-20 13:15:58 -05:00
parent 9533bb686d
commit 192ce891d0
82 changed files with 2176 additions and 846 deletions

View file

@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.datadelivery.bandwidth;bundle-version="1.0.0", com.raytheon.uf.common.datadelivery.bandwidth;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.retrieval;bundle-version="1.0.0", com.raytheon.uf.common.datadelivery.retrieval;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0", com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0",
com.raytheon.uf.common.units;bundle-version="1.0.0" com.raytheon.uf.common.units;bundle-version="1.0.0",
com.raytheon.uf.common.site;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.datadelivery;uses:="org.eclipse.ui.plugin,org.osgi.framework", Export-Package: com.raytheon.uf.viz.datadelivery;uses:="org.eclipse.ui.plugin,org.osgi.framework",

View file

@ -8,7 +8,7 @@
class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler"> class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler">
<constructor-arg> <constructor-arg>
<bean <bean
class="com.raytheon.uf.common.datadelivery.registry.handlers.UserSubscriptionHandler" /> class="com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler" />
</constructor-arg> </constructor-arg>
<constructor-arg> <constructor-arg>
<bean <bean
@ -20,7 +20,7 @@
class="com.raytheon.uf.viz.datadelivery.handlers.VizPendingSubscriptionHandler"> class="com.raytheon.uf.viz.datadelivery.handlers.VizPendingSubscriptionHandler">
<constructor-arg> <constructor-arg>
<bean <bean
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingUserSubscriptionHandler" /> class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSiteSubscriptionHandler" />
</constructor-arg> </constructor-arg>
<constructor-arg> <constructor-arg>
<bean <bean

View file

@ -114,6 +114,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 12, 2012 1391 bgonzale Added job for dataset retrieval. * Dec 12, 2012 1391 bgonzale Added job for dataset retrieval.
* Jan 08, 2012 1436 bgonzale Fixed area text box display update check. * Jan 08, 2012 1436 bgonzale Fixed area text box display update check.
* Jan 14, 2012 1437 bgonzale Clear filters when creating a new configuration. * Jan 14, 2012 1437 bgonzale Clear filters when creating a new configuration.
* May 15, 2013 1040 mpduff Put DataDeliveryGUIUtils.markNotBusyInUIThread in finally block.
* *
* </pre> * </pre>
* *
@ -1073,11 +1074,15 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
try {
if (!dataTableComp.isDisposed()) { if (!dataTableComp.isDisposed()) {
dataTableComp.updateTable(matchingDataSets); dataTableComp.updateTable(matchingDataSets);
updateTableEntriesLabel(); updateTableEntriesLabel();
} }
DataDeliveryGUIUtils.markNotBusyInUIThread(jobParent); } finally {
DataDeliveryGUIUtils
.markNotBusyInUIThread(jobParent);
}
} }
}); });
} }

View file

@ -54,6 +54,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 27, 2012 702 jpiatt Initial creation. * Jun 27, 2012 702 jpiatt Initial creation.
* May 15, 2013 1040 mpduff Fixed button width.
* *
* </pre> * </pre>
* *
@ -148,8 +149,6 @@ public class DurationComp extends Composite {
} }
}); });
int buttonWidth = 85;
GridData btnData = new GridData(buttonWidth, SWT.DEFAULT);
int textWidth = 100; int textWidth = 100;
GridData textData = new GridData(textWidth, SWT.DEFAULT); GridData textData = new GridData(textWidth, SWT.DEFAULT);
@ -171,9 +170,12 @@ public class DurationComp extends Composite {
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (!DataDeliveryGUIUtils.validateDate(false, startText.getText())) { if (!DataDeliveryGUIUtils.validateDate(false,
DataDeliveryUtils.showMessage(getShell(), SWT.ERROR, "Invalid Date/Time", startText.getText())) {
"Invalid Starting Date/Time entered.\n\n" + "Please use the Select Date button\n" DataDeliveryUtils.showMessage(getShell(), SWT.ERROR,
"Invalid Date/Time",
"Invalid Starting Date/Time entered.\n\n"
+ "Please use the Select Date button\n"
+ "to select the date/time."); + "to select the date/time.");
} }
} }
@ -181,7 +183,6 @@ public class DurationComp extends Composite {
startDateBtn = new Button(periodComp, SWT.PUSH); startDateBtn = new Button(periodComp, SWT.PUSH);
startDateBtn.setText(" Select Date "); startDateBtn.setText(" Select Date ");
startDateBtn.setLayoutData(btnData);
startDateBtn.setEnabled(false); startDateBtn.setEnabled(false);
startDateBtn.addSelectionListener(new SelectionAdapter() { startDateBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
@ -205,17 +206,17 @@ public class DurationComp extends Composite {
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (!DataDeliveryGUIUtils.validateDate(false, endText.getText())) { if (!DataDeliveryGUIUtils.validateDate(false, endText.getText())) {
DataDeliveryUtils.showMessage(getShell(), SWT.ERROR, "Invalid Date/Time", DataDeliveryUtils.showMessage(getShell(), SWT.ERROR,
"Invalid End Date/Time entered.\n\n" + "Please use the Select Date button\n" "Invalid Date/Time",
"Invalid End Date/Time entered.\n\n"
+ "Please use the Select Date button\n"
+ "to select the date/time."); + "to select the date/time.");
} }
} }
}); });
btnData = new GridData(buttonWidth, SWT.DEFAULT);
endDateBtn = new Button(periodComp, SWT.PUSH); endDateBtn = new Button(periodComp, SWT.PUSH);
endDateBtn.setText(" Select Date "); endDateBtn.setText(" Select Date ");
endDateBtn.setLayoutData(btnData);
endDateBtn.setEnabled(false); endDateBtn.setEnabled(false);
endDateBtn.addSelectionListener(new SelectionAdapter() { endDateBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
@ -233,10 +234,12 @@ public class DurationComp extends Composite {
if (d != null) { if (d != null) {
startDate = d; startDate = d;
try { try {
startText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(startDate) + "Z"); startText.setText(DataDeliveryGUIUtils.getSubscriptionFormat()
.format(startDate) + "Z");
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Invalid date format - format needs to be " + statusHandler.handle(Priority.PROBLEM,
"MM/dd/yyyy HH", e); "Invalid date format - format needs to be "
+ "MM/dd/yyyy HH", e);
} }
} }
@ -250,10 +253,12 @@ public class DurationComp extends Composite {
if (d != null) { if (d != null) {
endDate = d; endDate = d;
try { try {
endText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(endDate) + "Z"); endText.setText(DataDeliveryGUIUtils.getSubscriptionFormat()
.format(endDate) + "Z");
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Invalid date format - format needs to be " + statusHandler.handle(Priority.PROBLEM,
"MM/dd/yyyy HH", e); "Invalid date format - format needs to be "
+ "MM/dd/yyyy HH", e);
} }
} }
} }
@ -283,8 +288,7 @@ public class DurationComp extends Composite {
/** /**
* Get the does not expire radio button selection. * Get the does not expire radio button selection.
* *
* @return boolean * @return boolean true if checked
* true if checked
*/ */
public boolean isIndefiniteChk() { public boolean isIndefiniteChk() {
return indefiniteChk.getSelection(); return indefiniteChk.getSelection();
@ -369,7 +373,9 @@ public class DurationComp extends Composite {
* @param startDate * @param startDate
*/ */
public void setStartDate(Date startDate) { public void setStartDate(Date startDate) {
startText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(startDate) + "Z"); startText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(
startDate)
+ "Z");
startText.setEnabled(true); startText.setEnabled(true);
startDateBtn.setEnabled(true); startDateBtn.setEnabled(true);
this.startDate = startDate; this.startDate = startDate;
@ -381,7 +387,9 @@ public class DurationComp extends Composite {
* @param endDate * @param endDate
*/ */
public void setEndDate(Date endDate) { public void setEndDate(Date endDate) {
endText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(endDate) + "Z"); endText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(
endDate)
+ "Z");
endText.setEnabled(true); endText.setEnabled(true);
endDateBtn.setEnabled(true); endDateBtn.setEnabled(true);
this.endDate = endDate; this.endDate = endDate;
@ -389,6 +397,7 @@ public class DurationComp extends Composite {
/** /**
* Check if dates are valid. * Check if dates are valid.
*
* @return true if dates are valid * @return true if dates are valid
*/ */
public boolean isValidChk() { public boolean isValidChk() {
@ -396,29 +405,33 @@ public class DurationComp extends Composite {
boolean dateOrderValid = false; boolean dateOrderValid = false;
if (!isIndefiniteChk()) { if (!isIndefiniteChk()) {
boolean validateDur = DataDeliveryGUIUtils.validateDate(false, getStartText()); boolean validateDur = DataDeliveryGUIUtils.validateDate(false,
getStartText());
if (validateDur) { if (validateDur) {
validateDur = DataDeliveryGUIUtils.validateDate(false, getEndText()); validateDur = DataDeliveryGUIUtils.validateDate(false,
getEndText());
if (validateDur) { if (validateDur) {
datesValid = true; datesValid = true;
dateOrderValid = DataDeliveryGUIUtils.checkDateOrder(getStartText(), getEndText(), true); dateOrderValid = DataDeliveryGUIUtils.checkDateOrder(
getStartText(), getEndText(), true);
} }
} }
} } else {
else {
datesValid = true; datesValid = true;
dateOrderValid = true; dateOrderValid = true;
} }
// Display error message // Display error message
if (!datesValid) { if (!datesValid) {
DataDeliveryUtils.showMessage(parentComp.getShell(), SWT.ERROR, "Invalid Date/Time", DataDeliveryUtils.showMessage(parentComp.getShell(), SWT.ERROR,
"Invalid Subscription Duration values entered.\n\n" + "Please use the Select Date button\n" "Invalid Date/Time",
"Invalid Subscription Duration values entered.\n\n"
+ "Please use the Select Date button\n"
+ "to select the date/time."); + "to select the date/time.");
} } else if (!dateOrderValid) {
else if (!dateOrderValid) { DataDeliveryUtils.showMessage(parentComp.getShell(), SWT.ERROR,
DataDeliveryUtils.showMessage(parentComp.getShell(), SWT.ERROR, "Invalid Start/End Dates", "Invalid Start/End Dates",
"Invalid Start or Expiration Duration Date entered.\n\n" "Invalid Start or Expiration Duration Date entered.\n\n"
+ "The expiration date is before the start date."); + "The expiration date is before the start date.");
} }

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jun 21, 2012 736 djohnson Change OPERATION_STATUS to OperationStatus. * Jun 21, 2012 736 djohnson Change OPERATION_STATUS to OperationStatus.
* Dec 03, 2012 1269 mpduff Change to take a list of subscriptions for the view mode. * Dec 03, 2012 1269 mpduff Change to take a list of subscriptions for the view mode.
* Dec 10, 2012 1300 bgonzale Table filtering by dataset and provider. * Dec 10, 2012 1300 bgonzale Table filtering by dataset and provider.
* May 23, 2012 2020 mpduff Implement method.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -64,13 +65,13 @@ public class SubscriptionViewer extends AbstractViewDlg implements
/** /**
* Provider name associated with subscriptions. i.e. NOMADS, NCDC,... * Provider name associated with subscriptions. i.e. NOMADS, NCDC,...
*/ */
private String providerName; private final String providerName;
/** /**
* Dataset name that the subscriptions are associated with. i.e. gfs, * Dataset name that the subscriptions are associated with. i.e. gfs,
* nam,... * nam,...
*/ */
private String datasetName; private final String datasetName;
/** Table composite */ /** Table composite */
private SubscriptionTableComp tableComp; private SubscriptionTableComp tableComp;
@ -237,4 +238,12 @@ public class SubscriptionViewer extends AbstractViewDlg implements
public void activateButtonUpdate(String text) { public void activateButtonUpdate(String text) {
// Not used. // Not used.
} }
/**
* {@inheritDoc}
*/
@Override
public void updateControls() {
// Not used.
}
} }

View file

@ -92,6 +92,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes. * Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Jan 02, 2013 1441 djohnson Access GroupDefinitionManager in a static fashion. * Jan 02, 2013 1441 djohnson Access GroupDefinitionManager in a static fashion.
* Apr 08, 2013 1826 djohnson Remove unused code, delivery options. * Apr 08, 2013 1826 djohnson Remove unused code, delivery options.
* May 15, 2013 1040 mpduff OfficeID is now a list so need to add it rather than set it.
* </pre> * </pre>
* *
* @author jpiatt * @author jpiatt
@ -276,8 +277,7 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
.getSelectedListItems()); .getSelectedListItems());
Set<String> differences = Sets.symmetricDifference( Set<String> differences = Sets.symmetricDifference(
selectedSubscriptionNames, selectedSubscriptionNames, initiallySelectedSubscriptions);
initiallySelectedSubscriptions);
Set<Subscription> addedToGroup = new HashSet<Subscription>(); Set<Subscription> addedToGroup = new HashSet<Subscription>();
Set<Subscription> removedFromGroup = new HashSet<Subscription>(); Set<Subscription> removedFromGroup = new HashSet<Subscription>();
@ -335,8 +335,7 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
} }
updateGroupDefinitionForSubscriptions(groupName, updateGroupDefinitionForSubscriptions(groupName,
groupSubscriptionsForUpdate, groupSubscriptionsForUpdate, removedFromGroup);
removedFromGroup);
timer.stop(); timer.stop();
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
@ -408,19 +407,16 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
subscription.setCoverage(cov); subscription.setCoverage(cov);
} }
subscription.setOfficeID(LocalizationManager.getInstance() subscription.addOfficeID(LocalizationManager.getInstance()
.getCurrentSite()); .getCurrentSite());
} }
try { try {
final ISubscriptionServiceResult result = DataDeliveryServices final ISubscriptionServiceResult result = DataDeliveryServices
.getSubscriptionService().updateWithPendingCheck( .getSubscriptionService().updateWithPendingCheck(
new ArrayList<Subscription>(Sets.union( new ArrayList<Subscription>(Sets.union(
groupSubscriptions, groupSubscriptions,
removeFromGroupSubscriptions)), removeFromGroupSubscriptions)), this);
this);
if (result.hasMessageToDisplay()) { if (result.hasMessageToDisplay()) {
DataDeliveryUtils.showMessage(getShell(), SWT.ICON_INFORMATION, DataDeliveryUtils.showMessage(getShell(), SWT.ICON_INFORMATION,
"Edit Group", result.getMessageToDisplay()); "Edit Group", result.getMessageToDisplay());

View file

@ -81,6 +81,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
* icon update when loading from a file. * icon update when loading from a file.
* Feb 24, 2013 1620 mpduff Fixed set clean issue when loading configurations. Set clean * Feb 24, 2013 1620 mpduff Fixed set clean issue when loading configurations. Set clean
* needs to be called after the data load job is complete. * needs to be called after the data load job is complete.
* May 15, 2013 1040 mpduff Called markNotBusyInUIThread.
* *
* </pre> * </pre>
* *
@ -193,13 +194,13 @@ public class FilterExpandBar extends Composite implements IFilterUpdate,
private void createExpandItems() { private void createExpandItems() {
if (dataTypes != null && dataTypes.length > 0) { if (dataTypes != null && dataTypes.length > 0) {
final Shell jobParent = this.getShell(); final Shell parentShell = this.getShell();
final Job job = new Job("Dataset Discovery...") { final Job job = new Job("Dataset Discovery...") {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
MetaDataManager dataManager = MetaDataManager.getInstance(); MetaDataManager dataManager = MetaDataManager.getInstance();
DataDeliveryGUIUtils.markBusyInUIThread(jobParent); DataDeliveryGUIUtils.markBusyInUIThread(parentShell);
dataManager.rereadMetaData(); dataManager.rereadMetaData();
dataManager.readMetaData(dataTypes[0]); dataManager.readMetaData(dataTypes[0]);
return Status.OK_STATUS; return Status.OK_STATUS;
@ -209,6 +210,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate,
job.addJobChangeListener(new JobChangeAdapter() { job.addJobChangeListener(new JobChangeAdapter() {
@Override @Override
public void done(IJobChangeEvent event) { public void done(IJobChangeEvent event) {
try {
DataTypeFilterElementXML dtfe; DataTypeFilterElementXML dtfe;
HashMap<String, ArrayList<String>> dataFilterMap = new HashMap<String, ArrayList<String>>(); HashMap<String, ArrayList<String>> dataFilterMap = new HashMap<String, ArrayList<String>>();
@ -216,7 +218,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate,
for (int i = 0; i < dataTypes.length; i++) { for (int i = 0; i < dataTypes.length; i++) {
String dataType = dataTypes[i]; String dataType = dataTypes[i];
dtfe = dataTypeFilterXml.getFilterData(dataType); dtfe = dataTypeFilterXml.getFilterData(dataType);
ArrayList<String> filterIDList = dtfe.getFilterIDList(); ArrayList<String> filterIDList = dtfe
.getFilterIDList();
dataFilterMap.put(dataType, filterIDList); dataFilterMap.put(dataType, filterIDList);
} }
@ -229,25 +232,28 @@ public class FilterExpandBar extends Composite implements IFilterUpdate,
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
// Now we have a list of common filters, lets build // Now we have a list of common filters, lets
// build
// them // them
for (String filter : filterList) { for (String filter : filterList) {
final FilterElementsXML fex = filterXml final FilterElementsXML fex = filterXml
.getFilter(filter); .getFilter(filter);
String clazz = fex.getClazz(); String clazz = fex.getClazz();
// TODO use reflection here to instantiate the // TODO use reflection here to instantiate
// the
// class // class
if (clazz.equals("FilterComp")) { if (clazz.equals("FilterComp")) {
createFilter(fex); createFilter(fex);
} }
} }
notifyListeners(SWT.SetData, new Event()); notifyListeners(SWT.SetData, new Event());
DataDeliveryGUIUtils
.markNotBusyInUIThread(jobParent);
setClean(); setClean();
} }
}); });
} finally {
DataDeliveryGUIUtils.markNotBusyInUIThread(parentShell);
}
} }
}); });

View file

@ -23,8 +23,8 @@ import java.util.List;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest; 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.IPendingSharedSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSiteSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler; 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.registry.handlers.PendingSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants; import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -44,6 +44,7 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
* Sep 27, 2012 1187 djohnson Initial creation * Sep 27, 2012 1187 djohnson Initial creation
* Nov 15, 2012 1286 djohnson Use server-keyed routing. * Nov 15, 2012 1286 djohnson Use server-keyed routing.
* Apr 05, 2013 1841 djohnson Add shared subscription support. * Apr 05, 2013 1841 djohnson Add shared subscription support.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -55,12 +56,12 @@ public class VizPendingSubscriptionHandler extends PendingSubscriptionHandler {
/** /**
* Constructor. * Constructor.
* *
* @param userSubscriptionHandler * @param siteSubscriptionHandler
*/ */
public VizPendingSubscriptionHandler( public VizPendingSubscriptionHandler(
IPendingUserSubscriptionHandler userSubscriptionHandler, IPendingSiteSubscriptionHandler siteSubscriptionHandler,
IPendingSharedSubscriptionHandler sharedSubscriptionHandler) { IPendingSharedSubscriptionHandler sharedSubscriptionHandler) {
super(userSubscriptionHandler, sharedSubscriptionHandler); super(siteSubscriptionHandler, sharedSubscriptionHandler);
} }
/** /**

View file

@ -23,8 +23,8 @@ import java.util.List;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest; 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.ISharedSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISiteSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; 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; import com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants; import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -45,6 +45,7 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
* Nov 15, 2012 1286 djohnson Use server-keyed routing. * Nov 15, 2012 1286 djohnson Use server-keyed routing.
* Mar 29, 2013 1841 djohnson Composes a userSubscriptionsHandler. * Mar 29, 2013 1841 djohnson Composes a userSubscriptionsHandler.
* Apr 05, 2013 1841 djohnson Add shared subscription support. * Apr 05, 2013 1841 djohnson Add shared subscription support.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -56,13 +57,13 @@ public class VizSubscriptionHandler extends SubscriptionHandler {
/** /**
* Constructor. * Constructor.
* *
* @param userSubscriptionHandler * @param siteSubscriptionHandler
* @param sharedSubscriptionHandler * @param sharedSubscriptionHandler
*/ */
public VizSubscriptionHandler( public VizSubscriptionHandler(
IUserSubscriptionHandler userSubscriptionHandler, ISiteSubscriptionHandler siteSubscriptionHandler,
ISharedSubscriptionHandler sharedSubscriptionHandler) { ISharedSubscriptionHandler sharedSubscriptionHandler) {
super(userSubscriptionHandler, sharedSubscriptionHandler); super(siteSubscriptionHandler, sharedSubscriptionHandler);
} }
/** /**

View file

@ -26,8 +26,13 @@ import java.util.Set;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
@ -38,17 +43,28 @@ import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority; import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery; import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
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.common.util.StringUtil;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.datadelivery.common.ui.ActivePeriodComp; import com.raytheon.uf.viz.datadelivery.common.ui.ActivePeriodComp;
import com.raytheon.uf.viz.datadelivery.common.ui.DurationComp; import com.raytheon.uf.viz.datadelivery.common.ui.DurationComp;
import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp; import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp;
import com.raytheon.uf.viz.datadelivery.common.ui.PriorityComp; import com.raytheon.uf.viz.datadelivery.common.ui.PriorityComp;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView; import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView;
import com.raytheon.uf.viz.datadelivery.system.SystemRuleManager; import com.raytheon.uf.viz.datadelivery.system.SystemRuleManager;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.presenter.components.ButtonConf; import com.raytheon.viz.ui.presenter.components.ButtonConf;
import com.raytheon.viz.ui.presenter.components.CheckBoxConf; import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
@ -80,6 +96,7 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
* Jan 04, 2013 1420 mpduff Add latency. * Jan 04, 2013 1420 mpduff Add latency.
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers. * Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Add Shared sites.
* *
* </pre> * </pre>
* *
@ -88,6 +105,9 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
*/ */
public class CreateSubscriptionDlg extends CaveSWTDialog implements public class CreateSubscriptionDlg extends CaveSWTDialog implements
ICreateSubscriptionDlgView { ICreateSubscriptionDlgView {
/** Status Handler */
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(CreateSubscriptionDlg.class);
/** The Main Composite */ /** The Main Composite */
private Composite mainComp; private Composite mainComp;
@ -146,6 +166,12 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
/** Available cycle times */ /** Available cycle times */
private Set<Integer> cycleTimes; private Set<Integer> cycleTimes;
private String[] sharedSites;
private Label selectedSiteLbl;
private final Font font;
/** /**
* Constructor. * Constructor.
* *
@ -155,8 +181,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
* true for new subscription, false for edit * true for new subscription, false for edit
*/ */
public CreateSubscriptionDlg(Shell parent, boolean create) { public CreateSubscriptionDlg(Shell parent, boolean create) {
super(parent, SWT.DIALOG_TRIM, CAVE.INDEPENDENT_SHELL super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
| CAVE.PERSPECTIVE_INDEPENDENT); CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT);
this.create = create; this.create = create;
if (create) { if (create) {
@ -164,6 +190,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
} else { } else {
setText("Edit Subscription"); setText("Edit Subscription");
} }
font = new Font(this.getDisplay(), "Monospace", 9, SWT.NORMAL);
} }
/* /*
@ -197,6 +225,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
priorityComp = new PriorityComp(mainComp, latency, priority); priorityComp = new PriorityComp(mainComp, latency, priority);
this.createCycleGroup(); this.createCycleGroup();
createSiteSelection();
if (create == false) { if (create == false) {
createChangeText(); createChangeText();
} }
@ -266,6 +296,97 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
changeReasonTxt.setLayoutData(new GridData(375, SWT.DEFAULT)); changeReasonTxt.setLayoutData(new GridData(375, SWT.DEFAULT));
} }
/**
* Create the site selection widgets.
*/
private void createSiteSelection() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
GridLayout gl = new GridLayout(2, false);
final Group group = new Group(mainComp, SWT.NONE);
group.setLayout(gl);
group.setLayoutData(gd);
group.setText(" Shared Sites ");
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false);
gl = new GridLayout(2, false);
final Composite c = new Composite(group, SWT.NONE);
c.setLayout(gl);
c.setLayoutData(gd);
gl = new GridLayout(1, false);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
final Button btn = new Button(c, SWT.NONE);
btn.setLayoutData(new GridData(95, SWT.DEFAULT));
btn.setText("Select Sites...");
btn.setToolTipText("Select sites for sharing");
btn.setEnabled(false);
final DataDeliveryPermission permission = DataDeliveryPermission.SHARED_SUBSCRIPTION_CREATE;
final IUser user = UserController.getUserObject();
final String msg = user.uniqueId()
+ " is not authorized to create shared subscriptions. "
+ StringUtil.NEWLINE + "Permission: " + permission;
try {
if (DataDeliveryServices.getPermissionsService()
.checkPermission(user, msg, permission).isAuthorized()) {
btn.setEnabled(true);
} else {
c.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(MouseEvent e) {
DataDeliveryGUIUtils.hideToolTip();
}
@Override
public void mouseHover(MouseEvent e) {
handleMouseEvent(e, msg, group.getBounds());
}
@Override
public void mouseEnter(MouseEvent e) {
handleMouseEvent(e, msg, group.getBounds());
}
});
}
} catch (VizException e1) {
statusHandler
.handle(Priority.PROBLEM, e1.getLocalizedMessage(), e1);
}
btn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SiteSelectionDlg dlg = new SiteSelectionDlg(shell, "OAX",
sharedSites);
dlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof String[]) {
String[] sites = (String[]) returnValue;
processSites(sites);
}
}
});
dlg.open();
}
});
selectedSiteLbl = new Label(group, SWT.BORDER);
selectedSiteLbl.setFont(font);
selectedSiteLbl.setText("");
selectedSiteLbl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
false));
if (!create) {
if (subscription != null && subscription.getOfficeIDs().size() > 0) {
String[] siteArr = subscription.getOfficeIDs().toArray(
new String[subscription.getOfficeIDs().size()]);
processSites(siteArr);
}
}
}
/** /**
* Create the bottom buttons * Create the bottom buttons
*/ */
@ -341,6 +462,21 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
shell.pack(); shell.pack();
} }
/**
* Handle the mouse event and display the tooltip.
*
* @param e
* MouseEvent
* @param msg
* Message to display
* @param bounds
* Bounds
*/
private void handleMouseEvent(MouseEvent e, String msg, Rectangle bounds) {
Point pos = shell.toDisplay(bounds.x + e.x + 15, bounds.y + e.y + 15);
DataDeliveryGUIUtils.showTooltip(this.shell, pos.x, pos.y, msg);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -349,6 +485,19 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
this.open(); this.open();
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
super.disposed();
if (font != null && !font.isDisposed()) {
font.dispose();
}
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -815,4 +964,49 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
public void setCycleTimes(Set<Integer> cycleTimes) { public void setCycleTimes(Set<Integer> cycleTimes) {
this.cycleTimes = cycleTimes; this.cycleTimes = cycleTimes;
} }
/**
* Process the site list
*
* @param sites
* list of sites
*/
private void processSites(String[] sites) {
this.sharedSites = sites;
StringBuilder toolTipText = new StringBuilder();
StringBuilder labelText = new StringBuilder();
boolean overflow = false;
for (int i = 0; i < sites.length; i++) {
toolTipText.append(sites[i]).append(" ");
if (i < 8) {
labelText.append(sites[i]).append(" ");
} else {
overflow = true;
}
}
String lt = labelText.toString().trim();
if (!lt.isEmpty() && overflow) {
lt = lt.concat("...");
}
selectedSiteLbl.setText(lt);
selectedSiteLbl.setToolTipText(toolTipText.toString());
}
/**
* {@inheritDoc}
*/
@Override
public String[] getSharedSites() {
return this.sharedSites;
}
/**
* {@inheritDoc}
*/
@Override
public void setOfficeIds(Set<String> officeIDs) {
List<String> list = new ArrayList<String>(officeIDs);
this.sharedSites = list.toArray(new String[officeIDs.size()]);
}
} }

View file

@ -32,8 +32,8 @@ import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition; import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -65,6 +65,8 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
* Jan 02, 2013 1441 djohnson Access GroupDefinitionManager in a static fashion. * Jan 02, 2013 1441 djohnson Access GroupDefinitionManager in a static fashion.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 14, 2013 1040 mpduff Changed to add office Id rather than setting it.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -74,7 +76,8 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
public class GroupAddDlg extends CaveSWTDialog { public class GroupAddDlg extends CaveSWTDialog {
/** Status Handler */ /** Status Handler */
private final IUFStatusHandler statusHandler = UFStatus.getHandler(GroupAddDlg.class); private final IUFStatusHandler statusHandler = UFStatus
.getHandler(GroupAddDlg.class);
/** The Main Composite */ /** The Main Composite */
private Composite mainComp; private Composite mainComp;
@ -133,12 +136,15 @@ public class GroupAddDlg extends CaveSWTDialog {
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened() * @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
*/ */
@Override @Override
protected void preOpened() { protected void preOpened() {
ComboBoxConf groupComboConf = new ComboBoxConf(true, "Select a Group", WidgetConf.DO_NOTHING); ComboBoxConf groupComboConf = new ComboBoxConf(true, "Select a Group",
WidgetConf.DO_NOTHING);
groupSelectComp.setGroupNameComboConf(groupComboConf); groupSelectComp.setGroupNameComboConf(groupComboConf);
} }
@ -231,8 +237,10 @@ public class GroupAddDlg extends CaveSWTDialog {
// Set duration // Set duration
if (groupDefinition.getSubscriptionStart() != null) { if (groupDefinition.getSubscriptionStart() != null) {
subscription.setSubscriptionStart(groupDefinition.getSubscriptionStart()); subscription.setSubscriptionStart(groupDefinition
subscription.setSubscriptionEnd(groupDefinition.getSubscriptionEnd()); .getSubscriptionStart());
subscription.setSubscriptionEnd(groupDefinition
.getSubscriptionEnd());
} else { } else {
subscription.setSubscriptionStart(null); subscription.setSubscriptionStart(null);
subscription.setSubscriptionEnd(null); subscription.setSubscriptionEnd(null);
@ -240,8 +248,10 @@ public class GroupAddDlg extends CaveSWTDialog {
// Set active period // Set active period
if (groupDefinition.getActivePeriodStart() != null) { if (groupDefinition.getActivePeriodStart() != null) {
subscription.setActivePeriodStart(groupDefinition.getActivePeriodStart()); subscription.setActivePeriodStart(groupDefinition
subscription.setActivePeriodEnd(groupDefinition.getActivePeriodEnd()); .getActivePeriodStart());
subscription.setActivePeriodEnd(groupDefinition
.getActivePeriodEnd());
} else { } else {
subscription.setActivePeriodStart(null); subscription.setActivePeriodStart(null);
subscription.setActivePeriodEnd(null); subscription.setActivePeriodEnd(null);
@ -252,12 +262,13 @@ public class GroupAddDlg extends CaveSWTDialog {
System.out.println("Fix Me: Need to calculate data set size"); System.out.println("Fix Me: Need to calculate data set size");
subscription.setDataSetSize(999); subscription.setDataSetSize(999);
subscription.setOfficeID(LocalizationManager.getInstance().getCurrentSite()); subscription.addOfficeID(LocalizationManager.getInstance()
.getCurrentSite());
// TODO: How to do this better? Will shared subscriptions participate in // TODO: How to do this better? Will shared subscriptions participate in
// groups? // groups?
if (subscription instanceof UserSubscription) { if (subscription instanceof SiteSubscription) {
((UserSubscription) subscription).setOwner(username); ((SiteSubscription) subscription).setOwner(username);
} }
try { try {
@ -269,8 +280,7 @@ public class GroupAddDlg extends CaveSWTDialog {
} }
subscriptionNotificationService.sendCreatedSubscriptionNotification( subscriptionNotificationService.sendCreatedSubscriptionNotification(
subscription, subscription, username);
username);
// refresh table // refresh table
callback.handleRefresh(); callback.handleRefresh();
@ -279,4 +289,3 @@ public class GroupAddDlg extends CaveSWTDialog {
} }
} }

View file

@ -29,6 +29,7 @@ package com.raytheon.uf.viz.datadelivery.subscription;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 15, 2012 687 lvenable Initial creation * Jun 15, 2012 687 lvenable Initial creation
* May 23, 2013 2020 mpduff Added updateControls method.
* *
* </pre> * </pre>
* *
@ -37,5 +38,16 @@ package com.raytheon.uf.viz.datadelivery.subscription;
*/ */
public interface ISubscriptionAction { public interface ISubscriptionAction {
/**
* Update the Activate button's text.
*
* @param text
* The text to display on the button
*/
public void activateButtonUpdate(String text); public void activateButtonUpdate(String text);
/**
* Update the controls.
*/
public void updateControls();
} }

View file

@ -23,8 +23,8 @@ import java.rmi.RemoteException;
import com.raytheon.uf.common.auth.user.IUser; import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription; import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest; import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.BasePrivilegedDataDeliveryService; import com.raytheon.uf.common.datadelivery.service.BasePrivilegedDataDeliveryService;
@ -44,6 +44,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Jan 21, 2013 1441 djohnson Use RequestRouter. * Jan 21, 2013 1441 djohnson Use RequestRouter.
* Feb 26, 2013 1643 djohnson Extends base class. * Feb 26, 2013 1643 djohnson Extends base class.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -99,9 +100,9 @@ public class RequestFromServerPermissionsService extends
final Subscription subscription) throws VizException { final Subscription subscription) throws VizException {
// TODO: Can this be done better? // TODO: Can this be done better?
if (subscription instanceof UserSubscription) { if (subscription instanceof SiteSubscription) {
return checkPermissionToChangeSubscription(user, return checkPermissionToChangeSubscription(user,
notAuthorizedMessage, (UserSubscription) subscription); notAuthorizedMessage, (SiteSubscription) subscription);
} else { } else {
return checkPermissionToChangeSubscription(user, return checkPermissionToChangeSubscription(user,
notAuthorizedMessage, (SharedSubscription) subscription); notAuthorizedMessage, (SharedSubscription) subscription);
@ -111,7 +112,7 @@ public class RequestFromServerPermissionsService extends
private IAuthorizedPermissionResponse checkPermissionToChangeSubscription( private IAuthorizedPermissionResponse checkPermissionToChangeSubscription(
final IUser user, String notAuthorizedMessage, final IUser user, String notAuthorizedMessage,
final UserSubscription subscription) throws VizException { final SiteSubscription subscription) throws VizException {
final IAuthorizedPermissionResponse r = checkPermissions(user, final IAuthorizedPermissionResponse r = checkPermissions(user,
notAuthorizedMessage, notAuthorizedMessage,

View file

@ -0,0 +1,175 @@
/**
* 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.datadelivery.subscription;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.site.SiteData;
import com.raytheon.uf.common.site.SiteData.SiteDataType;
import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.widgets.DualListComposite;
import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
/**
* Shared site selection dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class SiteSelectionDlg extends CaveSWTDialog {
private DualListComposite comp;
private final String[] sharedSites;
private final String site;
/**
* Constructor.
*
* @param parent
* Parent Shell
* @param site
* Home Site
* @param sharedSites
* list of shared sites
*/
public SiteSelectionDlg(Shell parent, String site, String[] sharedSites) {
super(parent, SWT.APPLICATION_MODAL | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
this.setText(site + " Site Selection");
this.sharedSites = sharedSites;
this.site = site;
}
/**
* {@inheritDoc}
*/
@Override
protected void initializeComponents(Shell shell) {
GridLayout gl = new GridLayout(1, false);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
Composite mainComp = new Composite(shell, SWT.NONE);
mainComp.setLayout(gl);
mainComp.setLayoutData(gd);
gl = new GridLayout(1, false);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
Label label = new Label(mainComp, SWT.NONE);
label.setText("Select sites to share with " + site + ":");
gl = new GridLayout(1, false);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
DualListConfig config = new DualListConfig();
config.setAvailableListLabel("Available Sites:");
config.setSelectedListLabel("Selected Sites:");
config.setShowUpDownBtns(false);
config.setListHeight(150);
config.setListWidth(70);
config.setFullList(getSiteList());
config.setSelectedList(Arrays.asList(sharedSites));
comp = new DualListComposite(mainComp, config);
comp.setLayout(gl);
comp.setLayoutData(gd);
gl = new GridLayout(2, false);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
Composite buttonComp = new Composite(this.getShell(), SWT.NONE);
buttonComp.setLayout(gl);
buttonComp.setLayoutData(gd);
Button okBtn = new Button(buttonComp, SWT.NONE);
okBtn.setText("OK");
okBtn.setLayoutData(new GridData(75, SWT.DEFAULT));
okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleOk();
}
});
Button cancelBtn = new Button(buttonComp, SWT.NONE);
cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(new GridData(75, SWT.DEFAULT));
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
close();
}
});
}
/**
* Get a list of WFO/RFC ids
*
* @return list of site ids
*/
private List<String> getSiteList() {
SiteMap siteMap = SiteMap.getInstance();
List<String> siteList = new ArrayList<String>();
Map<String, SiteData> siteDataMap = siteMap.getSiteData();
for (Entry<String, SiteData> entry : siteDataMap.entrySet()) {
SiteDataType type = entry.getValue().getType();
if (type == SiteDataType.WFO || type == SiteDataType.RFC) {
siteList.add(entry.getKey());
}
}
// Remove the current site
siteList.remove(this.site);
return siteList;
}
/**
* OK event handler.
*/
private void handleOk() {
String[] selectedItems = comp.getSelectedItems();
setReturnValue(selectedItems);
close();
}
}

View file

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
@ -61,6 +62,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.auth.UserController; import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction; import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction; import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange; import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange;
@ -116,7 +118,8 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* remove race condition of GUI thread updating the table after notification. * remove race condition of GUI thread updating the table after notification.
* Jan 22, 2013 1520 mpduff Removed menu accelerators. * Jan 22, 2013 1520 mpduff Removed menu accelerators.
* Mar 29, 2013 1841 djohnson Subscription implementations now provide a copy method. * Mar 29, 2013 1841 djohnson Subscription implementations now provide a copy method.
* May 29, 2013 2000 djohnson Copy subscription now requires editing first to prevent duplicates, and remove duplicate code. * May 09, 2013 2000 djohnson Copy subscription now requires editing first to prevent duplicates, and remove duplicate code.
* May 17, 2013 1040 mpduff Change office id to list for shared subscription.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -168,6 +171,10 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
} }
} }
/** Current site */
private final String CURRENT_SITE = LocalizationManager.getInstance()
.getCurrentSite();
/** The activate button */ /** The activate button */
private Button activateBtn; private Button activateBtn;
@ -947,20 +954,27 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
SubscriptionManagerRowData rowData = tableComp SubscriptionManagerRowData rowData = tableComp
.getSubscriptionData().getDataRow(i); .getSubscriptionData().getDataRow(i);
String office = rowData.getOfficeId(); Set<String> office = rowData.getOfficeIds();
officeDisplayItems.add(office); officeDisplayItems.addAll(office);
} }
} }
officeNames = officeDisplayItems.toArray(new String[officeDisplayItems officeNames = officeDisplayItems.toArray(new String[officeDisplayItems
.size()]); .size()]);
String[] officeAll = new String[officeNames.length + 1]; String[] officeAll = new String[officeNames.length + 1];
officeAll[0] = "ALL"; officeAll[0] = "ALL";
System.arraycopy(officeNames, 0, officeAll, 1, officeNames.length); System.arraycopy(officeNames, 0, officeAll, 1, officeNames.length);
int idx = 0;
for (String site : officeAll) {
if (site.equalsIgnoreCase(CURRENT_SITE)) {
break;
}
idx++;
}
officeCbo.setItems(officeAll); officeCbo.setItems(officeAll);
officeCbo.select(0); officeCbo.select(idx);
} }
@ -1107,4 +1121,13 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
public void tableLock(boolean isLocked) { public void tableLock(boolean isLocked) {
// no-op // no-op
} }
/**
* {@inheritDoc}
*/
@Override
public void updateControls() {
loadGroupNames();
loadOfficeNames();
}
} }

View file

@ -20,8 +20,10 @@
package com.raytheon.uf.viz.datadelivery.subscription; package com.raytheon.uf.viz.datadelivery.subscription;
import java.util.Date; import java.util.Date;
import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.datadelivery.common.ui.ISortTable; import com.raytheon.uf.viz.datadelivery.common.ui.ISortTable;
import com.raytheon.uf.viz.datadelivery.common.ui.ITableData; import com.raytheon.uf.viz.datadelivery.common.ui.ITableData;
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection; import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
@ -47,13 +49,15 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Oct 2, 2012 1103 jpiatt Remove unused methods, update enum, code clean up. * Oct 2, 2012 1103 jpiatt Remove unused methods, update enum, code clean up.
* Jan 25, 2012 1528 djohnson Priorities no longer need incrementing for display. * Jan 25, 2012 1528 djohnson Priorities no longer need incrementing for display.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Change Office IDs to set.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
* @version 1.0 * @version 1.0
*/ */
public class SubscriptionManagerRowData implements ITableData<SubscriptionManagerRowData> { public class SubscriptionManagerRowData implements
ITableData<SubscriptionManagerRowData> {
/** Dataset id. */ /** Dataset id. */
private String dataSetID = null; private String dataSetID = null;
@ -86,13 +90,14 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
private Date activeEnd = null; private Date activeEnd = null;
/** Subscription column titles. */ /** Subscription column titles. */
private final String[] columns = DataDeliveryUtils.getColumnTitles(TABLE_TYPE.SUBSCRIPTION); private final String[] columns = DataDeliveryUtils
.getColumnTitles(TABLE_TYPE.SUBSCRIPTION);
/** Subscription details. */ /** Subscription details. */
private String details = null; private String details = null;
/** Office id. */ /** Office ids. */
private String officeId = null; private Set<String> officeIds = null;
/** Size of dataset. */ /** Size of dataset. */
private long dataSetSize = 0; private long dataSetSize = 0;
@ -334,22 +339,22 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
} }
/** /**
* Get the office identification. * Get the office ids.
* *
* @return the dataSetID * @return the officeIds
*/ */
public String getOfficeId() { public Set<String> getOfficeIds() {
return officeId; return officeIds;
} }
/** /**
* Set the office identification. * Set the office ids.
* *
* @param dataSetID * @param officeIds
* the dataSetID to set * the officeIds to set
*/ */
public void setOfficeId(String officeId) { public void setOfficeIds(Set<String> officeIds) {
this.officeId = officeId; this.officeIds = officeIds;
} }
/** /**
@ -397,8 +402,8 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
/** /**
* Set the subscription object. * Set the subscription object.
* *
* @param subscription obj * @param subscription
* the subscription to set * obj the subscription to set
*/ */
public void setSubscription(Subscription subscription) { public void setSubscription(Subscription subscription) {
this.subscription = subscription; this.subscription = subscription;
@ -406,8 +411,8 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
} }
/** /**
* Set the subscription status. Statuses include active, * Set the subscription status. Statuses include active, inactive, expired,
* inactive, expired, & invalid. * & invalid.
* *
* @param status * @param status
* the status to set * the status to set
@ -417,8 +422,8 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
} }
/** /**
* Get the subscription status. Statuses include active, * Get the subscription status. Statuses include active, inactive, expired,
* inactive, expired, & invalid. * & invalid.
* *
* @return status * @return status
*/ */
@ -452,14 +457,13 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
this.setActiveEnd(subscription.getActivePeriodEnd()); this.setActiveEnd(subscription.getActivePeriodEnd());
this.setDataSetID(subscription.getDataSetName()); this.setDataSetID(subscription.getDataSetName());
this.setDescription(subscription.getDescription()); this.setDescription(subscription.getDescription());
this.setOfficeId(subscription.getOfficeID()); this.setOfficeIds(subscription.getOfficeIDs());
this.setDataSetSize(subscription.getDataSetSize()); this.setDataSetSize(subscription.getDataSetSize());
this.setGroupName(subscription.getGroupName()); this.setGroupName(subscription.getGroupName());
if (subscription.isFullDataSet()) { if (subscription.isFullDataSet()) {
this.setFullDataSet(FullDataset.FULL); this.setFullDataSet(FullDataset.FULL);
} } else {
else {
this.setFullDataSet(FullDataset.SUBSET); this.setFullDataSet(FullDataset.SUBSET);
} }
@ -501,7 +505,7 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
} else if (columnName.equals(columns[++cIndex])) { } else if (columnName.equals(columns[++cIndex])) {
return columnName; return columnName;
} else if (columnName.equals(columns[++cIndex])) { } else if (columnName.equals(columns[++cIndex])) {
return officeId; return this.getOfficeIdsAsList();
} else if (columnName.equals(columns[++cIndex])) { } else if (columnName.equals(columns[++cIndex])) {
return fullDataSet.toString(); return fullDataSet.toString();
} else if (columnName.equals(columns[++cIndex])) { } else if (columnName.equals(columns[++cIndex])) {
@ -520,20 +524,16 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
// handle empty date cells // handle empty date cells
if ((d1 == null) && (d2 == null)) { if ((d1 == null) && (d2 == null)) {
return 0; return 0;
} } else if (d1 == null) {
else if (d1 == null) {
return 1; return 1;
} } else if (d2 == null) {
else if (d2 == null) {
return -1; return -1;
} }
if (d1.before(d2)) { if (d1.before(d2)) {
return 1; return 1;
} } else if (d1.after(d2)) {
else if (d1.after(d2)) {
return -1; return -1;
} } else {
else {
return 0; return 0;
} }
} }
@ -560,22 +560,21 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
int returnValue = 0; int returnValue = 0;
if (columnName.equals("Subscription Start")) { if (columnName.equals("Subscription Start")) {
returnValue = checkDate(this.getSubscriptionStart(), o.getSubscriptionStart()); returnValue = checkDate(this.getSubscriptionStart(),
} o.getSubscriptionStart());
else if (columnName.equals("Subscription Expiration")) { } else if (columnName.equals("Subscription Expiration")) {
returnValue = checkDate(this.getSubscriptionEnd(), o.getSubscriptionEnd()); returnValue = checkDate(this.getSubscriptionEnd(),
} o.getSubscriptionEnd());
else if (columnName.equals("Active Period Start")) { } else if (columnName.equals("Active Period Start")) {
returnValue = checkDate(this.getActiveStart(), o.getActiveStart()); returnValue = checkDate(this.getActiveStart(), o.getActiveStart());
} } else if (columnName.equals("Active Period End")) {
else if (columnName.equals("Active Period End")) {
returnValue = checkDate(this.getActiveEnd(), o.getActiveEnd()); returnValue = checkDate(this.getActiveEnd(), o.getActiveEnd());
} else if (columnName.equals("Data Size")) { } else if (columnName.equals("Data Size")) {
returnValue = (int) (this.getDataSetSize() - o.getDataSetSize()); returnValue = (int) (this.getDataSetSize() - o.getDataSetSize());
} } else {
else {
if (o.getSortValue(columnName) != null) { if (o.getSortValue(columnName) != null) {
returnValue = sortValue.toUpperCase().compareTo(o.getSortValue(columnName).toUpperCase()); returnValue = sortValue.toUpperCase().compareTo(
o.getSortValue(columnName).toUpperCase());
} }
} }
@ -585,4 +584,22 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
return returnValue; return returnValue;
} }
/**
* Get office ids as comma separated list
*
* @return String of office ids
*/
public String getOfficeIdsAsList() {
return StringUtil.join(this.officeIds, ',');
}
/**
* Get office ids display list, first 3 offices in the list
*
* @return the display string
*/
public String getOfficeIdsDisplayList() {
return StringUtil.getDisplayList(officeIds, " ", 3);
}
} }

View file

@ -99,7 +99,9 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jan 07, 2013 1437 bgonzale Added sort column direction updates. * Jan 07, 2013 1437 bgonzale Added sort column direction updates.
* Jan 28, 2013 1529 djohnson Disable menu items if no subscriptions are selected. * Jan 28, 2013 1529 djohnson Disable menu items if no subscriptions are selected.
* Apr 08, 2013 1826 djohnson Remove delivery options, move column value parsing to the columns themselves. * Apr 08, 2013 1826 djohnson Remove delivery options, move column value parsing to the columns themselves.
* May 29, 2013 2000 djohnson Consolidate and remove duplicate code. * May 09, 2013 2000 djohnson Consolidate and remove duplicate code.
* May 15, 2013 1040 mpduff Place markNotBusyInUIThread in a finally block.
* May 23, 2013 2020 mpduff Call updateControls();
* *
* </pre> * </pre>
* *
@ -246,11 +248,8 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
} }
if (table.getSelectionCount() > 1) { if (table.getSelectionCount() > 1) {
int choice = DataDeliveryUtils int choice = DataDeliveryUtils.showMessage(this.getShell(),
.showMessage( SWT.ERROR | SWT.YES | SWT.NO, "Single Selection Only",
this.getShell(),
SWT.ERROR | SWT.YES | SWT.NO,
"Single Selection Only",
"Multiple subscriptions are selected.\n" "Multiple subscriptions are selected.\n"
+ "Only the first selected item will be used.\n\n" + "Only the first selected item will be used.\n\n"
+ "Continue?"); + "Continue?");
@ -457,14 +456,18 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
job.addJobChangeListener(new JobChangeAdapter() { job.addJobChangeListener(new JobChangeAdapter() {
@Override @Override
public void done(IJobChangeEvent event) { public void done(IJobChangeEvent event) {
try {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
updateTable(subList); updateTable(subList);
subActionCallback.updateControls();
} }
}); });
} finally {
DataDeliveryGUIUtils.markNotBusyInUIThread(jobShell); DataDeliveryGUIUtils.markNotBusyInUIThread(jobShell);
} }
}
}); });
job.schedule(); job.schedule();
} }

View file

@ -19,8 +19,11 @@
**/ **/
package com.raytheon.uf.viz.datadelivery.subscription.approve; package com.raytheon.uf.viz.datadelivery.subscription.approve;
import java.util.Set;
import com.raytheon.uf.common.auth.user.IUser; import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.datadelivery.common.ui.ISortTable; import com.raytheon.uf.viz.datadelivery.common.ui.ISortTable;
import com.raytheon.uf.viz.datadelivery.common.ui.ITableData; import com.raytheon.uf.viz.datadelivery.common.ui.ITableData;
import com.raytheon.uf.viz.datadelivery.subscription.approve.SubApprovalTableComp.Action; import com.raytheon.uf.viz.datadelivery.subscription.approve.SubApprovalTableComp.Action;
@ -39,6 +42,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Sep 17, 2012 1157 mpduff Add null check. * Sep 17, 2012 1157 mpduff Add null check.
* Nov 28, 2012 1286 djohnson Hide details of checking whether a user is a row's subscription's owner. * Nov 28, 2012 1286 djohnson Hide details of checking whether a user is a row's subscription's owner.
* Dec 20, 2012 1413 bgonzale Implemented compareTo. * Dec 20, 2012 1413 bgonzale Implemented compareTo.
* May 15, 2013 1040 mpduff Change office id to a set.
* *
* </pre> * </pre>
* *
@ -46,7 +50,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* @version 1.0 * @version 1.0
*/ */
public class SubscriptionApprovalRowData implements ITableData<SubscriptionApprovalRowData> { public class SubscriptionApprovalRowData implements
ITableData<SubscriptionApprovalRowData> {
/** The subscription object */ /** The subscription object */
private InitialPendingSubscription subscription; private InitialPendingSubscription subscription;
@ -63,7 +68,7 @@ public class SubscriptionApprovalRowData implements ITableData<SubscriptionAppro
private String description; private String description;
/** The office id of the subscription */ /** The office id of the subscription */
private String officeId; private Set<String> officeIds;
/** Reason for the change to the subscription */ /** Reason for the change to the subscription */
private String changeReason; private String changeReason;
@ -155,21 +160,20 @@ public class SubscriptionApprovalRowData implements ITableData<SubscriptionAppro
} }
/** /**
* @return the officeId * @return the officeIds
*/ */
public String getOfficeId() { public Set<String> getOfficeIds() {
return officeId; return officeIds;
} }
/** /**
* @param officeId * @param officeIds
* the officeId to set * the officeIds to set
*/ */
public void setOfficeId(String officeId) { public void setOfficeIds(Set<String> officeIds) {
this.officeId = officeId; this.officeIds = officeIds;
} }
/** /**
* @return the changeReason * @return the changeReason
*/ */
@ -178,7 +182,8 @@ public class SubscriptionApprovalRowData implements ITableData<SubscriptionAppro
} }
/** /**
* @param changeReason the changeReason to set * @param changeReason
* the changeReason to set
*/ */
public void setChangeReason(String changeReason) { public void setChangeReason(String changeReason) {
this.changeReason = changeReason; this.changeReason = changeReason;
@ -186,7 +191,7 @@ public class SubscriptionApprovalRowData implements ITableData<SubscriptionAppro
private void populate() { private void populate() {
this.description = subscription.getDescription(); this.description = subscription.getDescription();
this.officeId = subscription.getOfficeID(); this.officeIds = subscription.getOfficeIDs();
this.owner = subscription.getOwner(); this.owner = subscription.getOwner();
this.subName = subscription.getName(); this.subName = subscription.getName();
this.changeOwner = subscription.getChangeReqId(); this.changeOwner = subscription.getChangeReqId();
@ -230,8 +235,8 @@ public class SubscriptionApprovalRowData implements ITableData<SubscriptionAppro
otherValue = o.getSubName(); otherValue = o.getSubName();
break; break;
case OFFICE: case OFFICE:
selfValue = getOfficeId(); selfValue = StringUtil.join(getOfficeIds(), ',');
otherValue = o.getOfficeId(); otherValue = StringUtil.join(o.getOfficeIds(), ',');
break; break;
case OWNER: case OWNER:
selfValue = getOwner(); selfValue = getOwner();
@ -268,7 +273,8 @@ public class SubscriptionApprovalRowData implements ITableData<SubscriptionAppro
} }
/** /**
* @param action the action to set * @param action
* the action to set
*/ */
public void setAction(String action) { public void setAction(String action) {
this.action = action; this.action = action;
@ -292,4 +298,13 @@ public class SubscriptionApprovalRowData implements ITableData<SubscriptionAppro
public boolean isOwner(IUser user) { public boolean isOwner(IUser user) {
return getSubscription().getOwner().equals(user.uniqueId().toString()); return getSubscription().getOwner().equals(user.uniqueId().toString());
} }
/**
* Get a list of office ids as a String
*
* @return list of ids
*/
public String getOfficeIdsAsList() {
return StringUtil.join(this.officeIds, ',');
}
} }

View file

@ -41,8 +41,10 @@ import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.DataSet; import com.raytheon.uf.common.datadelivery.registry.DataSet;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition; import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription; import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority; 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.Utils.SubscriptionStatus;
@ -107,6 +109,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions. * Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Add shared sites.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -178,6 +181,9 @@ public class CreateSubscriptionDlgPresenter {
* @param dataSet * @param dataSet
* The dataset * The dataset
* @param create * @param create
* true for create, false for edit
* @param guiThreadTaskExecutor
* task executor
*/ */
public CreateSubscriptionDlgPresenter(ICreateSubscriptionDlgView view, public CreateSubscriptionDlgPresenter(ICreateSubscriptionDlgView view,
DataSet dataSet, boolean create, DataSet dataSet, boolean create,
@ -231,7 +237,6 @@ public class CreateSubscriptionDlgPresenter {
} }
}; };
this.view.setCycleTimes(cycleTimes); this.view.setCycleTimes(cycleTimes);
this.view.setSubscription(this.subscription);
this.view.setPreOpenCallback(callback); this.view.setPreOpenCallback(callback);
this.view.openDlg(); this.view.openDlg();
} }
@ -253,6 +258,7 @@ public class CreateSubscriptionDlgPresenter {
*/ */
public void setSubscriptionData(Subscription sub) { public void setSubscriptionData(Subscription sub) {
this.subscription = sub; this.subscription = sub;
this.view.setSubscription(sub);
} }
/** /**
@ -387,6 +393,8 @@ public class CreateSubscriptionDlgPresenter {
if (!Strings.isNullOrEmpty(subscription.getGroupName())) { if (!Strings.isNullOrEmpty(subscription.getGroupName())) {
view.setGroupName(subscription.getGroupName()); view.setGroupName(subscription.getGroupName());
} }
view.setOfficeIds(subscription.getOfficeIDs());
} }
/** /**
@ -430,6 +438,18 @@ public class CreateSubscriptionDlgPresenter {
if (!validate()) { if (!validate()) {
return false; return false;
} }
String[] sharedSites = view.getSharedSites();
if (sharedSites != null && sharedSites.length > 1) {
SharedSubscription sharedSub = new SharedSubscription(subscription);
sharedSub.setRoute(Network.SBN);
Set<String> officeList = Sets.newHashSet(sharedSites);
sharedSub.setOfficeIDs(officeList);
subscription = sharedSub;
} else {
Set<String> officeList = Sets.newHashSet();
officeList.add(LocalizationManager.getInstance().getCurrentSite());
subscription.setOfficeIDs(officeList);
}
// Data are valid, now add info to the subscription object and store // Data are valid, now add info to the subscription object and store
subscription.setProvider(dataSet.getProviderName()); subscription.setProvider(dataSet.getProviderName());
@ -496,9 +516,6 @@ public class CreateSubscriptionDlgPresenter {
SubscriptionPriority priority = view.getPriority(); SubscriptionPriority priority = view.getPriority();
subscription.setPriority(priority); subscription.setPriority(priority);
subscription.setOfficeID(LocalizationManager.getInstance()
.getCurrentSite());
subscription.setName(view.getSubscriptionName()); subscription.setName(view.getSubscriptionName());
subscription.setDescription(view.getSubscriptionDescription()); subscription.setDescription(view.getSubscriptionDescription());
@ -549,17 +566,19 @@ public class CreateSubscriptionDlgPresenter {
job.addJobChangeListener(new JobChangeAdapter() { job.addJobChangeListener(new JobChangeAdapter() {
@Override @Override
public void done(final IJobChangeEvent event) { public void done(final IJobChangeEvent event) {
try {
final IStatus status = event.getResult(); final IStatus status = event.getResult();
final boolean subscriptionCreated = status.isOK(); final boolean subscriptionCreated = status
.isOK();
if (subscriptionCreated) { if (subscriptionCreated) {
sendSubscriptionNotification(subscription, sendSubscriptionNotification(subscription,
username); username);
} }
if (!Strings.isNullOrEmpty(status.getMessage())) { if (!Strings.isNullOrEmpty(status.getMessage())) {
guiThreadTaskExecutor.runAsync(new Runnable() { guiThreadTaskExecutor
.runAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!view.isDisposed()) { if (!view.isDisposed()) {
@ -579,9 +598,11 @@ public class CreateSubscriptionDlgPresenter {
} }
}); });
} }
} finally {
DataDeliveryGUIUtils DataDeliveryGUIUtils
.markNotBusyInUIThread(jobShell); .markNotBusyInUIThread(jobShell);
}; }
}
}); });
job.schedule(); job.schedule();
return false; return false;
@ -609,8 +630,7 @@ public class CreateSubscriptionDlgPresenter {
} else { } else {
// Check for pending subscription, can only have one pending change // Check for pending subscription, can only have one pending change
PendingSubscription pendingSub = subscription PendingSubscription pendingSub = subscription
.pending(LocalizationManager.getInstance() .pending(LocalizationManager.getInstance().getCurrentUser());
.getCurrentUser());
pendingSub.setChangeReason(view.getChangeReason()); pendingSub.setChangeReason(view.getChangeReason());
// Create the registry ids // Create the registry ids

View file

@ -50,9 +50,9 @@ import com.raytheon.uf.common.datadelivery.registry.Ensemble;
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet; import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData; import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.serialization.JAXBManager; import com.raytheon.uf.common.serialization.JAXBManager;
@ -89,6 +89,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Jan 28, 2013 1533 djohnson Update the calculated dataset size after loading subset xml. * Jan 28, 2013 1533 djohnson Update the calculated dataset size after loading subset xml.
* Mar 21, 2013 1794 djohnson Add option to create a shared subscription, if phase3 code is available. * Mar 21, 2013 1794 djohnson Add option to create a shared subscription, if phase3 code is available.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* *
* </pre> * </pre>
@ -258,7 +259,7 @@ public class GriddedSubsetManagerDlg
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public <T extends UserSubscription> T createSubscription(T sub, public <T extends SiteSubscription> T createSubscription(T sub,
Network defaultRoute) { Network defaultRoute) {
T subscription = super.createSubscription(sub, defaultRoute); T subscription = super.createSubscription(sub, defaultRoute);
if (subscription == null) { if (subscription == null) {

View file

@ -1,58 +0,0 @@
/**
* 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.datadelivery.subscription.subset;
import org.eclipse.swt.SWT;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
/**
* Placeholder shared subscription handler that will display a notice the
* functionality is not available. It should never be invoked unless the
* 5-Data_Delivery phase 3 code is available, but provides another layer in case
* it somehow is invoked.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2013 1841 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class NotEnabledSubscriptionHandler implements
ISharedSubscriptionHandler {
/**
* {@inheritDoc}
*/
@Override
public void launchCreateSharedSubscriptionGui(SubsetManagerDlg<?, ?, ?> subsetManagerDlg) {
DataDeliveryUtils.showMessage(subsetManagerDlg.getShell(), SWT.OK,
"Unavailable option", "Shared subscriptions are not enabled.");
}
}

View file

@ -56,10 +56,9 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Levels; import com.raytheon.uf.common.datadelivery.registry.Levels;
import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Parameter; import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants; import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.retrieval.util.DataSizeUtils; import com.raytheon.uf.common.datadelivery.retrieval.util.DataSizeUtils;
@ -70,7 +69,6 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.ServiceLoaderUtil;
import com.raytheon.uf.viz.core.VizAppTaskExecutor; import com.raytheon.uf.viz.core.VizAppTaskExecutor;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.common.xml.AreaXML; import com.raytheon.uf.viz.datadelivery.common.xml.AreaXML;
@ -136,6 +134,8 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Mar 21, 2013 1794 djohnson Add option to create a shared subscription, if phase3 code is available. * Mar 21, 2013 1794 djohnson Add option to create a shared subscription, if phase3 code is available.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Implement shared subscriptions.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -151,10 +151,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
private final IUFStatusHandler statusHandler = UFStatus private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SubsetManagerDlg.class); .getHandler(SubsetManagerDlg.class);
private final ISharedSubscriptionHandler sharedSubscriptionHandler = ServiceLoaderUtil
.load(SubsetManagerDlg.class, ISharedSubscriptionHandler.class,
new NotEnabledSubscriptionHandler());
/** Subset Name text box */ /** Subset Name text box */
private Text nameText; private Text nameText;
@ -478,29 +474,15 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
subscribeBtn.addSelectionListener(new SelectionAdapter() { subscribeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (subscription == null) {
launchCreateSubscriptionGui(createSubscription( launchCreateSubscriptionGui(createSubscription(
new UserSubscription(), Network.OPSNET)); new SiteSubscription(), Network.OPSNET));
} else {
launchCreateSubscriptionGui(subscription);
}
} }
}); });
if (create) {
if (DataDeliveryConstants.PHASE3_ENABLED) {
btnData = new GridData(buttonWidth, SWT.DEFAULT);
Button sharedSubscribeBtn = new Button(bottomComp, SWT.PUSH);
sharedSubscribeBtn.setText("Shared...");
sharedSubscribeBtn
.setToolTipText("Click to create a shared subscription to a subset");
sharedSubscribeBtn.setLayoutData(btnData);
sharedSubscribeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
sharedSubscriptionHandler
.launchCreateSharedSubscriptionGui(SubsetManagerDlg.this);
}
});
}
}
btnData = new GridData(buttonWidth, SWT.DEFAULT); btnData = new GridData(buttonWidth, SWT.DEFAULT);
Button queryBtn = new Button(bottomComp, SWT.PUSH); Button queryBtn = new Button(bottomComp, SWT.PUSH);
queryBtn.setText("Query"); queryBtn.setText("Query");
@ -525,6 +507,12 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
}); });
} }
/**
* Launch the Create Subscription GUI.
*
* @param sub
* The subscription object
*/
public void launchCreateSubscriptionGui(Subscription sub) { public void launchCreateSubscriptionGui(Subscription sub) {
DataDeliveryGUIUtils.markBusyInUIThread(shell); DataDeliveryGUIUtils.markBusyInUIThread(shell);
if (handleOK(sub)) { if (handleOK(sub)) {
@ -535,17 +523,11 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
} }
/** /**
* OK button action handler * Launch the Create Subscription GUI
*
* @param defaultRoute
*
* @return true if data are valid
*/ */
private boolean handleOK(Subscription sub) { private boolean handleOK(Subscription sub) {
if (this.validated(true)) { if (this.validated(true)) {
if (subDlg != null && !subDlg.isDisposed()) { if (subDlg != null && !subDlg.isDisposed()) {
subDlg.setSubscriptionData(sub);
subDlg.bringToTop(); subDlg.bringToTop();
} else { } else {
subDlg = new CreateSubscriptionDlgPresenter( subDlg = new CreateSubscriptionDlgPresenter(
@ -589,23 +571,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
} }
} }
/**
* Create the shared subscription.
*
* @param <T>
* The subscription object reference type
* @param sub
* The subscription to populate
* @param the
* route for the subscription
*
* @return the populated subscription
*/
public SharedSubscription createSubscription(SharedSubscription sub,
Network defaultRoute) {
return setupCommonSubscriptionAttributes(sub, defaultRoute);
}
/** /**
* Create the user subscription. * Create the user subscription.
* *
@ -618,7 +583,7 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
* *
* @return the populated subscription * @return the populated subscription
*/ */
public <T extends UserSubscription> T createSubscription(T sub, protected <T extends SiteSubscription> T createSubscription(T sub,
Network defaultRoute) { Network defaultRoute) {
Preconditions.checkNotNull(sub, "A subscription must be provided."); Preconditions.checkNotNull(sub, "A subscription must be provided.");
@ -654,7 +619,12 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
sub.setRoute(defaultRoute); sub.setRoute(defaultRoute);
sub.setName(nameText.getText()); sub.setName(nameText.getText());
sub.setOfficeID(LocalizationManager.getInstance().getCurrentSite()); if (subscription == null || subscription.getOfficeIDs() == null) {
sub.addOfficeID(LocalizationManager.getInstance().getCurrentSite());
} else {
sub.setOfficeIDs(subscription.getOfficeIDs());
}
if (!create) { if (!create) {
sub.setGroupName(this.subscription.getGroupName()); sub.setGroupName(this.subscription.getGroupName());
sub.setSubscriptionEnd(this.subscription.getSubscriptionEnd()); sub.setSubscriptionEnd(this.subscription.getSubscriptionEnd());

View file

@ -46,6 +46,7 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
* Jan 04, 2013 1420 mpduff Added getters for latency and priority. * Jan 04, 2013 1420 mpduff Added getters for latency and priority.
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum. * Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 13, 2013 1040 mpduff Added getSharedSites method.
* *
* </pre> * </pre>
* *
@ -394,4 +395,19 @@ public interface ICreateSubscriptionDlgView extends IPresenterView {
* @param cycleTimes * @param cycleTimes
*/ */
void setCycleTimes(Set<Integer> cycleTimes); void setCycleTimes(Set<Integer> cycleTimes);
/**
* Get the list of shared sites
*
* @return shared sites
*/
String[] getSharedSites();
/**
* Set the list of office ids.
*
* @param officeIDs
* list of office ids
*/
void setOfficeIds(Set<String> officeIDs);
} }

View file

@ -29,7 +29,10 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner; import org.eclipse.swt.widgets.Spinner;
@ -60,6 +63,7 @@ import com.raytheon.uf.viz.core.VizApp;
* Dec 18, 2012 1439 mpduff Change Regex to match invalid chars. * Dec 18, 2012 1439 mpduff Change Regex to match invalid chars.
* Jan 04, 2013 1420 mpduff Change default priority to normal priority. * Jan 04, 2013 1420 mpduff Change default priority to normal priority.
* Jan 25, 2013 1528 djohnson Subscription priority has moved up in the world to the Subscription class. * Jan 25, 2013 1528 djohnson Subscription priority has moved up in the world to the Subscription class.
* May 17, 2013 1040 mpduff Fixed JavaDoc and added tooltip.
* May 20, 2013 2000 djohnson Add methods for managing widget listeners. * May 20, 2013 2000 djohnson Add methods for managing widget listeners.
* *
* </pre> * </pre>
@ -73,6 +77,9 @@ public class DataDeliveryGUIUtils {
private final static IUFStatusHandler statusHandler = UFStatus private final static IUFStatusHandler statusHandler = UFStatus
.getHandler(DataDeliveryGUIUtils.class); .getHandler(DataDeliveryGUIUtils.class);
/** Tooltip */
private static Shell tooltip;
/** Subscription start/end date format */ /** Subscription start/end date format */
private final static ThreadLocal<SimpleDateFormat> subscriptionFormat = new ThreadLocal<SimpleDateFormat>() { private final static ThreadLocal<SimpleDateFormat> subscriptionFormat = new ThreadLocal<SimpleDateFormat>() {
@Override @Override
@ -279,9 +286,10 @@ public class DataDeliveryGUIUtils {
* mouse cursor over it to the wait cursor. To undo this call the * mouse cursor over it to the wait cursor. To undo this call the
* corresponding method markNotBusyInUIThread(Shell). * corresponding method markNotBusyInUIThread(Shell).
* *
* @see DataDeliveryGUIUtils.markNotBusyInUIThread(Shell) * @see #DataDeliveryGUIUtils.markNotBusyInUIThread(Shell)
* *
* @param shell * @param shell
* The Shell to mark busy
*/ */
public static void markBusyInUIThread(final Shell shell) { public static void markBusyInUIThread(final Shell shell) {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@ -301,9 +309,13 @@ public class DataDeliveryGUIUtils {
* mouse cursor to normal. This call is the followup to * mouse cursor to normal. This call is the followup to
* markBusyInUIThread(Shell). * markBusyInUIThread(Shell).
* *
* @see DataDeliveryGUIUtils.markBusyInUIThread(Shell) * This should be placed in a finally block so when exceptions occur this
* code is still called.
*
* @see #DataDeliveryGUIUtils.markBusyInUIThread(Shell)
* *
* @param shell * @param shell
* the Shell used in markBusyInUIThread
*/ */
public static void markNotBusyInUIThread(final Shell shell) { public static void markNotBusyInUIThread(final Shell shell) {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@ -320,6 +332,11 @@ public class DataDeliveryGUIUtils {
/** /**
* Check the user's latency value. * Check the user's latency value.
* *
* @param latency
* the latency value
* @param maxLatency
* the max latency value
*
* @return true if valid * @return true if valid
*/ */
public static boolean latencyValidChk(int latency, int maxLatency) { public static boolean latencyValidChk(int latency, int maxLatency) {
@ -397,4 +414,49 @@ public class DataDeliveryGUIUtils {
} }
}; };
} }
/**
* Get a tooltip display. Caller is responsible for disposing the tooltip by
* calling {@link #hideToolTip}.
*
* @param parent
* the parent shell
* @param x
* the x location
* @param y
* the y location
* @param text
* the text
*/
public static void showTooltip(Shell parent, int x, int y, String text) {
if (tooltip != null && !tooltip.isDisposed()) {
tooltip.dispose();
}
tooltip = new Shell(parent, SWT.TOOL | SWT.ON_TOP);
tooltip.setLayout(new GridLayout());
tooltip.setBackground(tooltip.getDisplay().getSystemColor(
SWT.COLOR_INFO_BACKGROUND));
tooltip.setBackgroundMode(SWT.INHERIT_FORCE);
Label lbContent = new Label(tooltip, SWT.NONE);
lbContent.setText(text);
Point lbContentSize = lbContent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int width = lbContentSize.x + 10;
int height = lbContentSize.y + 10;
tooltip.setBounds(x, y, width, height);
tooltip.setVisible(true);
}
/**
* Dispose the tooltip created by {@link #showTooltip}
*/
public static void hideToolTip() {
if (tooltip != null && !tooltip.isDisposed()) {
tooltip.dispose();
}
}
} }

View file

@ -27,6 +27,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
@ -42,6 +43,7 @@ import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest; import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerRowData; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerRowData;
@ -71,6 +73,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jan 30, 2013 1543 djohnson Use List instead of ArrayList. * Jan 30, 2013 1543 djohnson Use List instead of ArrayList.
* Apr 08, 2013 1826 djohnson Add getDisplayData() method to subscription columns. * Apr 08, 2013 1826 djohnson Add getDisplayData() method to subscription columns.
* Apr 10, 2013 1891 djohnson Add getDisplayData() method to pending subscription columns. * Apr 10, 2013 1891 djohnson Add getDisplayData() method to pending subscription columns.
* May 15, 2013 1040 mpduff Using Set for office Ids.
* May 20, 2013 2000 djohnson Add message to inform the user changes were applied. * May 20, 2013 2000 djohnson Add message to inform the user changes were applied.
* </pre> * </pre>
* *
@ -252,7 +255,7 @@ public class DataDeliveryUtils {
OFFICE_ID("Office ID", null) { OFFICE_ID("Office ID", null) {
@Override @Override
public String getDisplayData(SubscriptionManagerRowData rd) { public String getDisplayData(SubscriptionManagerRowData rd) {
return rd.getOfficeId(); return rd.getOfficeIdsDisplayList();
} }
}, },
/** Column Full Dataset */ /** Column Full Dataset */
@ -420,7 +423,7 @@ public class DataDeliveryUtils {
OFFICE("Office Id", null) { OFFICE("Office Id", null) {
@Override @Override
public String getDisplayData(SubscriptionApprovalRowData rd) { public String getDisplayData(SubscriptionApprovalRowData rd) {
return rd.getOfficeId(); return rd.getOfficeIdsAsList();
} }
}, },
/** Description */ /** Description */
@ -607,7 +610,7 @@ public class DataDeliveryUtils {
* @return The formated details string * @return The formated details string
*/ */
public static String formatDetails(Subscription sub) { public static String formatDetails(Subscription sub) {
final String newline = System.getProperty("line.separator"); final String newline = StringUtil.NEWLINE;
final String space = " "; final String space = " ";
final String comma = ", "; final String comma = ", ";
@ -622,9 +625,11 @@ public class DataDeliveryUtils {
fmtStr.append("Dataset Size: ").append(sub.getDataSetSize()) fmtStr.append("Dataset Size: ").append(sub.getDataSetSize())
.append(newline); .append(newline);
fmtStr.append("Provider: ").append(sub.getProvider()).append(newline); fmtStr.append("Provider: ").append(sub.getProvider()).append(newline);
fmtStr.append("Office ID: ").append(sub.getOfficeID()).append(newline); fmtStr.append("Office IDs: ")
.append(getFormatedList(sub.getOfficeIDs())).append(newline);
fmtStr.append("Priority: ") fmtStr.append("Priority: ")
.append(sub.getPriority().getPriorityValue()).append(newline); .append(sub.getPriority().getPriorityValue()).append(newline);
fmtStr.append("Network: ").append(sub.getRoute()).append(newline);
fmtStr.append("Coverage: ").append(newline); fmtStr.append("Coverage: ").append(newline);
final Coverage coverage = sub.getCoverage(); final Coverage coverage = sub.getCoverage();
@ -713,6 +718,17 @@ public class DataDeliveryUtils {
return fmtStr.toString(); return fmtStr.toString();
} }
/**
* Get a formatted list.
*
* @param list
* List of items
* @return a formatted list as a String
*/
public static String getFormatedList(Set<String> list) {
return StringUtil.getIndentedList(list, " ");
}
/** /**
* Send an authorization request * Send an authorization request
* *
@ -756,7 +772,8 @@ public class DataDeliveryUtils {
final int nextIndex = i + 1; final int nextIndex = i + 1;
if (nextIndex < size) { if (nextIndex < size) {
int tempMax = cycles.get(nextIndex) - cycles.get(i); int tempMax = cycles.get(nextIndex) - cycles.get(i);
maximumTimeBetweenCycles = Math.max(maximumTimeBetweenCycles, tempMax); maximumTimeBetweenCycles = Math.max(maximumTimeBetweenCycles,
tempMax);
} }
} }

View file

@ -0,0 +1,86 @@
/**
* 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.viz.ui.widgets;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import com.raytheon.viz.ui.widgets.duallist.DualList;
import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
/**
* Dual list widget composite.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class DualListComposite extends Composite {
private DualList dl;
private final DualListConfig config;
/**
* Constructor.
*
* @param parent
* Parent composite
* @param config
* Dual list config
*/
public DualListComposite(Composite parent, DualListConfig config) {
super(parent, SWT.NONE);
this.config = config;
init();
}
/**
* Initialize
*/
private void init() {
GridLayout gl = new GridLayout(3, false);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
dl = new DualList(this, SWT.NONE, config);
dl.setLayout(gl);
dl.setLayoutData(gd);
}
/**
* Get the selected items.
*
* @return String[] of items in the selected list
*/
public String[] getSelectedItems() {
return dl.getSelectedListItems();
}
}

View file

@ -0,0 +1,54 @@
#!/bin/bash
SQL_SCRIPT="getSubscriptionSite.sql"
# ensure that the sql script is present
if [ ! -f ${SQL_SCRIPT} ]; then
echo "ERROR: the required sql script - ${SQL_SCRIPT} was not found."
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: update started - converting Subscription sites to a collection"
# run the update
OUTPUT=`/awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT}`
SITE=`echo $OUTPUT | sed 's/.*{\(.*\)}.*/\1/g'`
if [ $? -ne 0 ]; then
echo "FATAL: the update has failed!"
exit 1
fi
# If we were able to find a subscription with a site, then this update will run.
# Otherwise, there are no subscriptions to convert.
if test "${SITE#*awips}" != "$SITE"
then
echo "INFO: there are no subscriptions in the database, not applying update."
exit 0
fi
SQL_SCRIPT="convertSubscriptionSitesToCollection.sql"
# ensure that the sql script is present
if [ ! -f ${SQL_SCRIPT} ]; then
echo "ERROR: the required sql script - ${SQL_SCRIPT} was not found."
echo "FATAL: the update has failed!"
exit 1
fi
# Copy the sql file, replacing the SITE token with the actual site
cat ${SQL_SCRIPT} | sed "s/@@SITE@@/${SITE}/g" > /tmp/${SQL_SCRIPT}
# run the update
/awips2/psql/bin/psql -U awips -d metadata -f /tmp/${SQL_SCRIPT}
if [ $? -ne 0 ]; then
echo "FATAL: the update has failed!"
exit 1
fi
# Remove temporary file
rm /tmp/${SQL_SCRIPT}
echo "INFO: the update has completed successfully!"
exit 0

View file

@ -17,34 +17,20 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.datadelivery.subscription.subset; \set ON_ERROR_STOP 1
\connect metadata;
/** -- Start a transaction
* Interface that will be implemented for phase3 datadelivery, but not in the BEGIN;
* common baseline.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2013 1841 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public interface ISharedSubscriptionHandler {
/** -- Remove officeID attribute
* Launch the GUI to create a shared subscription. update ebxml.value set stringvalue = regexp_replace(stringvalue, 'officeID=".*?"', '', 'g');
*
* @param subsetManagerDlg
*/
void launchCreateSharedSubscriptionGui(
SubsetManagerDlg<?, ?, ?> subsetManagerDlg);
} -- Add officeID element
update ebxml.value set stringvalue = regexp_replace(stringvalue, '(<pendingSiteSubscription.*?>)', E'\\1<officeId>@@SITE@@</officeId>', 'g');
update ebxml.value set stringvalue = regexp_replace(stringvalue, '(<initialPendingSiteSubscription.*?>)', E'\\1<officeId>@@SITE@@</officeId>', 'g');
update ebxml.value set stringvalue = regexp_replace(stringvalue, '(<siteSubscription.*?>)', E'\\1<officeId>@@SITE@@</officeId>', 'g');
-- Commit the transaction
END;

View file

@ -0,0 +1,23 @@
/**
* 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.
**/
\set ON_ERROR_STOP 1
\connect metadata;
select distinct regexp_matches(stringvalue, 'officeID="(.*?)"') from ebxml.value where stringvalue like '%officeID%';

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SQL_SCRIPT="renameSubscriptionToUserSubscription.sql" SQL_SCRIPT="renameSubscriptionToSiteSubscription.sql"
# ensure that the sql script is present # ensure that the sql script is present
if [ ! -f ${SQL_SCRIPT} ]; then if [ ! -f ${SQL_SCRIPT} ]; then
@ -9,7 +9,7 @@ if [ ! -f ${SQL_SCRIPT} ]; then
exit 1 exit 1
fi fi
echo "INFO: update started - renaming Subscription to UserSubscription" echo "INFO: update started - renaming Subscription to SiteSubscription"
# run the update # run the update
/awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT} /awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT}

View file

@ -23,49 +23,49 @@
-- Start a transaction -- Start a transaction
BEGIN; BEGIN;
-- New classification nodes for UserSubscription -- New classification nodes for SiteSubscription
insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'com.raytheon.uf.common.datadelivery.registry.UserSubscription', parent, '/com.raytheon.uf.common.datadelivery.registry.UserSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription'; insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.SiteSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.SiteSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'com.raytheon.uf.common.datadelivery.registry.SiteSubscription', parent, '/com.raytheon.uf.common.datadelivery.registry.SiteSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:UserSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:UserSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'UserSubscription', parent, '/urn:oasis:names:tc:ebxml-regrep:classificationScheme:ObjectType/RegistryObject/UserSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription'; insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:SiteSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:SiteSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'SiteSubscription', parent, '/urn:oasis:names:tc:ebxml-regrep:classificationScheme:ObjectType/RegistryObject/SiteSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription';
-- Update foreign keys for the taxonomy to UserSubscription -- Update foreign keys for the taxonomy to SiteSubscription
update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription'; update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.SiteSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:UserSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription'; update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:SiteSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription';
-- Delete Subscription classification nodes -- Delete Subscription classification nodes
delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription'; delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription';
delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription'; delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
-- Update registry object references from Subscription to UserSubscription -- Update registry object references from Subscription to SiteSubscription
update ebxml.registryobjectlist_registryobject set registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription' where registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription'; update ebxml.registryobjectlist_registryobject set registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.SiteSubscription' where registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
update ebxml.registryobject set objecttype = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription' where objecttype ='urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription'; update ebxml.registryobject set objecttype = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.SiteSubscription' where objecttype ='urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
update ebxml.value set stringvalue = regexp_replace(stringvalue, '<subscription ', '<userSubscription ', 'g'); update ebxml.value set stringvalue = regexp_replace(stringvalue, '<subscription ', '<siteSubscription ', 'g');
update ebxml.value set stringvalue = regexp_replace(stringvalue, '</subscription>', '</userSubscription>', 'g'); update ebxml.value set stringvalue = regexp_replace(stringvalue, '</subscription>', '</siteSubscription>', 'g');
-- Update the aggregated events -- Update the aggregated events
update events.aggregate set grouping = regexp_replace(grouping, 'com\.raytheon\.uf\.common\.datadelivery\.registry\.Subscription', 'com.raytheon.uf.common.datadelivery.registry.UserSubscription', 'g'); update events.aggregate set grouping = regexp_replace(grouping, 'com\.raytheon\.uf\.common\.datadelivery\.registry\.Subscription', 'com.raytheon.uf.common.datadelivery.registry.SiteSubscription', 'g');
-- New classification nodes for InitialPendingUserSubscription -- New classification nodes for InitialPendingSiteSubscription
insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription', parent, '/com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription'; insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription', parent, '/com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription';
insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingUserSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingUserSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'UserSubscription', parent, '/urn:oasis:names:tc:ebxml-regrep:classificationScheme:ObjectType/RegistryObject/UserSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSubscription'; insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSiteSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSiteSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'SiteSubscription', parent, '/urn:oasis:names:tc:ebxml-regrep:classificationScheme:ObjectType/RegistryObject/SiteSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSubscription';
-- Update foreign keys for the taxonomy to InitialPendingUserSubscription -- Update foreign keys for the taxonomy to InitialPendingSiteSubscription
update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription'; update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription';
update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingUserSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSubscription'; update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSiteSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSubscription';
-- Delete InitialPendingSubscription classification nodes -- Delete InitialPendingSubscription classification nodes
delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSubscription'; delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSubscription';
delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription'; delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription';
-- Update registry object references from InitialPendingSubscription to InitialPendingUserSubscription -- Update registry object references from InitialPendingSubscription to InitialPendingSiteSubscription
update ebxml.registryobjectlist_registryobject set registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription' where registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription'; update ebxml.registryobjectlist_registryobject set registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription' where registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription';
update ebxml.registryobject set objecttype = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription' where objecttype ='urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription'; update ebxml.registryobject set objecttype = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription' where objecttype ='urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription';
update ebxml.value set stringvalue = regexp_replace(stringvalue, '<pendingSubscription ', '<pendingUserSubscription ', 'g'); update ebxml.value set stringvalue = regexp_replace(stringvalue, '<pendingSubscription ', '<pendingSiteSubscription ', 'g');
update ebxml.value set stringvalue = regexp_replace(stringvalue, '</pendingSubscription>', '</pendingUserSubscription>', 'g'); update ebxml.value set stringvalue = regexp_replace(stringvalue, '</pendingSubscription>', '</pendingSiteSubscription>', 'g');
update ebxml.value set stringvalue = regexp_replace(stringvalue, '<initialPendingSubscription ', '<initialPendingUserSubscription ', 'g'); update ebxml.value set stringvalue = regexp_replace(stringvalue, '<initialPendingSubscription ', '<initialPendingSiteSubscription ', 'g');
update ebxml.value set stringvalue = regexp_replace(stringvalue, '</initialPendingSubscription>', '</initialPendingUserSubscription>', 'g'); update ebxml.value set stringvalue = regexp_replace(stringvalue, '</initialPendingSubscription>', '</initialPendingSiteSubscription>', 'g');
-- Update the aggregated events -- Update the aggregated events
update events.aggregate set grouping = regexp_replace(grouping, 'com\.raytheon\.uf\.common\.datadelivery\.registry\.InitialPendingSubscription', 'com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription', 'g'); update events.aggregate set grouping = regexp_replace(grouping, 'com\.raytheon\.uf\.common\.datadelivery\.registry\.InitialPendingSubscription', 'com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription', 'g');
-- Commit the transaction -- Commit the transaction
END; END;

View file

@ -23,6 +23,7 @@ package com.raytheon.uf.common.auth.req;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution; import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.auth.resp.UserNotAuthorized;
import com.raytheon.uf.common.serialization.ExceptionWrapper; import com.raytheon.uf.common.serialization.ExceptionWrapper;
import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse; import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -37,7 +38,8 @@ import com.raytheon.uf.common.status.UFStatus;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 23, 2013 1643 djohnson Initial creation * Jan 23, 2013 1643 djohnson Initial creation.
* May 20, 2013 1040 mpduff Add check for UserNotAuthorized.
* *
* </pre> * </pre>
* *
@ -70,6 +72,8 @@ public class BasePrivilegedServerService<T extends AbstractPrivilegedRequest>
ExceptionWrapper ExceptionWrapper
.unwrapThrowable(((ServerErrorResponse) object) .unwrapThrowable(((ServerErrorResponse) object)
.getException())); .getException()));
} else if (object instanceof UserNotAuthorized) {
return null;
} else { } else {
statusHandler statusHandler
.warn(String .warn(String

View file

@ -20,7 +20,7 @@ com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData
com.raytheon.uf.common.datadelivery.registry.Parameter com.raytheon.uf.common.datadelivery.registry.Parameter
com.raytheon.uf.common.datadelivery.registry.ParameterLevel com.raytheon.uf.common.datadelivery.registry.ParameterLevel
com.raytheon.uf.common.datadelivery.registry.PendingSharedSubscription com.raytheon.uf.common.datadelivery.registry.PendingSharedSubscription
com.raytheon.uf.common.datadelivery.registry.PendingUserSubscription com.raytheon.uf.common.datadelivery.registry.PendingSiteSubscription
com.raytheon.uf.common.datadelivery.registry.Projection com.raytheon.uf.common.datadelivery.registry.Projection
com.raytheon.uf.common.datadelivery.registry.Provider com.raytheon.uf.common.datadelivery.registry.Provider
com.raytheon.uf.common.datadelivery.registry.Time com.raytheon.uf.common.datadelivery.registry.Time

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Dec 11, 2012 1403 djohnson No longer a registry object. * Dec 11, 2012 1403 djohnson No longer a registry object.
* Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor. * Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -53,7 +54,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@XmlRootElement(name = "AdhocSubscription") @XmlRootElement(name = "AdhocSubscription")
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
public class AdhocSubscription extends UserSubscription implements public class AdhocSubscription extends SiteSubscription implements
ISerializableObject { ISerializableObject {
private static final long serialVersionUID = -2200080380095632486L; private static final long serialVersionUID = -2200080380095632486L;
@ -62,7 +63,7 @@ public class AdhocSubscription extends UserSubscription implements
setGroupName("Adhoc"); setGroupName("Adhoc");
} }
public AdhocSubscription(UserSubscription subscription) { public AdhocSubscription(SiteSubscription subscription) {
super(subscription); super(subscription);
setGroupName("Adhoc"); setGroupName("Adhoc");
} }

View file

@ -32,6 +32,7 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 5, 2012 0726 djohnson Initial creation * Oct 5, 2012 0726 djohnson Initial creation
* Dec 11, 2012 1403 djohnson Adhoc subscriptions no longer go to the registry. * Dec 11, 2012 1403 djohnson Adhoc subscriptions no longer go to the registry.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -49,8 +50,8 @@ public final class DataDeliveryRegistryObjectTypes {
public static final String DATASETMETADATA = RegistryUtil public static final String DATASETMETADATA = RegistryUtil
.getObjectType(DataSetMetaData.class); .getObjectType(DataSetMetaData.class);
public static final String USER_SUBSCRIPTION = RegistryUtil public static final String SITE_SUBSCRIPTION = RegistryUtil
.getObjectType(UserSubscription.class); .getObjectType(SiteSubscription.class);
public static final String SHARED_SUBSCRIPTION = RegistryUtil public static final String SHARED_SUBSCRIPTION = RegistryUtil
.getObjectType(SharedSubscription.class); .getObjectType(SharedSubscription.class);

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor. * Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* Apr 02, 2013 1841 djohnson InitialPendingSubscription is now InitialPendingUserSubscription. * Apr 02, 2013 1841 djohnson InitialPendingSubscription is now InitialPendingUserSubscription.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -57,7 +58,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT, Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
Subscription.OWNER_SLOT, Subscription.OWNER_SLOT,
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }) InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT })
public class InitialPendingUserSubscription extends UserSubscription implements public class InitialPendingSiteSubscription extends SiteSubscription implements
InitialPendingSubscription { InitialPendingSubscription {
private static final long serialVersionUID = 2779084460608459754L; private static final long serialVersionUID = 2779084460608459754L;
@ -75,7 +76,7 @@ public class InitialPendingUserSubscription extends UserSubscription implements
/** /**
* Constructor * Constructor
*/ */
public InitialPendingUserSubscription() { public InitialPendingSiteSubscription() {
//empty //empty
} }
@ -87,7 +88,7 @@ public class InitialPendingUserSubscription extends UserSubscription implements
* @param user * @param user
* user * user
*/ */
public InitialPendingUserSubscription(UserSubscription subscription, String user) { public InitialPendingSiteSubscription(SiteSubscription subscription, String user) {
super(subscription); super(subscription);
this.setChangeReqId(user); this.setChangeReqId(user);
@ -134,6 +135,6 @@ public class InitialPendingUserSubscription extends UserSubscription implements
*/ */
@Override @Override
public Subscription subscription() { public Subscription subscription() {
return new UserSubscription(this); return new SiteSubscription(this);
} }
} }

View file

@ -53,22 +53,22 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@XmlRootElement @XmlRootElement
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
@RegistryObject(objectType = InitialPendingUserSubscription.class, value = { @RegistryObject(objectType = InitialPendingSiteSubscription.class, value = {
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT, Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT, Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT,
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = AssociationTypes.RELATED_TO, keyFields = { InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = AssociationTypes.RELATED_TO, keyFields = {
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT, Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = UserSubscription.class) }) Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = SiteSubscription.class) })
public class PendingUserSubscription extends InitialPendingUserSubscription public class PendingSiteSubscription extends InitialPendingSiteSubscription
implements PendingSubscription, ISerializableObject { implements PendingSubscription, ISerializableObject {
private static final long serialVersionUID = 7607153845750089310L; private static final long serialVersionUID = 7607153845750089310L;
public PendingUserSubscription() { public PendingSiteSubscription() {
} }
public PendingUserSubscription(UserSubscription subscription, public PendingSiteSubscription(SiteSubscription subscription,
String currentUser) { String currentUser) {
super(subscription, currentUser); super(subscription, currentUser);
} }

View file

@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
@ -35,10 +37,12 @@ import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.HashCodeBuilder;
import com.google.common.collect.Sets;
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus; import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
import com.raytheon.uf.common.registry.annotations.SlotAttribute; import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter; import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.ebxml.slots.SetSlotConverter;
import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
@ -54,6 +58,8 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 25, 2013 1841 djohnson Extracted from Subscription. * Mar 25, 2013 1841 djohnson Extracted from Subscription.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Changed to use Set for office id.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -61,8 +67,8 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* @version 1.0 * @version 1.0
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso({ PendingUserSubscription.class, PendingSharedSubscription.class, @XmlSeeAlso({ PendingSiteSubscription.class, PendingSharedSubscription.class,
AdhocSubscription.class, UserSubscription.class, AdhocSubscription.class, SiteSubscription.class,
SharedSubscription.class }) SharedSubscription.class })
public abstract class RecurringSubscription implements ISerializableObject, public abstract class RecurringSubscription implements ISerializableObject,
Serializable, Subscription { Serializable, Subscription {
@ -84,7 +90,7 @@ public abstract class RecurringSubscription implements ISerializableObject,
* @param name * @param name
* New subscription name * New subscription name
*/ */
public RecurringSubscription(RecurringSubscription sub, String name) { public RecurringSubscription(Subscription sub, String name) {
this.setActive(sub.isActive()); this.setActive(sub.isActive());
this.setActivePeriodEnd(sub.getActivePeriodEnd()); this.setActivePeriodEnd(sub.getActivePeriodEnd());
this.setActivePeriodStart(sub.getActivePeriodStart()); this.setActivePeriodStart(sub.getActivePeriodStart());
@ -96,7 +102,7 @@ public abstract class RecurringSubscription implements ISerializableObject,
this.setGroupName(sub.getGroupName()); this.setGroupName(sub.getGroupName());
this.setId(sub.getId()); this.setId(sub.getId());
this.setName(name); this.setName(name);
this.setOfficeID(sub.getOfficeID()); this.setOfficeIDs(sub.getOfficeIDs());
this.setParameter(sub.getParameter()); this.setParameter(sub.getParameter());
this.setPriority(sub.getPriority()); this.setPriority(sub.getPriority());
this.setProvider(sub.getProvider()); this.setProvider(sub.getProvider());
@ -120,7 +126,7 @@ public abstract class RecurringSubscription implements ISerializableObject,
* @param sub * @param sub
* Subscription object * Subscription object
*/ */
public RecurringSubscription(RecurringSubscription sub) { public RecurringSubscription(Subscription sub) {
this(sub, sub.getName()); this(sub, sub.getName());
} }
@ -143,10 +149,11 @@ public abstract class RecurringSubscription implements ISerializableObject,
@SlotAttribute(PROVIDER_NAME_SLOT) @SlotAttribute(PROVIDER_NAME_SLOT)
private String provider; private String provider;
@XmlAttribute @XmlElements({ @XmlElement(name = "officeId") })
@DynamicSerializeElement @DynamicSerializeElement
@SlotAttribute @SlotAttribute
private String officeID; @SlotAttributeConverter(SetSlotConverter.class)
protected Set<String> officeIDs = Sets.newTreeSet();
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@ -308,24 +315,19 @@ public abstract class RecurringSubscription implements ISerializableObject,
} }
/** /**
* Get owner office id. * {@inheritDoc}
*
* @return office id
*/ */
@Override @Override
public String getOfficeID() { public Set<String> getOfficeIDs() {
return officeID; return officeIDs;
} }
/** /**
* Set office id. * {@inheritDoc}
*
* @param officeID
* the office id
*/ */
@Override @Override
public void setOfficeID(String officeID) { public void setOfficeIDs(Set<String> officeIDs) {
this.officeID = officeID; this.officeIDs = new TreeSet<String>(officeIDs);
} }
/** /**

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 27, 2013 1841 djohnson Initial creation * Mar 27, 2013 1841 djohnson Initial creation
* May 15, 2013 1040 mpduff Added addOfficeId.
* *
* </pre> * </pre>
* *
@ -52,7 +53,7 @@ public class SharedSubscription extends RecurringSubscription {
private static final long serialVersionUID = -7221500266253493273L; private static final long serialVersionUID = -7221500266253493273L;
public static final String SHARED_SUBSCRIPTION_OWNER = "shared"; private static final String SHARED_SUBSCRIPTION_OWNER = "shared";
/** /**
* Constructor. * Constructor.
@ -64,7 +65,7 @@ public class SharedSubscription extends RecurringSubscription {
/** /**
* @param sharedSubscription * @param sharedSubscription
*/ */
public SharedSubscription(SharedSubscription sub) { public SharedSubscription(Subscription sub) {
super(sub); super(sub);
} }
@ -114,4 +115,14 @@ public class SharedSubscription extends RecurringSubscription {
public PendingSubscription pending(String currentUser) { public PendingSubscription pending(String currentUser) {
return new PendingSharedSubscription(this, currentUser); return new PendingSharedSubscription(this, currentUser);
} }
/**
* {@inheritDoc}
*/
@Override
public void addOfficeID(String officeId) {
if (!officeIDs.contains(officeId)) {
this.officeIDs.add(officeId);
}
}
} }

View file

@ -56,6 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum. * Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
* Feb 20, 2013 1543 djohnson Route is now a slot. * Feb 20, 2013 1543 djohnson Route is now a slot.
* Mar 29, 2013 1841 djohnson Renamed to UserSubscription. * Mar 29, 2013 1841 djohnson Renamed to UserSubscription.
* May 15, 2013 1040 mpduff Added addOfficeId.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -68,13 +70,13 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@RegistryObject({ Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT, @RegistryObject({ Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }) Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT })
@DynamicSerialize @DynamicSerialize
public class UserSubscription extends RecurringSubscription { public class SiteSubscription extends RecurringSubscription {
private static final long serialVersionUID = -6422673887457060034L; private static final long serialVersionUID = -6422673887457060034L;
/** /**
* Constructor. * Constructor.
*/ */
public UserSubscription() { public SiteSubscription() {
} }
@ -86,7 +88,7 @@ public class UserSubscription extends RecurringSubscription {
* @param name * @param name
* New subscription name * New subscription name
*/ */
public UserSubscription(UserSubscription sub, String name) { public SiteSubscription(SiteSubscription sub, String name) {
this(sub); this(sub);
this.setName(name); this.setName(name);
this.setId(RegistryUtil.getRegistryObjectKey(this)); this.setId(RegistryUtil.getRegistryObjectKey(this));
@ -98,7 +100,7 @@ public class UserSubscription extends RecurringSubscription {
* @param sub * @param sub
* Subscription object * Subscription object
*/ */
public UserSubscription(UserSubscription sub) { public SiteSubscription(SiteSubscription sub) {
super(sub); super(sub);
this.setOwner(sub.getOwner()); this.setOwner(sub.getOwner());
} }
@ -133,7 +135,7 @@ public class UserSubscription extends RecurringSubscription {
*/ */
@Override @Override
public Subscription copy() { public Subscription copy() {
return new UserSubscription(this); return new SiteSubscription(this);
} }
/** /**
@ -141,7 +143,7 @@ public class UserSubscription extends RecurringSubscription {
*/ */
@Override @Override
public Subscription copy(String newName) { public Subscription copy(String newName) {
return new UserSubscription(this, newName); return new SiteSubscription(this, newName);
} }
/** /**
@ -149,7 +151,7 @@ public class UserSubscription extends RecurringSubscription {
*/ */
@Override @Override
public InitialPendingSubscription initialPending(String currentUser) { public InitialPendingSubscription initialPending(String currentUser) {
return new InitialPendingUserSubscription(this, currentUser); return new InitialPendingSiteSubscription(this, currentUser);
} }
/** /**
@ -157,6 +159,16 @@ public class UserSubscription extends RecurringSubscription {
*/ */
@Override @Override
public PendingSubscription pending(String currentUser) { public PendingSubscription pending(String currentUser) {
return new PendingUserSubscription(this, currentUser); return new PendingSiteSubscription(this, currentUser);
}
/**
* {@inheritDoc}
*/
@Override
public void addOfficeID(String officeId) {
if (!officeIDs.contains(officeId)) {
this.officeIDs.add(officeId);
}
} }
} }

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.common.datadelivery.registry;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlEnumValue;
@ -36,6 +37,7 @@ import javax.xml.bind.annotation.XmlEnumValue;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 25, 2013 1841 djohnson Extracted from UserSubscription. * Mar 25, 2013 1841 djohnson Extracted from UserSubscription.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Changed officeId to a set.
* *
* </pre> * </pre>
* *
@ -180,19 +182,19 @@ public interface Subscription {
String getOwner(); String getOwner();
/** /**
* Get owner office id. * Get office ids.
* *
* @return office id * @return office id list
*/ */
String getOfficeID(); Set<String> getOfficeIDs();
/** /**
* Set office id. * Set office ids.
* *
* @param officeID * @param officeIDs
* the office id * the office ids
*/ */
void setOfficeID(String officeID); void setOfficeIDs(Set<String> officeIDs);
/** /**
* Get subscription priority for fulfillment. * Get subscription priority for fulfillment.
@ -591,4 +593,12 @@ public interface Subscription {
* @return * @return
*/ */
PendingSubscription pending(String currentUser); PendingSubscription pending(String currentUser);
/**
* Add an office Id to the list.
*
* @param officeId
* Office Id to add
*/
void addOfficeID(String officeId);
} }

View file

@ -22,7 +22,8 @@ package com.raytheon.uf.common.datadelivery.registry.ebxml;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/** /**
@ -39,6 +40,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Jun 21, 2012 736 djohnson Add thrift serialization annotations. * Jun 21, 2012 736 djohnson Add thrift serialization annotations.
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries. * Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
* Sep 24, 2012 1157 mpduff Extends InitialPendingUserSubscriptionQuery. * Sep 24, 2012 1157 mpduff Extends InitialPendingUserSubscriptionQuery.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -47,22 +49,22 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
public class PendingUserSubscriptionQuery extends public class PendingSiteSubscriptionQuery extends
SubscriptionFilterableQuery<InitialPendingUserSubscription> { SubscriptionFilterableQuery<InitialPendingSiteSubscription> {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Class<InitialPendingUserSubscription> getResultType() { public Class<InitialPendingSiteSubscription> getResultType() {
return InitialPendingUserSubscription.class; return InitialPendingSiteSubscription.class;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Class<InitialPendingUserSubscription> getObjectType() { public Class<InitialPendingSiteSubscription> getObjectType() {
return InitialPendingUserSubscription.class; return InitialPendingSiteSubscription.class;
} }
} }

View file

@ -22,12 +22,12 @@ package com.raytheon.uf.common.datadelivery.registry.ebxml;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/** /**
* Implementation of {@link SubscriptionFilterableQuery} to retrieve * Implementation of {@link SubscriptionFilterableQuery} to retrieve
* {@link UserSubscription}s. * {@link SiteSubscription}s.
* *
* <pre> * <pre>
* *
@ -39,6 +39,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Jul 23, 2012 702 jpiatt Added setters for groupName & officeId. * Jul 23, 2012 702 jpiatt Added setters for groupName & officeId.
* Oct 03, 2012 1241 djohnson Move query parameters to {@link SubscriptionFilterableQuery}. * Oct 03, 2012 1241 djohnson Move query parameters to {@link SubscriptionFilterableQuery}.
* Mar 29, 2013 1841 djohnson Renamed from SubscriptionQuery. * Mar 29, 2013 1841 djohnson Renamed from SubscriptionQuery.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -48,21 +49,21 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
public class UserSubscriptionQuery extends public class SiteSubscriptionQuery extends
SubscriptionFilterableQuery<UserSubscription> { SubscriptionFilterableQuery<SiteSubscription> {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Class<UserSubscription> getResultType() { public Class<SiteSubscription> getResultType() {
return UserSubscription.class; return SiteSubscription.class;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Class<UserSubscription> getObjectType() { public Class<SiteSubscription> getObjectType() {
return UserSubscription.class; return SiteSubscription.class;
} }
} }

View file

@ -19,12 +19,12 @@
**/ **/
package com.raytheon.uf.common.datadelivery.registry.handlers; package com.raytheon.uf.common.datadelivery.registry.handlers;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
/** /**
* The {@link IRegistryObjectHandler} interface for * The {@link IRegistryObjectHandler} interface for
* {@link InitialPendingUserSubscription}. * {@link InitialPendingSiteSubscription}.
* *
* <pre> * <pre>
* *
@ -41,6 +41,6 @@ import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
* @author djohnson * @author djohnson
* @version 1.0 * @version 1.0
*/ */
public interface IPendingUserSubscriptionHandler extends public interface IPendingSiteSubscriptionHandler extends
IBasePendingSubscriptionHandler<InitialPendingUserSubscription> { IBasePendingSubscriptionHandler<InitialPendingSiteSubscription> {
} }

View file

@ -20,7 +20,7 @@
package com.raytheon.uf.common.datadelivery.registry.handlers; package com.raytheon.uf.common.datadelivery.registry.handlers;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
/** /**
@ -41,6 +41,6 @@ import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
* @author djohnson * @author djohnson
* @version 1.0 * @version 1.0
*/ */
public interface IUserSubscriptionHandler extends public interface ISiteSubscriptionHandler extends
ISubscriptionTypeHandler<UserSubscription> { ISubscriptionTypeHandler<SiteSubscription> {
} }

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 05, 2013 1841 djohnson Initial creation * Apr 05, 2013 1841 djohnson Initial creation
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *

View file

@ -19,13 +19,13 @@
**/ **/
package com.raytheon.uf.common.datadelivery.registry.handlers; package com.raytheon.uf.common.datadelivery.registry.handlers;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.ebxml.PendingUserSubscriptionQuery; import com.raytheon.uf.common.datadelivery.registry.ebxml.PendingSiteSubscriptionQuery;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
/** /**
* {@link IRegistryObjectHandler} implementation for * {@link IRegistryObjectHandler} implementation for
* {@link InitialPendingUserSubscription}s. * {@link InitialPendingSiteSubscription}s.
* *
* <pre> * <pre>
* *
@ -42,23 +42,23 @@ import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
* @author djohnson * @author djohnson
* @version 1.0 * @version 1.0
*/ */
public class PendingUserSubscriptionHandler extends public class PendingSiteSubscriptionHandler extends
BasePendingSubscriptionHandler<InitialPendingUserSubscription, PendingUserSubscriptionQuery> BasePendingSubscriptionHandler<InitialPendingSiteSubscription, PendingSiteSubscriptionQuery>
implements IPendingUserSubscriptionHandler { implements IPendingSiteSubscriptionHandler {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected PendingUserSubscriptionQuery getQuery() { protected PendingSiteSubscriptionQuery getQuery() {
return new PendingUserSubscriptionQuery(); return new PendingSiteSubscriptionQuery();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected Class<InitialPendingUserSubscription> getRegistryObjectClass() { protected Class<InitialPendingSiteSubscription> getRegistryObjectClass() {
return InitialPendingUserSubscription.class; return InitialPendingSiteSubscription.class;
} }
} }

View file

@ -29,10 +29,10 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSharedSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
@ -58,22 +58,22 @@ import com.raytheon.uf.common.util.CollectionUtil;
*/ */
public class PendingSubscriptionHandler implements IPendingSubscriptionHandler { public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
private final IPendingUserSubscriptionHandler userSubscriptionHandler; private final IPendingSiteSubscriptionHandler siteSubscriptionHandler;
private final IPendingSharedSubscriptionHandler sharedSubscriptionHandler; private final IPendingSharedSubscriptionHandler sharedSubscriptionHandler;
/** /**
* Constructor. * Constructor.
* *
* @param userSubscriptionHandler * @param siteSubscriptionHandler
* the user subscription handler * the user subscription handler
* @param sharedSubscriptionHandler * @param sharedSubscriptionHandler
* the shared subscription handler * the shared subscription handler
*/ */
public PendingSubscriptionHandler( public PendingSubscriptionHandler(
IPendingUserSubscriptionHandler userSubscriptionHandler, IPendingSiteSubscriptionHandler siteSubscriptionHandler,
IPendingSharedSubscriptionHandler sharedSubscriptionHandler) { IPendingSharedSubscriptionHandler sharedSubscriptionHandler) {
this.userSubscriptionHandler = userSubscriptionHandler; this.siteSubscriptionHandler = siteSubscriptionHandler;
this.sharedSubscriptionHandler = sharedSubscriptionHandler; this.sharedSubscriptionHandler = sharedSubscriptionHandler;
} }
@ -83,7 +83,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public InitialPendingSubscription getByName(String name) public InitialPendingSubscription getByName(String name)
throws RegistryHandlerException { throws RegistryHandlerException {
InitialPendingSubscription value = userSubscriptionHandler InitialPendingSubscription value = siteSubscriptionHandler
.getByName(name); .getByName(name);
if (value == null) { if (value == null) {
value = sharedSubscriptionHandler.getByName(name); value = sharedSubscriptionHandler.getByName(name);
@ -98,8 +98,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public List<InitialPendingSubscription> getByOwner(String owner) public List<InitialPendingSubscription> getByOwner(String owner)
throws RegistryHandlerException { throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList(); List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getByOwner(owner)); subs.addAll(siteSubscriptionHandler.getByOwner(owner));
subs.addAll(userSubscriptionHandler.getByOwner(owner)); subs.addAll(siteSubscriptionHandler.getByOwner(owner));
return subs; return subs;
} }
@ -110,7 +110,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public List<InitialPendingSubscription> getByGroupName(String group) public List<InitialPendingSubscription> getByGroupName(String group)
throws RegistryHandlerException { throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList(); List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getByGroupName(group)); subs.addAll(siteSubscriptionHandler.getByGroupName(group));
subs.addAll(sharedSubscriptionHandler.getByGroupName(group)); subs.addAll(sharedSubscriptionHandler.getByGroupName(group));
return subs; return subs;
} }
@ -122,7 +122,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public List<InitialPendingSubscription> getByFilters(String group, public List<InitialPendingSubscription> getByFilters(String group,
String officeId) throws RegistryHandlerException { String officeId) throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList(); List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getByFilters(group, officeId)); subs.addAll(siteSubscriptionHandler.getByFilters(group, officeId));
subs.addAll(sharedSubscriptionHandler.getByFilters(group, officeId)); subs.addAll(sharedSubscriptionHandler.getByFilters(group, officeId));
return subs; return subs;
} }
@ -134,7 +134,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public Set<String> getSubscribedToDataSetNames() public Set<String> getSubscribedToDataSetNames()
throws RegistryHandlerException { throws RegistryHandlerException {
Set<String> names = Sets.newHashSet(); Set<String> names = Sets.newHashSet();
names.addAll(userSubscriptionHandler.getSubscribedToDataSetNames()); names.addAll(siteSubscriptionHandler.getSubscribedToDataSetNames());
names.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames()); names.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames());
return names; return names;
} }
@ -146,7 +146,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public List<InitialPendingSubscription> getActive() public List<InitialPendingSubscription> getActive()
throws RegistryHandlerException { throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList(); List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getActive()); subs.addAll(siteSubscriptionHandler.getActive());
subs.addAll(sharedSubscriptionHandler.getActive()); subs.addAll(sharedSubscriptionHandler.getActive());
return subs; return subs;
} }
@ -158,7 +158,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public List<InitialPendingSubscription> getActiveForRoute(Network route) public List<InitialPendingSubscription> getActiveForRoute(Network route)
throws RegistryHandlerException { throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList(); List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getActiveForRoute(route)); subs.addAll(siteSubscriptionHandler.getActiveForRoute(route));
subs.addAll(sharedSubscriptionHandler.getActiveForRoute(route)); subs.addAll(sharedSubscriptionHandler.getActiveForRoute(route));
return subs; return subs;
} }
@ -170,7 +170,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public List<InitialPendingSubscription> getActiveForRoutes( public List<InitialPendingSubscription> getActiveForRoutes(
Network... routes) throws RegistryHandlerException { Network... routes) throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList(); List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getActiveForRoutes(routes)); subs.addAll(siteSubscriptionHandler.getActiveForRoutes(routes));
subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes)); subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes));
return subs; return subs;
} }
@ -181,7 +181,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public InitialPendingSubscription getById(String id) public InitialPendingSubscription getById(String id)
throws RegistryHandlerException { throws RegistryHandlerException {
InitialPendingSubscription value = userSubscriptionHandler.getById(id); InitialPendingSubscription value = siteSubscriptionHandler.getById(id);
if (value == null) { if (value == null) {
value = sharedSubscriptionHandler.getById(id); value = sharedSubscriptionHandler.getById(id);
} }
@ -195,7 +195,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public List<InitialPendingSubscription> getAll() public List<InitialPendingSubscription> getAll()
throws RegistryHandlerException { throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList(); List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getAll()); subs.addAll(siteSubscriptionHandler.getAll());
subs.addAll(sharedSubscriptionHandler.getAll()); subs.addAll(sharedSubscriptionHandler.getAll());
return subs; return subs;
} }
@ -206,8 +206,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public void store(InitialPendingSubscription obj) public void store(InitialPendingSubscription obj)
throws RegistryHandlerException { throws RegistryHandlerException {
if (obj instanceof InitialPendingUserSubscription) { if (obj instanceof InitialPendingSiteSubscription) {
userSubscriptionHandler.store((InitialPendingUserSubscription) obj); siteSubscriptionHandler.store((InitialPendingSiteSubscription) obj);
} else { } else {
sharedSubscriptionHandler sharedSubscriptionHandler
.store((InitialPendingSharedSubscription) obj); .store((InitialPendingSharedSubscription) obj);
@ -220,9 +220,9 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public void update(InitialPendingSubscription obj) public void update(InitialPendingSubscription obj)
throws RegistryHandlerException { throws RegistryHandlerException {
if (obj instanceof InitialPendingUserSubscription) { if (obj instanceof InitialPendingSiteSubscription) {
userSubscriptionHandler siteSubscriptionHandler
.update((InitialPendingUserSubscription) obj); .update((InitialPendingSiteSubscription) obj);
} else { } else {
sharedSubscriptionHandler sharedSubscriptionHandler
.update((InitialPendingSharedSubscription) obj); .update((InitialPendingSharedSubscription) obj);
@ -235,9 +235,9 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public void delete(InitialPendingSubscription obj) public void delete(InitialPendingSubscription obj)
throws RegistryHandlerException { throws RegistryHandlerException {
if (obj instanceof InitialPendingUserSubscription) { if (obj instanceof InitialPendingSiteSubscription) {
userSubscriptionHandler siteSubscriptionHandler
.delete((InitialPendingUserSubscription) obj); .delete((InitialPendingSiteSubscription) obj);
} else { } else {
sharedSubscriptionHandler sharedSubscriptionHandler
.delete((InitialPendingSharedSubscription) obj); .delete((InitialPendingSharedSubscription) obj);
@ -250,7 +250,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public void deleteById(String username, String registryId) public void deleteById(String username, String registryId)
throws RegistryHandlerException { throws RegistryHandlerException {
userSubscriptionHandler.deleteById(username, registryId); siteSubscriptionHandler.deleteById(username, registryId);
sharedSubscriptionHandler.deleteById(username, registryId); sharedSubscriptionHandler.deleteById(username, registryId);
} }
@ -260,7 +260,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public void deleteByIds(String username, List<String> registryIds) public void deleteByIds(String username, List<String> registryIds)
throws RegistryHandlerException { throws RegistryHandlerException {
userSubscriptionHandler.deleteByIds(username, registryIds); siteSubscriptionHandler.deleteByIds(username, registryIds);
sharedSubscriptionHandler.deleteByIds(username, registryIds); sharedSubscriptionHandler.deleteByIds(username, registryIds);
} }
@ -270,9 +270,9 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public void delete(String username, InitialPendingSubscription obj) public void delete(String username, InitialPendingSubscription obj)
throws RegistryHandlerException { throws RegistryHandlerException {
if (obj instanceof InitialPendingUserSubscription) { if (obj instanceof InitialPendingSiteSubscription) {
userSubscriptionHandler.delete(username, siteSubscriptionHandler.delete(username,
(InitialPendingUserSubscription) obj); (InitialPendingSiteSubscription) obj);
} else { } else {
sharedSubscriptionHandler.delete(username, sharedSubscriptionHandler.delete(username,
(InitialPendingSharedSubscription) obj); (InitialPendingSharedSubscription) obj);
@ -288,8 +288,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
throws RegistryHandlerException { throws RegistryHandlerException {
if (!CollectionUtil.isNullOrEmpty(objects)) { if (!CollectionUtil.isNullOrEmpty(objects)) {
final Collection asSubtype = objects; final Collection asSubtype = objects;
if (objects.iterator().next() instanceof InitialPendingUserSubscription) { if (objects.iterator().next() instanceof InitialPendingSiteSubscription) {
userSubscriptionHandler.delete(asSubtype); siteSubscriptionHandler.delete(asSubtype);
} else { } else {
sharedSubscriptionHandler.delete(asSubtype); sharedSubscriptionHandler.delete(asSubtype);
} }
@ -306,8 +306,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
throws RegistryHandlerException { throws RegistryHandlerException {
if (!CollectionUtil.isNullOrEmpty(objects)) { if (!CollectionUtil.isNullOrEmpty(objects)) {
final Collection asSubtype = objects; final Collection asSubtype = objects;
if (objects.iterator().next() instanceof UserSubscription) { if (objects.iterator().next() instanceof SiteSubscription) {
userSubscriptionHandler.delete(username, asSubtype); siteSubscriptionHandler.delete(username, asSubtype);
} else { } else {
sharedSubscriptionHandler.delete(username, asSubtype); sharedSubscriptionHandler.delete(username, asSubtype);
} }
@ -320,8 +320,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public InitialPendingSubscription getBySubscription( public InitialPendingSubscription getBySubscription(
Subscription subscription) throws RegistryHandlerException { Subscription subscription) throws RegistryHandlerException {
if (subscription instanceof UserSubscription) { if (subscription instanceof SiteSubscription) {
return userSubscriptionHandler.getBySubscription(subscription); return siteSubscriptionHandler.getBySubscription(subscription);
} else { } else {
return sharedSubscriptionHandler.getBySubscription(subscription); return sharedSubscriptionHandler.getBySubscription(subscription);
} }
@ -333,7 +333,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
@Override @Override
public InitialPendingSubscription getBySubscriptionId(String id) public InitialPendingSubscription getBySubscriptionId(String id)
throws RegistryHandlerException { throws RegistryHandlerException {
InitialPendingSubscription value = userSubscriptionHandler.getById(id); InitialPendingSubscription value = siteSubscriptionHandler.getById(id);
if (value == null) { if (value == null) {
value = sharedSubscriptionHandler.getById(id); value = sharedSubscriptionHandler.getById(id);
} }
@ -350,8 +350,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
throws RegistryHandlerException { throws RegistryHandlerException {
if (!CollectionUtil.isNullOrEmpty(subscriptions)) { if (!CollectionUtil.isNullOrEmpty(subscriptions)) {
final Collection asSubtype = subscriptions; final Collection asSubtype = subscriptions;
if (subscriptions.iterator().next() instanceof UserSubscription) { if (subscriptions.iterator().next() instanceof SiteSubscription) {
return nullOrSubscriptionList(userSubscriptionHandler return nullOrSubscriptionList(siteSubscriptionHandler
.getBySubscriptions(asSubtype)); .getBySubscriptions(asSubtype));
} else { } else {
return nullOrSubscriptionList(sharedSubscriptionHandler return nullOrSubscriptionList(sharedSubscriptionHandler
@ -368,7 +368,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
public List<InitialPendingSubscription> getBySubscriptionIds( public List<InitialPendingSubscription> getBySubscriptionIds(
List<String> ids) throws RegistryHandlerException { List<String> ids) throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList(); List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getBySubscriptionIds(ids)); subs.addAll(siteSubscriptionHandler.getBySubscriptionIds(ids));
subs.addAll(sharedSubscriptionHandler.getBySubscriptionIds(ids)); subs.addAll(sharedSubscriptionHandler.getBySubscriptionIds(ids));
return subs; return subs;
} }

View file

@ -19,12 +19,12 @@
**/ **/
package com.raytheon.uf.common.datadelivery.registry.handlers; package com.raytheon.uf.common.datadelivery.registry.handlers;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.ebxml.UserSubscriptionQuery; import com.raytheon.uf.common.datadelivery.registry.ebxml.SiteSubscriptionQuery;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
/** /**
* {@link IRegistryObjectHandler} implementation for {@link UserSubscription}. * {@link IRegistryObjectHandler} implementation for {@link SiteSubscription}.
* *
* <pre> * <pre>
* *
@ -43,23 +43,23 @@ import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
* @author djohnson * @author djohnson
* @version 1.0 * @version 1.0
*/ */
public class UserSubscriptionHandler extends public class SiteSubscriptionHandler extends
SubscriptionTypeHandler<UserSubscription, UserSubscriptionQuery> SubscriptionTypeHandler<SiteSubscription, SiteSubscriptionQuery>
implements IUserSubscriptionHandler { implements ISiteSubscriptionHandler {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected UserSubscriptionQuery getQuery() { protected SiteSubscriptionQuery getQuery() {
return new UserSubscriptionQuery(); return new SiteSubscriptionQuery();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected Class<UserSubscription> getRegistryObjectClass() { protected Class<SiteSubscription> getRegistryObjectClass() {
return UserSubscription.class; return SiteSubscription.class;
} }
} }

View file

@ -26,11 +26,11 @@ import java.util.Set;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.PendingSiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription; 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.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
@ -49,6 +49,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
* Oct 17, 2012 0726 djohnson Add {@link #getActiveByDataSetAndProvider}. * Oct 17, 2012 0726 djohnson Add {@link #getActiveByDataSetAndProvider}.
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions. * Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
* 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil * 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* *
* </pre> * </pre>
* *
@ -57,22 +58,22 @@ import com.raytheon.uf.common.util.CollectionUtil;
*/ */
public class SubscriptionHandler implements ISubscriptionHandler { public class SubscriptionHandler implements ISubscriptionHandler {
private final IUserSubscriptionHandler userSubscriptionHandler; private final ISiteSubscriptionHandler siteSubscriptionHandler;
private final ISharedSubscriptionHandler sharedSubscriptionHandler; private final ISharedSubscriptionHandler sharedSubscriptionHandler;
/** /**
* Constructor. * Constructor.
* *
* @param userSubscriptionHandler * @param siteSubscriptionHandler
* the user subscription handler * the user subscription handler
* @param sharedSubscriptionHandler * @param sharedSubscriptionHandler
* the shared subscription handler * the shared subscription handler
*/ */
public SubscriptionHandler( public SubscriptionHandler(
IUserSubscriptionHandler userSubscriptionHandler, ISiteSubscriptionHandler siteSubscriptionHandler,
ISharedSubscriptionHandler sharedSubscriptionHandler) { ISharedSubscriptionHandler sharedSubscriptionHandler) {
this.userSubscriptionHandler = userSubscriptionHandler; this.siteSubscriptionHandler = siteSubscriptionHandler;
this.sharedSubscriptionHandler = sharedSubscriptionHandler; this.sharedSubscriptionHandler = sharedSubscriptionHandler;
} }
@ -82,8 +83,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
@Override @Override
public Subscription getByPendingSubscription(PendingSubscription pending) public Subscription getByPendingSubscription(PendingSubscription pending)
throws RegistryHandlerException { throws RegistryHandlerException {
if (pending instanceof PendingUserSubscription) { if (pending instanceof PendingSiteSubscription) {
return userSubscriptionHandler.getByPendingSubscription(pending); return siteSubscriptionHandler.getByPendingSubscription(pending);
} else { } else {
return sharedSubscriptionHandler.getByPendingSubscription(pending); return sharedSubscriptionHandler.getByPendingSubscription(pending);
} }
@ -95,7 +96,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
@Override @Override
public Subscription getByPendingSubscriptionId(final String id) public Subscription getByPendingSubscriptionId(final String id)
throws RegistryHandlerException { throws RegistryHandlerException {
Subscription value = userSubscriptionHandler.getById(id); Subscription value = siteSubscriptionHandler.getById(id);
if (value == null) { if (value == null) {
value = sharedSubscriptionHandler.getById(id); value = sharedSubscriptionHandler.getById(id);
} }
@ -108,7 +109,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
@Override @Override
public void deleteByIds(String username, List<String> ids) public void deleteByIds(String username, List<String> ids)
throws RegistryHandlerException { throws RegistryHandlerException {
userSubscriptionHandler.deleteByIds(username, ids); siteSubscriptionHandler.deleteByIds(username, ids);
sharedSubscriptionHandler.deleteByIds(username, ids); sharedSubscriptionHandler.deleteByIds(username, ids);
} }
@ -119,7 +120,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
public List<Subscription> getActiveByDataSetAndProvider(String dataSetName, public List<Subscription> getActiveByDataSetAndProvider(String dataSetName,
String providerName) throws RegistryHandlerException { String providerName) throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList(); List<Subscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getActiveByDataSetAndProvider( subs.addAll(siteSubscriptionHandler.getActiveByDataSetAndProvider(
dataSetName, providerName)); dataSetName, providerName));
subs.addAll(sharedSubscriptionHandler.getActiveByDataSetAndProvider( subs.addAll(sharedSubscriptionHandler.getActiveByDataSetAndProvider(
dataSetName, providerName)); dataSetName, providerName));
@ -132,7 +133,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
*/ */
@Override @Override
public Subscription getByName(String name) throws RegistryHandlerException { public Subscription getByName(String name) throws RegistryHandlerException {
Subscription value = userSubscriptionHandler.getByName(name); Subscription value = siteSubscriptionHandler.getByName(name);
if (value == null) { if (value == null) {
value = sharedSubscriptionHandler.getByName(name); value = sharedSubscriptionHandler.getByName(name);
} }
@ -146,7 +147,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
public List<Subscription> getByOwner(String owner) public List<Subscription> getByOwner(String owner)
throws RegistryHandlerException { throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList(); List<Subscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getByOwner(owner)); subs.addAll(siteSubscriptionHandler.getByOwner(owner));
subs.addAll(sharedSubscriptionHandler.getByOwner(owner)); subs.addAll(sharedSubscriptionHandler.getByOwner(owner));
return subs; return subs;
@ -159,7 +160,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
public List<Subscription> getByGroupName(String group) public List<Subscription> getByGroupName(String group)
throws RegistryHandlerException { throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList(); List<Subscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getByGroupName(group)); subs.addAll(siteSubscriptionHandler.getByGroupName(group));
subs.addAll(sharedSubscriptionHandler.getByGroupName(group)); subs.addAll(sharedSubscriptionHandler.getByGroupName(group));
return subs; return subs;
@ -172,7 +173,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
public List<Subscription> getByFilters(String group, String officeId) public List<Subscription> getByFilters(String group, String officeId)
throws RegistryHandlerException { throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList(); List<Subscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getByFilters(group, officeId)); subs.addAll(siteSubscriptionHandler.getByFilters(group, officeId));
subs.addAll(sharedSubscriptionHandler.getByFilters(group, officeId)); subs.addAll(sharedSubscriptionHandler.getByFilters(group, officeId));
return subs; return subs;
@ -185,7 +186,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
public Set<String> getSubscribedToDataSetNames() public Set<String> getSubscribedToDataSetNames()
throws RegistryHandlerException { throws RegistryHandlerException {
Set<String> set = Sets.newHashSet(); Set<String> set = Sets.newHashSet();
set.addAll(userSubscriptionHandler.getSubscribedToDataSetNames()); set.addAll(siteSubscriptionHandler.getSubscribedToDataSetNames());
set.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames()); set.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames());
return set; return set;
@ -197,7 +198,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
@Override @Override
public List<Subscription> getActive() throws RegistryHandlerException { public List<Subscription> getActive() throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList(); List<Subscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getActive()); subs.addAll(siteSubscriptionHandler.getActive());
subs.addAll(sharedSubscriptionHandler.getActive()); subs.addAll(sharedSubscriptionHandler.getActive());
return subs; return subs;
@ -210,7 +211,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
public List<Subscription> getActiveForRoute(Network route) public List<Subscription> getActiveForRoute(Network route)
throws RegistryHandlerException { throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList(); List<Subscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getActiveForRoute(route)); subs.addAll(siteSubscriptionHandler.getActiveForRoute(route));
subs.addAll(sharedSubscriptionHandler.getActiveForRoute(route)); subs.addAll(sharedSubscriptionHandler.getActiveForRoute(route));
return subs; return subs;
} }
@ -222,7 +223,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
public List<Subscription> getActiveForRoutes(Network... routes) public List<Subscription> getActiveForRoutes(Network... routes)
throws RegistryHandlerException { throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList(); List<Subscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getActiveForRoutes(routes)); subs.addAll(siteSubscriptionHandler.getActiveForRoutes(routes));
subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes)); subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes));
return subs; return subs;
} }
@ -232,7 +233,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
*/ */
@Override @Override
public Subscription getById(String id) throws RegistryHandlerException { public Subscription getById(String id) throws RegistryHandlerException {
Subscription value = userSubscriptionHandler.getById(id); Subscription value = siteSubscriptionHandler.getById(id);
if (value == null) { if (value == null) {
value = sharedSubscriptionHandler.getById(id); value = sharedSubscriptionHandler.getById(id);
} }
@ -245,7 +246,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
@Override @Override
public List<Subscription> getAll() throws RegistryHandlerException { public List<Subscription> getAll() throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList(); List<Subscription> subs = Lists.newArrayList();
subs.addAll(userSubscriptionHandler.getAll()); subs.addAll(siteSubscriptionHandler.getAll());
subs.addAll(sharedSubscriptionHandler.getAll()); subs.addAll(sharedSubscriptionHandler.getAll());
return subs; return subs;
} }
@ -255,8 +256,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
*/ */
@Override @Override
public void store(Subscription obj) throws RegistryHandlerException { public void store(Subscription obj) throws RegistryHandlerException {
if (obj instanceof UserSubscription) { if (obj instanceof SiteSubscription) {
userSubscriptionHandler.store((UserSubscription) obj); siteSubscriptionHandler.store((SiteSubscription) obj);
} else { } else {
sharedSubscriptionHandler.store((SharedSubscription) obj); sharedSubscriptionHandler.store((SharedSubscription) obj);
} }
@ -267,8 +268,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
*/ */
@Override @Override
public void update(Subscription obj) throws RegistryHandlerException { public void update(Subscription obj) throws RegistryHandlerException {
if (obj instanceof UserSubscription) { if (obj instanceof SiteSubscription) {
userSubscriptionHandler.update((UserSubscription) obj); siteSubscriptionHandler.update((SiteSubscription) obj);
} else { } else {
sharedSubscriptionHandler.update((SharedSubscription) obj); sharedSubscriptionHandler.update((SharedSubscription) obj);
} }
@ -279,8 +280,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
*/ */
@Override @Override
public void delete(Subscription obj) throws RegistryHandlerException { public void delete(Subscription obj) throws RegistryHandlerException {
if (obj instanceof UserSubscription) { if (obj instanceof SiteSubscription) {
userSubscriptionHandler.delete((UserSubscription) obj); siteSubscriptionHandler.delete((SiteSubscription) obj);
} else { } else {
sharedSubscriptionHandler.delete((SharedSubscription) obj); sharedSubscriptionHandler.delete((SharedSubscription) obj);
} }
@ -292,7 +293,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
@Override @Override
public void deleteById(String username, String registryId) public void deleteById(String username, String registryId)
throws RegistryHandlerException { throws RegistryHandlerException {
userSubscriptionHandler.deleteById(username, registryId); siteSubscriptionHandler.deleteById(username, registryId);
sharedSubscriptionHandler.deleteById(username, registryId); sharedSubscriptionHandler.deleteById(username, registryId);
} }
@ -302,8 +303,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
@Override @Override
public void delete(String username, Subscription obj) public void delete(String username, Subscription obj)
throws RegistryHandlerException { throws RegistryHandlerException {
if (obj instanceof UserSubscription) { if (obj instanceof SiteSubscription) {
userSubscriptionHandler.delete(username, (UserSubscription) obj); siteSubscriptionHandler.delete(username, (SiteSubscription) obj);
} else { } else {
sharedSubscriptionHandler sharedSubscriptionHandler
.delete(username, (SharedSubscription) obj); .delete(username, (SharedSubscription) obj);
@ -319,8 +320,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
throws RegistryHandlerException { throws RegistryHandlerException {
if (!CollectionUtil.isNullOrEmpty(objects)) { if (!CollectionUtil.isNullOrEmpty(objects)) {
final Collection asSubtype = objects; final Collection asSubtype = objects;
if (objects.iterator().next() instanceof UserSubscription) { if (objects.iterator().next() instanceof SiteSubscription) {
userSubscriptionHandler.delete(asSubtype); siteSubscriptionHandler.delete(asSubtype);
} else { } else {
sharedSubscriptionHandler.delete(asSubtype); sharedSubscriptionHandler.delete(asSubtype);
} }
@ -336,8 +337,8 @@ public class SubscriptionHandler implements ISubscriptionHandler {
throws RegistryHandlerException { throws RegistryHandlerException {
if (!CollectionUtil.isNullOrEmpty(objects)) { if (!CollectionUtil.isNullOrEmpty(objects)) {
final Collection asSubtype = objects; final Collection asSubtype = objects;
if (objects.iterator().next() instanceof UserSubscription) { if (objects.iterator().next() instanceof SiteSubscription) {
userSubscriptionHandler.delete(username, asSubtype); siteSubscriptionHandler.delete(username, asSubtype);
} else { } else {
sharedSubscriptionHandler.delete(username, asSubtype); sharedSubscriptionHandler.delete(username, asSubtype);
} }

View file

@ -44,7 +44,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 05, 2013 1841 djohnson Extracted and genericized from UserSubscriptionHandler. * Apr 05, 2013 1841 djohnson Extracted and genericized from siteSubscriptionHandler.
* *
* </pre> * </pre>
* *

View file

@ -28,7 +28,8 @@ package com.raytheon.uf.common.datadelivery.request;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 3, 2012 1241 djohnson Initial creation * Oct 03, 2012 1241 djohnson Initial creation.
* May 20, 2013 1040 mpduff Added Shared Subscription permissions.
* *
* </pre> * </pre>
* *
@ -45,7 +46,11 @@ public enum DataDeliveryPermission {
"subscription.edit"), SYSTEM_MANAGEMENT_VIEW( "subscription.edit"), SYSTEM_MANAGEMENT_VIEW(
"systemmanagement.view"), SUBSCRIPTION_CREATE("subscription.create"), SUBSCRIPTION_ACTIVATE( "systemmanagement.view"), SUBSCRIPTION_CREATE("subscription.create"), SUBSCRIPTION_ACTIVATE(
"subscription.activate"), SUBSCRIPTION_DELETE("subscription.delete"), SYSTEM_MANAGEMENT_CREATE( "subscription.activate"), SUBSCRIPTION_DELETE("subscription.delete"), SYSTEM_MANAGEMENT_CREATE(
"systemmanagement.create"); "systemmanagement.create"), SHARED_SUBSCRIPTION_CREATE(
"shared.subscription.create"), SHARED_SUBSCRIPTION_DELETE(
"shared.subscription.delete"), SHARED_SUBSCRIPTION_EDIT(
"shared.subscription.edit"), SHARED_SUBSCRIPTION_ACTIVATE(
"shared.subscription.activate");
private String stringValue; private String stringValue;

View file

@ -10,11 +10,10 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ValueType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ValueType;
/** /**
* A <code>SlotConverter</code> implementation for converting the * A <code>SlotConverter</code> implementation for converting the members of a
* members of a Set into a RegistryObject slot type. A collection * Set into a RegistryObject slot type. A collection slot type will be created
* slot type will be created and the Set members converted to elements * and the Set members converted to elements with slot values of a appropriate
* with slot values of a appropriate type for the member. The collection * type for the member. The collection type for the slot will be set to Set.
* type for the slot will be set to Set.
* *
* <pre> * <pre>
* *
@ -23,13 +22,14 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ValueType;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 15, 2012 455 jspinks Initial creation * May 15, 2012 455 jspinks Initial creation
* May 15, 2013 1040 mpduff Made non-abstract.
* *
* </pre> * </pre>
* *
* @author jspinks * @author jspinks
* @version 1.0 * @version 1.0
*/ */
public abstract class SetSlotConverter implements SlotConverter { public class SetSlotConverter implements SlotConverter {
/** /**
* Extract a List of SlotType Objects from the given slotValue Object. * Extract a List of SlotType Objects from the given slotValue Object.
@ -44,22 +44,21 @@ public abstract class SetSlotConverter implements SlotConverter {
* provided. * provided.
* *
* @throws IllegalArgumentException * @throws IllegalArgumentException
* If the slotValue Object provided is not an instance of Set, or * If the slotValue Object provided is not an instance of Set,
* the Set member cannot be converted to a value. * or the Set member cannot be converted to a value.
* *
* @see java.util.Map * @see java.util.Map
*/ */
@Override @Override
public List<SlotType> getSlots(String slotName, Object slotValue) throws IllegalArgumentException { public List<SlotType> getSlots(String slotName, Object slotValue)
throws IllegalArgumentException {
List<SlotType> slots = new ArrayList<SlotType>(); List<SlotType> slots = new ArrayList<SlotType>();
SlotType slot = new SlotType(); SlotType slot = new SlotType();
slot.setName(slotName); slot.setName(slotName);
List<ValueType> collectionValues = new ArrayList<ValueType>(); List<ValueType> collectionValues = new ArrayList<ValueType>();
CollectionValueType cvt = new CollectionValueType(); CollectionValueType cvt = new CollectionValueType();
if (slotValue instanceof Set) { if (slotValue instanceof Set) {
for (Object o : (Set<?>) slotValue) { for (Object o : (Set<?>) slotValue) {
@ -67,16 +66,19 @@ public abstract class SetSlotConverter implements SlotConverter {
if (vt != null) { if (vt != null) {
collectionValues.add(newEntrySlot(o)); collectionValues.add(newEntrySlot(o));
} else { } else {
throw new IllegalArgumentException("Set with parameterized type " + o.getClass().getName() + throw new IllegalArgumentException(
" cannot be converted by " + SetSlotConverter.class.getName()); "Set with parameterized type "
+ o.getClass().getName()
+ " cannot be converted by "
+ SetSlotConverter.class.getName());
} }
} }
} else {
} throw new IllegalArgumentException("Object of type "
else { + slotValue.getClass().getName()
throw new IllegalArgumentException("Object of type " + slotValue.getClass().getName() + + " cannot be converted by "
" cannot be converted by " + SetSlotConverter.class.getName()); + SetSlotConverter.class.getName());
} }
cvt.setCollectionValue(collectionValues); cvt.setCollectionValue(collectionValues);

View file

@ -0,0 +1,118 @@
/**
* 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.site;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
/**
* AWIPS 2 site data object holding information regarding the site.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class SiteData {
private static final String WFO_STRING = "wfo";
private static final String RFC_STRING = "rfc";
private static final String RO_STRING = "ro";
private static final String NC_STRING = "nc";
/**
* Site Data Types
*/
@XmlEnum
public enum SiteDataType {
@XmlEnumValue(WFO_STRING)
WFO, @XmlEnumValue(RFC_STRING)
RFC, @XmlEnumValue(RO_STRING)
RO, @XmlEnumValue(NC_STRING)
NC;
}
/** Site id */
private String id;
/** Site type (cwa, rfc, etc) */
private SiteDataType type;
/**
* Default constructor.
*/
public SiteData() {
}
/**
* Constructor.
*
* @param id
* Site id
* @param type
* Site type
*/
public SiteData(String id, SiteDataType type) {
this.id = id;
this.type = type;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the type
*/
public SiteDataType getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(SiteDataType type) {
this.type = type;
}
}

View file

@ -30,13 +30,20 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet; import java.util.TreeSet;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.site.xml.NwsSitesXML;
import com.raytheon.uf.common.site.xml.SiteIdXML;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -52,6 +59,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Jul 16, 2010 bfarmer Initial creation * Jul 16, 2010 bfarmer Initial creation
* Apr 09, 2012 DR14765 mhuang Map out correct CCCC site ID for backup * Apr 09, 2012 DR14765 mhuang Map out correct CCCC site ID for backup
* sites. * sites.
* May 15, 2013 1040 mpduff Add awips_site_list.xml.
* *
* </pre> * </pre>
* *
@ -73,21 +81,45 @@ public class SiteMap {
private static final String RFC_TABLE_FILENAME = "textdb/rfc_lookup_table.dat"; private static final String RFC_TABLE_FILENAME = "textdb/rfc_lookup_table.dat";
private List<String> rfcList = new ArrayList<String>(); private static final String LOCATION_ID_FILENAME = "awips_site_list.xml";
private Map<String, String> siteToSiteMap = new HashMap<String, String>(); private final List<String> rfcList = new ArrayList<String>();
private Map<String, String> nationalCategoryMap = new HashMap<String, String>(); private final Map<String, String> siteToSiteMap = new HashMap<String, String>();
private Map<String, String> siteTo4LetterSite = new HashMap<String, String>(); private final Map<String, String> nationalCategoryMap = new HashMap<String, String>();
private Map<String, Set<String>> siteTo3LetterSite = new HashMap<String, Set<String>>(); private final Map<String, String> siteTo4LetterSite = new HashMap<String, String>();
private final Map<String, Set<String>> siteTo3LetterSite = new HashMap<String, Set<String>>();
private final Map<String, SiteData> siteMap = new TreeMap<String, SiteData>();
/** JAXB context */
private JAXBContext jax;
/** Unmarshaller object */
private Unmarshaller unmarshaller;
/**
* Get an instance.
*
* @return the instance
*/
public static SiteMap getInstance() { public static SiteMap getInstance() {
return instance; return instance;
} }
private SiteMap() { private SiteMap() {
Class[] classes = new Class[] { NwsSitesXML.class, SiteIdXML.class };
try {
jax = JAXBContext.newInstance(classes);
this.unmarshaller = jax.createUnmarshaller();
} catch (JAXBException e) {
throw new ExceptionInInitializerError(
"Error creating context for SiteMap");
}
readFiles(); readFiles();
} }
@ -111,8 +143,11 @@ public class SiteMap {
} }
/** /**
* Attempt to map an xxxid to a cccid. Use the afos_lookup_table.dat data only. * Attempt to map an xxxid to a cccid. Use the afos_lookup_table.dat data
* @param xxx An id to map. * only.
*
* @param xxx
* An id to map.
* @return * @return
*/ */
public String getAFOSTableMap(String xxx) { public String getAFOSTableMap(String xxx) {
@ -128,6 +163,7 @@ public class SiteMap {
nationalCategoryMap.clear(); nationalCategoryMap.clear();
siteTo4LetterSite.clear(); siteTo4LetterSite.clear();
siteTo3LetterSite.clear(); siteTo3LetterSite.clear();
siteMap.clear();
// load base afos lookup // load base afos lookup
IPathManager pathMgr = PathManagerFactory.getPathManager(); IPathManager pathMgr = PathManagerFactory.getPathManager();
@ -151,6 +187,18 @@ public class SiteMap {
file = pathMgr.getFile(lc, NATIONAL_CATEGORY_TABLE_FILENAME); file = pathMgr.getFile(lc, NATIONAL_CATEGORY_TABLE_FILENAME);
loadNationalCategoryFile(file, nationalCategoryMap); loadNationalCategoryFile(file, nationalCategoryMap);
// Load site list
lc = pathMgr.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE);
file = pathMgr.getFile(lc, LOCATION_ID_FILENAME);
if (file == null || !file.exists()) {
lc = pathMgr.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.BASE);
file = pathMgr.getFile(lc, LOCATION_ID_FILENAME);
System.out.println(LOCATION_ID_FILENAME);
}
loadSiteListFile(file);
// post-process the nationalCategoryMap to generate the 3 to 4 letter // post-process the nationalCategoryMap to generate the 3 to 4 letter
// mapping // mapping
for (String icao : nationalCategoryMap.keySet()) { for (String icao : nationalCategoryMap.keySet()) {
@ -314,6 +362,24 @@ public class SiteMap {
} }
} }
private void loadSiteListFile(File file) {
if (file != null && file.exists()) {
NwsSitesXML siteXml;
try {
siteXml = (NwsSitesXML) unmarshaller.unmarshal(file);
for (SiteIdXML xml : siteXml.getSiteIds()) {
String id = xml.getId();
SiteData sd = new SiteData(id, xml.getType());
this.siteMap.put(id, sd);
}
} catch (JAXBException e) {
statusHandler.handle(Priority.PROBLEM,
"Problem reading in Site Id File ["
+ LOCATION_ID_FILENAME + "]", e);
}
}
}
/** /**
* Converts a 3 letter site ID into a 4 letter ID, e.g. OAX to KOAX * Converts a 3 letter site ID into a 4 letter ID, e.g. OAX to KOAX
* *
@ -330,13 +396,13 @@ public class SiteMap {
} else { } else {
// DR_14765, in case the site hashed out from combined mapping // DR_14765, in case the site hashed out from combined mapping
// table from both national_category_table and afo_lookup_table // table from both national_category_table and afo_lookup_table
// does not start with K but not from site3LetterTo4LetterOerride.dat // does not start with K but not from
// site3LetterTo4LetterOerride.dat
// which are starting with P or T // which are starting with P or T
char[] siteChar = site.toCharArray(); char[] siteChar = site.toCharArray();
if (siteChar[0] != 'K') { if (siteChar[0] != 'K') {
if (!((siteChar[0] == 'P' && (siteChar[1] == 'A' || siteChar[1] == 'G' if (!((siteChar[0] == 'P' && (siteChar[1] == 'A'
|| siteChar[1] == 'H')) || || siteChar[1] == 'G' || siteChar[1] == 'H')) || (siteChar[0] == 'T' && siteChar[1] == 'S'))) {
(siteChar[0] == 'T' && siteChar[1] == 'S'))) {
site = "K" + site3LetterId; site = "K" + site3LetterId;
} }
} }
@ -371,4 +437,13 @@ public class SiteMap {
public boolean isRFCSite(String site) { public boolean isRFCSite(String site) {
return rfcList.contains(site); return rfcList.contains(site);
} }
/**
* Get the site data objects.
*
* @return site data objects
*/
public Map<String, SiteData> getSiteData() {
return siteMap;
}
} }

View file

@ -0,0 +1,79 @@
/**
* 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.site.xml;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
/**
* XML object for NWS Site IDs.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@XmlRootElement(name = "nwsSites")
@XmlAccessorType(XmlAccessType.NONE)
public class NwsSitesXML {
@XmlElements({ @XmlElement(name = "site", type = SiteIdXML.class) })
private List<SiteIdXML> siteIds = new ArrayList<SiteIdXML>();
/**
* @return the siteIds
*/
public List<SiteIdXML> getSiteIds() {
return siteIds;
}
/**
* @param siteIds
* the siteIds to set
*/
public void setSiteIds(ArrayList<SiteIdXML> siteIds) {
this.siteIds = siteIds;
}
/**
* Add a site id to the list.
*
* @param idXml
* The object to add.
*/
public void addSiteId(SiteIdXML idXml) {
if (idXml != null) {
this.siteIds.add(idXml);
}
}
}

View file

@ -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.site.xml;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.site.SiteData.SiteDataType;
/**
* Site tag xml object.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class SiteIdXML {
/** Site ID */
@XmlAttribute(name = "id")
private String id;
/** Site type */
@XmlAttribute(name = "type")
private SiteDataType type;
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the type
*/
public SiteDataType getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(SiteDataType type) {
this.type = type;
}
}

View file

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<nwsSites>
<site type="wfo" id="AFC"/>
<site type="wfo" id="ABQ"/>
<site type="wfo" id="ABR"/>
<site type="wfo" id="AER"/>
<site type="wfo" id="AFG"/>
<site type="wfo" id="AJK"/>
<site type="wfo" id="AKQ"/>
<site type="wfo" id="ALU"/>
<site type="wfo" id="ALY"/>
<site type="wfo" id="AMA"/>
<site type="wfo" id="APX"/>
<site type="wfo" id="ARX"/>
<site type="wfo" id="BGM"/>
<site type="wfo" id="BIS"/>
<site type="wfo" id="BMX"/>
<site type="wfo" id="BOI"/>
<site type="wfo" id="BOU"/>
<site type="wfo" id="BOX"/>
<site type="wfo" id="BRO"/>
<site type="wfo" id="BTV"/>
<site type="wfo" id="BUF"/>
<site type="wfo" id="BYZ"/>
<site type="wfo" id="CAE"/>
<site type="wfo" id="CAR"/>
<site type="wfo" id="CHS"/>
<site type="wfo" id="CLE"/>
<site type="wfo" id="CRP"/>
<site type="wfo" id="CTP"/>
<site type="wfo" id="CYS"/>
<site type="wfo" id="DDC"/>
<site type="wfo" id="DLH"/>
<site type="wfo" id="DMX"/>
<site type="wfo" id="DTX"/>
<site type="wfo" id="DVN"/>
<site type="wfo" id="EAX"/>
<site type="wfo" id="EKA"/>
<site type="wfo" id="EPZ"/>
<site type="wfo" id="EWX"/>
<site type="wfo" id="FFC"/>
<site type="wfo" id="FGF"/>
<site type="wfo" id="FGZ"/>
<site type="wfo" id="FSD"/>
<site type="wfo" id="FWD"/>
<site type="wfo" id="GGW"/>
<site type="wfo" id="GID"/>
<site type="wfo" id="GJT"/>
<site type="wfo" id="GLD"/>
<site type="wfo" id="GRB"/>
<site type="wfo" id="GRR"/>
<site type="wfo" id="GSP"/>
<site type="wfo" id="GUM"/>
<site type="wfo" id="GYX"/>
<site type="wfo" id="HFO"/>
<site type="wfo" id="HGX"/>
<site type="wfo" id="HNX"/>
<site type="wfo" id="HUN"/>
<site type="wfo" id="ICT"/>
<site type="wfo" id="ILM"/>
<site type="wfo" id="ILN"/>
<site type="wfo" id="ILX"/>
<site type="wfo" id="IND"/>
<site type="wfo" id="IWX"/>
<site type="wfo" id="JAN"/>
<site type="wfo" id="JAX"/>
<site type="wfo" id="JKL"/>
<site type="wfo" id="KEY"/>
<site type="wfo" id="LBF"/>
<site type="wfo" id="LCH"/>
<site type="wfo" id="LIX"/>
<site type="wfo" id="LKN"/>
<site type="wfo" id="LMK"/>
<site type="wfo" id="LOT"/>
<site type="wfo" id="LOX"/>
<site type="wfo" id="LSX"/>
<site type="wfo" id="LUB"/>
<site type="wfo" id="LWX"/>
<site type="wfo" id="LZK"/>
<site type="wfo" id="MAF"/>
<site type="wfo" id="MEG"/>
<site type="wfo" id="MFL"/>
<site type="wfo" id="MFR"/>
<site type="wfo" id="MHX"/>
<site type="wfo" id="MKX"/>
<site type="wfo" id="MLB"/>
<site type="wfo" id="MOB"/>
<site type="wfo" id="MPX"/>
<site type="wfo" id="MQT"/>
<site type="wfo" id="MRX"/>
<site type="wfo" id="MSO"/>
<site type="wfo" id="MTR"/>
<site type="wfo" id="OAX"/>
<site type="wfo" id="OHX"/>
<site type="wfo" id="OKX"/>
<site type="wfo" id="OTX"/>
<site type="wfo" id="OUN"/>
<site type="wfo" id="PAH"/>
<site type="wfo" id="PBZ"/>
<site type="wfo" id="PDT"/>
<site type="wfo" id="PHI"/>
<site type="wfo" id="PIH"/>
<site type="wfo" id="PQR"/>
<site type="wfo" id="PSR"/>
<site type="wfo" id="PUB"/>
<site type="wfo" id="RAH"/>
<site type="wfo" id="REV"/>
<site type="wfo" id="RIW"/>
<site type="wfo" id="RLX"/>
<site type="wfo" id="RNK"/>
<site type="wfo" id="SEW"/>
<site type="wfo" id="SGF"/>
<site type="wfo" id="SGX"/>
<site type="wfo" id="SHV"/>
<site type="wfo" id="SJT"/>
<site type="wfo" id="SJU"/>
<site type="wfo" id="SLC"/>
<site type="wfo" id="STO"/>
<site type="wfo" id="TAE"/>
<site type="wfo" id="TBW"/>
<site type="wfo" id="TFX"/>
<site type="wfo" id="TOP"/>
<site type="wfo" id="TSA"/>
<site type="wfo" id="TWC"/>
<site type="wfo" id="UNR"/>
<site type="wfo" id="VEF"/>
<site type="rfc" id="ACR"/>
<site type="rfc" id="ALR"/>
<site type="rfc" id="FWR"/>
<site type="rfc" id="KRF"/>
<site type="rfc" id="MSR"/>
<site type="rfc" id="ORN"/>
<site type="rfc" id="PTR"/>
<site type="rfc" id="RHA"/>
<site type="rfc" id="RSA"/>
<site type="rfc" id="STR"/>
<site type="rfc" id="TAR"/>
<site type="rfc" id="TIR"/>
<site type="rfc" id="TUA"/>
<site type="ro" id="VUY"/>
<site type="ro" id="BCQ"/>
<site type="ro" id="EHU"/>
<site type="ro" id="VHW"/>
<site type="ro" id="PBP"/>
<site type="ro" id="ARE"/>
<site type="ro" id="ARW"/>
<site type="nc" id="HAK"/>
<site type="nc" id="HUS"/>
</nwsSites>

View file

@ -123,7 +123,8 @@ public final class StringUtil {
* the character to join them with * the character to join them with
* @return the concatenated string * @return the concatenated string
*/ */
public static <T> String join(final Collection<T> portions, final char joinCharacter) { public static <T> String join(final Collection<T> portions,
final char joinCharacter) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
if (CollectionUtil.isNullOrEmpty(portions)) { if (CollectionUtil.isNullOrEmpty(portions)) {
@ -209,4 +210,66 @@ public final class StringUtil {
} }
return sb.toString(); return sb.toString();
} }
/**
* Get a string as a separated list showing up to the limit of items.
*
* @param list
* List of items to put in the "list"
* @param delimiter
* Delimiting String
* @param limit
* number of items to display
* @return the list
*/
public static String getDisplayList(Collection<String> list,
String delimiter, int limit) {
StringBuilder sb = new StringBuilder();
if (list.size() < limit) {
limit = list.size();
}
int count = 0;
for (String s : list) {
if (count < limit) {
sb.append(s).append(delimiter);
} else {
// remove the trailing space
sb.replace(sb.length() - 1, sb.length(), "");
sb.append("...");
break;
}
count++;
}
return sb.toString();
}
/**
* Create a list with all the lines except the first indented.
*
* @param list
* list of items
* @param indent
* String of spaces making up the indent
* @return the list
*/
public static String getIndentedList(Collection<String> list,
final String indent) {
StringBuilder sb = new StringBuilder();
int count = 0;
for (String id : list) {
if (count == 10) {
sb.append(StringUtil.NEWLINE);
sb.append(indent);
count = 0;
}
sb.append(id).append(" ");
count++;
}
return sb.toString();
}
} }

View file

@ -39,7 +39,7 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.event.EventBus; import com.raytheon.uf.common.event.EventBus;
import com.raytheon.uf.common.registry.event.InsertRegistryEvent; import com.raytheon.uf.common.registry.event.InsertRegistryEvent;
@ -208,7 +208,7 @@ public abstract class BandwidthManager extends
+ "]"); + "]");
} }
} else if (DataDeliveryRegistryObjectTypes.USER_SUBSCRIPTION } else if (DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION
.equals(objectType) .equals(objectType)
|| DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION || DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION
.equals(objectType)) { .equals(objectType)) {
@ -308,8 +308,8 @@ public abstract class BandwidthManager extends
Subscription sub = updateSubscriptionWithDataSetMetaData( Subscription sub = updateSubscriptionWithDataSetMetaData(
subscription, dataSetMetaData); subscription, dataSetMetaData);
if (sub instanceof UserSubscription) { if (sub instanceof SiteSubscription) {
schedule(new AdhocSubscription((UserSubscription) sub)); schedule(new AdhocSubscription((SiteSubscription) sub));
} else { } else {
statusHandler statusHandler
.warn("Unable to create adhoc queries for shared subscriptions at this point. This functionality should be added in the future..."); .warn("Unable to create adhoc queries for shared subscriptions at this point. This functionality should be added in the future...");
@ -582,7 +582,7 @@ public abstract class BandwidthManager extends
public void subscriptionRemoved(RemoveRegistryEvent event) { public void subscriptionRemoved(RemoveRegistryEvent event) {
String objectType = event.getObjectType(); String objectType = event.getObjectType();
if (objectType != null) { if (objectType != null) {
if (DataDeliveryRegistryObjectTypes.USER_SUBSCRIPTION if (DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION
.equals(objectType) .equals(objectType)
|| DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION || DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION
.equals(objectType)) { .equals(objectType)) {
@ -752,9 +752,9 @@ public abstract class BandwidthManager extends
// Create an adhoc subscription based on the new subscription, // Create an adhoc subscription based on the new subscription,
// and set it to retrieve the most recent cycle (or most recent // and set it to retrieve the most recent cycle (or most recent
// url if a daily product) // url if a daily product)
if (subscription instanceof UserSubscription) { if (subscription instanceof SiteSubscription) {
AdhocSubscription adhoc = new AdhocSubscription( AdhocSubscription adhoc = new AdhocSubscription(
(UserSubscription) subscription); (SiteSubscription) subscription);
adhoc = bandwidthDaoUtil.setAdhocMostRecentUrlAndTime( adhoc = bandwidthDaoUtil.setAdhocMostRecentUrlAndTime(
adhoc, useMostRecentDataSetUpdate); adhoc, useMostRecentDataSetUpdate);

View file

@ -10,7 +10,7 @@
class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler"> class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler">
<constructor-arg> <constructor-arg>
<bean <bean
class="com.raytheon.uf.common.datadelivery.registry.handlers.UserSubscriptionHandler" /> class="com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler" />
</constructor-arg> </constructor-arg>
<constructor-arg> <constructor-arg>
<bean <bean
@ -22,7 +22,7 @@
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler"> class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler">
<constructor-arg> <constructor-arg>
<bean <bean
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingUserSubscriptionHandler" /> class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSiteSubscriptionHandler" />
</constructor-arg> </constructor-arg>
<constructor-arg> <constructor-arg>
<bean <bean

View file

@ -46,6 +46,36 @@
</description> </description>
</permission> </permission>
<permission id="shared.subscription.create">
<description>
Control Access to Create Data Delivery Shared Subscriptions
</description>
</permission>
<permission id="shared.subscription.edit">
<description>
Control Access to Edit Data Delivery Shared Subscriptions
</description>
</permission>
<permission id="shared.subscription.delete">
<description>
Control Access to Delete Data Delivery Shared Subscriptions
</description>
</permission>
<permission id="shared.subscription.activate">
<description>
Control Access to Activate Data Delivery Shared Subscriptions
</description>
</permission>
<permission id="subscription.approve.share">
<description>
Authorization to Approve Shared Data Delivery Subscriptions
</description>
</permission>
<permission id="subscription.approve.view"> <permission id="subscription.approve.view">
<description> <description>
Authorization to View Pending Data Delivery Subscriptions Authorization to View Pending Data Delivery Subscriptions
@ -100,6 +130,17 @@
<rolePermission>group.edit</rolePermission> <rolePermission>group.edit</rolePermission>
</role> </role>
<role roleId="shared.subscription.admin">
<roleDescription>
This role is a grouping of permissions, default shared subscription admin role
</roleDescription>
<rolePermission>shared.subscription.create</rolePermission>
<rolePermission>shared.subscription.edit</rolePermission>
<rolePermission>shared.subscription.delete</rolePermission>
<rolePermission>shared.subscription.activate</rolePermission>
<rolePermission>subscription.approve.share</rolePermission>
</role>
<!-- ALL user is selected for permissions permitted to all users --> <!-- ALL user is selected for permissions permitted to all users -->
<user userId="ALL"> <user userId="ALL">
<userPermission>subscription.view</userPermission> <userPermission>subscription.view</userPermission>

View file

@ -37,7 +37,7 @@ import org.springframework.context.ApplicationContext;
import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.localization.PathManagerFactoryTest; import com.raytheon.uf.common.localization.PathManagerFactoryTest;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.time.util.TimeUtilTest; import com.raytheon.uf.common.time.util.TimeUtilTest;
@ -163,7 +163,7 @@ public abstract class AbstractBandwidthManagerIntTest {
* *
* @return the subscription * @return the subscription
*/ */
protected UserSubscription createSubscriptionThatFillsUpABucket() { protected SiteSubscription createSubscriptionThatFillsUpABucket() {
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize); return createSubscriptionWithDataSetSizeInBytes(fullBucketSize);
} }
@ -172,7 +172,7 @@ public abstract class AbstractBandwidthManagerIntTest {
* *
* @return the subscription * @return the subscription
*/ */
protected UserSubscription createSubscriptionThatFillsUpTenBuckets() { protected SiteSubscription createSubscriptionThatFillsUpTenBuckets() {
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 10); return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 10);
} }
@ -181,7 +181,7 @@ public abstract class AbstractBandwidthManagerIntTest {
* *
* @return the subscription * @return the subscription
*/ */
protected UserSubscription createSubscriptionThatFillsHalfABucket() { protected SiteSubscription createSubscriptionThatFillsHalfABucket() {
return createSubscriptionWithDataSetSizeInBytes(halfBucketSize); return createSubscriptionWithDataSetSizeInBytes(halfBucketSize);
} }
@ -190,7 +190,7 @@ public abstract class AbstractBandwidthManagerIntTest {
* *
* @return the subscription * @return the subscription
*/ */
protected UserSubscription createSubscriptionThatFillsAThirdOfABucket() { protected SiteSubscription createSubscriptionThatFillsAThirdOfABucket() {
return createSubscriptionWithDataSetSizeInBytes(thirdBucketSizeInBytes); return createSubscriptionWithDataSetSizeInBytes(thirdBucketSizeInBytes);
} }
@ -199,13 +199,13 @@ public abstract class AbstractBandwidthManagerIntTest {
* *
* @return the subscription * @return the subscription
*/ */
protected UserSubscription createSubscriptionThatFillsUpTwoBuckets() { protected SiteSubscription createSubscriptionThatFillsUpTwoBuckets() {
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 2); return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 2);
} }
protected UserSubscription createSubscriptionWithDataSetSizeInBytes( protected SiteSubscription createSubscriptionWithDataSetSizeInBytes(
long bytes) { long bytes) {
UserSubscription subscription = SubscriptionFixture.INSTANCE SiteSubscription subscription = SubscriptionFixture.INSTANCE
.get(subscriptionSeed++); .get(subscriptionSeed++);
subscription.setDataSetSize(BandwidthUtil subscription.setDataSetSize(BandwidthUtil
.convertBytesToKilobytes(bytes)); .convertBytesToKilobytes(bytes));

View file

@ -62,7 +62,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority; import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.registry.event.RemoveRegistryEvent; import com.raytheon.uf.common.registry.event.RemoveRegistryEvent;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -816,7 +816,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
final int numberOfSubscriptionsWithSameProviderDataSet = 4; final int numberOfSubscriptionsWithSameProviderDataSet = 4;
final UserSubscription templateSubscription = createSubscriptionThatFillsUpABucket(); final SiteSubscription templateSubscription = createSubscriptionThatFillsUpABucket();
final Network route = templateSubscription.getRoute(); final Network route = templateSubscription.getRoute();
templateSubscription.setDataSetSize(templateSubscription templateSubscription.setDataSetSize(templateSubscription
.getDataSetSize() .getDataSetSize()
@ -828,7 +828,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
final Subscription[] subscriptions = new Subscription[numberOfSubscriptionsWithSameProviderDataSet]; final Subscription[] subscriptions = new Subscription[numberOfSubscriptionsWithSameProviderDataSet];
for (int i = 0; i < numberOfSubscriptionsWithSameProviderDataSet; i++) { for (int i = 0; i < numberOfSubscriptionsWithSameProviderDataSet; i++) {
final UserSubscription currentSubscription = new UserSubscription( final SiteSubscription currentSubscription = new SiteSubscription(
templateSubscription, "ILookLikeTheOtherGuys-" + i); templateSubscription, "ILookLikeTheOtherGuys-" + i);
subscriptions[i] = currentSubscription; subscriptions[i] = currentSubscription;
@ -1015,7 +1015,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
private void sendDeletedSubscriptionEvent(Subscription subscription) { private void sendDeletedSubscriptionEvent(Subscription subscription) {
RemoveRegistryEvent event = new RemoveRegistryEvent( RemoveRegistryEvent event = new RemoveRegistryEvent(
subscription.getOwner(), subscription.getId()); subscription.getOwner(), subscription.getId());
event.setObjectType(DataDeliveryRegistryObjectTypes.USER_SUBSCRIPTION); event.setObjectType(DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION);
bandwidthManager.subscriptionRemoved(event); bandwidthManager.subscriptionRemoved(event);
} }

View file

@ -39,7 +39,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
*/ */
public class AdhocSubscriptionFixture extends public class AdhocSubscriptionFixture extends
BaseUserSubscriptionFixture<AdhocSubscription> { BaseSiteSubscriptionFixture<AdhocSubscription> {
public static final AdhocSubscriptionFixture INSTANCE = new AdhocSubscriptionFixture(); public static final AdhocSubscriptionFixture INSTANCE = new AdhocSubscriptionFixture();

View file

@ -24,7 +24,7 @@ import java.util.Random;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
/** /**
* Adds attributes specific to {@link UserSubscription} types. * Adds attributes specific to {@link SiteSubscription} types.
* *
* <pre> * <pre>
* *
@ -40,7 +40,7 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
* @version 1.0 * @version 1.0
*/ */
public abstract class BaseUserSubscriptionFixture<T extends UserSubscription> public abstract class BaseSiteSubscriptionFixture<T extends SiteSubscription>
extends BaseSubscriptionFixture<T> { extends BaseSubscriptionFixture<T> {
/** /**

View file

@ -41,6 +41,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
* Jan 30, 2013 1543 djohnson Add coverage/parameter data. * Jan 30, 2013 1543 djohnson Add coverage/parameter data.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Office Ids are now a list.
* *
* </pre> * </pre>
* *
@ -74,7 +75,7 @@ public abstract class BaseSubscriptionFixture<T extends Subscription> extends
subscription.setFullDataSet(random.nextBoolean()); subscription.setFullDataSet(random.nextBoolean());
subscription.setGroupName("group" + random.nextInt()); subscription.setGroupName("group" + random.nextInt());
subscription.setName("name" + seedValue); subscription.setName("name" + seedValue);
subscription.setOfficeID("officeID" + random.nextInt()); subscription.addOfficeID("officeID" + random.nextInt());
subscription.addParameter(ParameterFixture.INSTANCE.get()); subscription.addParameter(ParameterFixture.INSTANCE.get());
// Same priority for all, individual tests needing to test specific // Same priority for all, individual tests needing to test specific
// priorities should set it manually anyway // priorities should set it manually anyway

View file

@ -42,7 +42,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
*/ */
public class PendingSubscriptionFixture extends public class PendingSubscriptionFixture extends
BaseUserSubscriptionFixture<PendingUserSubscription> { BaseSiteSubscriptionFixture<PendingSiteSubscription> {
public static final PendingSubscriptionFixture INSTANCE = new PendingSubscriptionFixture(); public static final PendingSubscriptionFixture INSTANCE = new PendingSubscriptionFixture();
@ -56,8 +56,8 @@ public class PendingSubscriptionFixture extends
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public PendingUserSubscription getInstance(long seedValue, Random random) { public PendingSiteSubscription getInstance(long seedValue, Random random) {
PendingUserSubscription sub = super.getInstance(seedValue, random); PendingSiteSubscription sub = super.getInstance(seedValue, random);
sub.setChangeReqId("change" + seedValue); sub.setChangeReqId("change" + seedValue);
return sub; return sub;
@ -67,8 +67,8 @@ public class PendingSubscriptionFixture extends
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected PendingUserSubscription getSubscription() { protected PendingSiteSubscription getSubscription() {
return new PendingUserSubscription(); return new PendingSiteSubscription();
} }
} }

View file

@ -34,6 +34,7 @@ import org.junit.Test;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 27, 2012 0743 djohnson Initial creation * Aug 27, 2012 0743 djohnson Initial creation
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
* May 15, 2013 1040 mpduff Changed to handle the list of office ids.
* *
* </pre> * </pre>
* *
@ -45,9 +46,9 @@ public class PendingSubscriptionTest {
@Test @Test
public void testCopyConstructorSetsOriginalSubNameAsName() { public void testCopyConstructorSetsOriginalSubNameAsName() {
UserSubscription subscription = SubscriptionFixture.INSTANCE.get(); SiteSubscription subscription = SubscriptionFixture.INSTANCE.get();
PendingUserSubscription pendingSubscription = new PendingUserSubscription( PendingSiteSubscription pendingSubscription = new PendingSiteSubscription(
subscription, "djohnson"); subscription, "djohnson");
assertEquals( assertEquals(
"The original subscription name should have been used for the pending subscription!", "The original subscription name should have been used for the pending subscription!",
@ -56,9 +57,9 @@ public class PendingSubscriptionTest {
@Test @Test
public void testCopyConstructorSetsSubscriptionValuesOnPendingSubscription() { public void testCopyConstructorSetsSubscriptionValuesOnPendingSubscription() {
UserSubscription subscription = SubscriptionFixture.INSTANCE.get(); SiteSubscription subscription = SubscriptionFixture.INSTANCE.get();
PendingUserSubscription copied = new PendingUserSubscription( PendingSiteSubscription copied = new PendingSiteSubscription(
subscription, "djohnson"); subscription, "djohnson");
assertEquals(subscription.getActivePeriodEnd(), assertEquals(subscription.getActivePeriodEnd(),
@ -71,7 +72,7 @@ public class PendingSubscriptionTest {
assertEquals(subscription.getDataSetType(), copied.getDataSetType()); assertEquals(subscription.getDataSetType(), copied.getDataSetType());
assertEquals(subscription.getDescription(), copied.getDescription()); assertEquals(subscription.getDescription(), copied.getDescription());
assertEquals(subscription.getGroupName(), copied.getGroupName()); assertEquals(subscription.getGroupName(), copied.getGroupName());
assertEquals(subscription.getOfficeID(), copied.getOfficeID()); assertEquals(subscription.getOfficeIDs(), copied.getOfficeIDs());
assertEquals(subscription.getPriority(), copied.getPriority()); assertEquals(subscription.getPriority(), copied.getPriority());
assertEquals(subscription.getProvider(), copied.getProvider()); assertEquals(subscription.getProvider(), copied.getProvider());
assertEquals(subscription.getStatus(), copied.getStatus()); assertEquals(subscription.getStatus(), copied.getStatus());

View file

@ -28,11 +28,14 @@ import static org.junit.Assert.assertThat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import javax.xml.bind.JAXBException;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus; import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.time.CalendarBuilder; import com.raytheon.uf.common.time.CalendarBuilder;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.time.util.TimeUtilTest; import com.raytheon.uf.common.time.util.TimeUtilTest;
@ -50,13 +53,14 @@ import com.raytheon.uf.common.time.util.TimeUtilTest;
* Jan 02, 2013 1345 djohnson Fix broken assertion that id matches copied object. * Jan 02, 2013 1345 djohnson Fix broken assertion that id matches copied object.
* Jan 11, 2013 1453 djohnson Add test for active period crossing year boundary. * Jan 11, 2013 1453 djohnson Add test for active period crossing year boundary.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
* May 15, 2013 1040 mpduff Office Id now a set.
* *
* </pre> * </pre>
* *
* @author djohnson * @author djohnson
* @version 1.0 * @version 1.0
*/ */
public class UserSubscriptionTest { public class SiteSubscriptionTest {
@Before @Before
public void setUp() { public void setUp() {
@ -74,9 +78,9 @@ public class UserSubscriptionTest {
@Test @Test
public void testCopyConstructorSetsSpecifiedName() throws Exception { public void testCopyConstructorSetsSpecifiedName() throws Exception {
UserSubscription subscription = SubscriptionFixture.INSTANCE.get(); SiteSubscription subscription = SubscriptionFixture.INSTANCE.get();
Subscription copied = new UserSubscription(subscription, "newName"); Subscription copied = new SiteSubscription(subscription, "newName");
assertEquals("Expected the new name to be set on the subscription!", assertEquals("Expected the new name to be set on the subscription!",
"newName", copied.getName()); "newName", copied.getName());
@ -85,9 +89,9 @@ public class UserSubscriptionTest {
@Test @Test
public void testCopyConstructorSetsValuesFromSourceSubscription() public void testCopyConstructorSetsValuesFromSourceSubscription()
throws Exception { throws Exception {
UserSubscription subscription = SubscriptionFixture.INSTANCE.get(); SiteSubscription subscription = SubscriptionFixture.INSTANCE.get();
Subscription copied = new UserSubscription(subscription, "newName"); Subscription copied = new SiteSubscription(subscription, "newName");
assertEquals(subscription.getActivePeriodEnd(), assertEquals(subscription.getActivePeriodEnd(),
copied.getActivePeriodEnd()); copied.getActivePeriodEnd());
@ -102,7 +106,7 @@ public class UserSubscriptionTest {
assertThat(copied.getId(), is(not(equalTo(subscription.getId())))); assertThat(copied.getId(), is(not(equalTo(subscription.getId()))));
assertEquals(subscription.getOfficeID(), copied.getOfficeID()); assertEquals(subscription.getOfficeIDs(), copied.getOfficeIDs());
assertEquals(subscription.getPriority(), copied.getPriority()); assertEquals(subscription.getPriority(), copied.getPriority());
assertEquals(subscription.getProvider(), copied.getProvider()); assertEquals(subscription.getProvider(), copied.getProvider());
assertEquals(subscription.getStatus(), copied.getStatus()); assertEquals(subscription.getStatus(), copied.getStatus());
@ -198,4 +202,12 @@ public class UserSubscriptionTest {
assertThat(subscription.getStatus(), assertThat(subscription.getStatus(),
is(equalTo(SubscriptionStatus.ACTIVE.toString()))); is(equalTo(SubscriptionStatus.ACTIVE.toString())));
} }
@Test
public void testIt() throws JAXBException {
Subscription subscription = new SubscriptionBuilder().withOfficeId(
"OAX").build();
System.out.println(new JAXBManager(SiteSubscription.class)
.marshalToXml(subscription));
}
} }

View file

@ -38,6 +38,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* Jan 30, 2013 1543 djohnson Add ability to specify route. * Jan 30, 2013 1543 djohnson Add ability to specify route.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Office Id now a set.
* *
* </pre> * </pre>
* *
@ -96,8 +97,8 @@ public class SubscriptionBuilder {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public UserSubscription build() { public SiteSubscription build() {
UserSubscription subscription = SubscriptionFixture.INSTANCE.get(); SiteSubscription subscription = SubscriptionFixture.INSTANCE.get();
subscription.setActive(active); subscription.setActive(active);
subscription.setActivePeriodStart(activePeriodStart); subscription.setActivePeriodStart(activePeriodStart);
subscription.setActivePeriodEnd(activePeriodEnd); subscription.setActivePeriodEnd(activePeriodEnd);
@ -110,7 +111,7 @@ public class SubscriptionBuilder {
subscription.setGroupName(groupName); subscription.setGroupName(groupName);
subscription.setLatencyInMinutes(latencyInMinutes); subscription.setLatencyInMinutes(latencyInMinutes);
subscription.setName(name); subscription.setName(name);
subscription.setOfficeID(officeId); subscription.addOfficeID(officeId);
subscription.setOwner(owner); subscription.setOwner(owner);
subscription.setPriority(priority); subscription.setPriority(priority);
subscription.setSubscriptionStart(subscriptionStart); subscription.setSubscriptionStart(subscriptionStart);

View file

@ -41,7 +41,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
*/ */
public class SubscriptionFixture extends public class SubscriptionFixture extends
BaseUserSubscriptionFixture<UserSubscription> { BaseSiteSubscriptionFixture<SiteSubscription> {
public static final SubscriptionFixture INSTANCE = new SubscriptionFixture(); public static final SubscriptionFixture INSTANCE = new SubscriptionFixture();
@ -55,7 +55,7 @@ public class SubscriptionFixture extends
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected UserSubscription getSubscription() { protected SiteSubscription getSubscription() {
return new UserSubscription(); return new SiteSubscription();
} }
} }

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 17, 2012 0726 djohnson Initial creation * Oct 17, 2012 0726 djohnson Initial creation
* Feb 20, 2013 1543 djohnson Implement route filtering. * Feb 20, 2013 1543 djohnson Implement route filtering.
* May 15, 2013 1040 mpduff Office Id now a set.
* *
* </pre> * </pre>
* *
@ -113,12 +114,12 @@ public class BaseMemorySubscriptionHandler<T extends Subscription> extends
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public List<T> getByFilters(String group, String officeId) public List<T> getByFilters(String group, String officeIds)
throws RegistryHandlerException { throws RegistryHandlerException {
List<T> retVal = new ArrayList<T>(); List<T> retVal = new ArrayList<T>();
for (T obj : getAll()) { for (T obj : getAll()) {
if (matches(group, obj.getGroupName()) if (matches(group, obj.getGroupName())
&& matches(officeId, obj.getOfficeID())) { && matches(officeIds, obj.getOfficeIDs())) {
retVal.add(obj); retVal.add(obj);
} }
} }

View file

@ -38,7 +38,7 @@ import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest; import com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder; import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.service.GroupDefinitionService; import com.raytheon.uf.common.datadelivery.service.GroupDefinitionService;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.RegistryManagerTest; import com.raytheon.uf.common.registry.RegistryManagerTest;
@ -97,10 +97,10 @@ public class GroupDefinitionServiceTest {
group.setGroupName(GROUP_NAME); group.setGroupName(GROUP_NAME);
groupHandler.store(group); groupHandler.store(group);
UserSubscription subscription = new SubscriptionBuilder() SiteSubscription subscription = new SubscriptionBuilder()
.withGroupName( .withGroupName(
GROUP_NAME).build(); GROUP_NAME).build();
UserSubscription subscription2 = new UserSubscription(subscription, SiteSubscription subscription2 = new SiteSubscription(subscription,
"sub2"); "sub2");
subscriptionHandler.store(subscription); subscriptionHandler.store(subscription);

View file

@ -34,7 +34,7 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedCoverage;
import com.raytheon.uf.common.datadelivery.registry.Parameter; import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.ParameterFixture; import com.raytheon.uf.common.datadelivery.registry.ParameterFixture;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.Envelope;
@ -61,8 +61,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsPercentOfParametersThatAreTheSame() { public void returnsPercentOfParametersThatAreTheSame() {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
sub1.getParameter().clear(); sub1.getParameter().clear();
sub1.addParameter(ParameterFixture.INSTANCE.get(1)); sub1.addParameter(ParameterFixture.INSTANCE.get(1));
@ -79,8 +79,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsZeroPercentOfParametersForNullsOrEmpties() { public void returnsZeroPercentOfParametersForNullsOrEmpties() {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
sub1.setParameter(null); sub1.setParameter(null);
@ -101,8 +101,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsPercentOfForecastHoursThatAreTheSame() { public void returnsPercentOfForecastHoursThatAreTheSame() {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
final List<Integer> sub1SelectedTimes = Arrays.asList(0, 1); final List<Integer> sub1SelectedTimes = Arrays.asList(0, 1);
sub1.getTime().setSelectedTimeIndices(sub1SelectedTimes); sub1.getTime().setSelectedTimeIndices(sub1SelectedTimes);
@ -117,8 +117,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsZeroPercentOfForecastHoursForNullsOrEmpties() { public void returnsZeroPercentOfForecastHoursForNullsOrEmpties() {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
sub1.getTime().setSelectedTimeIndices(null); sub1.getTime().setSelectedTimeIndices(null);
final List<Integer> sub2SelectedTimes = Arrays.asList(0, 3, 4); final List<Integer> sub2SelectedTimes = Arrays.asList(0, 3, 4);
@ -139,8 +139,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsPercentOfCyclesThatAreTheSame() { public void returnsPercentOfCyclesThatAreTheSame() {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
final List<Integer> sub1CycleTimes = Arrays.asList(0, 6); final List<Integer> sub1CycleTimes = Arrays.asList(0, 6);
sub1.getTime().setCycleTimes(sub1CycleTimes); sub1.getTime().setCycleTimes(sub1CycleTimes);
@ -155,8 +155,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsZeroPercentOfCyclesForNullsOrEmpties() { public void returnsZeroPercentOfCyclesForNullsOrEmpties() {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
sub1.getTime().setCycleTimes(null); sub1.getTime().setCycleTimes(null);
final List<Integer> cycleTimes = Arrays.asList(0, 3, 4); final List<Integer> cycleTimes = Arrays.asList(0, 3, 4);
@ -173,8 +173,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsPercentOfSpatialThatIsTheSame() public void returnsPercentOfSpatialThatIsTheSame()
throws TransformException { throws TransformException {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
ReferencedEnvelope envelope1 = new ReferencedEnvelope(new Envelope( ReferencedEnvelope envelope1 = new ReferencedEnvelope(new Envelope(
new Coordinate(-5, 0), new Coordinate(0, 5)), new Coordinate(-5, 0), new Coordinate(0, 5)),
@ -198,8 +198,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsZeroPercentOfSpatialWhenNoOverlap() public void returnsZeroPercentOfSpatialWhenNoOverlap()
throws TransformException { throws TransformException {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
ReferencedEnvelope envelope1 = new ReferencedEnvelope(new Envelope( ReferencedEnvelope envelope1 = new ReferencedEnvelope(new Envelope(
new Coordinate(-5, 0), new Coordinate(0, 5)), new Coordinate(-5, 0), new Coordinate(0, 5)),
@ -217,8 +217,8 @@ public class SubscriptionDuplicateCheckerTest {
@Test @Test
public void returnsZeroPercentOfSpatialForNulls() throws TransformException { public void returnsZeroPercentOfSpatialForNulls() throws TransformException {
final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1);
final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2);
sub1.setCoverage(null); sub1.setCoverage(null);

View file

@ -78,11 +78,11 @@ public class TestJaxbableClassesLocator implements IJaxbableClassesLocator {
com.raytheon.uf.common.datadelivery.registry.Parameter.class, com.raytheon.uf.common.datadelivery.registry.Parameter.class,
com.raytheon.uf.common.datadelivery.registry.ParameterLevel.class, com.raytheon.uf.common.datadelivery.registry.ParameterLevel.class,
com.raytheon.uf.common.datadelivery.registry.PendingSharedSubscription.class, com.raytheon.uf.common.datadelivery.registry.PendingSharedSubscription.class,
com.raytheon.uf.common.datadelivery.registry.PendingUserSubscription.class, com.raytheon.uf.common.datadelivery.registry.PendingSiteSubscription.class,
com.raytheon.uf.common.datadelivery.registry.Projection.class, com.raytheon.uf.common.datadelivery.registry.Projection.class,
com.raytheon.uf.common.datadelivery.registry.Provider.class, com.raytheon.uf.common.datadelivery.registry.Provider.class,
com.raytheon.uf.common.datadelivery.registry.SharedSubscription.class, com.raytheon.uf.common.datadelivery.registry.SharedSubscription.class,
com.raytheon.uf.common.datadelivery.registry.UserSubscription.class, com.raytheon.uf.common.datadelivery.registry.SiteSubscription.class,
com.raytheon.uf.common.datadelivery.registry.Time.class, com.raytheon.uf.common.datadelivery.registry.Time.class,
com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterLookup.class, com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterLookup.class,
com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterConfig.class, com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterConfig.class,

View file

@ -31,7 +31,7 @@ import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder; import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -64,15 +64,15 @@ public class FindActiveSubscriptionsForRouteTest {
.getSubscriptionHandler(); .getSubscriptionHandler();
// Two OPSNET subscriptions // Two OPSNET subscriptions
final UserSubscription opsnetSub1 = new SubscriptionBuilder() final SiteSubscription opsnetSub1 = new SubscriptionBuilder()
.withName("opsnetSub1").withRoute(Network.OPSNET).build(); .withName("opsnetSub1").withRoute(Network.OPSNET).build();
final UserSubscription opsnetSub2 = new UserSubscription(opsnetSub1, final SiteSubscription opsnetSub2 = new SiteSubscription(opsnetSub1,
"opsnetSub2"); "opsnetSub2");
// Two SBN subscriptions // Two SBN subscriptions
final UserSubscription sbnSub1 = new SubscriptionBuilder() final SiteSubscription sbnSub1 = new SubscriptionBuilder()
.withName("sbnSub1").withRoute(Network.SBN).build(); .withName("sbnSub1").withRoute(Network.SBN).build();
final UserSubscription sbnSub2 = new UserSubscription(sbnSub1, final SiteSubscription sbnSub2 = new SiteSubscription(sbnSub1,
"sbnSub2"); "sbnSub2");
// Store all subscriptions // Store all subscriptions

View file

@ -30,7 +30,7 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.registry.RegistryManagerTest; import com.raytheon.uf.common.registry.RegistryManagerTest;
/** /**
@ -61,7 +61,7 @@ public class OpenDAPRetrievalGeneratorTest {
Time time = new Time(); Time time = new Time();
time.setCycleTimes(Arrays.asList(0, 12)); time.setCycleTimes(Arrays.asList(0, 12));
UserSubscription subscription = new UserSubscription(); SiteSubscription subscription = new SiteSubscription();
subscription.setTime(time); subscription.setTime(time);
GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE
@ -77,7 +77,7 @@ public class OpenDAPRetrievalGeneratorTest {
Time time = new Time(); Time time = new Time();
time.setCycleTimes(Arrays.asList(0, 12)); time.setCycleTimes(Arrays.asList(0, 12));
UserSubscription subscription = new UserSubscription(); SiteSubscription subscription = new SiteSubscription();
subscription.setTime(time); subscription.setTime(time);
GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE
@ -93,7 +93,7 @@ public class OpenDAPRetrievalGeneratorTest {
Time time = new Time(); Time time = new Time();
time.setCycleTimes(Arrays.asList(0, 12)); time.setCycleTimes(Arrays.asList(0, 12));
Subscription subscription = new UserSubscription(); Subscription subscription = new SiteSubscription();
subscription.setTime(time); subscription.setTime(time);
GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE
@ -110,7 +110,7 @@ public class OpenDAPRetrievalGeneratorTest {
time.setCycleTimes(Arrays time.setCycleTimes(Arrays
.<Integer> asList(GriddedDataSetMetaData.NO_CYCLE)); .<Integer> asList(GriddedDataSetMetaData.NO_CYCLE));
Subscription subscription = new UserSubscription(); Subscription subscription = new SiteSubscription();
subscription.setTime(time); subscription.setTime(time);
GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE

View file

@ -32,7 +32,7 @@ import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription; import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.serialization.SerializationUtil;
/** /**
@ -62,7 +62,7 @@ public class NotificationMessageContainsTypeTest {
@BeforeClass @BeforeClass
public static void classSetUp() throws JMSException, JAXBException { public static void classSetUp() throws JMSException, JAXBException {
when(message.getText()).thenReturn( when(message.getText()).thenReturn(
SerializationUtil.marshalToXml(new UserSubscription())); SerializationUtil.marshalToXml(new SiteSubscription()));
} }
@Test @Test
@ -70,7 +70,7 @@ public class NotificationMessageContainsTypeTest {
throws JMSException, JAXBException { throws JMSException, JAXBException {
NotificationMessageContainsType condition = new NotificationMessageContainsType( NotificationMessageContainsType condition = new NotificationMessageContainsType(
String.class, UserSubscription.class); String.class, SiteSubscription.class);
assertThat( assertThat(
condition condition
.matchesCondition(new NotificationMessage[] { notificationMessage }), .matchesCondition(new NotificationMessage[] { notificationMessage }),
@ -82,7 +82,7 @@ public class NotificationMessageContainsTypeTest {
JAXBException { JAXBException {
NotificationMessageContainsType condition = new NotificationMessageContainsType( NotificationMessageContainsType condition = new NotificationMessageContainsType(
UserSubscription.class); SiteSubscription.class);
assertThat( assertThat(
condition condition
.matchesCondition(new NotificationMessage[] { notificationMessage }), .matchesCondition(new NotificationMessage[] { notificationMessage }),

View file

@ -36,7 +36,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import com.raytheon.uf.common.auth.user.IUser; import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
@ -340,6 +340,6 @@ public class SubscriptionServiceMassUpdateTest extends
when( when(
DataDeliveryHandlers.getPendingSubscriptionHandler() DataDeliveryHandlers.getPendingSubscriptionHandler()
.getBySubscription(subscription)).thenReturn( .getBySubscription(subscription)).thenReturn(
new InitialPendingUserSubscription()); new InitialPendingSiteSubscription());
} }
} }

View file

@ -45,7 +45,7 @@ import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder; import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.time.CalendarBuilder; import com.raytheon.uf.common.time.CalendarBuilder;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
@ -74,6 +74,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlg
* Jan 11, 2013 1453 djohnson Add test from failed test scenario. * Jan 11, 2013 1453 djohnson Add test from failed test scenario.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
* Apr 08, 2013 1826 djohnson Remove delivery options. * Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Remove method.
* *
* </pre> * </pre>
* *
@ -197,7 +198,7 @@ public class CreateSubscriptionPresenterTest {
cal.add(Calendar.YEAR, -1); cal.add(Calendar.YEAR, -1);
Date oneYearAgo = cal.getTime(); Date oneYearAgo = cal.getTime();
UserSubscription subscription = new SubscriptionBuilder() SiteSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(oneYearAgo) .withActivePeriodStart(oneYearAgo)
.withActivePeriodEnd(oneYearAgo).build(); .withActivePeriodEnd(oneYearAgo).build();
@ -221,7 +222,7 @@ public class CreateSubscriptionPresenterTest {
// Freeze time at Jan. 5 // Freeze time at Jan. 5
TimeUtilTest.freezeTime(yesterday.getTime() + TimeUtil.MILLIS_PER_DAY); TimeUtilTest.freezeTime(yesterday.getTime() + TimeUtil.MILLIS_PER_DAY);
UserSubscription subscription = new SubscriptionBuilder() SiteSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(yesterday) .withActivePeriodStart(yesterday)
.withActivePeriodEnd(yesterday).build(); .withActivePeriodEnd(yesterday).build();
@ -254,7 +255,7 @@ public class CreateSubscriptionPresenterTest {
cal.add(Calendar.DAY_OF_MONTH, 3); cal.add(Calendar.DAY_OF_MONTH, 3);
Date threeDaysFromNow = cal.getTime(); Date threeDaysFromNow = cal.getTime();
UserSubscription subscription = new SubscriptionBuilder() SiteSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(yesterday) .withActivePeriodStart(yesterday)
.withActivePeriodEnd(threeDaysFromNow).build(); .withActivePeriodEnd(threeDaysFromNow).build();
@ -281,7 +282,7 @@ public class CreateSubscriptionPresenterTest {
cal2.add(Calendar.DAY_OF_YEAR, 3); cal2.add(Calendar.DAY_OF_YEAR, 3);
Date oneYearAgoPlusThreeDays = cal2.getTime(); Date oneYearAgoPlusThreeDays = cal2.getTime();
UserSubscription subscription = new SubscriptionBuilder() SiteSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(oneYearAgo) .withActivePeriodStart(oneYearAgo)
.withActivePeriodEnd(oneYearAgoPlusThreeDays).build(); .withActivePeriodEnd(oneYearAgoPlusThreeDays).build();
@ -313,7 +314,7 @@ public class CreateSubscriptionPresenterTest {
cal2.set(Calendar.YEAR, 1970); cal2.set(Calendar.YEAR, 1970);
Date januaryFourth = cal2.getTime(); Date januaryFourth = cal2.getTime();
UserSubscription subscription = new SubscriptionBuilder() SiteSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(decemberThirtieth) .withActivePeriodStart(decemberThirtieth)
.withActivePeriodEnd(januaryFourth).build(); .withActivePeriodEnd(januaryFourth).build();
@ -377,7 +378,7 @@ public class CreateSubscriptionPresenterTest {
cal2.set(Calendar.YEAR, 1970); cal2.set(Calendar.YEAR, 1970);
final Date endDate = cal2.getTime(); final Date endDate = cal2.getTime();
UserSubscription subscription = new SubscriptionBuilder() SiteSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(startDate).withActivePeriodEnd(endDate) .withActivePeriodStart(startDate).withActivePeriodEnd(endDate)
.build(); .build();
@ -395,16 +396,9 @@ public class CreateSubscriptionPresenterTest {
argThat(yyyyMmDdMatches(januaryFirstYearLater))); argThat(yyyyMmDdMatches(januaryFirstYearLater)));
} }
@Test
public void verifySubscriptionSetToView() {
presenter.open();
verify(view).setSubscription(presenter.getSubscription());
}
@Test @Test
public void verifyCycleTimesSetToView() { public void verifyCycleTimesSetToView() {
presenter.open(); presenter.open();
verify(view).setCycleTimes(dataSet.getCycles()); verify(view).setCycleTimes(dataSet.getCycles());
} }
} }

View file

@ -30,7 +30,7 @@ import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.DataType; import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.units.DataSizeUnit; import com.raytheon.uf.common.units.DataSizeUnit;
import com.raytheon.uf.viz.datadelivery.system.CreateEditRuleDlg.FreqUnitOptions; import com.raytheon.uf.viz.datadelivery.system.CreateEditRuleDlg.FreqUnitOptions;
import com.raytheon.uf.viz.datadelivery.system.Operator; import com.raytheon.uf.viz.datadelivery.system.Operator;
@ -64,7 +64,7 @@ public class RuleXMLTest {
@Before @Before
public void setUp() { public void setUp() {
sub = new UserSubscription(); sub = new SiteSubscription();
sub.setDataSetName("GFS"); sub.setDataSetName("GFS");
sub.setDataSetType(DataType.GRID); sub.setDataSetType(DataType.GRID);
sub.setDataSetSize(100); sub.setDataSetSize(100);