diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index e6fcec3db6..7edd9aeacb 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1140,6 +1140,7 @@ create_website_step7_title=Step Seven - Email Users create_website_step7_desc=Notify the website users. create_website_finish_instruction=To close this wizard and create your web project space click Finish. To review or change your selections click Back. create_website_summary_users=Users and Roles +server_already_exist=Server with name {0} already exists. edit_website_title=Edit Web Project Wizard edit_website_desc=This wizard helps you modify the settings for a web project space. edit_website_finish_instruction=To close this wizard and save the modified settings for your web project space click Finish. To review or change your selections click Back. diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index f18622c8e7..addff0e405 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -25,6 +25,7 @@ package org.alfresco.web.bean.wcm; import java.io.Serializable; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -87,6 +88,7 @@ public class CreateWebsiteWizard extends BaseWizardBean private static final long serialVersionUID = 6480869380508635173L; private static final String MSG_USERROLES = "create_website_summary_users"; + private static final String MSG_SERVER_ALREADY_EXIST = "server_already_exist"; private static final String COMPONENT_FORMLIST = "form-list"; private static final String COMPONENT_WORKFLOWLIST = "workflow-list"; @@ -1147,6 +1149,36 @@ public class CreateWebsiteWizard extends BaseWizardBean public String saveDeploymentServerConfig() { + String currentServerName = (String) editedDeployServerProps.get(DeploymentServerConfig.PROP_NAME); + if (currentServerName == null ||currentServerName.length() == 0) + { + currentServerName = "" + editedDeployServerProps.get(DeploymentServerConfig.PROP_HOST)+ ":" + editedDeployServerProps.get(DeploymentServerConfig.PROP_PORT); + } + for (DeploymentServerConfig server: deployServersList) + { + if (!server.getId().equals(currentDeployServer.getId())) + { + Map serverProps = server.getProperties(); + String serverName = (String) serverProps.get(DeploymentServerConfig.PROP_NAME); + if (serverName == null ||serverName.length() == 0) + { + serverName = "" + serverProps.get(DeploymentServerConfig.PROP_HOST)+ ":" + serverProps.get(DeploymentServerConfig.PROP_PORT); + } + + if (currentServerName.equals(serverName)) + { + if (this.inAddDeployServerMode) + { + this.deployServersList.remove(this.currentDeployServer); + this.deployServersMap.remove(this.currentDeployServer.getId()); + } + + Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), MSG_SERVER_ALREADY_EXIST), currentServerName)); + + return null; + } + } + } // set the edited properties this.currentDeployServer.setProperties(this.editedDeployServerProps);