diff options
Diffstat (limited to 'src/main/java')
6 files changed, 62 insertions, 49 deletions
diff --git a/src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java b/src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java index c2402cd..5e4f3c4 100644 --- a/src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java +++ b/src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright © 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.auth; import java.security.cert.X509Certificate; @@ -41,6 +42,7 @@ public class AAIMicroServiceAuth { /** * @param babelAuthConfig * @throws AAIAuthException + * if the Auth Policy cannot be loaded */ @Inject public AAIMicroServiceAuth(final BabelAuthConfig babelAuthConfig) throws AAIAuthException { diff --git a/src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java b/src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java index 7178810..7d18a40 100644 --- a/src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java +++ b/src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright © 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.logging; import com.att.eelf.i18n.EELFResourceManager; @@ -25,18 +26,18 @@ import org.onap.aai.cl.eelf.LogMessageEnum; public enum ApplicationMsgs implements LogMessageEnum { - DISTRIBUTION_EVENT, - MESSAGE_AUDIT, - MESSAGE_METRIC, - MISSING_REQUEST_ID, - PROCESS_REQUEST_ERROR, - INVALID_CSAR_FILE, - INVALID_REQUEST_JSON, - BABEL_REQUEST_PAYLOAD, - BABEL_RESPONSE_PAYLOAD, - LOAD_PROPERTIES, - PROCESSING_VNF_CATALOG_ERROR, - TEMP_FILE_ERROR, + DISTRIBUTION_EVENT, // + MESSAGE_AUDIT, // + MESSAGE_METRIC, // + MISSING_REQUEST_ID, // + PROCESS_REQUEST_ERROR, // + INVALID_CSAR_FILE, // + INVALID_REQUEST_JSON, // + BABEL_REQUEST_PAYLOAD, // + BABEL_RESPONSE_PAYLOAD, // + LOAD_PROPERTIES, // + PROCESSING_VNF_CATALOG_ERROR, // + TEMP_FILE_ERROR, // MISSING_SERVICE_METADATA; static { 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 f474321..bbd1ff3 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 @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright © 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; @@ -42,6 +43,7 @@ import org.onap.aai.cl.api.Logger; */ public class ModelGenerator implements ArtifactGenerator { + private static final Logger logger = LogHelper.INSTANCE; private static final String VERSION_DELIMITER = "."; @@ -52,9 +54,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<BabelArtifact> generateArtifacts(byte[] csarArchive, List<Artifact> csarArtifacts) @@ -89,9 +93,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) { diff --git a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java index 488faae..3bff7e7 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright © 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.api; import java.io.StringWriter; @@ -52,7 +53,8 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator { /** * Method to generate the AAI model for a Service. * - * @param service Java object model representing an AAI {@link Service} model + * @param service + * Java object model representing an AAI {@link Service} model * @return XML representation of the service model in String format */ @Override @@ -111,7 +113,8 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator { /** * Method to generate the AAI model for a Resource. * - * @param resource Java object model representing an AAI {@link Resource} model + * @param resource + * Java object model representing an AAI {@link Resource} model * @return XML representation of the resource model in String format */ @Override @@ -164,10 +167,11 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator { /** * Method to create the <model-element></model-element> holding the relationship value for a resource/widget model. * - * @param newDataDelFlag Value of the <new-data-del-flag></new-data-del-flag> attribute for a widget/resource in the - * model xml - * @param relationshipValue Value of the <relationship-value></relationship-value> attribute for the widget/resource - * in the model xml + * @param newDataDelFlag + * Value of the <new-data-del-flag></new-data-del-flag> attribute for a widget/resource in the model xml + * @param relationshipValue + * Value of the <relationship-value></relationship-value> attribute for the widget/resource in the model + * xml * @return Java object representation for the <model-element></model-element> holding the relationship */ private ModelElement createRelationshipModelElement(String newDataDelFlag, String modelVersionId, @@ -200,8 +204,10 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator { * Method to create the child model elements of the widget. Handles the generation of recursive child widget * elements (if any) * - * @param parent Reference to the parent widget model element - * @param widgetChildrenSet Set of children obtained from the tosca/widget definition + * @param parent + * Reference to the parent widget model element + * @param widgetChildrenSet + * Set of children obtained from the tosca/widget definition */ private void generateWidgetChildren(ModelElement parent, Set<Widget> widgetChildrenSet) { for (Widget widget : widgetChildrenSet) { @@ -223,21 +229,19 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator { /** * Converts the data delete flag value from boolean to String as per AAI model. * - * @param delFlag Boolean value as true/false from the annotation + * @param delFlag + * Boolean value as true/false from the annotation * @return Converted value to a flag as per AAI model */ private String getNewDataDelFlagValue(boolean delFlag) { - if (delFlag) { - return "T"; - } else { - return "F"; - } + return delFlag ? "T" : "F"; } /** * JAXB marshalling helper method to convert the Java object model to XML String. * - * @param model Java Object model of a service/widget/resource + * @param model + * Java Object model of a service/widget/resource * @return XML representation of the Java model in String format */ private String getModelAsString(Model model) { diff --git a/src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java b/src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java index 121bc19..dffff62 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java @@ -18,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.babel.xml.generator.model; import java.util.Collections; @@ -29,7 +30,7 @@ public class Resource extends Model { private Type type; private boolean deleteFlag; - private boolean isResource = true; + private boolean isResource = true; private Map<String, Object> properties = Collections.emptyMap(); Widget vserver = null; @@ -106,18 +107,17 @@ public class Resource extends Model { public boolean addWidget(Widget widget) { if (type == Type.VFMODULE) { if (widget.memberOf(members)) { - if (vserver == null && widget.getId().equals(new VServerWidget().getId())) { + if (vserver == null && widget instanceof VServerWidget) { addVserverWidget(widget); - } else if (widget.getId().equals(new LIntfWidget().getId())) { + } else if (widget instanceof LIntfWidget) { return addLIntfWidget(widget); - } else if (widget.getId().equals(new VolumeWidget().getId())) { + } else if (widget instanceof VolumeWidget) { addVolumeWidget(widget); return true; } - if (widget.getId().equals(new OamNetwork().getId())) { - return false; + if (!(widget instanceof OamNetwork)) { + return widgets.add(widget); } - return widgets.add(widget); } return false; } else { diff --git a/src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java b/src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java index 11a9612..be84526 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java @@ -114,8 +114,7 @@ public abstract class Widget extends Model { } public String getName() { - ModelWidget widgetModel = this.getClass().getAnnotation(ModelWidget.class); - return widgetModel.name(); + return this.getClass().getAnnotation(ModelWidget.class).name(); } /** |