From 192ce891d00bf62cb8791636ff4b1cc0bbc980fd Mon Sep 17 00:00:00 2001 From: Mike Duff Date: Mon, 20 May 2013 13:15:58 -0500 Subject: [PATCH] Issue #2020 - Implement Shared Subscriptions Cave-side. Change-Id: I96e156043ec34e7ec98c2d8c3aafb6916c31e7cf Former-commit-id: 1e00c7f935cf22ac5064060069164af6044f2150 --- .../META-INF/MANIFEST.MF | 3 +- .../res/spring/datadelivery-handlers.xml | 4 +- .../datadelivery/browser/DataBrowserDlg.java | 13 +- .../datadelivery/common/ui/DurationComp.java | 199 ++++++++++-------- .../common/ui/SubscriptionViewer.java | 23 +- .../common/ui/UserSelectComp.java | 14 +- .../datadelivery/filter/FilterExpandBar.java | 84 ++++---- .../VizPendingSubscriptionHandler.java | 9 +- .../handlers/VizSubscriptionHandler.java | 9 +- .../subscription/CreateSubscriptionDlg.java | 198 ++++++++++++++++- .../subscription/GroupAddDlg.java | 55 +++-- .../subscription/ISubscriptionAction.java | 14 +- .../RequestFromServerPermissionsService.java | 9 +- .../subscription/SiteSelectionDlg.java | 175 +++++++++++++++ .../subscription/SubscriptionManagerDlg.java | 33 ++- .../SubscriptionManagerRowData.java | 141 +++++++------ .../subscription/SubscriptionTableComp.java | 31 +-- .../approve/SubscriptionApprovalRowData.java | 53 +++-- .../CreateSubscriptionDlgPresenter.java | 92 ++++---- .../subset/GriddedSubsetManagerDlg.java | 5 +- .../subset/NotEnabledSubscriptionHandler.java | 58 ----- .../subscription/subset/SubsetManagerDlg.java | 78 +++---- .../view/ICreateSubscriptionDlgView.java | 16 ++ .../utils/DataDeliveryGUIUtils.java | 66 +++++- .../datadelivery/utils/DataDeliveryUtils.java | 43 ++-- .../viz/ui/widgets/DualListComposite.java | 86 ++++++++ .../convertSubscriptionSitesToCollection.sh | 54 +++++ .../convertSubscriptionSitesToCollection.sql | 40 ++-- deltaScripts/13.5.1/getSubscriptionSite.sql | 23 ++ ...> renameSubscriptionToSiteSubscription.sh} | 4 +- ... renameSubscriptionToSiteSubscription.sql} | 54 ++--- .../auth/req/BasePrivilegedServerService.java | 6 +- ...f.common.serialization.ISerializableObject | 2 +- .../registry/AdhocSubscription.java | 5 +- .../DataDeliveryRegistryObjectTypes.java | 5 +- ...va => InitialPendingSiteSubscription.java} | 9 +- ...tion.java => PendingSiteSubscription.java} | 10 +- .../registry/RecurringSubscription.java | 38 ++-- .../registry/SharedSubscription.java | 17 +- ...ubscription.java => SiteSubscription.java} | 28 ++- .../datadelivery/registry/Subscription.java | 24 ++- ...java => PendingSiteSubscriptionQuery.java} | 16 +- ...nQuery.java => SiteSubscriptionQuery.java} | 17 +- ...a => IPendingSiteSubscriptionHandler.java} | 8 +- ...ler.java => ISiteSubscriptionHandler.java} | 6 +- .../handlers/ISubscriptionTypeHandler.java | 1 + ...va => PendingSiteSubscriptionHandler.java} | 20 +- .../handlers/PendingSubscriptionHandler.java | 80 +++---- ...dler.java => SiteSubscriptionHandler.java} | 20 +- .../handlers/SubscriptionHandler.java | 69 +++--- .../handlers/SubscriptionTypeHandler.java | 2 +- .../request/DataDeliveryPermission.java | 9 +- .../ebxml/slots/SetSlotConverter.java | 70 +++--- .../com/raytheon/uf/common/site/SiteData.java | 118 +++++++++++ .../com/raytheon/uf/common/site/SiteMap.java | 119 +++++++++-- .../uf/common/site/xml/NwsSitesXML.java | 79 +++++++ .../uf/common/site/xml/SiteIdXML.java | 83 ++++++++ .../common_static/base/awips_site_list.xml | 149 +++++++++++++ .../raytheon/uf/common/util/StringUtil.java | 65 +++++- .../bandwidth/BandwidthManager.java | 14 +- .../res/spring/datadelivery-handlers-impl.xml | 4 +- .../base/roles/dataDeliveryUserRoles.xml | 41 ++++ .../AbstractBandwidthManagerIntTest.java | 16 +- .../bandwidth/BandwidthManagerIntTest.java | 8 +- .../registry/AdhocSubscriptionFixture.java | 2 +- ....java => BaseSiteSubscriptionFixture.java} | 4 +- .../registry/BaseSubscriptionFixture.java | 3 +- .../registry/PendingSubscriptionFixture.java | 10 +- .../registry/PendingSubscriptionTest.java | 11 +- ...ionTest.java => SiteSubscriptionTest.java} | 24 ++- .../registry/SubscriptionBuilder.java | 7 +- .../registry/SubscriptionFixture.java | 6 +- .../BaseMemorySubscriptionHandler.java | 5 +- .../handlers/GroupDefinitionServiceTest.java | 6 +- .../SubscriptionDuplicateCheckerTest.java | 38 ++-- .../TestJaxbableClassesLocator.java | 4 +- .../FindActiveSubscriptionsForRouteTest.java | 10 +- .../OpenDAPRetrievalGeneratorTest.java | 10 +- .../NotificationMessageContainsTypeTest.java | 8 +- .../SubscriptionServiceMassUpdateTest.java | 4 +- .../CreateSubscriptionPresenterTest.java | 22 +- .../subscription/xml/RuleXMLTest.java | 4 +- 82 files changed, 2176 insertions(+), 846 deletions(-) create mode 100644 cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SiteSelectionDlg.java delete mode 100644 cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/NotEnabledSubscriptionHandler.java create mode 100644 cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/widgets/DualListComposite.java create mode 100644 deltaScripts/13.5.1/convertSubscriptionSitesToCollection.sh rename cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/ISharedSubscriptionHandler.java => deltaScripts/13.5.1/convertSubscriptionSitesToCollection.sql (52%) create mode 100644 deltaScripts/13.5.1/getSubscriptionSite.sql rename deltaScripts/13.5.1/{renameSubscriptionToUserSubscription.sh => renameSubscriptionToSiteSubscription.sh} (78%) rename deltaScripts/13.5.1/{renameSubscriptionToUserSubscription.sql => renameSubscriptionToSiteSubscription.sql} (72%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/{InitialPendingUserSubscription.java => InitialPendingSiteSubscription.java} (92%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/{PendingUserSubscription.java => PendingSiteSubscription.java} (90%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/{UserSubscription.java => SiteSubscription.java} (85%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/{PendingUserSubscriptionQuery.java => PendingSiteSubscriptionQuery.java} (78%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/{UserSubscriptionQuery.java => SiteSubscriptionQuery.java} (80%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/{IPendingUserSubscriptionHandler.java => IPendingSiteSubscriptionHandler.java} (88%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/{IUserSubscriptionHandler.java => ISiteSubscriptionHandler.java} (89%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/{PendingUserSubscriptionHandler.java => PendingSiteSubscriptionHandler.java} (76%) rename edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/{UserSubscriptionHandler.java => SiteSubscriptionHandler.java} (75%) create mode 100644 edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteData.java create mode 100644 edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/xml/NwsSitesXML.java create mode 100644 edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/xml/SiteIdXML.java create mode 100644 edexOsgi/com.raytheon.uf.common.site/utility/common_static/base/awips_site_list.xml rename tests/unit/com/raytheon/uf/common/datadelivery/registry/{BaseUserSubscriptionFixture.java => BaseSiteSubscriptionFixture.java} (93%) rename tests/unit/com/raytheon/uf/common/datadelivery/registry/{UserSubscriptionTest.java => SiteSubscriptionTest.java} (90%) diff --git a/cave/com.raytheon.uf.viz.datadelivery/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.datadelivery/META-INF/MANIFEST.MF index 0d679b7f56..2390899732 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.datadelivery/META-INF/MANIFEST.MF @@ -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.retrieval;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-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.datadelivery;uses:="org.eclipse.ui.plugin,org.osgi.framework", diff --git a/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery-handlers.xml b/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery-handlers.xml index 3c76d6e852..4d65892ed8 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery-handlers.xml +++ b/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery-handlers.xml @@ -8,7 +8,7 @@ class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler"> + class="com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler" /> + class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSiteSubscriptionHandler" /> * @@ -1073,11 +1074,15 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate, VizApp.runAsync(new Runnable() { @Override public void run() { - if (!dataTableComp.isDisposed()) { - dataTableComp.updateTable(matchingDataSets); - updateTableEntriesLabel(); + try { + if (!dataTableComp.isDisposed()) { + dataTableComp.updateTable(matchingDataSets); + updateTableEntriesLabel(); + } + } finally { + DataDeliveryGUIUtils + .markNotBusyInUIThread(jobParent); } - DataDeliveryGUIUtils.markNotBusyInUIThread(jobParent); } }); } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/DurationComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/DurationComp.java index b75f8979fb..6cea1b5942 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/DurationComp.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/DurationComp.java @@ -44,7 +44,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils; /** - * This is the subscription duration composite. This class is intended to be + * This is the subscription duration composite. This class is intended to be * extended so common classes can be created and shared. * *
@@ -53,7 +53,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
  * 
  * 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.
  * 
  * 
* @@ -65,13 +66,13 @@ public class DurationComp extends Composite { /** Status Handler */ private final IUFStatusHandler statusHandler = UFStatus .getHandler(DurationComp.class); - + /** TableItem object. */ private final Composite parentComp; - + /** The indefinite option radio button */ private Button indefiniteChk; - + /** The start date text field */ private Text startText; @@ -83,13 +84,13 @@ public class DurationComp extends Composite { /** The end date text field */ private Text endText; - + /** The starting date */ private Date startDate; /** The ending date */ private Date endDate; - + /** * Constructor. * @@ -120,7 +121,7 @@ public class DurationComp extends Composite { createDurationGroup(); } - + /** * Create the Subscription Duration Group */ @@ -145,11 +146,9 @@ public class DurationComp extends Composite { endText.setEnabled(inDef); endDateBtn.setEnabled(inDef); - } + } }); - int buttonWidth = 85; - GridData btnData = new GridData(buttonWidth, SWT.DEFAULT); int textWidth = 100; GridData textData = new GridData(textWidth, SWT.DEFAULT); @@ -157,9 +156,9 @@ public class DurationComp extends Composite { Composite periodComp = new Composite(durationGrp, SWT.NONE); periodComp.setLayout(new GridLayout(3, false)); periodComp.setLayoutData(gd); - + gd = new GridData(SWT.LEFT, SWT.CENTER, false, false); - + Label startLbl = new Label(periodComp, SWT.LEFT); startLbl.setLayoutData(gd); startLbl.setText("Start Date: "); @@ -171,17 +170,19 @@ public class DurationComp extends Composite { @Override public void focusLost(FocusEvent e) { - if (!DataDeliveryGUIUtils.validateDate(false, startText.getText())) { - DataDeliveryUtils.showMessage(getShell(), SWT.ERROR, "Invalid Date/Time", - "Invalid Starting Date/Time entered.\n\n" + "Please use the Select Date button\n" + if (!DataDeliveryGUIUtils.validateDate(false, + startText.getText())) { + 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."); } } }); startDateBtn = new Button(periodComp, SWT.PUSH); - startDateBtn.setText("Select Date"); - startDateBtn.setLayoutData(btnData); + startDateBtn.setText(" Select Date "); startDateBtn.setEnabled(false); startDateBtn.addSelectionListener(new SelectionAdapter() { @Override @@ -191,7 +192,7 @@ public class DurationComp extends Composite { }); gd = new GridData(SWT.LEFT, SWT.CENTER, false, false); - + Label endLbl = new Label(periodComp, SWT.LEFT); endLbl.setLayoutData(gd); endLbl.setText("Expiration Date: "); @@ -205,17 +206,17 @@ public class DurationComp extends Composite { @Override public void focusLost(FocusEvent e) { if (!DataDeliveryGUIUtils.validateDate(false, endText.getText())) { - DataDeliveryUtils.showMessage(getShell(), SWT.ERROR, "Invalid Date/Time", - "Invalid End Date/Time entered.\n\n" + "Please use the Select Date button\n" + DataDeliveryUtils.showMessage(getShell(), SWT.ERROR, + "Invalid Date/Time", + "Invalid End Date/Time entered.\n\n" + + "Please use the Select Date button\n" + "to select the date/time."); } } }); - btnData = new GridData(buttonWidth, SWT.DEFAULT); endDateBtn = new Button(periodComp, SWT.PUSH); - endDateBtn.setText("Select Date"); - endDateBtn.setLayoutData(btnData); + endDateBtn.setText(" Select Date "); endDateBtn.setEnabled(false); endDateBtn.addSelectionListener(new SelectionAdapter() { @Override @@ -224,7 +225,7 @@ public class DurationComp extends Composite { } }); } - + /** * Get the start date selected by the user */ @@ -233,15 +234,17 @@ public class DurationComp extends Composite { if (d != null) { startDate = d; try { - startText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(startDate) + "Z"); + startText.setText(DataDeliveryGUIUtils.getSubscriptionFormat() + .format(startDate) + "Z"); } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, "Invalid date format - format needs to be " + - "MM/dd/yyyy HH", e); + statusHandler.handle(Priority.PROBLEM, + "Invalid date format - format needs to be " + + "MM/dd/yyyy HH", e); } } } - + /** * Get the end date selected by the user */ @@ -250,10 +253,12 @@ public class DurationComp extends Composite { if (d != null) { endDate = d; try { - endText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(endDate) + "Z"); + endText.setText(DataDeliveryGUIUtils.getSubscriptionFormat() + .format(endDate) + "Z"); } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, "Invalid date format - format needs to be " + - "MM/dd/yyyy HH", e); + statusHandler.handle(Priority.PROBLEM, + "Invalid date format - format needs to be " + + "MM/dd/yyyy HH", e); } } } @@ -274,29 +279,28 @@ public class DurationComp extends Composite { Object obj = ac.open(); if ((obj != null) && (obj instanceof Calendar)) { - return ((Calendar)obj).getTime(); + return ((Calendar) obj).getTime(); } return null; } - + /** * Get the does not expire radio button selection. * - * @return boolean - * true if checked + * @return boolean true if checked */ public boolean isIndefiniteChk() { - return indefiniteChk.getSelection(); - } + return indefiniteChk.getSelection(); + } - /** - * Set the does not expire check box. - * - * @param flag - */ + /** + * Set the does not expire check box. + * + * @param flag + */ public void setNoExpiration(boolean flag) { - indefiniteChk.setSelection(flag); + indefiniteChk.setSelection(flag); } /** @@ -310,13 +314,13 @@ public class DurationComp extends Composite { } else { return null; } - + } - + /** * Enable or disable text boxes. * - * @param flag + * @param flag */ public void resetTextBoxes(boolean flag) { this.startText.setEnabled(flag); @@ -351,7 +355,7 @@ public class DurationComp extends Composite { * @param flag */ public void setStartBtnEnabled(boolean flag) { - startDateBtn.setEnabled(flag); + startDateBtn.setEnabled(flag); } /** @@ -360,70 +364,79 @@ public class DurationComp extends Composite { * @param flag */ public void setEndBtnEnabled(boolean flag) { - endDateBtn.setEnabled(flag); + endDateBtn.setEnabled(flag); } - - /** + + /** * Set the start date. * * @param startDate */ public void setStartDate(Date startDate) { - startText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(startDate) + "Z"); + startText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format( + startDate) + + "Z"); startText.setEnabled(true); - startDateBtn.setEnabled(true); + startDateBtn.setEnabled(true); this.startDate = startDate; } - /** + /** * Set the end date. * * @param endDate - */ - public void setEndDate(Date endDate) { - endText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format(endDate) + "Z"); + */ + public void setEndDate(Date endDate) { + endText.setText(DataDeliveryGUIUtils.getSubscriptionFormat().format( + endDate) + + "Z"); endText.setEnabled(true); - endDateBtn.setEnabled(true); + endDateBtn.setEnabled(true); this.endDate = endDate; - } + } - /** - * Check if dates are valid. - * @return true if dates are valid - */ - public boolean isValidChk() { - boolean datesValid = false; - boolean dateOrderValid = false; + /** + * Check if dates are valid. + * + * @return true if dates are valid + */ + public boolean isValidChk() { + boolean datesValid = false; + boolean dateOrderValid = false; - if (!isIndefiniteChk()) { - boolean validateDur = DataDeliveryGUIUtils.validateDate(false, getStartText()); - if (validateDur) { + if (!isIndefiniteChk()) { + boolean validateDur = DataDeliveryGUIUtils.validateDate(false, + getStartText()); + if (validateDur) { - validateDur = DataDeliveryGUIUtils.validateDate(false, getEndText()); - if (validateDur) { - datesValid = true; - dateOrderValid = DataDeliveryGUIUtils.checkDateOrder(getStartText(), getEndText(), true); - } - } - } - else { - datesValid = true; - dateOrderValid = true; - } + validateDur = DataDeliveryGUIUtils.validateDate(false, + getEndText()); + if (validateDur) { + datesValid = true; + dateOrderValid = DataDeliveryGUIUtils.checkDateOrder( + getStartText(), getEndText(), true); + } + } + } else { + datesValid = true; + dateOrderValid = true; + } - // Display error message - if (!datesValid) { - DataDeliveryUtils.showMessage(parentComp.getShell(), SWT.ERROR, "Invalid Date/Time", - "Invalid Subscription Duration values entered.\n\n" + "Please use the Select Date button\n" - + "to select the date/time."); - } - else if (!dateOrderValid) { - DataDeliveryUtils.showMessage(parentComp.getShell(), SWT.ERROR, "Invalid Start/End Dates", - "Invalid Start or Expiration Duration Date entered.\n\n" - + "The expiration date is before the start date."); - } + // Display error message + if (!datesValid) { + DataDeliveryUtils.showMessage(parentComp.getShell(), SWT.ERROR, + "Invalid Date/Time", + "Invalid Subscription Duration values entered.\n\n" + + "Please use the Select Date button\n" + + "to select the date/time."); + } else if (!dateOrderValid) { + DataDeliveryUtils.showMessage(parentComp.getShell(), SWT.ERROR, + "Invalid Start/End Dates", + "Invalid Start or Expiration Duration Date entered.\n\n" + + "The expiration date is before the start date."); + } - return datesValid && dateOrderValid; - } + return datesValid && dateOrderValid; + } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java index c54a300ac6..ade517177d 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java @@ -52,6 +52,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE; * 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 10, 2012 1300 bgonzale Table filtering by dataset and provider. + * May 23, 2012 2020 mpduff Implement method. * * * @author mpduff @@ -64,13 +65,13 @@ public class SubscriptionViewer extends AbstractViewDlg implements /** * 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, * nam,... */ - private String datasetName; + private final String datasetName; /** Table composite */ private SubscriptionTableComp tableComp; @@ -106,7 +107,7 @@ public class SubscriptionViewer extends AbstractViewDlg implements /** * Constructor taking a list of subscriptions. - * + * * @param parent * Parent Shell * @param subscriptionList @@ -125,7 +126,7 @@ public class SubscriptionViewer extends AbstractViewDlg implements /* * (non-Javadoc) - * + * * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout() */ @Override @@ -138,7 +139,7 @@ public class SubscriptionViewer extends AbstractViewDlg implements /* * (non-Javadoc) - * + * * @see * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayoutData() */ @@ -149,7 +150,7 @@ public class SubscriptionViewer extends AbstractViewDlg implements /* * (non-Javadoc) - * + * * @see * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org * .eclipse.swt.widgets.Shell) @@ -229,7 +230,7 @@ public class SubscriptionViewer extends AbstractViewDlg implements /* * (non-Javadoc) - * + * * @see com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionAction# * activateButtonUpdate(java.lang.String) */ @@ -237,4 +238,12 @@ public class SubscriptionViewer extends AbstractViewDlg implements public void activateButtonUpdate(String text) { // Not used. } + + /** + * {@inheritDoc} + */ + @Override + public void updateControls() { + // Not used. + } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java index 58aa5f72e9..3ba53d7ba4 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java @@ -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. * Jan 02, 2013 1441 djohnson Access GroupDefinitionManager in a static fashion. * 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. * * * @author jpiatt @@ -276,8 +277,7 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay, .getSelectedListItems()); Set differences = Sets.symmetricDifference( - selectedSubscriptionNames, - initiallySelectedSubscriptions); + selectedSubscriptionNames, initiallySelectedSubscriptions); Set addedToGroup = new HashSet(); Set removedFromGroup = new HashSet(); @@ -335,8 +335,7 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay, } updateGroupDefinitionForSubscriptions(groupName, - groupSubscriptionsForUpdate, - removedFromGroup); + groupSubscriptionsForUpdate, removedFromGroup); timer.stop(); if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { @@ -408,19 +407,16 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay, subscription.setCoverage(cov); } - subscription.setOfficeID(LocalizationManager.getInstance() + subscription.addOfficeID(LocalizationManager.getInstance() .getCurrentSite()); - } - try { final ISubscriptionServiceResult result = DataDeliveryServices .getSubscriptionService().updateWithPendingCheck( new ArrayList(Sets.union( groupSubscriptions, - removeFromGroupSubscriptions)), - this); + removeFromGroupSubscriptions)), this); if (result.hasMessageToDisplay()) { DataDeliveryUtils.showMessage(getShell(), SWT.ICON_INFORMATION, "Edit Group", result.getMessageToDisplay()); diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/FilterExpandBar.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/FilterExpandBar.java index df3b709cfd..9c3bfffae4 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/FilterExpandBar.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/FilterExpandBar.java @@ -81,6 +81,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig; * icon update when loading from a file. * 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. + * May 15, 2013 1040 mpduff Called markNotBusyInUIThread. * * * @@ -193,13 +194,13 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, private void createExpandItems() { if (dataTypes != null && dataTypes.length > 0) { - final Shell jobParent = this.getShell(); + final Shell parentShell = this.getShell(); final Job job = new Job("Dataset Discovery...") { @Override protected IStatus run(IProgressMonitor monitor) { MetaDataManager dataManager = MetaDataManager.getInstance(); - DataDeliveryGUIUtils.markBusyInUIThread(jobParent); + DataDeliveryGUIUtils.markBusyInUIThread(parentShell); dataManager.rereadMetaData(); dataManager.readMetaData(dataTypes[0]); return Status.OK_STATUS; @@ -209,45 +210,50 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { - DataTypeFilterElementXML dtfe; - HashMap> dataFilterMap = new HashMap>(); + try { + DataTypeFilterElementXML dtfe; + HashMap> dataFilterMap = new HashMap>(); - // Get filters for each data type - for (int i = 0; i < dataTypes.length; i++) { - String dataType = dataTypes[i]; - dtfe = dataTypeFilterXml.getFilterData(dataType); - ArrayList filterIDList = dtfe.getFilterIDList(); - dataFilterMap.put(dataType, filterIDList); - } - - // Now have a list of available filter types - // Need to find the common filters - FilterDefinitionManager filterMan = FilterDefinitionManager - .getInstance(); - filterList = filterMan.findCommon(dataFilterMap); - - VizApp.runAsync(new Runnable() { - @Override - public void run() { - // Now we have a list of common filters, lets build - // them - for (String filter : filterList) { - final FilterElementsXML fex = filterXml - .getFilter(filter); - String clazz = fex.getClazz(); - - // TODO use reflection here to instantiate the - // class - if (clazz.equals("FilterComp")) { - createFilter(fex); - } - } - notifyListeners(SWT.SetData, new Event()); - DataDeliveryGUIUtils - .markNotBusyInUIThread(jobParent); - setClean(); + // Get filters for each data type + for (int i = 0; i < dataTypes.length; i++) { + String dataType = dataTypes[i]; + dtfe = dataTypeFilterXml.getFilterData(dataType); + ArrayList filterIDList = dtfe + .getFilterIDList(); + dataFilterMap.put(dataType, filterIDList); } - }); + + // Now have a list of available filter types + // Need to find the common filters + FilterDefinitionManager filterMan = FilterDefinitionManager + .getInstance(); + filterList = filterMan.findCommon(dataFilterMap); + + VizApp.runAsync(new Runnable() { + @Override + public void run() { + // Now we have a list of common filters, lets + // build + // them + for (String filter : filterList) { + final FilterElementsXML fex = filterXml + .getFilter(filter); + String clazz = fex.getClazz(); + + // TODO use reflection here to instantiate + // the + // class + if (clazz.equals("FilterComp")) { + createFilter(fex); + } + } + notifyListeners(SWT.SetData, new Event()); + setClean(); + } + }); + } finally { + DataDeliveryGUIUtils.markNotBusyInUIThread(parentShell); + } } }); diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/handlers/VizPendingSubscriptionHandler.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/handlers/VizPendingSubscriptionHandler.java index 66292f136a..804396a804 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/handlers/VizPendingSubscriptionHandler.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/handlers/VizPendingSubscriptionHandler.java @@ -23,8 +23,8 @@ import java.util.List; import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest; import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSharedSubscriptionHandler; +import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSiteSubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler; -import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingUserSubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler; import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; @@ -44,6 +44,7 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter; * Sep 27, 2012 1187 djohnson Initial creation * Nov 15, 2012 1286 djohnson Use server-keyed routing. * Apr 05, 2013 1841 djohnson Add shared subscription support. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -55,12 +56,12 @@ public class VizPendingSubscriptionHandler extends PendingSubscriptionHandler { /** * Constructor. * - * @param userSubscriptionHandler + * @param siteSubscriptionHandler */ public VizPendingSubscriptionHandler( - IPendingUserSubscriptionHandler userSubscriptionHandler, + IPendingSiteSubscriptionHandler siteSubscriptionHandler, IPendingSharedSubscriptionHandler sharedSubscriptionHandler) { - super(userSubscriptionHandler, sharedSubscriptionHandler); + super(siteSubscriptionHandler, sharedSubscriptionHandler); } /** diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/handlers/VizSubscriptionHandler.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/handlers/VizSubscriptionHandler.java index 34c249b6aa..f9284e7be4 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/handlers/VizSubscriptionHandler.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/handlers/VizSubscriptionHandler.java @@ -23,8 +23,8 @@ import java.util.List; import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest; import com.raytheon.uf.common.datadelivery.registry.handlers.ISharedSubscriptionHandler; +import com.raytheon.uf.common.datadelivery.registry.handlers.ISiteSubscriptionHandler; 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.request.DataDeliveryConstants; 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. * Mar 29, 2013 1841 djohnson Composes a userSubscriptionsHandler. * Apr 05, 2013 1841 djohnson Add shared subscription support. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -56,13 +57,13 @@ public class VizSubscriptionHandler extends SubscriptionHandler { /** * Constructor. * - * @param userSubscriptionHandler + * @param siteSubscriptionHandler * @param sharedSubscriptionHandler */ public VizSubscriptionHandler( - IUserSubscriptionHandler userSubscriptionHandler, + ISiteSubscriptionHandler siteSubscriptionHandler, ISharedSubscriptionHandler sharedSubscriptionHandler) { - super(userSubscriptionHandler, sharedSubscriptionHandler); + super(siteSubscriptionHandler, sharedSubscriptionHandler); } /** diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java index 312d875cf1..1b9b757202 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java @@ -26,8 +26,13 @@ import java.util.Set; import org.eclipse.core.runtime.Status; 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.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.GridLayout; 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.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.SubscriptionPriority; 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.DurationComp; import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp; 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.system.SystemRuleManager; +import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils; 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.CheckBoxConf; @@ -80,6 +96,7 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf; * Jan 04, 2013 1420 mpduff Add latency. * Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers. * Apr 08, 2013 1826 djohnson Remove delivery options. + * May 15, 2013 1040 mpduff Add Shared sites. * * * @@ -88,6 +105,9 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf; */ public class CreateSubscriptionDlg extends CaveSWTDialog implements ICreateSubscriptionDlgView { + /** Status Handler */ + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(CreateSubscriptionDlg.class); /** The Main Composite */ private Composite mainComp; @@ -146,6 +166,12 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements /** Available cycle times */ private Set cycleTimes; + private String[] sharedSites; + + private Label selectedSiteLbl; + + private final Font font; + /** * Constructor. * @@ -155,8 +181,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements * true for new subscription, false for edit */ public CreateSubscriptionDlg(Shell parent, boolean create) { - super(parent, SWT.DIALOG_TRIM, CAVE.INDEPENDENT_SHELL - | CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL, + CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT); this.create = create; if (create) { @@ -164,6 +190,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements } else { 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); this.createCycleGroup(); + createSiteSelection(); + if (create == false) { createChangeText(); } @@ -266,6 +296,97 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements 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 */ @@ -341,6 +462,21 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements 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} */ @@ -349,6 +485,19 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements 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} */ @@ -815,4 +964,49 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements public void setCycleTimes(Set 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 officeIDs) { + List list = new ArrayList(officeIDs); + this.sharedSites = list.toArray(new String[officeIDs.size()]); + } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/GroupAddDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/GroupAddDlg.java index 752f9e81cd..3134507a9d 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/GroupAddDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/GroupAddDlg.java @@ -32,8 +32,8 @@ import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Shell; 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.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; 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. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * 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. * * * @@ -74,7 +76,8 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf; public class GroupAddDlg extends CaveSWTDialog { /** Status Handler */ - private final IUFStatusHandler statusHandler = UFStatus.getHandler(GroupAddDlg.class); + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(GroupAddDlg.class); /** The Main Composite */ private Composite mainComp; @@ -95,11 +98,11 @@ public class GroupAddDlg extends CaveSWTDialog { * Constructor. * * @param parent - * parent shell + * parent shell * @param subscription - * Subscription object + * Subscription object * @param callback - * callback to parent shell + * callback to parent shell */ public GroupAddDlg(Shell parent, Subscription subscription, IGroupAction callback) { @@ -125,20 +128,23 @@ public class GroupAddDlg extends CaveSWTDialog { mainComp.setLayoutData(gd); createSubInfo(); - - // TODO - need to change this to not us the IGroupAction + + // TODO - need to change this to not us the IGroupAction groupSelectComp = new GroupSelectComp(mainComp, true); groupSelectComp.setGroupName(subscription.getGroupName()); createButtons(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened() */ @Override 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); } @@ -220,28 +226,32 @@ public class GroupAddDlg extends CaveSWTDialog { */ private boolean handleOK() { - //Get Group Definition + // Get Group Definition String groupName = groupSelectComp.getGroupName(); GroupDefinition groupDefinition = GroupDefinitionManager .getGroup(groupName); - //Apply group properties to subscription definition + // Apply group properties to subscription definition if (groupDefinition != null) { subscription.setGroupName(groupName); - //Set duration + // Set duration if (groupDefinition.getSubscriptionStart() != null) { - subscription.setSubscriptionStart(groupDefinition.getSubscriptionStart()); - subscription.setSubscriptionEnd(groupDefinition.getSubscriptionEnd()); + subscription.setSubscriptionStart(groupDefinition + .getSubscriptionStart()); + subscription.setSubscriptionEnd(groupDefinition + .getSubscriptionEnd()); } else { subscription.setSubscriptionStart(null); subscription.setSubscriptionEnd(null); } - //Set active period + // Set active period if (groupDefinition.getActivePeriodStart() != null) { - subscription.setActivePeriodStart(groupDefinition.getActivePeriodStart()); - subscription.setActivePeriodEnd(groupDefinition.getActivePeriodEnd()); + subscription.setActivePeriodStart(groupDefinition + .getActivePeriodStart()); + subscription.setActivePeriodEnd(groupDefinition + .getActivePeriodEnd()); } else { subscription.setActivePeriodStart(null); subscription.setActivePeriodEnd(null); @@ -252,12 +262,13 @@ public class GroupAddDlg extends CaveSWTDialog { System.out.println("Fix Me: Need to calculate data set size"); subscription.setDataSetSize(999); - subscription.setOfficeID(LocalizationManager.getInstance().getCurrentSite()); + subscription.addOfficeID(LocalizationManager.getInstance() + .getCurrentSite()); // TODO: How to do this better? Will shared subscriptions participate in // groups? - if (subscription instanceof UserSubscription) { - ((UserSubscription) subscription).setOwner(username); + if (subscription instanceof SiteSubscription) { + ((SiteSubscription) subscription).setOwner(username); } try { @@ -269,8 +280,7 @@ public class GroupAddDlg extends CaveSWTDialog { } subscriptionNotificationService.sendCreatedSubscriptionNotification( - subscription, - username); + subscription, username); // refresh table callback.handleRefresh(); @@ -279,4 +289,3 @@ public class GroupAddDlg extends CaveSWTDialog { } } - diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ISubscriptionAction.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ISubscriptionAction.java index 62dde99ba3..9cac68c7c8 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ISubscriptionAction.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ISubscriptionAction.java @@ -28,7 +28,8 @@ package com.raytheon.uf.viz.datadelivery.subscription; * * 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. * * * @@ -37,5 +38,16 @@ package com.raytheon.uf.viz.datadelivery.subscription; */ public interface ISubscriptionAction { + /** + * Update the Activate button's text. + * + * @param text + * The text to display on the button + */ public void activateButtonUpdate(String text); + + /** + * Update the controls. + */ + public void updateControls(); } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/RequestFromServerPermissionsService.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/RequestFromServerPermissionsService.java index d1d0008e65..f4912c7e50 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/RequestFromServerPermissionsService.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/RequestFromServerPermissionsService.java @@ -23,8 +23,8 @@ import java.rmi.RemoteException; import com.raytheon.uf.common.auth.user.IUser; 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.UserSubscription; import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest; import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; 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. * Feb 26, 2013 1643 djohnson Extends base class. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -99,9 +100,9 @@ public class RequestFromServerPermissionsService extends final Subscription subscription) throws VizException { // TODO: Can this be done better? - if (subscription instanceof UserSubscription) { + if (subscription instanceof SiteSubscription) { return checkPermissionToChangeSubscription(user, - notAuthorizedMessage, (UserSubscription) subscription); + notAuthorizedMessage, (SiteSubscription) subscription); } else { return checkPermissionToChangeSubscription(user, notAuthorizedMessage, (SharedSubscription) subscription); @@ -111,7 +112,7 @@ public class RequestFromServerPermissionsService extends private IAuthorizedPermissionResponse checkPermissionToChangeSubscription( final IUser user, String notAuthorizedMessage, - final UserSubscription subscription) throws VizException { + final SiteSubscription subscription) throws VizException { final IAuthorizedPermissionResponse r = checkPermissions(user, notAuthorizedMessage, diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SiteSelectionDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SiteSelectionDlg.java new file mode 100644 index 0000000000..c2baee1670 --- /dev/null +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SiteSelectionDlg.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 29, 2013   1040     mpduff      Initial creation
+ * 
+ * 
+ * + * @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 getSiteList() { + SiteMap siteMap = SiteMap.getInstance(); + List siteList = new ArrayList(); + + Map siteDataMap = siteMap.getSiteData(); + + for (Entry 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(); + } +} \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java index 5946dbc25c..f7a6499059 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.SortedSet; 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.viz.core.auth.UserController; 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.common.ui.IGroupAction; 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. * Jan 22, 2013 1520 mpduff Removed menu accelerators. * 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. * * * @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 */ private Button activateBtn; @@ -947,20 +954,27 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements SubscriptionManagerRowData rowData = tableComp .getSubscriptionData().getDataRow(i); - String office = rowData.getOfficeId(); - officeDisplayItems.add(office); - + Set office = rowData.getOfficeIds(); + officeDisplayItems.addAll(office); } } officeNames = officeDisplayItems.toArray(new String[officeDisplayItems .size()]); String[] officeAll = new String[officeNames.length + 1]; + officeAll[0] = "ALL"; 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.select(0); + officeCbo.select(idx); } @@ -1107,4 +1121,13 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements public void tableLock(boolean isLocked) { // no-op } + + /** + * {@inheritDoc} + */ + @Override + public void updateControls() { + loadGroupNames(); + loadOfficeNames(); + } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerRowData.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerRowData.java index 1dbc73e1c4..b5d504ebbc 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerRowData.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerRowData.java @@ -20,8 +20,10 @@ package com.raytheon.uf.viz.datadelivery.subscription; import java.util.Date; +import java.util.Set; 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.ITableData; import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection; @@ -47,14 +49,16 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE; * 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. * Apr 08, 2013 1826 djohnson Remove delivery options. + * May 15, 2013 1040 mpduff Change Office IDs to set. * * * @author mpduff * @version 1.0 */ -public class SubscriptionManagerRowData implements ITableData { - +public class SubscriptionManagerRowData implements + ITableData { + /** Dataset id. */ private String dataSetID = null; @@ -86,13 +90,14 @@ public class SubscriptionManagerRowData implements ITableData officeIds = null; /** Size of dataset. */ private long dataSetSize = 0; @@ -105,22 +110,22 @@ public class SubscriptionManagerRowData implements ITableData getOfficeIds() { + return officeIds; } /** - * Set the office identification. + * Set the office ids. * - * @param dataSetID - * the dataSetID to set + * @param officeIds + * the officeIds to set */ - public void setOfficeId(String officeId) { - this.officeId = officeId; + public void setOfficeIds(Set officeIds) { + this.officeIds = officeIds; } /** @@ -397,8 +402,8 @@ public class SubscriptionManagerRowData implements ITableData * @@ -246,12 +248,9 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction { } if (table.getSelectionCount() > 1) { - int choice = DataDeliveryUtils - .showMessage( - this.getShell(), - SWT.ERROR | SWT.YES | SWT.NO, - "Single Selection Only", - "Multiple subscriptions are selected.\n" + int choice = DataDeliveryUtils.showMessage(this.getShell(), + SWT.ERROR | SWT.YES | SWT.NO, "Single Selection Only", + "Multiple subscriptions are selected.\n" + "Only the first selected item will be used.\n\n" + "Continue?"); return choice != SWT.NO; @@ -457,13 +456,17 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction { job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { - VizApp.runAsync(new Runnable() { - @Override - public void run() { - updateTable(subList); - } - }); - DataDeliveryGUIUtils.markNotBusyInUIThread(jobShell); + try { + VizApp.runAsync(new Runnable() { + @Override + public void run() { + updateTable(subList); + subActionCallback.updateControls(); + } + }); + } finally { + DataDeliveryGUIUtils.markNotBusyInUIThread(jobShell); + } } }); job.schedule(); diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/approve/SubscriptionApprovalRowData.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/approve/SubscriptionApprovalRowData.java index ff94d109a4..177a2b399a 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/approve/SubscriptionApprovalRowData.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/approve/SubscriptionApprovalRowData.java @@ -19,8 +19,11 @@ **/ 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.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.ITableData; import com.raytheon.uf.viz.datadelivery.subscription.approve.SubApprovalTableComp.Action; @@ -37,8 +40,9 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils; * ------------ ---------- ----------- -------------------------- * Jun 7, 2012 mpduff Initial creation. * 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. - * Dec 20, 2012 1413 bgonzale Implemented compareTo. + * 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. + * May 15, 2013 1040 mpduff Change office id to a set. * * * @@ -46,7 +50,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils; * @version 1.0 */ -public class SubscriptionApprovalRowData implements ITableData { +public class SubscriptionApprovalRowData implements + ITableData { /** The subscription object */ private InitialPendingSubscription subscription; @@ -63,7 +68,7 @@ public class SubscriptionApprovalRowData implements ITableData officeIds; /** Reason for the change to the subscription */ private String changeReason; @@ -155,21 +160,20 @@ public class SubscriptionApprovalRowData implements ITableData getOfficeIds() { + return officeIds; } /** - * @param officeId - * the officeId to set + * @param officeIds + * the officeIds to set */ - public void setOfficeId(String officeId) { - this.officeId = officeId; + public void setOfficeIds(Set officeIds) { + this.officeIds = officeIds; } - /** * @return the changeReason */ @@ -178,7 +182,8 @@ public class SubscriptionApprovalRowData implements ITableData * * @author mpduff @@ -178,6 +181,9 @@ public class CreateSubscriptionDlgPresenter { * @param dataSet * The dataset * @param create + * true for create, false for edit + * @param guiThreadTaskExecutor + * task executor */ public CreateSubscriptionDlgPresenter(ICreateSubscriptionDlgView view, DataSet dataSet, boolean create, @@ -231,7 +237,6 @@ public class CreateSubscriptionDlgPresenter { } }; this.view.setCycleTimes(cycleTimes); - this.view.setSubscription(this.subscription); this.view.setPreOpenCallback(callback); this.view.openDlg(); } @@ -253,6 +258,7 @@ public class CreateSubscriptionDlgPresenter { */ public void setSubscriptionData(Subscription sub) { this.subscription = sub; + this.view.setSubscription(sub); } /** @@ -387,6 +393,8 @@ public class CreateSubscriptionDlgPresenter { if (!Strings.isNullOrEmpty(subscription.getGroupName())) { view.setGroupName(subscription.getGroupName()); } + + view.setOfficeIds(subscription.getOfficeIDs()); } /** @@ -430,6 +438,18 @@ public class CreateSubscriptionDlgPresenter { if (!validate()) { return false; } + String[] sharedSites = view.getSharedSites(); + if (sharedSites != null && sharedSites.length > 1) { + SharedSubscription sharedSub = new SharedSubscription(subscription); + sharedSub.setRoute(Network.SBN); + Set officeList = Sets.newHashSet(sharedSites); + sharedSub.setOfficeIDs(officeList); + subscription = sharedSub; + } else { + Set officeList = Sets.newHashSet(); + officeList.add(LocalizationManager.getInstance().getCurrentSite()); + subscription.setOfficeIDs(officeList); + } // Data are valid, now add info to the subscription object and store subscription.setProvider(dataSet.getProviderName()); @@ -496,9 +516,6 @@ public class CreateSubscriptionDlgPresenter { SubscriptionPriority priority = view.getPriority(); subscription.setPriority(priority); - subscription.setOfficeID(LocalizationManager.getInstance() - .getCurrentSite()); - subscription.setName(view.getSubscriptionName()); subscription.setDescription(view.getSubscriptionDescription()); @@ -549,39 +566,43 @@ public class CreateSubscriptionDlgPresenter { job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(final IJobChangeEvent event) { + try { + final IStatus status = event.getResult(); - final IStatus status = event.getResult(); + final boolean subscriptionCreated = status + .isOK(); + if (subscriptionCreated) { + sendSubscriptionNotification(subscription, + username); + } - final boolean subscriptionCreated = status.isOK(); - if (subscriptionCreated) { - sendSubscriptionNotification(subscription, - username); + if (!Strings.isNullOrEmpty(status.getMessage())) { + guiThreadTaskExecutor + .runAsync(new Runnable() { + @Override + public void run() { + if (!view.isDisposed()) { + if (subscriptionCreated) { + view.displayPopup( + CREATED_TITLE, + status.getMessage()); + view.setStatus(Status.OK); + view.closeDlg(); + } else { + view.setStatus(Status.CANCEL); + view.displayPopup( + "Unable to Create Subscription", + status.getMessage()); + } + } + } + }); + } + } finally { + DataDeliveryGUIUtils + .markNotBusyInUIThread(jobShell); } - - if (!Strings.isNullOrEmpty(status.getMessage())) { - guiThreadTaskExecutor.runAsync(new Runnable() { - @Override - public void run() { - if (!view.isDisposed()) { - if (subscriptionCreated) { - view.displayPopup( - CREATED_TITLE, - status.getMessage()); - view.setStatus(Status.OK); - view.closeDlg(); - } else { - view.setStatus(Status.CANCEL); - view.displayPopup( - "Unable to Create Subscription", - status.getMessage()); - } - } - } - }); - } - DataDeliveryGUIUtils - .markNotBusyInUIThread(jobShell); - }; + } }); job.schedule(); return false; @@ -609,8 +630,7 @@ public class CreateSubscriptionDlgPresenter { } else { // Check for pending subscription, can only have one pending change PendingSubscription pendingSub = subscription - .pending(LocalizationManager.getInstance() - .getCurrentUser()); + .pending(LocalizationManager.getInstance().getCurrentUser()); pendingSub.setChangeReason(view.getChangeReason()); // Create the registry ids diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java index 6ea872c868..25398f7348 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java @@ -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.GriddedDataSetMetaData; 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.Time; -import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; 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. * 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. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -258,7 +259,7 @@ public class GriddedSubsetManagerDlg * {@inheritDoc} */ @Override - public T createSubscription(T sub, + public T createSubscription(T sub, Network defaultRoute) { T subscription = super.createSubscription(sub, defaultRoute); if (subscription == null) { diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/NotEnabledSubscriptionHandler.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/NotEnabledSubscriptionHandler.java deleted file mode 100644 index 677f4bb142..0000000000 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/NotEnabledSubscriptionHandler.java +++ /dev/null @@ -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. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 27, 2013 1841       djohnson     Initial creation
- * 
- * 
- * - * @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."); - } - -} diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java index bd81ff3ca1..ba1f0236f0 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java @@ -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.Network; 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.Time; -import com.raytheon.uf.common.datadelivery.registry.UserSubscription; import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants; import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; 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.UFStatus; 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.localization.LocalizationManager; 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 29, 2013 1841 djohnson Subscription is now UserSubscription. * 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. * * * @author mpduff @@ -151,10 +151,6 @@ public abstract class SubsetManagerDlg - * 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. * @@ -618,7 +583,7 @@ public abstract class SubsetManagerDlg T createSubscription(T sub, + protected T createSubscription(T sub, Network defaultRoute) { Preconditions.checkNotNull(sub, "A subscription must be provided."); @@ -654,7 +619,12 @@ public abstract class SubsetManagerDlg * @@ -394,4 +395,19 @@ public interface ICreateSubscriptionDlgView extends IPresenterView { * @param cycleTimes */ void setCycleTimes(Set 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 officeIDs); } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryGUIUtils.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryGUIUtils.java index 87e3a53ecc..6451fdc27a 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryGUIUtils.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryGUIUtils.java @@ -29,7 +29,10 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; 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.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; 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. * 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. + * May 17, 2013 1040 mpduff Fixed JavaDoc and added tooltip. * May 20, 2013 2000 djohnson Add methods for managing widget listeners. * * @@ -73,6 +77,9 @@ public class DataDeliveryGUIUtils { private final static IUFStatusHandler statusHandler = UFStatus .getHandler(DataDeliveryGUIUtils.class); + /** Tooltip */ + private static Shell tooltip; + /** Subscription start/end date format */ private final static ThreadLocal subscriptionFormat = new ThreadLocal() { @Override @@ -279,9 +286,10 @@ public class DataDeliveryGUIUtils { * mouse cursor over it to the wait cursor. To undo this call the * corresponding method markNotBusyInUIThread(Shell). * - * @see DataDeliveryGUIUtils.markNotBusyInUIThread(Shell) + * @see #DataDeliveryGUIUtils.markNotBusyInUIThread(Shell) * * @param shell + * The Shell to mark busy */ public static void markBusyInUIThread(final Shell shell) { VizApp.runAsync(new Runnable() { @@ -301,9 +309,13 @@ public class DataDeliveryGUIUtils { * mouse cursor to normal. This call is the followup to * 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 + * the Shell used in markBusyInUIThread */ public static void markNotBusyInUIThread(final Shell shell) { VizApp.runAsync(new Runnable() { @@ -320,6 +332,11 @@ public class DataDeliveryGUIUtils { /** * Check the user's latency value. * + * @param latency + * the latency value + * @param maxLatency + * the max latency value + * * @return true if valid */ 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(); + } + } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtils.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtils.java index be39f19cce..f5e727788f 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtils.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtils.java @@ -27,6 +27,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.TimeZone; 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.time.util.TimeUtil; 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.requests.ThriftClient; 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. * Apr 08, 2013 1826 djohnson Add getDisplayData() method to 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. * * @@ -252,7 +255,7 @@ public class DataDeliveryUtils { OFFICE_ID("Office ID", null) { @Override public String getDisplayData(SubscriptionManagerRowData rd) { - return rd.getOfficeId(); + return rd.getOfficeIdsDisplayList(); } }, /** Column Full Dataset */ @@ -420,7 +423,7 @@ public class DataDeliveryUtils { OFFICE("Office Id", null) { @Override public String getDisplayData(SubscriptionApprovalRowData rd) { - return rd.getOfficeId(); + return rd.getOfficeIdsAsList(); } }, /** Description */ @@ -607,7 +610,7 @@ public class DataDeliveryUtils { * @return The formated details string */ public static String formatDetails(Subscription sub) { - final String newline = System.getProperty("line.separator"); + final String newline = StringUtil.NEWLINE; final String space = " "; final String comma = ", "; @@ -621,24 +624,26 @@ public class DataDeliveryUtils { .append(newline); fmtStr.append("Dataset Size: ").append(sub.getDataSetSize()) .append(newline); - fmtStr.append("Provider : ").append(sub.getProvider()).append(newline); - fmtStr.append("Office ID: ").append(sub.getOfficeID()).append(newline); - fmtStr.append("Priority : ") + fmtStr.append("Provider: ").append(sub.getProvider()).append(newline); + fmtStr.append("Office IDs: ") + .append(getFormatedList(sub.getOfficeIDs())).append(newline); + fmtStr.append("Priority: ") .append(sub.getPriority().getPriorityValue()).append(newline); + fmtStr.append("Network: ").append(sub.getRoute()).append(newline); fmtStr.append("Coverage: ").append(newline); final Coverage coverage = sub.getCoverage(); if (coverage.getProjection() != null) { - fmtStr.append("------ Projection : ") + fmtStr.append("------ Projection: ") .append(coverage.getProjection()).append(newline); } else { - fmtStr.append("------ Projection : ").append(newline); + fmtStr.append("------ Projection: ").append(newline); } final DecimalFormat decimalFormat = format.get(); final Coordinate requestLowerRight = coverage.getRequestLowerRight(); final Coordinate requestUpperLeft = coverage.getRequestUpperLeft(); if (requestLowerRight == null || requestUpperLeft == null) { - fmtStr.append("------ Upper Left : ") + fmtStr.append("------ Upper Left: ") .append(decimalFormat.format(coverage.getUpperLeft().x)) .append(comma) .append((decimalFormat.format(coverage.getUpperLeft().y))) @@ -649,7 +654,7 @@ public class DataDeliveryUtils { .append(decimalFormat.format(coverage.getLowerRight().y)) .append(newline); } else { - fmtStr.append("------ Upper Left : ") + fmtStr.append("------ Upper Left: ") .append(decimalFormat.format(requestUpperLeft.x)) .append(comma) .append(decimalFormat.format(requestUpperLeft.y)) @@ -692,14 +697,14 @@ public class DataDeliveryUtils { .append(newline); fmtStr.append("------ Definition: ").append(p.getDefinition()) .append(newline); - fmtStr.append("------ Data Type : ").append(p.getDataType()) + fmtStr.append("------ Data Type: ").append(p.getDataType()) .append(newline); fmtStr.append("------ Level Type: ").append(newline); for (DataLevelType dlt : p.getLevelType()) { fmtStr.append("------------ Type: ").append(dlt.getType()) .append(newline); - fmtStr.append("------------ ID : ").append(dlt.getId()) + fmtStr.append("------------ ID: ").append(dlt.getId()) .append(newline); if (dlt.getUnit() != null) { fmtStr.append("------------ Unit: ").append(dlt.getUnit()) @@ -713,6 +718,17 @@ public class DataDeliveryUtils { return fmtStr.toString(); } + /** + * Get a formatted list. + * + * @param list + * List of items + * @return a formatted list as a String + */ + public static String getFormatedList(Set list) { + return StringUtil.getIndentedList(list, " "); + } + /** * Send an authorization request * @@ -756,7 +772,8 @@ public class DataDeliveryUtils { final int nextIndex = i + 1; if (nextIndex < size) { int tempMax = cycles.get(nextIndex) - cycles.get(i); - maximumTimeBetweenCycles = Math.max(maximumTimeBetweenCycles, tempMax); + maximumTimeBetweenCycles = Math.max(maximumTimeBetweenCycles, + tempMax); } } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/widgets/DualListComposite.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/widgets/DualListComposite.java new file mode 100644 index 0000000000..cde4a54785 --- /dev/null +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/widgets/DualListComposite.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 29, 2013     1040   mpduff      Initial creation
+ * 
+ * 
+ * + * @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(); + } +} diff --git a/deltaScripts/13.5.1/convertSubscriptionSitesToCollection.sh b/deltaScripts/13.5.1/convertSubscriptionSitesToCollection.sh new file mode 100644 index 0000000000..95c249ff61 --- /dev/null +++ b/deltaScripts/13.5.1/convertSubscriptionSitesToCollection.sh @@ -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 diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/ISharedSubscriptionHandler.java b/deltaScripts/13.5.1/convertSubscriptionSitesToCollection.sql similarity index 52% rename from cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/ISharedSubscriptionHandler.java rename to deltaScripts/13.5.1/convertSubscriptionSitesToCollection.sql index fd7107e8a3..8618b5d234 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/ISharedSubscriptionHandler.java +++ b/deltaScripts/13.5.1/convertSubscriptionSitesToCollection.sql @@ -17,34 +17,20 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.viz.datadelivery.subscription.subset; +\set ON_ERROR_STOP 1 +\connect metadata; -/** - * Interface that will be implemented for phase3 datadelivery, but not in the - * common baseline. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 27, 2013 1841       djohnson     Initial creation
- * 
- * 
- * - * @author djohnson - * @version 1.0 - */ +-- Start a transaction +BEGIN; -public interface ISharedSubscriptionHandler { - /** - * Launch the GUI to create a shared subscription. - * - * @param subsetManagerDlg - */ - void launchCreateSharedSubscriptionGui( - SubsetManagerDlg subsetManagerDlg); +-- Remove officeID attribute +update ebxml.value set stringvalue = regexp_replace(stringvalue, 'officeID=".*?"', '', 'g'); -} +-- Add officeID element +update ebxml.value set stringvalue = regexp_replace(stringvalue, '()', E'\\1@@SITE@@', 'g'); +update ebxml.value set stringvalue = regexp_replace(stringvalue, '()', E'\\1@@SITE@@', 'g'); +update ebxml.value set stringvalue = regexp_replace(stringvalue, '()', E'\\1@@SITE@@', 'g'); + +-- Commit the transaction +END; diff --git a/deltaScripts/13.5.1/getSubscriptionSite.sql b/deltaScripts/13.5.1/getSubscriptionSite.sql new file mode 100644 index 0000000000..2cee0a06bc --- /dev/null +++ b/deltaScripts/13.5.1/getSubscriptionSite.sql @@ -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%'; diff --git a/deltaScripts/13.5.1/renameSubscriptionToUserSubscription.sh b/deltaScripts/13.5.1/renameSubscriptionToSiteSubscription.sh similarity index 78% rename from deltaScripts/13.5.1/renameSubscriptionToUserSubscription.sh rename to deltaScripts/13.5.1/renameSubscriptionToSiteSubscription.sh index 9491130d29..b82ed31d5b 100644 --- a/deltaScripts/13.5.1/renameSubscriptionToUserSubscription.sh +++ b/deltaScripts/13.5.1/renameSubscriptionToSiteSubscription.sh @@ -1,6 +1,6 @@ #!/bin/bash -SQL_SCRIPT="renameSubscriptionToUserSubscription.sql" +SQL_SCRIPT="renameSubscriptionToSiteSubscription.sql" # ensure that the sql script is present if [ ! -f ${SQL_SCRIPT} ]; then @@ -9,7 +9,7 @@ if [ ! -f ${SQL_SCRIPT} ]; then exit 1 fi -echo "INFO: update started - renaming Subscription to UserSubscription" +echo "INFO: update started - renaming Subscription to SiteSubscription" # run the update /awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT} diff --git a/deltaScripts/13.5.1/renameSubscriptionToUserSubscription.sql b/deltaScripts/13.5.1/renameSubscriptionToSiteSubscription.sql similarity index 72% rename from deltaScripts/13.5.1/renameSubscriptionToUserSubscription.sql rename to deltaScripts/13.5.1/renameSubscriptionToSiteSubscription.sql index ef2d457e18..c45b196118 100644 --- a/deltaScripts/13.5.1/renameSubscriptionToUserSubscription.sql +++ b/deltaScripts/13.5.1/renameSubscriptionToSiteSubscription.sql @@ -23,49 +23,49 @@ -- Start a transaction BEGIN; --- New classification nodes for UserSubscription -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: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'; +-- 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.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: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 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:UserSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription'; +-- 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.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:SiteSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription'; -- 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:com.raytheon.uf.common.datadelivery.registry.Subscription'; --- Update registry object references from Subscription to UserSubscription -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.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.value set stringvalue = regexp_replace(stringvalue, '', '', 'g'); +-- 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.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.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, '', '', 'g'); -- 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 -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: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'; +-- 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.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: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 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:InitialPendingUserSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSubscription'; +-- 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.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:InitialPendingSiteSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:InitialPendingSubscription'; -- 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:com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription'; --- Update registry object references from InitialPendingSubscription to InitialPendingUserSubscription -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.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.value set stringvalue = regexp_replace(stringvalue, '', '', 'g'); -update ebxml.value set stringvalue = regexp_replace(stringvalue, '', '', 'g'); +-- 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.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.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, '', '', 'g'); +update ebxml.value set stringvalue = regexp_replace(stringvalue, '', '', 'g'); -- 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 -END; \ No newline at end of file +END; diff --git a/edexOsgi/com.raytheon.uf.common.auth/src/com/raytheon/uf/common/auth/req/BasePrivilegedServerService.java b/edexOsgi/com.raytheon.uf.common.auth/src/com/raytheon/uf/common/auth/req/BasePrivilegedServerService.java index 41a46d15c8..6ef6d6c9d9 100644 --- a/edexOsgi/com.raytheon.uf.common.auth/src/com/raytheon/uf/common/auth/req/BasePrivilegedServerService.java +++ b/edexOsgi/com.raytheon.uf.common.auth/src/com/raytheon/uf/common/auth/req/BasePrivilegedServerService.java @@ -23,6 +23,7 @@ package com.raytheon.uf.common.auth.req; import java.rmi.RemoteException; 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.comm.response.ServerErrorResponse; import com.raytheon.uf.common.status.IUFStatusHandler; @@ -37,7 +38,8 @@ import com.raytheon.uf.common.status.UFStatus; * * 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. * * * @@ -70,6 +72,8 @@ public class BasePrivilegedServerService ExceptionWrapper .unwrapThrowable(((ServerErrorResponse) object) .getException())); + } else if (object instanceof UserNotAuthorized) { + return null; } else { statusHandler .warn(String diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index a27c024acd..689c25ad27 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -20,7 +20,7 @@ com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData com.raytheon.uf.common.datadelivery.registry.Parameter com.raytheon.uf.common.datadelivery.registry.ParameterLevel com.raytheon.uf.common.datadelivery.registry.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.Provider com.raytheon.uf.common.datadelivery.registry.Time diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/AdhocSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/AdhocSubscription.java index 5e1c0cf60b..1fdf37f825 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/AdhocSubscription.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/AdhocSubscription.java @@ -43,6 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; * Dec 11, 2012 1403 djohnson No longer a registry object. * Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -53,7 +54,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; @XmlRootElement(name = "AdhocSubscription") @XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public class AdhocSubscription extends UserSubscription implements +public class AdhocSubscription extends SiteSubscription implements ISerializableObject { private static final long serialVersionUID = -2200080380095632486L; @@ -62,7 +63,7 @@ public class AdhocSubscription extends UserSubscription implements setGroupName("Adhoc"); } - public AdhocSubscription(UserSubscription subscription) { + public AdhocSubscription(SiteSubscription subscription) { super(subscription); setGroupName("Adhoc"); } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java index 169720d5d5..b1dd779a4a 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java @@ -32,6 +32,7 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil; * ------------ ---------- ----------- -------------------------- * Oct 5, 2012 0726 djohnson Initial creation * Dec 11, 2012 1403 djohnson Adhoc subscriptions no longer go to the registry. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -49,8 +50,8 @@ public final class DataDeliveryRegistryObjectTypes { public static final String DATASETMETADATA = RegistryUtil .getObjectType(DataSetMetaData.class); - public static final String USER_SUBSCRIPTION = RegistryUtil - .getObjectType(UserSubscription.class); + public static final String SITE_SUBSCRIPTION = RegistryUtil + .getObjectType(SiteSubscription.class); public static final String SHARED_SUBSCRIPTION = RegistryUtil .getObjectType(SharedSubscription.class); diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/InitialPendingUserSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/InitialPendingSiteSubscription.java similarity index 92% rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/InitialPendingUserSubscription.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/InitialPendingSiteSubscription.java index c84d936c23..e74eca1967 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/InitialPendingUserSubscription.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/InitialPendingSiteSubscription.java @@ -44,6 +44,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor. * Mar 29, 2013 1841 djohnson Subscription is now UserSubscription. * Apr 02, 2013 1841 djohnson InitialPendingSubscription is now InitialPendingUserSubscription. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -57,7 +58,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT, InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }) -public class InitialPendingUserSubscription extends UserSubscription implements +public class InitialPendingSiteSubscription extends SiteSubscription implements InitialPendingSubscription { private static final long serialVersionUID = 2779084460608459754L; @@ -75,7 +76,7 @@ public class InitialPendingUserSubscription extends UserSubscription implements /** * Constructor */ - public InitialPendingUserSubscription() { + public InitialPendingSiteSubscription() { //empty } @@ -87,7 +88,7 @@ public class InitialPendingUserSubscription extends UserSubscription implements * @param user * user */ - public InitialPendingUserSubscription(UserSubscription subscription, String user) { + public InitialPendingSiteSubscription(SiteSubscription subscription, String user) { super(subscription); this.setChangeReqId(user); @@ -134,6 +135,6 @@ public class InitialPendingUserSubscription extends UserSubscription implements */ @Override public Subscription subscription() { - return new UserSubscription(this); + return new SiteSubscription(this); } } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingUserSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscription.java similarity index 90% rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingUserSubscription.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscription.java index f7cb22e09b..6bf5f3a1ca 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingUserSubscription.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscription.java @@ -53,22 +53,22 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -@RegistryObject(objectType = InitialPendingUserSubscription.class, value = { +@RegistryObject(objectType = InitialPendingSiteSubscription.class, value = { Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT, InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = AssociationTypes.RELATED_TO, keyFields = { Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT, - Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = UserSubscription.class) }) -public class PendingUserSubscription extends InitialPendingUserSubscription + Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = SiteSubscription.class) }) +public class PendingSiteSubscription extends InitialPendingSiteSubscription implements PendingSubscription, ISerializableObject { private static final long serialVersionUID = 7607153845750089310L; - public PendingUserSubscription() { + public PendingSiteSubscription() { } - public PendingUserSubscription(UserSubscription subscription, + public PendingSiteSubscription(SiteSubscription subscription, String currentUser) { super(subscription, currentUser); } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/RecurringSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/RecurringSubscription.java index 0496392eb7..db716c73a1 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/RecurringSubscription.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/RecurringSubscription.java @@ -24,6 +24,8 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.Set; +import java.util.TreeSet; import javax.xml.bind.annotation.XmlAccessType; 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.HashCodeBuilder; +import com.google.common.collect.Sets; import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus; import com.raytheon.uf.common.registry.annotations.SlotAttribute; import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter; 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.annotations.DynamicSerializeElement; 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. * 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. * * * @@ -61,8 +67,8 @@ import com.raytheon.uf.common.time.util.TimeUtil; * @version 1.0 */ @XmlAccessorType(XmlAccessType.NONE) -@XmlSeeAlso({ PendingUserSubscription.class, PendingSharedSubscription.class, - AdhocSubscription.class, UserSubscription.class, +@XmlSeeAlso({ PendingSiteSubscription.class, PendingSharedSubscription.class, + AdhocSubscription.class, SiteSubscription.class, SharedSubscription.class }) public abstract class RecurringSubscription implements ISerializableObject, Serializable, Subscription { @@ -84,7 +90,7 @@ public abstract class RecurringSubscription implements ISerializableObject, * @param name * New subscription name */ - public RecurringSubscription(RecurringSubscription sub, String name) { + public RecurringSubscription(Subscription sub, String name) { this.setActive(sub.isActive()); this.setActivePeriodEnd(sub.getActivePeriodEnd()); this.setActivePeriodStart(sub.getActivePeriodStart()); @@ -96,7 +102,7 @@ public abstract class RecurringSubscription implements ISerializableObject, this.setGroupName(sub.getGroupName()); this.setId(sub.getId()); this.setName(name); - this.setOfficeID(sub.getOfficeID()); + this.setOfficeIDs(sub.getOfficeIDs()); this.setParameter(sub.getParameter()); this.setPriority(sub.getPriority()); this.setProvider(sub.getProvider()); @@ -120,7 +126,7 @@ public abstract class RecurringSubscription implements ISerializableObject, * @param sub * Subscription object */ - public RecurringSubscription(RecurringSubscription sub) { + public RecurringSubscription(Subscription sub) { this(sub, sub.getName()); } @@ -143,10 +149,11 @@ public abstract class RecurringSubscription implements ISerializableObject, @SlotAttribute(PROVIDER_NAME_SLOT) private String provider; - @XmlAttribute + @XmlElements({ @XmlElement(name = "officeId") }) @DynamicSerializeElement @SlotAttribute - private String officeID; + @SlotAttributeConverter(SetSlotConverter.class) + protected Set officeIDs = Sets.newTreeSet(); @XmlAttribute @DynamicSerializeElement @@ -308,24 +315,19 @@ public abstract class RecurringSubscription implements ISerializableObject, } /** - * Get owner office id. - * - * @return office id + * {@inheritDoc} */ @Override - public String getOfficeID() { - return officeID; + public Set getOfficeIDs() { + return officeIDs; } /** - * Set office id. - * - * @param officeID - * the office id + * {@inheritDoc} */ @Override - public void setOfficeID(String officeID) { - this.officeID = officeID; + public void setOfficeIDs(Set officeIDs) { + this.officeIDs = new TreeSet(officeIDs); } /** diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java index 1a18566bab..c0f882bba6 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java @@ -35,7 +35,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; * * 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. * * * @@ -52,7 +53,7 @@ public class SharedSubscription extends RecurringSubscription { private static final long serialVersionUID = -7221500266253493273L; - public static final String SHARED_SUBSCRIPTION_OWNER = "shared"; + private static final String SHARED_SUBSCRIPTION_OWNER = "shared"; /** * Constructor. @@ -64,7 +65,7 @@ public class SharedSubscription extends RecurringSubscription { /** * @param sharedSubscription */ - public SharedSubscription(SharedSubscription sub) { + public SharedSubscription(Subscription sub) { super(sub); } @@ -114,4 +115,14 @@ public class SharedSubscription extends RecurringSubscription { public PendingSubscription pending(String currentUser) { return new PendingSharedSubscription(this, currentUser); } + + /** + * {@inheritDoc} + */ + @Override + public void addOfficeID(String officeId) { + if (!officeIDs.contains(officeId)) { + this.officeIDs.add(officeId); + } + } } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/UserSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SiteSubscription.java similarity index 85% rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/UserSubscription.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SiteSubscription.java index c7faee6d0b..9cdbf0fcae 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/UserSubscription.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SiteSubscription.java @@ -56,6 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * Jan 25, 2013 1528 djohnson Subscription priority is now an enum. * Feb 20, 2013 1543 djohnson Route is now a slot. * Mar 29, 2013 1841 djohnson Renamed to UserSubscription. + * May 15, 2013 1040 mpduff Added addOfficeId. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -68,13 +70,13 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @RegistryObject({ Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }) @DynamicSerialize -public class UserSubscription extends RecurringSubscription { +public class SiteSubscription extends RecurringSubscription { private static final long serialVersionUID = -6422673887457060034L; /** * Constructor. */ - public UserSubscription() { + public SiteSubscription() { } @@ -86,7 +88,7 @@ public class UserSubscription extends RecurringSubscription { * @param name * New subscription name */ - public UserSubscription(UserSubscription sub, String name) { + public SiteSubscription(SiteSubscription sub, String name) { this(sub); this.setName(name); this.setId(RegistryUtil.getRegistryObjectKey(this)); @@ -98,7 +100,7 @@ public class UserSubscription extends RecurringSubscription { * @param sub * Subscription object */ - public UserSubscription(UserSubscription sub) { + public SiteSubscription(SiteSubscription sub) { super(sub); this.setOwner(sub.getOwner()); } @@ -133,7 +135,7 @@ public class UserSubscription extends RecurringSubscription { */ @Override public Subscription copy() { - return new UserSubscription(this); + return new SiteSubscription(this); } /** @@ -141,7 +143,7 @@ public class UserSubscription extends RecurringSubscription { */ @Override 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 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 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); + } } } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Subscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Subscription.java index 7aa5a03d84..c626f72bd2 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Subscription.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Subscription.java @@ -21,6 +21,7 @@ package com.raytheon.uf.common.datadelivery.registry; import java.util.Date; import java.util.List; +import java.util.Set; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; @@ -36,6 +37,7 @@ import javax.xml.bind.annotation.XmlEnumValue; * ------------ ---------- ----------- -------------------------- * Mar 25, 2013 1841 djohnson Extracted from UserSubscription. * Apr 08, 2013 1826 djohnson Remove delivery options. + * May 15, 2013 1040 mpduff Changed officeId to a set. * * * @@ -180,19 +182,19 @@ public interface Subscription { String getOwner(); /** - * Get owner office id. + * Get office ids. * - * @return office id + * @return office id list */ - String getOfficeID(); + Set getOfficeIDs(); /** - * Set office id. + * Set office ids. * - * @param officeID - * the office id + * @param officeIDs + * the office ids */ - void setOfficeID(String officeID); + void setOfficeIDs(Set officeIDs); /** * Get subscription priority for fulfillment. @@ -591,4 +593,12 @@ public interface Subscription { * @return */ PendingSubscription pending(String currentUser); + + /** + * Add an office Id to the list. + * + * @param officeId + * Office Id to add + */ + void addOfficeID(String officeId); } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/PendingUserSubscriptionQuery.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/PendingSiteSubscriptionQuery.java similarity index 78% rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/PendingUserSubscriptionQuery.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/PendingSiteSubscriptionQuery.java index 456e70db14..7064de9489 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/PendingUserSubscriptionQuery.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/PendingSiteSubscriptionQuery.java @@ -22,7 +22,8 @@ package com.raytheon.uf.common.datadelivery.registry.ebxml; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import com.raytheon.uf.common.datadelivery.registry.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; /** @@ -39,6 +40,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; * Jun 21, 2012 736 djohnson Add thrift serialization annotations. * Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries. * Sep 24, 2012 1157 mpduff Extends InitialPendingUserSubscriptionQuery. + * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * * * @@ -47,22 +49,22 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; */ @XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public class PendingUserSubscriptionQuery extends - SubscriptionFilterableQuery { +public class PendingSiteSubscriptionQuery extends + SubscriptionFilterableQuery { /** * {@inheritDoc} */ @Override - public Class getResultType() { - return InitialPendingUserSubscription.class; + public Class getResultType() { + return InitialPendingSiteSubscription.class; } /** * {@inheritDoc} */ @Override - public Class getObjectType() { - return InitialPendingUserSubscription.class; + public Class getObjectType() { + return InitialPendingSiteSubscription.class; } } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/UserSubscriptionQuery.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/SiteSubscriptionQuery.java similarity index 80% rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/UserSubscriptionQuery.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/SiteSubscriptionQuery.java index f81d2dbcd8..fe98875f1c 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/UserSubscriptionQuery.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/SiteSubscriptionQuery.java @@ -22,12 +22,12 @@ package com.raytheon.uf.common.datadelivery.registry.ebxml; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import com.raytheon.uf.common.datadelivery.registry.UserSubscription; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; /** * Implementation of {@link SubscriptionFilterableQuery} to retrieve - * {@link UserSubscription}s. + * {@link SiteSubscription}s. * *
  * 
@@ -39,6 +39,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
  * Jul 23, 2012 702        jpiatt      Added setters for groupName & officeId.
  * Oct 03, 2012 1241       djohnson    Move query parameters to {@link SubscriptionFilterableQuery}.
  * Mar 29, 2013 1841       djohnson    Renamed from SubscriptionQuery.
+ * May 21, 2013 2020       mpduff      Rename UserSubscription to SiteSubscription.
  * 
  * 
* @@ -48,21 +49,21 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; */ @XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public class UserSubscriptionQuery extends - SubscriptionFilterableQuery { +public class SiteSubscriptionQuery extends + SubscriptionFilterableQuery { /** * {@inheritDoc} */ @Override - public Class getResultType() { - return UserSubscription.class; + public Class getResultType() { + return SiteSubscription.class; } /** * {@inheritDoc} */ @Override - public Class getObjectType() { - return UserSubscription.class; + public Class getObjectType() { + return SiteSubscription.class; } } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IPendingUserSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IPendingSiteSubscriptionHandler.java similarity index 88% rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IPendingUserSubscriptionHandler.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IPendingSiteSubscriptionHandler.java index c1e9be8600..23b7963742 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IPendingUserSubscriptionHandler.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IPendingSiteSubscriptionHandler.java @@ -19,12 +19,12 @@ **/ 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; /** * The {@link IRegistryObjectHandler} interface for - * {@link InitialPendingUserSubscription}. + * {@link InitialPendingSiteSubscription}. * *
  * 
@@ -41,6 +41,6 @@ import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
  * @author djohnson
  * @version 1.0
  */
-public interface IPendingUserSubscriptionHandler extends
-        IBasePendingSubscriptionHandler {
+public interface IPendingSiteSubscriptionHandler extends
+        IBasePendingSubscriptionHandler {
 }
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IUserSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISiteSubscriptionHandler.java
similarity index 89%
rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IUserSubscriptionHandler.java
rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISiteSubscriptionHandler.java
index 27d6c81358..802261b435 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IUserSubscriptionHandler.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISiteSubscriptionHandler.java
@@ -20,7 +20,7 @@
 package com.raytheon.uf.common.datadelivery.registry.handlers;
 
 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;
 
 /**
@@ -41,6 +41,6 @@ import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
  * @author djohnson
  * @version 1.0
  */
-public interface IUserSubscriptionHandler extends
-        ISubscriptionTypeHandler {
+public interface ISiteSubscriptionHandler extends
+        ISubscriptionTypeHandler {
 }
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISubscriptionTypeHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISubscriptionTypeHandler.java
index c46dc5051b..70526b40e2 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISubscriptionTypeHandler.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISubscriptionTypeHandler.java
@@ -36,6 +36,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Apr 05, 2013 1841       djohnson     Initial creation
+ * May 21, 2013 2020       mpduff       Rename UserSubscription to SiteSubscription.
  * 
  * 
* diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingUserSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSiteSubscriptionHandler.java similarity index 76% rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingUserSubscriptionHandler.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSiteSubscriptionHandler.java index 91452c2510..84d46a201f 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingUserSubscriptionHandler.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSiteSubscriptionHandler.java @@ -19,13 +19,13 @@ **/ package com.raytheon.uf.common.datadelivery.registry.handlers; -import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription; -import com.raytheon.uf.common.datadelivery.registry.ebxml.PendingUserSubscriptionQuery; +import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription; +import com.raytheon.uf.common.datadelivery.registry.ebxml.PendingSiteSubscriptionQuery; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; /** * {@link IRegistryObjectHandler} implementation for - * {@link InitialPendingUserSubscription}s. + * {@link InitialPendingSiteSubscription}s. * *
  * 
@@ -42,23 +42,23 @@ import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
  * @author djohnson
  * @version 1.0
  */
-public class PendingUserSubscriptionHandler extends
-        BasePendingSubscriptionHandler
-        implements IPendingUserSubscriptionHandler {
+public class PendingSiteSubscriptionHandler extends
+        BasePendingSubscriptionHandler
+        implements IPendingSiteSubscriptionHandler {
 
     /**
      * {@inheritDoc}
      */
     @Override
-    protected PendingUserSubscriptionQuery getQuery() {
-        return new PendingUserSubscriptionQuery();
+    protected PendingSiteSubscriptionQuery getQuery() {
+        return new PendingSiteSubscriptionQuery();
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    protected Class getRegistryObjectClass() {
-        return InitialPendingUserSubscription.class;
+    protected Class getRegistryObjectClass() {
+        return InitialPendingSiteSubscription.class;
     }
 }
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandler.java
index 3bc705941f..1cb0020520 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandler.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandler.java
@@ -29,10 +29,10 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import com.raytheon.uf.common.datadelivery.registry.InitialPendingSharedSubscription;
 import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
-import com.raytheon.uf.common.datadelivery.registry.InitialPendingUserSubscription;
+import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription;
 import com.raytheon.uf.common.datadelivery.registry.Network;
 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.RegistryHandlerException;
 import com.raytheon.uf.common.util.CollectionUtil;
@@ -58,22 +58,22 @@ import com.raytheon.uf.common.util.CollectionUtil;
  */
 public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
 
-    private final IPendingUserSubscriptionHandler userSubscriptionHandler;
+    private final IPendingSiteSubscriptionHandler siteSubscriptionHandler;
 
     private final IPendingSharedSubscriptionHandler sharedSubscriptionHandler;
 
     /**
      * Constructor.
      * 
-     * @param userSubscriptionHandler
+     * @param siteSubscriptionHandler
      *            the user subscription handler
      * @param sharedSubscriptionHandler
      *            the shared subscription handler
      */
     public PendingSubscriptionHandler(
-            IPendingUserSubscriptionHandler userSubscriptionHandler,
+            IPendingSiteSubscriptionHandler siteSubscriptionHandler,
             IPendingSharedSubscriptionHandler sharedSubscriptionHandler) {
-        this.userSubscriptionHandler = userSubscriptionHandler;
+        this.siteSubscriptionHandler = siteSubscriptionHandler;
         this.sharedSubscriptionHandler = sharedSubscriptionHandler;
     }
 
@@ -83,7 +83,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public InitialPendingSubscription getByName(String name)
             throws RegistryHandlerException {
-        InitialPendingSubscription value = userSubscriptionHandler
+        InitialPendingSubscription value = siteSubscriptionHandler
                 .getByName(name);
         if (value == null) {
             value = sharedSubscriptionHandler.getByName(name);
@@ -98,8 +98,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public List getByOwner(String owner)
             throws RegistryHandlerException {
         List subs = Lists.newArrayList();
-        subs.addAll(userSubscriptionHandler.getByOwner(owner));
-        subs.addAll(userSubscriptionHandler.getByOwner(owner));
+        subs.addAll(siteSubscriptionHandler.getByOwner(owner));
+        subs.addAll(siteSubscriptionHandler.getByOwner(owner));
         return subs;
     }
 
@@ -110,7 +110,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public List getByGroupName(String group)
             throws RegistryHandlerException {
         List subs = Lists.newArrayList();
-        subs.addAll(userSubscriptionHandler.getByGroupName(group));
+        subs.addAll(siteSubscriptionHandler.getByGroupName(group));
         subs.addAll(sharedSubscriptionHandler.getByGroupName(group));
         return subs;
     }
@@ -122,7 +122,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public List getByFilters(String group,
             String officeId) throws RegistryHandlerException {
         List subs = Lists.newArrayList();
-        subs.addAll(userSubscriptionHandler.getByFilters(group, officeId));
+        subs.addAll(siteSubscriptionHandler.getByFilters(group, officeId));
         subs.addAll(sharedSubscriptionHandler.getByFilters(group, officeId));
         return subs;
     }
@@ -134,7 +134,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public Set getSubscribedToDataSetNames()
             throws RegistryHandlerException {
         Set names = Sets.newHashSet();
-        names.addAll(userSubscriptionHandler.getSubscribedToDataSetNames());
+        names.addAll(siteSubscriptionHandler.getSubscribedToDataSetNames());
         names.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames());
         return names;
     }
@@ -146,7 +146,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public List getActive()
             throws RegistryHandlerException {
         List subs = Lists.newArrayList();
-        subs.addAll(userSubscriptionHandler.getActive());
+        subs.addAll(siteSubscriptionHandler.getActive());
         subs.addAll(sharedSubscriptionHandler.getActive());
         return subs;
     }
@@ -158,7 +158,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public List getActiveForRoute(Network route)
             throws RegistryHandlerException {
         List subs = Lists.newArrayList();
-        subs.addAll(userSubscriptionHandler.getActiveForRoute(route));
+        subs.addAll(siteSubscriptionHandler.getActiveForRoute(route));
         subs.addAll(sharedSubscriptionHandler.getActiveForRoute(route));
         return subs;
     }
@@ -170,7 +170,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public List getActiveForRoutes(
             Network... routes) throws RegistryHandlerException {
         List subs = Lists.newArrayList();
-        subs.addAll(userSubscriptionHandler.getActiveForRoutes(routes));
+        subs.addAll(siteSubscriptionHandler.getActiveForRoutes(routes));
         subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes));
         return subs;
     }
@@ -181,7 +181,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public InitialPendingSubscription getById(String id)
             throws RegistryHandlerException {
-        InitialPendingSubscription value = userSubscriptionHandler.getById(id);
+        InitialPendingSubscription value = siteSubscriptionHandler.getById(id);
         if (value == null) {
             value = sharedSubscriptionHandler.getById(id);
         }
@@ -195,7 +195,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public List getAll()
             throws RegistryHandlerException {
         List subs = Lists.newArrayList();
-        subs.addAll(userSubscriptionHandler.getAll());
+        subs.addAll(siteSubscriptionHandler.getAll());
         subs.addAll(sharedSubscriptionHandler.getAll());
         return subs;
     }
@@ -206,8 +206,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public void store(InitialPendingSubscription obj)
             throws RegistryHandlerException {
-        if (obj instanceof InitialPendingUserSubscription) {
-            userSubscriptionHandler.store((InitialPendingUserSubscription) obj);
+        if (obj instanceof InitialPendingSiteSubscription) {
+            siteSubscriptionHandler.store((InitialPendingSiteSubscription) obj);
         } else {
             sharedSubscriptionHandler
                     .store((InitialPendingSharedSubscription) obj);
@@ -220,9 +220,9 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public void update(InitialPendingSubscription obj)
             throws RegistryHandlerException {
-        if (obj instanceof InitialPendingUserSubscription) {
-            userSubscriptionHandler
-                    .update((InitialPendingUserSubscription) obj);
+        if (obj instanceof InitialPendingSiteSubscription) {
+            siteSubscriptionHandler
+                    .update((InitialPendingSiteSubscription) obj);
         } else {
             sharedSubscriptionHandler
                     .update((InitialPendingSharedSubscription) obj);
@@ -235,9 +235,9 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public void delete(InitialPendingSubscription obj)
             throws RegistryHandlerException {
-        if (obj instanceof InitialPendingUserSubscription) {
-            userSubscriptionHandler
-                    .delete((InitialPendingUserSubscription) obj);
+        if (obj instanceof InitialPendingSiteSubscription) {
+            siteSubscriptionHandler
+                    .delete((InitialPendingSiteSubscription) obj);
         } else {
             sharedSubscriptionHandler
                     .delete((InitialPendingSharedSubscription) obj);
@@ -250,7 +250,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public void deleteById(String username, String registryId)
             throws RegistryHandlerException {
-        userSubscriptionHandler.deleteById(username, registryId);
+        siteSubscriptionHandler.deleteById(username, registryId);
         sharedSubscriptionHandler.deleteById(username, registryId);
     }
 
@@ -260,7 +260,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public void deleteByIds(String username, List registryIds)
             throws RegistryHandlerException {
-        userSubscriptionHandler.deleteByIds(username, registryIds);
+        siteSubscriptionHandler.deleteByIds(username, registryIds);
         sharedSubscriptionHandler.deleteByIds(username, registryIds);
     }
 
@@ -270,9 +270,9 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public void delete(String username, InitialPendingSubscription obj)
             throws RegistryHandlerException {
-        if (obj instanceof InitialPendingUserSubscription) {
-            userSubscriptionHandler.delete(username,
-                    (InitialPendingUserSubscription) obj);
+        if (obj instanceof InitialPendingSiteSubscription) {
+            siteSubscriptionHandler.delete(username,
+                    (InitialPendingSiteSubscription) obj);
         } else {
             sharedSubscriptionHandler.delete(username,
                     (InitialPendingSharedSubscription) obj);
@@ -288,8 +288,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
             throws RegistryHandlerException {
         if (!CollectionUtil.isNullOrEmpty(objects)) {
             final Collection asSubtype = objects;
-            if (objects.iterator().next() instanceof InitialPendingUserSubscription) {
-                userSubscriptionHandler.delete(asSubtype);
+            if (objects.iterator().next() instanceof InitialPendingSiteSubscription) {
+                siteSubscriptionHandler.delete(asSubtype);
             } else {
                 sharedSubscriptionHandler.delete(asSubtype);
             }
@@ -306,8 +306,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
             throws RegistryHandlerException {
         if (!CollectionUtil.isNullOrEmpty(objects)) {
             final Collection asSubtype = objects;
-            if (objects.iterator().next() instanceof UserSubscription) {
-                userSubscriptionHandler.delete(username, asSubtype);
+            if (objects.iterator().next() instanceof SiteSubscription) {
+                siteSubscriptionHandler.delete(username, asSubtype);
             } else {
                 sharedSubscriptionHandler.delete(username, asSubtype);
             }
@@ -320,8 +320,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public InitialPendingSubscription getBySubscription(
             Subscription subscription) throws RegistryHandlerException {
-        if (subscription instanceof UserSubscription) {
-            return userSubscriptionHandler.getBySubscription(subscription);
+        if (subscription instanceof SiteSubscription) {
+            return siteSubscriptionHandler.getBySubscription(subscription);
         } else {
             return sharedSubscriptionHandler.getBySubscription(subscription);
         }
@@ -333,7 +333,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     @Override
     public InitialPendingSubscription getBySubscriptionId(String id)
             throws RegistryHandlerException {
-        InitialPendingSubscription value = userSubscriptionHandler.getById(id);
+        InitialPendingSubscription value = siteSubscriptionHandler.getById(id);
         if (value == null) {
             value = sharedSubscriptionHandler.getById(id);
         }
@@ -350,8 +350,8 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
             throws RegistryHandlerException {
         if (!CollectionUtil.isNullOrEmpty(subscriptions)) {
             final Collection asSubtype = subscriptions;
-            if (subscriptions.iterator().next() instanceof UserSubscription) {
-                return nullOrSubscriptionList(userSubscriptionHandler
+            if (subscriptions.iterator().next() instanceof SiteSubscription) {
+                return nullOrSubscriptionList(siteSubscriptionHandler
                         .getBySubscriptions(asSubtype));
             } else {
                 return nullOrSubscriptionList(sharedSubscriptionHandler
@@ -368,7 +368,7 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
     public List getBySubscriptionIds(
             List ids) throws RegistryHandlerException {
         List subs = Lists.newArrayList();
-        subs.addAll(userSubscriptionHandler.getBySubscriptionIds(ids));
+        subs.addAll(siteSubscriptionHandler.getBySubscriptionIds(ids));
         subs.addAll(sharedSubscriptionHandler.getBySubscriptionIds(ids));
         return subs;
     }
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/UserSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SiteSubscriptionHandler.java
similarity index 75%
rename from edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/UserSubscriptionHandler.java
rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SiteSubscriptionHandler.java
index 984ab554be..29d240d9bc 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/UserSubscriptionHandler.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SiteSubscriptionHandler.java
@@ -19,12 +19,12 @@
  **/
 package com.raytheon.uf.common.datadelivery.registry.handlers;
 
-import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
-import com.raytheon.uf.common.datadelivery.registry.ebxml.UserSubscriptionQuery;
+import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
+import com.raytheon.uf.common.datadelivery.registry.ebxml.SiteSubscriptionQuery;
 import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
 
 /**
- * {@link IRegistryObjectHandler} implementation for {@link UserSubscription}.
+ * {@link IRegistryObjectHandler} implementation for {@link SiteSubscription}.
  * 
  * 
  * 
@@ -43,23 +43,23 @@ import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
  * @author djohnson
  * @version 1.0
  */
-public class UserSubscriptionHandler extends
-        SubscriptionTypeHandler
-        implements IUserSubscriptionHandler {
+public class SiteSubscriptionHandler extends
+        SubscriptionTypeHandler
+        implements ISiteSubscriptionHandler {
 
     /**
      * {@inheritDoc}
      */
     @Override
-    protected UserSubscriptionQuery getQuery() {
-        return new UserSubscriptionQuery();
+    protected SiteSubscriptionQuery getQuery() {
+        return new SiteSubscriptionQuery();
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    protected Class getRegistryObjectClass() {
-        return UserSubscription.class;
+    protected Class getRegistryObjectClass() {
+        return SiteSubscription.class;
     }
 }
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandler.java
index bc2f639c40..41f68e26a2 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandler.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandler.java
@@ -26,11 +26,11 @@ import java.util.Set;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import com.raytheon.uf.common.datadelivery.registry.Network;
+import com.raytheon.uf.common.datadelivery.registry.PendingSiteSubscription;
 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.SiteSubscription;
 import com.raytheon.uf.common.datadelivery.registry.Subscription;
-import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
 import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
 import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
 import com.raytheon.uf.common.util.CollectionUtil;
@@ -49,6 +49,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
  * Oct 17, 2012 0726       djohnson     Add {@link #getActiveByDataSetAndProvider}.
  * Apr 05, 2013 1841       djohnson     Add support for shared subscriptions.
  * 4/9/2013     1802      bphillip     Using constant values from constants package instead of RegistryUtil
+ * May 21, 2013 2020       mpduff       Rename UserSubscription to SiteSubscription.
  * 
  * 
* @@ -57,22 +58,22 @@ import com.raytheon.uf.common.util.CollectionUtil; */ public class SubscriptionHandler implements ISubscriptionHandler { - private final IUserSubscriptionHandler userSubscriptionHandler; + private final ISiteSubscriptionHandler siteSubscriptionHandler; private final ISharedSubscriptionHandler sharedSubscriptionHandler; /** * Constructor. * - * @param userSubscriptionHandler + * @param siteSubscriptionHandler * the user subscription handler * @param sharedSubscriptionHandler * the shared subscription handler */ public SubscriptionHandler( - IUserSubscriptionHandler userSubscriptionHandler, + ISiteSubscriptionHandler siteSubscriptionHandler, ISharedSubscriptionHandler sharedSubscriptionHandler) { - this.userSubscriptionHandler = userSubscriptionHandler; + this.siteSubscriptionHandler = siteSubscriptionHandler; this.sharedSubscriptionHandler = sharedSubscriptionHandler; } @@ -82,8 +83,8 @@ public class SubscriptionHandler implements ISubscriptionHandler { @Override public Subscription getByPendingSubscription(PendingSubscription pending) throws RegistryHandlerException { - if (pending instanceof PendingUserSubscription) { - return userSubscriptionHandler.getByPendingSubscription(pending); + if (pending instanceof PendingSiteSubscription) { + return siteSubscriptionHandler.getByPendingSubscription(pending); } else { return sharedSubscriptionHandler.getByPendingSubscription(pending); } @@ -95,7 +96,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { @Override public Subscription getByPendingSubscriptionId(final String id) throws RegistryHandlerException { - Subscription value = userSubscriptionHandler.getById(id); + Subscription value = siteSubscriptionHandler.getById(id); if (value == null) { value = sharedSubscriptionHandler.getById(id); } @@ -108,7 +109,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { @Override public void deleteByIds(String username, List ids) throws RegistryHandlerException { - userSubscriptionHandler.deleteByIds(username, ids); + siteSubscriptionHandler.deleteByIds(username, ids); sharedSubscriptionHandler.deleteByIds(username, ids); } @@ -119,7 +120,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { public List getActiveByDataSetAndProvider(String dataSetName, String providerName) throws RegistryHandlerException { List subs = Lists.newArrayList(); - subs.addAll(userSubscriptionHandler.getActiveByDataSetAndProvider( + subs.addAll(siteSubscriptionHandler.getActiveByDataSetAndProvider( dataSetName, providerName)); subs.addAll(sharedSubscriptionHandler.getActiveByDataSetAndProvider( dataSetName, providerName)); @@ -132,7 +133,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { */ @Override public Subscription getByName(String name) throws RegistryHandlerException { - Subscription value = userSubscriptionHandler.getByName(name); + Subscription value = siteSubscriptionHandler.getByName(name); if (value == null) { value = sharedSubscriptionHandler.getByName(name); } @@ -146,7 +147,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { public List getByOwner(String owner) throws RegistryHandlerException { List subs = Lists.newArrayList(); - subs.addAll(userSubscriptionHandler.getByOwner(owner)); + subs.addAll(siteSubscriptionHandler.getByOwner(owner)); subs.addAll(sharedSubscriptionHandler.getByOwner(owner)); return subs; @@ -159,7 +160,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { public List getByGroupName(String group) throws RegistryHandlerException { List subs = Lists.newArrayList(); - subs.addAll(userSubscriptionHandler.getByGroupName(group)); + subs.addAll(siteSubscriptionHandler.getByGroupName(group)); subs.addAll(sharedSubscriptionHandler.getByGroupName(group)); return subs; @@ -172,7 +173,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { public List getByFilters(String group, String officeId) throws RegistryHandlerException { List subs = Lists.newArrayList(); - subs.addAll(userSubscriptionHandler.getByFilters(group, officeId)); + subs.addAll(siteSubscriptionHandler.getByFilters(group, officeId)); subs.addAll(sharedSubscriptionHandler.getByFilters(group, officeId)); return subs; @@ -185,7 +186,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { public Set getSubscribedToDataSetNames() throws RegistryHandlerException { Set set = Sets.newHashSet(); - set.addAll(userSubscriptionHandler.getSubscribedToDataSetNames()); + set.addAll(siteSubscriptionHandler.getSubscribedToDataSetNames()); set.addAll(sharedSubscriptionHandler.getSubscribedToDataSetNames()); return set; @@ -197,7 +198,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { @Override public List getActive() throws RegistryHandlerException { List subs = Lists.newArrayList(); - subs.addAll(userSubscriptionHandler.getActive()); + subs.addAll(siteSubscriptionHandler.getActive()); subs.addAll(sharedSubscriptionHandler.getActive()); return subs; @@ -210,7 +211,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { public List getActiveForRoute(Network route) throws RegistryHandlerException { List subs = Lists.newArrayList(); - subs.addAll(userSubscriptionHandler.getActiveForRoute(route)); + subs.addAll(siteSubscriptionHandler.getActiveForRoute(route)); subs.addAll(sharedSubscriptionHandler.getActiveForRoute(route)); return subs; } @@ -222,7 +223,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { public List getActiveForRoutes(Network... routes) throws RegistryHandlerException { List subs = Lists.newArrayList(); - subs.addAll(userSubscriptionHandler.getActiveForRoutes(routes)); + subs.addAll(siteSubscriptionHandler.getActiveForRoutes(routes)); subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes)); return subs; } @@ -232,7 +233,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { */ @Override public Subscription getById(String id) throws RegistryHandlerException { - Subscription value = userSubscriptionHandler.getById(id); + Subscription value = siteSubscriptionHandler.getById(id); if (value == null) { value = sharedSubscriptionHandler.getById(id); } @@ -245,7 +246,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { @Override public List getAll() throws RegistryHandlerException { List subs = Lists.newArrayList(); - subs.addAll(userSubscriptionHandler.getAll()); + subs.addAll(siteSubscriptionHandler.getAll()); subs.addAll(sharedSubscriptionHandler.getAll()); return subs; } @@ -255,8 +256,8 @@ public class SubscriptionHandler implements ISubscriptionHandler { */ @Override public void store(Subscription obj) throws RegistryHandlerException { - if (obj instanceof UserSubscription) { - userSubscriptionHandler.store((UserSubscription) obj); + if (obj instanceof SiteSubscription) { + siteSubscriptionHandler.store((SiteSubscription) obj); } else { sharedSubscriptionHandler.store((SharedSubscription) obj); } @@ -267,8 +268,8 @@ public class SubscriptionHandler implements ISubscriptionHandler { */ @Override public void update(Subscription obj) throws RegistryHandlerException { - if (obj instanceof UserSubscription) { - userSubscriptionHandler.update((UserSubscription) obj); + if (obj instanceof SiteSubscription) { + siteSubscriptionHandler.update((SiteSubscription) obj); } else { sharedSubscriptionHandler.update((SharedSubscription) obj); } @@ -279,8 +280,8 @@ public class SubscriptionHandler implements ISubscriptionHandler { */ @Override public void delete(Subscription obj) throws RegistryHandlerException { - if (obj instanceof UserSubscription) { - userSubscriptionHandler.delete((UserSubscription) obj); + if (obj instanceof SiteSubscription) { + siteSubscriptionHandler.delete((SiteSubscription) obj); } else { sharedSubscriptionHandler.delete((SharedSubscription) obj); } @@ -292,7 +293,7 @@ public class SubscriptionHandler implements ISubscriptionHandler { @Override public void deleteById(String username, String registryId) throws RegistryHandlerException { - userSubscriptionHandler.deleteById(username, registryId); + siteSubscriptionHandler.deleteById(username, registryId); sharedSubscriptionHandler.deleteById(username, registryId); } @@ -302,8 +303,8 @@ public class SubscriptionHandler implements ISubscriptionHandler { @Override public void delete(String username, Subscription obj) throws RegistryHandlerException { - if (obj instanceof UserSubscription) { - userSubscriptionHandler.delete(username, (UserSubscription) obj); + if (obj instanceof SiteSubscription) { + siteSubscriptionHandler.delete(username, (SiteSubscription) obj); } else { sharedSubscriptionHandler .delete(username, (SharedSubscription) obj); @@ -319,8 +320,8 @@ public class SubscriptionHandler implements ISubscriptionHandler { throws RegistryHandlerException { if (!CollectionUtil.isNullOrEmpty(objects)) { final Collection asSubtype = objects; - if (objects.iterator().next() instanceof UserSubscription) { - userSubscriptionHandler.delete(asSubtype); + if (objects.iterator().next() instanceof SiteSubscription) { + siteSubscriptionHandler.delete(asSubtype); } else { sharedSubscriptionHandler.delete(asSubtype); } @@ -336,8 +337,8 @@ public class SubscriptionHandler implements ISubscriptionHandler { throws RegistryHandlerException { if (!CollectionUtil.isNullOrEmpty(objects)) { final Collection asSubtype = objects; - if (objects.iterator().next() instanceof UserSubscription) { - userSubscriptionHandler.delete(username, asSubtype); + if (objects.iterator().next() instanceof SiteSubscription) { + siteSubscriptionHandler.delete(username, asSubtype); } else { sharedSubscriptionHandler.delete(username, asSubtype); } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionTypeHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionTypeHandler.java index fcbe707cde..6b3d857cc0 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionTypeHandler.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionTypeHandler.java @@ -44,7 +44,7 @@ import com.raytheon.uf.common.util.CollectionUtil; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 05, 2013 1841 djohnson Extracted and genericized from UserSubscriptionHandler. + * Apr 05, 2013 1841 djohnson Extracted and genericized from siteSubscriptionHandler. * *
* diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.request/src/com/raytheon/uf/common/datadelivery/request/DataDeliveryPermission.java b/edexOsgi/com.raytheon.uf.common.datadelivery.request/src/com/raytheon/uf/common/datadelivery/request/DataDeliveryPermission.java index a5eb61ba36..642b106ba8 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.request/src/com/raytheon/uf/common/datadelivery/request/DataDeliveryPermission.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.request/src/com/raytheon/uf/common/datadelivery/request/DataDeliveryPermission.java @@ -28,7 +28,8 @@ package com.raytheon.uf.common.datadelivery.request; * * 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. * * * @@ -45,7 +46,11 @@ public enum DataDeliveryPermission { "subscription.edit"), SYSTEM_MANAGEMENT_VIEW( "systemmanagement.view"), SUBSCRIPTION_CREATE("subscription.create"), SUBSCRIPTION_ACTIVATE( "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; diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/slots/SetSlotConverter.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/slots/SetSlotConverter.java index 418d684bbd..12f6c06805 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/slots/SetSlotConverter.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/slots/SetSlotConverter.java @@ -10,26 +10,26 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ValueType; /** - * A SlotConverter implementation for converting the - * members of a Set into a RegistryObject slot type. A collection - * slot type will be created and the Set members converted to elements - * with slot values of a appropriate type for the member. The collection - * type for the slot will be set to Set. + * A SlotConverter implementation for converting the members of a + * Set into a RegistryObject slot type. A collection slot type will be created + * and the Set members converted to elements with slot values of a appropriate + * type for the member. The collection type for the slot will be set to Set. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * May 15, 2012 455        jspinks     Initial creation
- *
+ * May 15, 2013 1040       mpduff      Made non-abstract.
+ * 
  * 
- * + * * @author jspinks * @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. @@ -44,65 +44,67 @@ public abstract class SetSlotConverter implements SlotConverter { * provided. * * @throws IllegalArgumentException - * If the slotValue Object provided is not an instance of Set, or - * the Set member cannot be converted to a value. + * If the slotValue Object provided is not an instance of Set, + * or the Set member cannot be converted to a value. * * @see java.util.Map */ @Override - public List getSlots(String slotName, Object slotValue) throws IllegalArgumentException { + public List getSlots(String slotName, Object slotValue) + throws IllegalArgumentException { List slots = new ArrayList(); - - + SlotType slot = new SlotType(); slot.setName(slotName); List collectionValues = new ArrayList(); CollectionValueType cvt = new CollectionValueType(); - - + if (slotValue instanceof Set) { - - for (Object o : (Set)slotValue) { + + for (Object o : (Set) slotValue) { ValueType vt = newEntrySlot(o); if (vt != null) { - collectionValues.add(newEntrySlot(o)); + collectionValues.add(newEntrySlot(o)); } else { - throw new IllegalArgumentException("Set with parameterized type " + o.getClass().getName() + - " cannot be converted by " + SetSlotConverter.class.getName()); + throw new IllegalArgumentException( + "Set with parameterized type " + + o.getClass().getName() + + " cannot be converted by " + + SetSlotConverter.class.getName()); } } - + } else { + throw new IllegalArgumentException("Object of type " + + slotValue.getClass().getName() + + " cannot be converted by " + + SetSlotConverter.class.getName()); } - else { - throw new IllegalArgumentException("Object of type " + slotValue.getClass().getName() + - " cannot be converted by " + SetSlotConverter.class.getName()); - } - + cvt.setCollectionValue(collectionValues); cvt.setCollectionType("urn:oasis:names:tc:ebxml-regrep:CollectionType:Set"); slot.setSlotValue(cvt); slots.add(slot); return slots; } - + /** * Create a new value for inclusion in the collection slot values. * * @param value - * The Object to extract the slot value from. - * + * The Object to extract the slot value from. + * * @return A ValueType to add to the collection slot. */ private ValueType newEntrySlot(Object value) { - + // TODO: Add more types as necessary. if (value instanceof String) { StringValueType entry = new StringValueType(); - entry.setStringValue((String)value); + entry.setStringValue((String) value); return entry; } - + return null; } } diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteData.java b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteData.java new file mode 100644 index 0000000000..734f8110bb --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteData.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 29, 2013    1040    mpduff      Initial creation
+ * 
+ * 
+ * + * @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; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteMap.java b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteMap.java index 27a94e85c9..52f1e4fcc5 100644 --- a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteMap.java +++ b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteMap.java @@ -30,13 +30,20 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeMap; 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.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; 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.UFStatus; 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 * Apr 09, 2012 DR14765 mhuang Map out correct CCCC site ID for backup * sites. + * May 15, 2013 1040 mpduff Add awips_site_list.xml. * * * @@ -73,21 +81,45 @@ public class SiteMap { private static final String RFC_TABLE_FILENAME = "textdb/rfc_lookup_table.dat"; - private List rfcList = new ArrayList(); + private static final String LOCATION_ID_FILENAME = "awips_site_list.xml"; - private Map siteToSiteMap = new HashMap(); + private final List rfcList = new ArrayList(); - private Map nationalCategoryMap = new HashMap(); + private final Map siteToSiteMap = new HashMap(); - private Map siteTo4LetterSite = new HashMap(); + private final Map nationalCategoryMap = new HashMap(); - private Map> siteTo3LetterSite = new HashMap>(); + private final Map siteTo4LetterSite = new HashMap(); + private final Map> siteTo3LetterSite = new HashMap>(); + + private final Map siteMap = new TreeMap(); + + /** JAXB context */ + private JAXBContext jax; + + /** Unmarshaller object */ + private Unmarshaller unmarshaller; + + /** + * Get an instance. + * + * @return the instance + */ public static SiteMap getInstance() { return instance; } 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(); } @@ -111,14 +143,17 @@ public class SiteMap { } /** - * Attempt to map an xxxid to a cccid. Use the afos_lookup_table.dat data only. - * @param xxx An id to map. + * Attempt to map an xxxid to a cccid. Use the afos_lookup_table.dat data + * only. + * + * @param xxx + * An id to map. * @return */ public String getAFOSTableMap(String xxx) { return siteToSiteMap.get(xxx); } - + public synchronized String mapICAOToCCC(String icao) { return nationalCategoryMap.get(icao); } @@ -128,6 +163,7 @@ public class SiteMap { nationalCategoryMap.clear(); siteTo4LetterSite.clear(); siteTo3LetterSite.clear(); + siteMap.clear(); // load base afos lookup IPathManager pathMgr = PathManagerFactory.getPathManager(); @@ -144,13 +180,25 @@ public class SiteMap { LocalizationLevel.SITE); file = pathMgr.getFile(lc, AFOS_LOOKUP_FILENAME); loadAfosLookupFile(file, siteToSiteMap); - + // load national category lc = pathMgr.getContext(LocalizationType.COMMON_STATIC, LocalizationLevel.BASE); file = pathMgr.getFile(lc, NATIONAL_CATEGORY_TABLE_FILENAME); 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 // mapping 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 * @@ -327,19 +393,19 @@ public class SiteMap { // if site not found default to K if (site == null) { site = "K" + site3LetterId; - } else { - // DR_14765, in case the site hashed out from combined mapping - // table from both national_category_table and afo_lookup_table - // does not start with K but not from site3LetterTo4LetterOerride.dat - // which are starting with P or T - char[] siteChar = site.toCharArray(); - if (siteChar[0] != 'K') { - if (!((siteChar[0] == 'P' && (siteChar[1] == 'A' || siteChar[1] == 'G' - || siteChar[1] == 'H')) || - (siteChar[0] == 'T' && siteChar[1] == 'S'))) { - site = "K" + site3LetterId; - } - } + } else { + // DR_14765, in case the site hashed out from combined mapping + // table from both national_category_table and afo_lookup_table + // does not start with K but not from + // site3LetterTo4LetterOerride.dat + // which are starting with P or T + char[] siteChar = site.toCharArray(); + if (siteChar[0] != 'K') { + if (!((siteChar[0] == 'P' && (siteChar[1] == 'A' + || siteChar[1] == 'G' || siteChar[1] == 'H')) || (siteChar[0] == 'T' && siteChar[1] == 'S'))) { + site = "K" + site3LetterId; + } + } } return site; @@ -371,4 +437,13 @@ public class SiteMap { public boolean isRFCSite(String site) { return rfcList.contains(site); } + + /** + * Get the site data objects. + * + * @return site data objects + */ + public Map getSiteData() { + return siteMap; + } } diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/xml/NwsSitesXML.java b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/xml/NwsSitesXML.java new file mode 100644 index 0000000000..125b8f0166 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/xml/NwsSitesXML.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 29, 2013    1040    mpduff      Initial creation
+ * 
+ * 
+ * + * @author mpduff + * @version 1.0 + */ +@XmlRootElement(name = "nwsSites") +@XmlAccessorType(XmlAccessType.NONE) +public class NwsSitesXML { + @XmlElements({ @XmlElement(name = "site", type = SiteIdXML.class) }) + private List siteIds = new ArrayList(); + + /** + * @return the siteIds + */ + public List getSiteIds() { + return siteIds; + } + + /** + * @param siteIds + * the siteIds to set + */ + public void setSiteIds(ArrayList 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); + } + } +} diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/xml/SiteIdXML.java b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/xml/SiteIdXML.java new file mode 100644 index 0000000000..5a35cf455e --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/xml/SiteIdXML.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 29, 2013    1040    mpduff      Initial creation
+ * 
+ * 
+ * + * @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; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.site/utility/common_static/base/awips_site_list.xml b/edexOsgi/com.raytheon.uf.common.site/utility/common_static/base/awips_site_list.xml new file mode 100644 index 0000000000..18be0c5edf --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.site/utility/common_static/base/awips_site_list.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/StringUtil.java b/edexOsgi/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/StringUtil.java index 5a832113f1..95f2218783 100644 --- a/edexOsgi/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/StringUtil.java +++ b/edexOsgi/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/StringUtil.java @@ -123,7 +123,8 @@ public final class StringUtil { * the character to join them with * @return the concatenated string */ - public static String join(final Collection portions, final char joinCharacter) { + public static String join(final Collection portions, + final char joinCharacter) { StringBuilder stringBuilder = new StringBuilder(); if (CollectionUtil.isNullOrEmpty(portions)) { @@ -209,4 +210,66 @@ public final class StringUtil { } 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 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 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(); + + } } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java index a11c7fb206..593d36f42f 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java @@ -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.Subscription; 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.event.EventBus; 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) || DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION .equals(objectType)) { @@ -308,8 +308,8 @@ public abstract class BandwidthManager extends Subscription sub = updateSubscriptionWithDataSetMetaData( subscription, dataSetMetaData); - if (sub instanceof UserSubscription) { - schedule(new AdhocSubscription((UserSubscription) sub)); + if (sub instanceof SiteSubscription) { + schedule(new AdhocSubscription((SiteSubscription) sub)); } else { statusHandler .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) { String objectType = event.getObjectType(); if (objectType != null) { - if (DataDeliveryRegistryObjectTypes.USER_SUBSCRIPTION + if (DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION .equals(objectType) || DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION .equals(objectType)) { @@ -752,9 +752,9 @@ public abstract class BandwidthManager extends // Create an adhoc subscription based on the new subscription, // and set it to retrieve the most recent cycle (or most recent // url if a daily product) - if (subscription instanceof UserSubscription) { + if (subscription instanceof SiteSubscription) { AdhocSubscription adhoc = new AdhocSubscription( - (UserSubscription) subscription); + (SiteSubscription) subscription); adhoc = bandwidthDaoUtil.setAdhocMostRecentUrlAndTime( adhoc, useMostRecentDataSetUpdate); diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.service/res/spring/datadelivery-handlers-impl.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.service/res/spring/datadelivery-handlers-impl.xml index d87a62028e..f0d81beb1b 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.service/res/spring/datadelivery-handlers-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.service/res/spring/datadelivery-handlers-impl.xml @@ -10,7 +10,7 @@ class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler"> + class="com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler" /> + class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSiteSubscriptionHandler" /> + + + Control Access to Create Data Delivery Shared Subscriptions + + + + + + Control Access to Edit Data Delivery Shared Subscriptions + + + + + + Control Access to Delete Data Delivery Shared Subscriptions + + + + + + Control Access to Activate Data Delivery Shared Subscriptions + + + + + + Authorization to Approve Shared Data Delivery Subscriptions + + + Authorization to View Pending Data Delivery Subscriptions @@ -100,6 +130,17 @@ group.edit + + + This role is a grouping of permissions, default shared subscription admin role + + shared.subscription.create + shared.subscription.edit + shared.subscription.delete + shared.subscription.activate + subscription.approve.share + + subscription.view diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthManagerIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthManagerIntTest.java index de7746463a..dc32faba7b 100644 --- a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthManagerIntTest.java +++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthManagerIntTest.java @@ -37,7 +37,7 @@ import org.springframework.context.ApplicationContext; import com.raytheon.uf.common.datadelivery.registry.Network; 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.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtilTest; @@ -163,7 +163,7 @@ public abstract class AbstractBandwidthManagerIntTest { * * @return the subscription */ - protected UserSubscription createSubscriptionThatFillsUpABucket() { + protected SiteSubscription createSubscriptionThatFillsUpABucket() { return createSubscriptionWithDataSetSizeInBytes(fullBucketSize); } @@ -172,7 +172,7 @@ public abstract class AbstractBandwidthManagerIntTest { * * @return the subscription */ - protected UserSubscription createSubscriptionThatFillsUpTenBuckets() { + protected SiteSubscription createSubscriptionThatFillsUpTenBuckets() { return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 10); } @@ -181,7 +181,7 @@ public abstract class AbstractBandwidthManagerIntTest { * * @return the subscription */ - protected UserSubscription createSubscriptionThatFillsHalfABucket() { + protected SiteSubscription createSubscriptionThatFillsHalfABucket() { return createSubscriptionWithDataSetSizeInBytes(halfBucketSize); } @@ -190,7 +190,7 @@ public abstract class AbstractBandwidthManagerIntTest { * * @return the subscription */ - protected UserSubscription createSubscriptionThatFillsAThirdOfABucket() { + protected SiteSubscription createSubscriptionThatFillsAThirdOfABucket() { return createSubscriptionWithDataSetSizeInBytes(thirdBucketSizeInBytes); } @@ -199,13 +199,13 @@ public abstract class AbstractBandwidthManagerIntTest { * * @return the subscription */ - protected UserSubscription createSubscriptionThatFillsUpTwoBuckets() { + protected SiteSubscription createSubscriptionThatFillsUpTwoBuckets() { return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 2); } - protected UserSubscription createSubscriptionWithDataSetSizeInBytes( + protected SiteSubscription createSubscriptionWithDataSetSizeInBytes( long bytes) { - UserSubscription subscription = SubscriptionFixture.INSTANCE + SiteSubscription subscription = SubscriptionFixture.INSTANCE .get(subscriptionSeed++); subscription.setDataSetSize(BandwidthUtil .convertBytesToKilobytes(bytes)); diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java index 07df14e744..29c2f3ed8e 100644 --- a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java +++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java @@ -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.SubscriptionFixture; 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.registry.event.RemoveRegistryEvent; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; @@ -816,7 +816,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { final int numberOfSubscriptionsWithSameProviderDataSet = 4; - final UserSubscription templateSubscription = createSubscriptionThatFillsUpABucket(); + final SiteSubscription templateSubscription = createSubscriptionThatFillsUpABucket(); final Network route = templateSubscription.getRoute(); templateSubscription.setDataSetSize(templateSubscription .getDataSetSize() @@ -828,7 +828,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { final Subscription[] subscriptions = new Subscription[numberOfSubscriptionsWithSameProviderDataSet]; for (int i = 0; i < numberOfSubscriptionsWithSameProviderDataSet; i++) { - final UserSubscription currentSubscription = new UserSubscription( + final SiteSubscription currentSubscription = new SiteSubscription( templateSubscription, "ILookLikeTheOtherGuys-" + i); subscriptions[i] = currentSubscription; @@ -1015,7 +1015,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { private void sendDeletedSubscriptionEvent(Subscription subscription) { RemoveRegistryEvent event = new RemoveRegistryEvent( subscription.getOwner(), subscription.getId()); - event.setObjectType(DataDeliveryRegistryObjectTypes.USER_SUBSCRIPTION); + event.setObjectType(DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION); bandwidthManager.subscriptionRemoved(event); } diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/AdhocSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/AdhocSubscriptionFixture.java index 45b515be07..e539982fb8 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/AdhocSubscriptionFixture.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/AdhocSubscriptionFixture.java @@ -39,7 +39,7 @@ import com.raytheon.uf.common.util.AbstractFixture; */ public class AdhocSubscriptionFixture extends - BaseUserSubscriptionFixture { + BaseSiteSubscriptionFixture { public static final AdhocSubscriptionFixture INSTANCE = new AdhocSubscriptionFixture(); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseUserSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSiteSubscriptionFixture.java similarity index 93% rename from tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseUserSubscriptionFixture.java rename to tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSiteSubscriptionFixture.java index 2db180507b..c34bb2f56e 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseUserSubscriptionFixture.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSiteSubscriptionFixture.java @@ -24,7 +24,7 @@ import java.util.Random; import com.raytheon.uf.common.registry.ebxml.RegistryUtil; /** - * Adds attributes specific to {@link UserSubscription} types. + * Adds attributes specific to {@link SiteSubscription} types. * *
  * 
@@ -40,7 +40,7 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
  * @version 1.0
  */
 
-public abstract class BaseUserSubscriptionFixture
+public abstract class BaseSiteSubscriptionFixture
         extends BaseSubscriptionFixture {
 
     /**
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSubscriptionFixture.java
index b7472a6eec..493274a4c5 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSubscriptionFixture.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSubscriptionFixture.java
@@ -41,6 +41,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
  * Jan 30, 2013 1543       djohnson     Add coverage/parameter data.
  * Mar 28, 2013 1841       djohnson     Subscription is now UserSubscription.
  * Apr 08, 2013 1826       djohnson     Remove delivery options.
+ * May 15, 2013 1040       mpduff       Office Ids are now a list.
  * 
  * 
* @@ -74,7 +75,7 @@ public abstract class BaseSubscriptionFixture extends subscription.setFullDataSet(random.nextBoolean()); subscription.setGroupName("group" + random.nextInt()); subscription.setName("name" + seedValue); - subscription.setOfficeID("officeID" + random.nextInt()); + subscription.addOfficeID("officeID" + random.nextInt()); subscription.addParameter(ParameterFixture.INSTANCE.get()); // Same priority for all, individual tests needing to test specific // priorities should set it manually anyway diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionFixture.java index 37c2084b01..5cc18fcabb 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionFixture.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionFixture.java @@ -42,7 +42,7 @@ import com.raytheon.uf.common.util.AbstractFixture; */ public class PendingSubscriptionFixture extends - BaseUserSubscriptionFixture { + BaseSiteSubscriptionFixture { public static final PendingSubscriptionFixture INSTANCE = new PendingSubscriptionFixture(); @@ -56,8 +56,8 @@ public class PendingSubscriptionFixture extends * {@inheritDoc} */ @Override - public PendingUserSubscription getInstance(long seedValue, Random random) { - PendingUserSubscription sub = super.getInstance(seedValue, random); + public PendingSiteSubscription getInstance(long seedValue, Random random) { + PendingSiteSubscription sub = super.getInstance(seedValue, random); sub.setChangeReqId("change" + seedValue); return sub; @@ -67,8 +67,8 @@ public class PendingSubscriptionFixture extends * {@inheritDoc} */ @Override - protected PendingUserSubscription getSubscription() { - return new PendingUserSubscription(); + protected PendingSiteSubscription getSubscription() { + return new PendingSiteSubscription(); } } diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java index cbf438bf98..25873bc410 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java @@ -34,6 +34,7 @@ import org.junit.Test; * ------------ ---------- ----------- -------------------------- * Aug 27, 2012 0743 djohnson Initial creation * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. + * May 15, 2013 1040 mpduff Changed to handle the list of office ids. * * * @@ -45,9 +46,9 @@ public class PendingSubscriptionTest { @Test public void testCopyConstructorSetsOriginalSubNameAsName() { - UserSubscription subscription = SubscriptionFixture.INSTANCE.get(); + SiteSubscription subscription = SubscriptionFixture.INSTANCE.get(); - PendingUserSubscription pendingSubscription = new PendingUserSubscription( + PendingSiteSubscription pendingSubscription = new PendingSiteSubscription( subscription, "djohnson"); assertEquals( "The original subscription name should have been used for the pending subscription!", @@ -56,9 +57,9 @@ public class PendingSubscriptionTest { @Test public void testCopyConstructorSetsSubscriptionValuesOnPendingSubscription() { - UserSubscription subscription = SubscriptionFixture.INSTANCE.get(); + SiteSubscription subscription = SubscriptionFixture.INSTANCE.get(); - PendingUserSubscription copied = new PendingUserSubscription( + PendingSiteSubscription copied = new PendingSiteSubscription( subscription, "djohnson"); assertEquals(subscription.getActivePeriodEnd(), @@ -71,7 +72,7 @@ public class PendingSubscriptionTest { assertEquals(subscription.getDataSetType(), copied.getDataSetType()); assertEquals(subscription.getDescription(), copied.getDescription()); assertEquals(subscription.getGroupName(), copied.getGroupName()); - assertEquals(subscription.getOfficeID(), copied.getOfficeID()); + assertEquals(subscription.getOfficeIDs(), copied.getOfficeIDs()); assertEquals(subscription.getPriority(), copied.getPriority()); assertEquals(subscription.getProvider(), copied.getProvider()); assertEquals(subscription.getStatus(), copied.getStatus()); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/UserSubscriptionTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java similarity index 90% rename from tests/unit/com/raytheon/uf/common/datadelivery/registry/UserSubscriptionTest.java rename to tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java index 3d4f25125f..3ec3d8522a 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/UserSubscriptionTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java @@ -28,11 +28,14 @@ import static org.junit.Assert.assertThat; import java.util.Calendar; import java.util.Date; +import javax.xml.bind.JAXBException; + import org.junit.After; import org.junit.Before; import org.junit.Test; 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.util.TimeUtil; 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 11, 2013 1453 djohnson Add test for active period crossing year boundary. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. + * May 15, 2013 1040 mpduff Office Id now a set. * * * * @author djohnson * @version 1.0 */ -public class UserSubscriptionTest { +public class SiteSubscriptionTest { @Before public void setUp() { @@ -74,9 +78,9 @@ public class UserSubscriptionTest { @Test 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!", "newName", copied.getName()); @@ -85,9 +89,9 @@ public class UserSubscriptionTest { @Test public void testCopyConstructorSetsValuesFromSourceSubscription() 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(), copied.getActivePeriodEnd()); @@ -102,7 +106,7 @@ public class UserSubscriptionTest { 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.getProvider(), copied.getProvider()); assertEquals(subscription.getStatus(), copied.getStatus()); @@ -198,4 +202,12 @@ public class UserSubscriptionTest { assertThat(subscription.getStatus(), 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)); + } } diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionBuilder.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionBuilder.java index 22868c99c7..9ed135df7e 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionBuilder.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionBuilder.java @@ -38,6 +38,7 @@ import com.raytheon.uf.common.time.util.TimeUtil; * Jan 30, 2013 1543 djohnson Add ability to specify route. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Apr 08, 2013 1826 djohnson Remove delivery options. + * May 15, 2013 1040 mpduff Office Id now a set. * * * @@ -96,8 +97,8 @@ public class SubscriptionBuilder { /** * {@inheritDoc} */ - public UserSubscription build() { - UserSubscription subscription = SubscriptionFixture.INSTANCE.get(); + public SiteSubscription build() { + SiteSubscription subscription = SubscriptionFixture.INSTANCE.get(); subscription.setActive(active); subscription.setActivePeriodStart(activePeriodStart); subscription.setActivePeriodEnd(activePeriodEnd); @@ -110,7 +111,7 @@ public class SubscriptionBuilder { subscription.setGroupName(groupName); subscription.setLatencyInMinutes(latencyInMinutes); subscription.setName(name); - subscription.setOfficeID(officeId); + subscription.addOfficeID(officeId); subscription.setOwner(owner); subscription.setPriority(priority); subscription.setSubscriptionStart(subscriptionStart); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionFixture.java index add041e172..4bcd611f2c 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionFixture.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionFixture.java @@ -41,7 +41,7 @@ import com.raytheon.uf.common.util.AbstractFixture; */ public class SubscriptionFixture extends - BaseUserSubscriptionFixture { + BaseSiteSubscriptionFixture { public static final SubscriptionFixture INSTANCE = new SubscriptionFixture(); @@ -55,7 +55,7 @@ public class SubscriptionFixture extends * {@inheritDoc} */ @Override - protected UserSubscription getSubscription() { - return new UserSubscription(); + protected SiteSubscription getSubscription() { + return new SiteSubscription(); } } diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/BaseMemorySubscriptionHandler.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/BaseMemorySubscriptionHandler.java index d0625d5b96..5de4c0931d 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/BaseMemorySubscriptionHandler.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/BaseMemorySubscriptionHandler.java @@ -39,6 +39,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException; * ------------ ---------- ----------- -------------------------- * Oct 17, 2012 0726 djohnson Initial creation * Feb 20, 2013 1543 djohnson Implement route filtering. + * May 15, 2013 1040 mpduff Office Id now a set. * * * @@ -113,12 +114,12 @@ public class BaseMemorySubscriptionHandler extends * {@inheritDoc} */ @Override - public List getByFilters(String group, String officeId) + public List getByFilters(String group, String officeIds) throws RegistryHandlerException { List retVal = new ArrayList(); for (T obj : getAll()) { if (matches(group, obj.getGroupName()) - && matches(officeId, obj.getOfficeID())) { + && matches(officeIds, obj.getOfficeIDs())) { retVal.add(obj); } } diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/GroupDefinitionServiceTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/GroupDefinitionServiceTest.java index b69cb28fc0..494d157045 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/GroupDefinitionServiceTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/GroupDefinitionServiceTest.java @@ -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.Subscription; 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.ISubscriptionNotificationService; import com.raytheon.uf.common.registry.RegistryManagerTest; @@ -97,10 +97,10 @@ public class GroupDefinitionServiceTest { group.setGroupName(GROUP_NAME); groupHandler.store(group); - UserSubscription subscription = new SubscriptionBuilder() + SiteSubscription subscription = new SubscriptionBuilder() .withGroupName( GROUP_NAME).build(); - UserSubscription subscription2 = new UserSubscription(subscription, + SiteSubscription subscription2 = new SiteSubscription(subscription, "sub2"); subscriptionHandler.store(subscription); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionDuplicateCheckerTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionDuplicateCheckerTest.java index 71a9bacc7a..a73186d1a9 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionDuplicateCheckerTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionDuplicateCheckerTest.java @@ -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.ParameterFixture; 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.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Envelope; @@ -61,8 +61,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsPercentOfParametersThatAreTheSame() { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); sub1.getParameter().clear(); sub1.addParameter(ParameterFixture.INSTANCE.get(1)); @@ -79,8 +79,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfParametersForNullsOrEmpties() { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); sub1.setParameter(null); @@ -101,8 +101,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsPercentOfForecastHoursThatAreTheSame() { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final List sub1SelectedTimes = Arrays.asList(0, 1); sub1.getTime().setSelectedTimeIndices(sub1SelectedTimes); @@ -117,8 +117,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfForecastHoursForNullsOrEmpties() { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); sub1.getTime().setSelectedTimeIndices(null); final List sub2SelectedTimes = Arrays.asList(0, 3, 4); @@ -139,8 +139,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsPercentOfCyclesThatAreTheSame() { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); final List sub1CycleTimes = Arrays.asList(0, 6); sub1.getTime().setCycleTimes(sub1CycleTimes); @@ -155,8 +155,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfCyclesForNullsOrEmpties() { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); sub1.getTime().setCycleTimes(null); final List cycleTimes = Arrays.asList(0, 3, 4); @@ -173,8 +173,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsPercentOfSpatialThatIsTheSame() throws TransformException { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); ReferencedEnvelope envelope1 = new ReferencedEnvelope(new Envelope( new Coordinate(-5, 0), new Coordinate(0, 5)), @@ -198,8 +198,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfSpatialWhenNoOverlap() throws TransformException { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); ReferencedEnvelope envelope1 = new ReferencedEnvelope(new Envelope( new Coordinate(-5, 0), new Coordinate(0, 5)), @@ -217,8 +217,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfSpatialForNulls() throws TransformException { - final UserSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final UserSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); sub1.setCoverage(null); diff --git a/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java b/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java index 61e559399a..268a491eb6 100644 --- a/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java +++ b/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java @@ -78,11 +78,11 @@ public class TestJaxbableClassesLocator implements IJaxbableClassesLocator { com.raytheon.uf.common.datadelivery.registry.Parameter.class, com.raytheon.uf.common.datadelivery.registry.ParameterLevel.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.Provider.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.retrieval.xml.ParameterLookup.class, com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterConfig.class, diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/util/FindActiveSubscriptionsForRouteTest.java b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/util/FindActiveSubscriptionsForRouteTest.java index 3a69cacd5f..1972173e07 100644 --- a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/util/FindActiveSubscriptionsForRouteTest.java +++ b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/util/FindActiveSubscriptionsForRouteTest.java @@ -31,7 +31,7 @@ import org.junit.Test; import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Subscription; 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.ISubscriptionHandler; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; @@ -64,15 +64,15 @@ public class FindActiveSubscriptionsForRouteTest { .getSubscriptionHandler(); // Two OPSNET subscriptions - final UserSubscription opsnetSub1 = new SubscriptionBuilder() + final SiteSubscription opsnetSub1 = new SubscriptionBuilder() .withName("opsnetSub1").withRoute(Network.OPSNET).build(); - final UserSubscription opsnetSub2 = new UserSubscription(opsnetSub1, + final SiteSubscription opsnetSub2 = new SiteSubscription(opsnetSub1, "opsnetSub2"); // Two SBN subscriptions - final UserSubscription sbnSub1 = new SubscriptionBuilder() + final SiteSubscription sbnSub1 = new SubscriptionBuilder() .withName("sbnSub1").withRoute(Network.SBN).build(); - final UserSubscription sbnSub2 = new UserSubscription(sbnSub1, + final SiteSubscription sbnSub2 = new SiteSubscription(sbnSub1, "sbnSub2"); // Store all subscriptions diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPRetrievalGeneratorTest.java b/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPRetrievalGeneratorTest.java index a0d34288e7..963b66a906 100644 --- a/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPRetrievalGeneratorTest.java +++ b/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPRetrievalGeneratorTest.java @@ -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.Subscription; 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; /** @@ -61,7 +61,7 @@ public class OpenDAPRetrievalGeneratorTest { Time time = new Time(); time.setCycleTimes(Arrays.asList(0, 12)); - UserSubscription subscription = new UserSubscription(); + SiteSubscription subscription = new SiteSubscription(); subscription.setTime(time); GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE @@ -77,7 +77,7 @@ public class OpenDAPRetrievalGeneratorTest { Time time = new Time(); time.setCycleTimes(Arrays.asList(0, 12)); - UserSubscription subscription = new UserSubscription(); + SiteSubscription subscription = new SiteSubscription(); subscription.setTime(time); GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE @@ -93,7 +93,7 @@ public class OpenDAPRetrievalGeneratorTest { Time time = new Time(); time.setCycleTimes(Arrays.asList(0, 12)); - Subscription subscription = new UserSubscription(); + Subscription subscription = new SiteSubscription(); subscription.setTime(time); GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE @@ -110,7 +110,7 @@ public class OpenDAPRetrievalGeneratorTest { time.setCycleTimes(Arrays . asList(GriddedDataSetMetaData.NO_CYCLE)); - Subscription subscription = new UserSubscription(); + Subscription subscription = new SiteSubscription(); subscription.setTime(time); GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE diff --git a/tests/unit/com/raytheon/uf/viz/core/notification/NotificationMessageContainsTypeTest.java b/tests/unit/com/raytheon/uf/viz/core/notification/NotificationMessageContainsTypeTest.java index ef720396e8..d9ddda8b28 100644 --- a/tests/unit/com/raytheon/uf/viz/core/notification/NotificationMessageContainsTypeTest.java +++ b/tests/unit/com/raytheon/uf/viz/core/notification/NotificationMessageContainsTypeTest.java @@ -32,7 +32,7 @@ import org.junit.BeforeClass; import org.junit.Test; import com.raytheon.uf.common.datadelivery.registry.SharedSubscription; -import com.raytheon.uf.common.datadelivery.registry.UserSubscription; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; import com.raytheon.uf.common.serialization.SerializationUtil; /** @@ -62,7 +62,7 @@ public class NotificationMessageContainsTypeTest { @BeforeClass public static void classSetUp() throws JMSException, JAXBException { when(message.getText()).thenReturn( - SerializationUtil.marshalToXml(new UserSubscription())); + SerializationUtil.marshalToXml(new SiteSubscription())); } @Test @@ -70,7 +70,7 @@ public class NotificationMessageContainsTypeTest { throws JMSException, JAXBException { NotificationMessageContainsType condition = new NotificationMessageContainsType( - String.class, UserSubscription.class); + String.class, SiteSubscription.class); assertThat( condition .matchesCondition(new NotificationMessage[] { notificationMessage }), @@ -82,7 +82,7 @@ public class NotificationMessageContainsTypeTest { JAXBException { NotificationMessageContainsType condition = new NotificationMessageContainsType( - UserSubscription.class); + SiteSubscription.class); assertThat( condition .matchesCondition(new NotificationMessage[] { notificationMessage }), diff --git a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionServiceMassUpdateTest.java b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionServiceMassUpdateTest.java index 4c7c22cf63..ea9ac7ecd0 100644 --- a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionServiceMassUpdateTest.java +++ b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionServiceMassUpdateTest.java @@ -36,7 +36,7 @@ import org.junit.Before; import org.junit.Test; 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.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; @@ -340,6 +340,6 @@ public class SubscriptionServiceMassUpdateTest extends when( DataDeliveryHandlers.getPendingSubscriptionHandler() .getBySubscription(subscription)).thenReturn( - new InitialPendingUserSubscription()); + new InitialPendingSiteSubscription()); } } diff --git a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionPresenterTest.java b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionPresenterTest.java index 375e46ccf4..0cd2cd2e8b 100644 --- a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionPresenterTest.java +++ b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionPresenterTest.java @@ -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.SubscriptionBuilder; 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.time.CalendarBuilder; 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. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Apr 08, 2013 1826 djohnson Remove delivery options. + * May 15, 2013 1040 mpduff Remove method. * * * @@ -197,7 +198,7 @@ public class CreateSubscriptionPresenterTest { cal.add(Calendar.YEAR, -1); Date oneYearAgo = cal.getTime(); - UserSubscription subscription = new SubscriptionBuilder() + SiteSubscription subscription = new SubscriptionBuilder() .withActivePeriodStart(oneYearAgo) .withActivePeriodEnd(oneYearAgo).build(); @@ -221,7 +222,7 @@ public class CreateSubscriptionPresenterTest { // Freeze time at Jan. 5 TimeUtilTest.freezeTime(yesterday.getTime() + TimeUtil.MILLIS_PER_DAY); - UserSubscription subscription = new SubscriptionBuilder() + SiteSubscription subscription = new SubscriptionBuilder() .withActivePeriodStart(yesterday) .withActivePeriodEnd(yesterday).build(); @@ -254,7 +255,7 @@ public class CreateSubscriptionPresenterTest { cal.add(Calendar.DAY_OF_MONTH, 3); Date threeDaysFromNow = cal.getTime(); - UserSubscription subscription = new SubscriptionBuilder() + SiteSubscription subscription = new SubscriptionBuilder() .withActivePeriodStart(yesterday) .withActivePeriodEnd(threeDaysFromNow).build(); @@ -281,7 +282,7 @@ public class CreateSubscriptionPresenterTest { cal2.add(Calendar.DAY_OF_YEAR, 3); Date oneYearAgoPlusThreeDays = cal2.getTime(); - UserSubscription subscription = new SubscriptionBuilder() + SiteSubscription subscription = new SubscriptionBuilder() .withActivePeriodStart(oneYearAgo) .withActivePeriodEnd(oneYearAgoPlusThreeDays).build(); @@ -313,7 +314,7 @@ public class CreateSubscriptionPresenterTest { cal2.set(Calendar.YEAR, 1970); Date januaryFourth = cal2.getTime(); - UserSubscription subscription = new SubscriptionBuilder() + SiteSubscription subscription = new SubscriptionBuilder() .withActivePeriodStart(decemberThirtieth) .withActivePeriodEnd(januaryFourth).build(); @@ -377,7 +378,7 @@ public class CreateSubscriptionPresenterTest { cal2.set(Calendar.YEAR, 1970); final Date endDate = cal2.getTime(); - UserSubscription subscription = new SubscriptionBuilder() + SiteSubscription subscription = new SubscriptionBuilder() .withActivePeriodStart(startDate).withActivePeriodEnd(endDate) .build(); @@ -395,16 +396,9 @@ public class CreateSubscriptionPresenterTest { argThat(yyyyMmDdMatches(januaryFirstYearLater))); } - @Test - public void verifySubscriptionSetToView() { - presenter.open(); - verify(view).setSubscription(presenter.getSubscription()); - } - @Test public void verifyCycleTimesSetToView() { presenter.open(); verify(view).setCycleTimes(dataSet.getCycles()); } - } diff --git a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/RuleXMLTest.java b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/RuleXMLTest.java index c52895e023..83631c5501 100644 --- a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/RuleXMLTest.java +++ b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/RuleXMLTest.java @@ -30,7 +30,7 @@ import org.junit.Test; import com.raytheon.uf.common.datadelivery.registry.DataType; 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.viz.datadelivery.system.CreateEditRuleDlg.FreqUnitOptions; import com.raytheon.uf.viz.datadelivery.system.Operator; @@ -64,7 +64,7 @@ public class RuleXMLTest { @Before public void setUp() { - sub = new UserSubscription(); + sub = new SiteSubscription(); sub.setDataSetName("GFS"); sub.setDataSetType(DataType.GRID); sub.setDataSetSize(100);