From 985972be48f916fb79898f9a8afa698b7078ed30 Mon Sep 17 00:00:00 2001 From: YuanHu Date: Wed, 26 Oct 2016 15:06:09 +0800 Subject: To delete the SubstitutionMapping Information when delete a csar package. Change-Id: If8d88acdf9cbdbdfe0a3824c500e5c07fdfd7f7b Issue-id: OCS-132 Signed-off-by: YuanHu --- .../commontosca/catalog/wrapper/PackageWrapper.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'catalog-core/catalog-mgr/src') 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); } } -- cgit 1.2.3-korg