aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-core/catalog-mgr/src
diff options
context:
space:
mode:
authorJian Huang <huang.jian12@zte.com.cn>2016-10-20 07:54:54 +0000
committerGerrit Code Review <gerrit@open-o.org>2016-10-20 07:54:54 +0000
commit20ac436c362d77ccc5b6fae6fecf90e5f0cc5ae6 (patch)
tree1758804d57a14d7b3513f14da7724cc48f50beee /catalog-core/catalog-mgr/src
parentdced0d872ab025e2e0cbfd06c3b5bedbfb0344c7 (diff)
parent6d3fbf27479d06d2daf52e4e8f7564787a4cd2c3 (diff)
Merge "Fix the bug "Repeat upload package has logic error"." into sun
Diffstat (limited to 'catalog-core/catalog-mgr/src')
-rw-r--r--catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java
index 1358674a..ab206916 100644
--- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java
+++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java
@@ -129,6 +129,15 @@ public class PackageWrapper {
boolean uploadResult = FileManagerFactory.createFileManager().upload(tempDirName, destPath);
if (uploadResult == true) {
PackageData packageData = PackageWrapperUtil.getPackageData(packageMeta);
+ ArrayList<PackageData> existPackageDatas =
+ PackageManager.getInstance().queryPackage(packageData.getName(),
+ packageData.getProvider(), packageData.getVersion(), null, packageData.getType());
+ if (null != existPackageDatas && existPackageDatas.size() > 0) {
+ LOG.warn("The package already exist ! Begin to delete the orgin data and reupload !");
+ for (int i = 0; i < existPackageDatas.size(); i++) {
+ this.delPackage(existPackageDatas.get(i).getCsarId());
+ }
+ }
packateDbData = PackageManager.getInstance().addPackage(packageData);
LOG.info("Store package data to database succed ! packateDbData = "
+ ToolUtil.objectToString(packateDbData));