X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Fxml%2Fgenerator%2FModelGenerator.java;h=8daa16555680696ea611cbc9899c3a4ed08bb4fe;hb=d2215b5d8b6c8976a9540a9e4706c7bebca80aa2;hp=dcd0f3e27c51d2e25dd2693a278d6e5ec03ce1c6;hpb=716e7f240c2f4a71d48e7708aa27194db2dd7f21;p=aai%2Fbabel.git diff --git a/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java index dcd0f3e..8daa165 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java @@ -1,9 +1,9 @@ /** - * ============LICENSE_START======================================================= + * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.babel.xml.generator; import java.util.Base64; @@ -38,7 +39,7 @@ import org.onap.aai.babel.xml.generator.data.GroupType; import org.onap.aai.cl.api.Logger; /** - * This class is responsible for generating xml model artifacts from a collection of csar file artifacts + * This class is responsible for generating XML model artifacts from a collection of CSAR artifacts. */ public class ModelGenerator implements ArtifactGenerator { @@ -52,9 +53,11 @@ public class ModelGenerator implements ArtifactGenerator { * Invokes the TOSCA artifact generator API with the input artifacts. * * @param csarArchive - * @param csarArtifacts the input artifacts + * @param csarArtifacts + * the input artifacts * @return {@link List} of output artifacts - * @throws XmlArtifactGenerationException if there is an error trying to generate xml artifacts + * @throws XmlArtifactGenerationException + * if there is an error trying to generate XML artifacts */ @Override public List generateArtifacts(byte[] csarArchive, List csarArtifacts) @@ -64,8 +67,6 @@ public class ModelGenerator implements ArtifactGenerator { // Get the service version to pass into the generator String toscaVersion = csarArtifacts.get(0).getVersion(); - logger.debug( - "Getting the service version for Tosca Version of the yml file. The Tosca Version is " + toscaVersion); String serviceVersion = getServiceVersion(toscaVersion); logger.debug("The service version is " + serviceVersion); Map additionalParams = new HashMap<>(); @@ -91,9 +92,12 @@ public class ModelGenerator implements ArtifactGenerator { /** * Creates an instance of an input artifact for the generator. * - * @param payload the payload downloaded from SDC - * @param artifactName name of the artifact to create - * @param artifactVersion version of the artifact to create + * @param payload + * the payload downloaded from SDC + * @param artifactName + * name of the artifact to create + * @param artifactVersion + * version of the artifact to create * @return an {@link Artifact} object constructed from the payload and artifactInfo */ public static Artifact createArtifact(byte[] payload, String artifactName, String artifactVersion) { @@ -111,12 +115,10 @@ public class ModelGenerator implements ArtifactGenerator { } private static String getServiceVersion(String artifactVersion) { + logger.debug("Artifact version=" + artifactVersion); String serviceVersion; - try { - String[] versionParts = artifactVersion.split(VERSION_DELIMITER_REGEXP); - Integer majorVersion = Integer.parseInt(versionParts[0]); - + int majorVersion = Integer.parseInt(artifactVersion.split(VERSION_DELIMITER_REGEXP)[0]); serviceVersion = majorVersion + VERSION_DELIMITER + "0"; } catch (Exception e) { logger.warn(ApplicationMsgs.DISTRIBUTION_EVENT,