diff options
author | 2016-10-26 15:06:09 +0800 | |
---|---|---|
committer | 2016-10-26 15:06:09 +0800 | |
commit | 0f4c8814e91030c7b994e8cc783a464e8f318f21 (patch) | |
tree | f50cf0eb64cdaa83b88f9d0bb19b71850d0bc0a7 /catalog-core/catalog-mgr | |
parent | 956eed828e744686bf0938b8583b83bf0b6a89ea (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); } } |