You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/04/16 22:06:43 UTC
[incubator-hop] branch master updated: HOP-2770 Projects with same
name must not be permitted
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new 1aaad79 HOP-2770 Projects with same name must not be permitted
new ab6621d Merge pull request #751 from sramazzina/HOP-2770
1aaad79 is described below
commit 1aaad7976e764a1869310c8d06a1bf5d08415608
Author: sergio.ramazzina <se...@serasoft.it>
AuthorDate: Fri Apr 16 21:35:58 2021 +0200
HOP-2770 Projects with same name must not be permitted
---
.../java/org/apache/hop/projects/project/ProjectDialog.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ProjectDialog.java b/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ProjectDialog.java
index 318526e..07206c6 100644
--- a/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ProjectDialog.java
+++ b/plugins/misc/projects/src/main/java/org/apache/hop/projects/project/ProjectDialog.java
@@ -24,6 +24,7 @@ import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.core.variables.Variables;
import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.projects.config.ProjectsConfig;
import org.apache.hop.projects.config.ProjectsConfigSingleton;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.dialog.BaseDialog;
@@ -478,6 +479,16 @@ public class ProjectDialog extends Dialog {
if (StringUtils.isEmpty(projectName)) {
throw new HopException("Please give your new project a name");
}
+
+ // Check if project name is unique otherwise force the user to change it!
+ ProjectsConfig prjsCfg = ProjectsConfigSingleton.getConfig();
+ List<String> prjs = prjsCfg.listProjectConfigNames();
+ for (String prj : prjs) {
+ if (projectName.equals(prj)) {
+ throw new HopException("Project '" + projectName + "' already exists. Project name must be unique!");
+ }
+ }
+
if (StringUtils.isNotEmpty(originalName)) {
if (!projectName.equals(originalName)) {
wName.setText(originalName);