diff options
author | YuanHu <yuan.hu1@zte.com.cn> | 2016-10-26 15:06:09 +0800 |
---|---|---|
committer | YuanHu <yuan.hu1@zte.com.cn> | 2016-10-26 15:07:25 +0800 |
commit | 985972be48f916fb79898f9a8afa698b7078ed30 (patch) | |
tree | e84df433f7c9ae616f2857e560f519fd224079a8 /catalog-core/catalog-mgr | |
parent | 678a9afb0339665afaf764ca51316f5fc3d7aed2 (diff) |
To delete the SubstitutionMapping Information when delete a csar package.
Change-Id: If8d88acdf9cbdbdfe0a3824c500e5c07fdfd7f7b
Issue-id: OCS-132
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'catalog-core/catalog-mgr')
-rw-r--r-- | catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/wrapper/PackageWrapper.java | 21 |
1 files changed, 15 insertions, 6 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 43e70919..8a882533 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 @@ -30,6 +30,8 @@ import org.openo.commontosca.catalog.entity.response.PackageMeta; import org.openo.commontosca.catalog.entity.response.UploadPackageResponse; import org.openo.commontosca.catalog.filemanage.FileManagerFactory; import org.openo.commontosca.catalog.model.parser.ModelParserFactory; +import org.openo.commontosca.catalog.model.service.ModelService; +import org.openo.commontosca.catalog.resources.CatalogBadRequestException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -227,18 +229,25 @@ public class PackageWrapper { } FileManagerFactory.createFileManager().delete(packagePath); // delete template data from db - PackageData packageData = new PackageData(); - packageData.setCsarId(csarId); try { - TemplateManager.getInstance().deleteServiceTemplateByCsarPackageInfo(packageData); - } catch (CatalogResourceException e2) { - LOG.error("delete template data from db error! csarId = " + csarId); + ModelService.getInstance().delete(csarId); + } catch (CatalogBadRequestException e) { + LOG.error("delete template data from db error! csarId = " + csarId, e); + } catch (CatalogResourceException e) { + LOG.error("delete template data from db error! csarId = " + csarId, e); } +// PackageData packageData = new PackageData(); +// packageData.setCsarId(csarId); +// try { +// TemplateManager.getInstance().deleteServiceTemplateByCsarPackageInfo(packageData); +// } catch (CatalogResourceException e2) { +// LOG.error("delete template data from db error! csarId = " + csarId); +// } //delete package data from database try { PackageManager.getInstance().deletePackage(csarId); } catch (CatalogResourceException e1) { - LOG.error("delete package by csarId from db error ! " + e1.getMessage()); + LOG.error("delete package by csarId from db error ! " + e1.getMessage(), e1); } } |