@retval false Any one of name, guid and version is invalid\r
\r
**/\r
- private boolean checkId() {\r
+ private boolean checkId(int mode) {\r
+ String name = this.jTextFieldBaseName.getText();\r
+ String guid = this.jTextFieldGuid.getText();\r
+ String version = this.jTextFieldVersion.getText();\r
+ \r
//\r
// Check Basename\r
//\r
- if (isEmpty(this.jTextFieldBaseName.getText())) {\r
+ if (isEmpty(name)) {\r
Log.wrn("Clone", "The Name is required!");\r
return false;\r
}\r
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\r
+ if (!DataValidation.isBaseName(name)) {\r
Log\r
.wrn("Clone",\r
"<html>Incorrect data type for the Name, it must<br>be a single word, starting with an alpha character.</html>");\r
//\r
// Check Guid\r
//\r
- if (isEmpty(this.jTextFieldGuid.getText())) {\r
+ if (isEmpty(guid)) {\r
Log.wrn("Clone", "A Guid is required!!");\r
return false;\r
}\r
- if (!DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
+ if (!DataValidation.isGuid(guid)) {\r
Log\r
.wrn(\r
"Clone",\r
//\r
// Check Version\r
//\r
- if (isEmpty(this.jTextFieldVersion.getText())) {\r
+ if (isEmpty(version)) {\r
Log.wrn("Clone", "A Version must be entered!");\r
return false;\r
}\r
- if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {\r
+ if (!DataValidation.isVersion(version)) {\r
Log\r
.wrn(\r
"Clone",\r
"<html>Incorrect data type for Version, which must<br>be one or more digits, optionally followed by sequence<br>of one or more dot, one or more digits; examples:<br>1.0 1.0.1 12.25.256</html>");\r
return false;\r
}\r
+ \r
+ if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
+ String packageGuid = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getGuid();\r
+ String packageVersion = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getVersion();\r
+ if (GlobalData.findModuleIdByGuidVersion(guid, version, packageGuid, packageVersion) != null) {\r
+ Log.wrn("Clone", "A module with same Guid and same Version already exists, please selece a new Guid or Version!");\r
+ return false;\r
+ }\r
+ }\r
+\r
+ if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
+ if (GlobalData.findPackageIdByGuidVersion(guid, version) != null) {\r
+ Log.wrn("Clone", "A package with same Guid and same Version already exists, please selece a new Guid or Version!");\r
+ return false;\r
+ }\r
+ }\r
+\r
+ if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
+ if (GlobalData.findPlatformIdByGuidVersion(guid, version) != null) {\r
+ Log.wrn("Clone", "A platform with same Guid and same Version already exists, please selece a new Guid or Version!");\r
+ return false;\r
+ }\r
+ }\r
\r
//\r
// Save information to id\r
//\r
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
trg = this.getModulePath();\r
- if (src.equals(trg)) {\r
+ if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {\r
Log.wrn("Clone", "The source and destination paths for cloning a module must be different!");\r
return false;\r
}\r
Log.wrn("Clone", "The target module already exists!");\r
return false;\r
}\r
- return checkId();\r
+ return checkId(mode);\r
}\r
\r
//\r
Log.wrn("Clone", "The target package already exists!");\r
return false;\r
}\r
- return checkId();\r
+ return checkId(mode);\r
}\r
\r
//\r
Log.wrn("Clone", "The platform clone must be located in the current workspace!");\r
return false;\r
}\r
+ if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {\r
+ Log.wrn("Clone", "The source and destination paths for cloning a platform must be different!");\r
+ return false;\r
+ }\r
trgFile = new File(trg);\r
if (trgFile.exists()) {\r
Log.wrn("Clone", "The target platform already exists.");\r
return false;\r
}\r
- return checkId();\r
+ return checkId(mode);\r
}\r
\r
return true;\r