diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2017-07-03 20:16:55 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2017-07-03 20:16:55 +0300 |
commit | 153a35821f0d25ce23cca467b76c5a7c5092c744 (patch) | |
tree | 0c66c4d1310019479e446ea3a4c26faffb0aa33f /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main | |
parent | ffdda7d685029d6a88ac82ac637e43bba96423cb (diff) |
[sdc] - last merges before moving to LF
Change-Id: I0df3ec795f0de84229ea4bb4806ec8f959243557
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index 2d1b62cd40..b145b38355 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -111,6 +111,7 @@ import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -119,7 +120,7 @@ import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager { - private static final String VALIDATION_VSP_ID = "validationOnlyVspId"; + private static String VALIDATION_VSP_ID = "validationOnlyVspId"; private static final String VALIDATION_VSP_NAME = "validationOnlyVspName"; //private static final String VALIDATION_VSP_USER = "validationOnlyVspUser"; @@ -412,15 +413,15 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa } VspDetails validationVsp = new VspDetails(); validationVsp.setName(VALIDATION_VSP_NAME); - validationVsp.setId(VALIDATION_VSP_ID); + + vspInfoDao.create(validationVsp); Version version = versioningManager.create( VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, - validationVsp.getId(), - user); + validationVsp.getId(), user); validationVsp.setVersion(version); - vspInfoDao.create(validationVsp); createUniqueName(VALIDATION_VSP_NAME); + VALIDATION_VSP_ID = validationVsp.getId(); return VALIDATION_VSP_ID; } @@ -792,16 +793,24 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private Map<String, List<ErrorMessage>> validateUploadData(UploadDataEntity uploadData) throws IOException { + + Map<String, List<ErrorMessage>> validationErrors = new HashMap<>(); if (uploadData == null || uploadData.getContentData() == null) { return null; } - FileContentHandler fileContentMap = - CommonUtil.loadUploadFileContent(uploadData.getContentData().array()); - //todo - check + FileContentHandler fileContentMap = new FileContentHandler(); + + try { + fileContentMap = + CommonUtil.loadUploadFileContent(uploadData.getContentData().array()); + } catch (Exception e){ + ErrorMessage errorMessage = new ErrorMessage(ErrorLevel.ERROR, e.getMessage()); + validationErrors.put("Upload file", Arrays.asList(errorMessage)); + } ValidationManager validationManager = ValidationManagerUtil.initValidationManager(fileContentMap); - Map<String, List<ErrorMessage>> validationErrors = validationManager.validate(); + validationErrors.putAll(validationManager.validate()); return MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, validationErrors)) |