in PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.appservice/src/com/microsoft/azuretools/appservice/ui/AppServiceCreateDialog.java [1184:1256]
protected boolean validated() {
String webappName = model.getWebAppName();
if (webappName.length() > 60 || !webappName.matches(WEB_APP_NAME_REGEX)) {
setError(dec_textAppName, WEB_APP_NAME_INVALID_MSG);
return false;
} else {
for (WebApp wa : Azure.az(AzureAppService.class).subscription(model.getSubscriptionId()).webapps(false)) {
if (wa != null && wa.name().toLowerCase().equals(webappName.toLowerCase())) {
setError(dec_textAppName, NAME_ALREADY_TAKEN);
return false;
}
}
}
if (model.getSubscriptionId() == null || model.getSubscriptionId().isEmpty()) {
setError(dec_comboSubscription, SELECT_A_VALID_SUBSCRIPTION);
return false;
}
if (model.isCreatingAppServicePlan()) {
if (model.getAppServicePlanName().isEmpty()) {
setError(dec_textAppSevicePlanName, ENTER_APP_SERVICE_PLAN_NAME);
return false;
} else {
if (!model.getAppServicePlanName().matches(APP_SERVICE_PLAN_NAME_REGEX)) {
setError(dec_textAppSevicePlanName, APP_SERVICE_PLAN_NAME_INVALID_MSG);
return false;
}
// App service plan name must be unique in each subscription
List<AppServicePlan> appServicePlans = Azure.az(AzureAppService.class)
.appServicePlans(model.getSubscriptionId(), false);
for (AppServicePlan asp : appServicePlans) {
if (asp != null && StringUtils.equalsIgnoreCase(asp.name(), model.getAppServicePlanName())) {
setError(dec_textAppSevicePlanName, APP_SERVICE_PLAN_NAME_MUST_UNUQUE);
return false;
}
}
}
if (model.getRegion() == null || model.getRegion().isEmpty()) {
setError(dec_comboAppServicePlanLocation, SELECT_LOCATION);
return false;
}
} else {
if (model.getAppServicePlanId() == null || model.getAppServicePlanId().isEmpty()) {
setError(dec_comboAppServicePlan, SELECT_APP_SERVICE_PLAN);
return false;
}
}
if (model.isCreatingResGrp()) {
if (model.getResourceGroup() == null || model.getResourceGroup().isEmpty()) {
setError(dec_textNewResGrName, ENTER_RESOURCE_GROUP);
return false;
}
if (!model.getResourceGroup().matches(RESOURCE_GROUP_NAME_REGEX)) {
setError(dec_textNewResGrName, RESOURCE_GROUP_NAME_INVALID_MSG);
return false;
}
for (ResourceGroup rg : Azure.az(AzureGroup.class).list(model.getSubscriptionId(), false)) {
if (rg != null && StringUtils.equalsIgnoreCase(rg.getName(), model.getResourceGroup())) {
setError(dec_textNewResGrName, NAME_ALREADY_TAKEN);
return false;
}
}
} else {
if (model.getResourceGroup() == null || model.getResourceGroup().isEmpty()) {
setError(dec_comboSelectResGr, SELECT_RESOURCE_GROUP);
return false;
}
}
// todo: add validation for jboss, only v3 pricing is supported
return true;
}