summaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorFrancis Toth <francis.toth@yoppworks.com>2020-04-24 10:31:36 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-05-03 11:07:52 +0000
commit43a1a1714aa08bf632faffd72f1791d59f02e59c (patch)
tree1fb62c3001b99ec4f405b9031b408b2f0be99483 /catalog-be/src
parentf52d4072ccb95b3a69b8f17b87ee44513167029e (diff)
Refactor CsarUtils::createCsar
Signed-off-by: Francis Toth <francis.toth@yoppworks.com> Change-Id: I41994c98515844030eed1d6f2756c9779e864cff Issue-ID: SDC-2812
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
index 6ecb51810e..85d0c78727 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
@@ -202,13 +202,12 @@ public class CsarUtils {
final String toscaBlock0 = createToscaBlock0(TOSCA_META_VERSION, CSAR_VERSION, createdBy, fileName);
byte[] toscaBlock0Byte = toscaBlock0.getBytes();
- Either<byte[], ResponseFormat> generateCsarZipResponse = generateCsarZip(csarBlock0Byte, toscaBlock0Byte, component, getFromCS, isInCertificationRequest);
-
- if (generateCsarZipResponse.isRight()) {
- return Either.right(generateCsarZipResponse.right().value());
- }
- loggerSupportability.log(LoggerSupportabilityActions.GENERATE_CSAR, StatusCode.COMPLETE,"Ended create Csar for component {} ",component.getName());
- return Either.left(generateCsarZipResponse.left().value());
+ return generateCsarZip(csarBlock0Byte, toscaBlock0Byte, component, getFromCS, isInCertificationRequest)
+ .left().map(responseFormat -> {
+ loggerSupportability.log(LoggerSupportabilityActions.GENERATE_CSAR, StatusCode.COMPLETE,
+ "Ended create Csar for component {} ", component.getName());
+ return responseFormat;
+ });
}
private Either<byte[], ResponseFormat> generateCsarZip(byte[] csarBlock0Byte, byte[] toscaBlock0Byte, Component component, boolean getFromCS, boolean isInCertificationRequest) {