X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Fxml%2Fgenerator%2Fapi%2FAaiArtifactGenerator.java;h=57e8a673f9258562a3ad52c11df22bd8dbaf0dac;hb=be30876e3a3872a7274c944995544836ff31913c;hp=19b3d80bce13cbf4e04ab507db6c69955a020f39;hpb=fc779f51a624bfddc68328bf3fd3c74594ef31f6;p=aai%2Fbabel.git diff --git a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java index 19b3d80..57e8a67 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java @@ -112,7 +112,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator { * * @param serviceVersion * @param csarHelper - * interface to the TOSCA parser + * interface to the TOSCA parser * @return the generated Artifacts (containing XML models) */ private GenerationData generateAllArtifacts(final String serviceVersion, ISdcCsarHelper csarHelper) { @@ -229,10 +229,9 @@ public class AaiArtifactGenerator implements ArtifactGenerator { if (model != null) { Metadata metadata = nodeTemplate.getMetaData(); - if (metadata != null && parser.hasAllottedResource(metadata.getAllProperties())) { - if (model.getWidgetType() == Type.VF) { - model = new Resource(Type.ALLOTTED_RESOURCE, true); - } + if (metadata != null && parser.hasAllottedResource(metadata.getAllProperties()) + && model.getWidgetType() == Type.VF) { + model = new Resource(Type.ALLOTTED_RESOURCE, true); } } @@ -242,6 +241,11 @@ public class AaiArtifactGenerator implements ArtifactGenerator { private void generateResourceModel(ISdcCsarHelper csarHelper, List resources, ArtifactGeneratorToscaParser parser, NodeTemplate nodeTemplate) { Resource resourceModel = getModelFor(parser, nodeTemplate); + if (resourceModel == null) { + log.info(ApplicationMsgs.DISTRIBUTION_EVENT, "Could not generate resource model"); + return; + } + Map serviceMetadata = nodeTemplate.getMetaData().getAllProperties(); resourceModel.populateModelIdentificationInformation(serviceMetadata); @@ -296,7 +300,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator { * Method to generate the artifact name for an AAI model. * * @param model - * AAI artifact model + * AAI artifact model * @return Model artifact name */ private String getArtifactName(Model model) { @@ -320,9 +324,9 @@ public class AaiArtifactGenerator implements ArtifactGenerator { * Create Resource artifact model from the AAI xml model string. * * @param resourceModel - * Model of the resource artifact + * Model of the resource artifact * @param aaiResourceModel - * AAI model as string + * AAI model as string * @return Generated {@link Artifact} model for the resource */ private Artifact getResourceArtifact(Model resourceModel, String aaiResourceModel) { @@ -352,9 +356,9 @@ public class AaiArtifactGenerator implements ArtifactGenerator { * Create Service artifact model from the AAI XML model. * * @param serviceModel - * Model of the service artifact + * Model of the service artifact * @param aaiServiceModel - * AAI model as string + * AAI model as string * @return Generated {@link Artifact} model for the service */ private Artifact getServiceArtifact(Service serviceModel, String aaiServiceModel) {