Merge "Issue #2538 - Check for existing adhoc queries in registry. Peer review comments" into development
Former-commit-id:834c2ac8da
[formerly834c2ac8da
[formerly 83b799d6d2475898a547fa7763c5613bd1c163d9]] Former-commit-id:f0ebee3bb3
Former-commit-id:7d04b2e4ce
This commit is contained in:
commit
ad77be1b44
2 changed files with 39 additions and 17 deletions
|
@ -45,6 +45,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 16, 2012 mpduff Initial creation.
|
* Mar 16, 2012 mpduff Initial creation.
|
||||||
* Dec 17, 2012 1434 mpduff Don't allow underscores in name.
|
* Dec 17, 2012 1434 mpduff Don't allow underscores in name.
|
||||||
|
* Nov 14, 2013 2538 mpduff Check for same name entered.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -159,23 +160,25 @@ public class FileNameDlg extends CaveSWTDialog {
|
||||||
* OK Button action handler.
|
* OK Button action handler.
|
||||||
*/
|
*/
|
||||||
private boolean handleOk() {
|
private boolean handleOk() {
|
||||||
if ((nameTxt.getText() != null) && (!nameTxt.getText().isEmpty())
|
String name = nameTxt.getText().trim();
|
||||||
&& (!nameTxt.getText().contains("_"))) {
|
|
||||||
setReturnValue(nameTxt.getText());
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
String title;
|
|
||||||
String message;
|
|
||||||
if (nameTxt.getText() == null || nameTxt.getText().isEmpty()) {
|
|
||||||
title = "Name Required";
|
|
||||||
message = "Name required. A Subscription Name must be entered.";
|
|
||||||
} else {
|
|
||||||
title = "Name Invalid";
|
|
||||||
message = "Underscore is not a valid character for a subscription name.";
|
|
||||||
}
|
|
||||||
|
|
||||||
DataDeliveryUtils.showMessage(getShell(), SWT.OK, title, message);
|
String title;
|
||||||
return false;
|
String message;
|
||||||
|
if (name == null || name.isEmpty()) {
|
||||||
|
title = "Name Required";
|
||||||
|
message = "Name required. A Subscription Name must be entered.";
|
||||||
|
} else if (name.equals(origName)) {
|
||||||
|
title = "Different Name Required";
|
||||||
|
message = "A different name must be used.";
|
||||||
|
} else if (name.contains("_") || name.contains(" ")) {
|
||||||
|
title = "Name Invalid";
|
||||||
|
message = "Underscore/space is not a valid character for a subscription name.";
|
||||||
|
} else {
|
||||||
|
setReturnValue(name);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataDeliveryUtils.showMessage(getShell(), SWT.OK, title, message);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -54,10 +54,12 @@ import com.raytheon.uf.common.datadelivery.registry.PointDataSet;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||||
|
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
@ -133,6 +135,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
||||||
* Oct 15, 2013 2477 mpduff Remove debug code.
|
* Oct 15, 2013 2477 mpduff Remove debug code.
|
||||||
* Oct 23, 2013 2484 dhladky Unique ID for subscriptions updated.
|
* Oct 23, 2013 2484 dhladky Unique ID for subscriptions updated.
|
||||||
* Oct 25, 2013 2292 mpduff Move overlap processing to edex.
|
* Oct 25, 2013 2292 mpduff Move overlap processing to edex.
|
||||||
|
* Nov 14, 2013 2538 mpduff Added check for duplicate subscription.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mpduff
|
* @author mpduff
|
||||||
|
@ -498,6 +501,22 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
|
||||||
boolean valid = this.validated(false);
|
boolean valid = this.validated(false);
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
// Check for existing subscription
|
||||||
|
ISubscriptionHandler handler = RegistryObjectHandlers
|
||||||
|
.get(ISubscriptionHandler.class);
|
||||||
|
try {
|
||||||
|
if (handler.getByName(nameText.getText()) != null) {
|
||||||
|
String message = "A query with this name already exists.\n\nPlease enter a different query name.";
|
||||||
|
DataDeliveryUtils.showMessage(getShell(), SWT.ERROR,
|
||||||
|
"Duplicate Query Name", message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (RegistryHandlerException e) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"Unable to check for an existing subscription by name.",
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
|
||||||
AdhocSubscription as = createSubscription(new AdhocSubscription(),
|
AdhocSubscription as = createSubscription(new AdhocSubscription(),
|
||||||
Network.OPSNET);
|
Network.OPSNET);
|
||||||
|
|
Loading…
Add table
Reference in a new issue