aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java6
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java246
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java267
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/model/Model.java8
4 files changed, 248 insertions, 279 deletions
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 8742de3..52d342f 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
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2019 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.
@@ -69,7 +69,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
private static final String GENERATOR_AAI_INVALID_SERVICE_VERSION =
"Cannot generate artifacts. Service version is incorrect";
- private AaiModelGenerator modelGenerator = new AaiModelGeneratorImpl();
+ private AaiModelGenerator modelGenerator = new AaiModelGenerator();
@Override
public GenerationData generateArtifact(byte[] csarArchive, List<Artifact> input,
diff --git a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java
index d3ddafd..91eb6a4 100644
--- a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java
+++ b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.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 (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.
@@ -21,13 +21,249 @@
package org.onap.aai.babel.xml.generator.api;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.List;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import org.onap.aai.babel.logging.ApplicationMsgs;
+import org.onap.aai.babel.logging.LogHelper;
import org.onap.aai.babel.xml.generator.XmlArtifactGenerationException;
+import org.onap.aai.babel.xml.generator.model.Model;
import org.onap.aai.babel.xml.generator.model.Resource;
import org.onap.aai.babel.xml.generator.model.Service;
+import org.onap.aai.babel.xml.generator.model.Widget;
+import org.onap.aai.babel.xml.generator.xsd.ModelElement;
+import org.onap.aai.babel.xml.generator.xsd.ModelElements;
+import org.onap.aai.babel.xml.generator.xsd.ModelVer;
+import org.onap.aai.babel.xml.generator.xsd.ModelVers;
+import org.onap.aai.babel.xml.generator.xsd.Relationship;
+import org.onap.aai.babel.xml.generator.xsd.RelationshipData;
+import org.onap.aai.babel.xml.generator.xsd.RelationshipList;
+import org.onap.aai.cl.api.Logger;
+import org.w3c.dom.DOMException;
-public interface AaiModelGenerator {
+/**
+ * Generates the A&AI XML models from the Service/Resource/Widget Java models.
+ */
+public class AaiModelGenerator {
+
+ private static Logger log = LogHelper.INSTANCE;
+
+ /**
+ * Method to generate the AAI model for a Service or Resource.
+ *
+ * @param model
+ * Java object model representing an AAI {@link Service} or {@link Resource} model
+ * @return XML representation of the model in String format
+ * @throws XmlArtifactGenerationException
+ */
+ public String generateModelFor(Model model) throws XmlArtifactGenerationException {
+ org.onap.aai.babel.xml.generator.xsd.Model aaiModel = createJaxbModel(model);
+ ModelElement baseWidget = addBaseWidgetRelation(model, aaiModel);
+ generateWidgetChildren(baseWidget, model.getWidgets());
+ return getModelAsString(aaiModel);
+ }
+
+ /**
+ * Create a JAXB Model from the supplied Service or Resource.
+ *
+ * @param model
+ * the Service or Resource containing the model details
+ * @return a new Model object based on the A&AI schema
+ */
+ private org.onap.aai.babel.xml.generator.xsd.Model createJaxbModel(Model model) {
+ log.debug(model.toString());
+
+ org.onap.aai.babel.xml.generator.xsd.Model aaiModel = new org.onap.aai.babel.xml.generator.xsd.Model();
+ aaiModel.setModelInvariantId(model.getModelId());
+ aaiModel.setModelType(model.getModelTypeName());
+
+ aaiModel.setModelVers(new ModelVers());
+ aaiModel.getModelVers().getModelVer().add(createModelVersion(model));
+
+ return aaiModel;
+ }
+
+ /**
+ * Create a new JAXB object representing the model-ver complex type, and populate this with the Model Version
+ * information.
+ *
+ * @param model
+ * the Service or Resource containing the version details
+ * @return a new ModelVer object
+ */
+ private ModelVer createModelVersion(Model model) {
+ ModelVer modelVer = new ModelVer();
+ modelVer.setModelDescription(model.getModelDescription());
+ modelVer.setModelName(model.getModelName());
+ modelVer.setModelVersion(model.getModelVersion());
+ modelVer.setModelVersionId(model.getModelNameVersionId());
+ modelVer.setModelElements(new ModelElements());
+ return modelVer;
+ }
+
+ /**
+ * Add base widget model element for the Service or Resource.
+ *
+ * @param model
+ * the Service or Resource containing the Model and child resources
+ * @param aaiModel
+ * the JAXB Model to populate
+ * @return a new ModelElement for the relationship to the base Widget
+ * @throws XmlArtifactGenerationException
+ */
+ private ModelElement addBaseWidgetRelation(Model model, org.onap.aai.babel.xml.generator.xsd.Model aaiModel)
+ throws XmlArtifactGenerationException {
+ ModelElement widgetElement = createWidgetRelationshipModelElement(model);
+ ModelVer modelVer = aaiModel.getModelVers().getModelVer().get(0);
+ modelVer.getModelElements().getModelElement().add(widgetElement);
+
+ // Add the child resources to the base widget model element list
+ List<ModelElement> modelElements = widgetElement.getModelElements().getModelElement();
+ for (Resource resource : model.getResources()) {
+ modelElements.add(createRelationshipModelElement(resource));
+ }
+
+ return widgetElement;
+ }
+
+ /**
+ * Create a model-element complex type storing the relationship to a Service or Resource model's base Widget.
+ *
+ * @param model
+ * the Service or Resource model storing the widget's relationship data
+ * @return a new Java object for the model-element type storing the Widget relationship
+ * @throws XmlArtifactGenerationException
+ */
+ private ModelElement createWidgetRelationshipModelElement(Model model) throws XmlArtifactGenerationException {
+ return createRelationshipModelElement(model.getDeleteFlag(), model.getWidgetId(),
+ model.getWidgetInvariantId());
+ }
+
+ /**
+ * Create a model-element complex type storing the relationship to a Resource model.
+ *
+ * @param resource
+ * the Resource model storing the relationship data
+ * @return a new Java object for the model-element type storing the relationship
+ * @throws XmlArtifactGenerationException
+ */
+ private ModelElement createRelationshipModelElement(Resource resource) {
+ return createRelationshipModelElement(resource.getDeleteFlag(), resource.getModelNameVersionId(),
+ resource.getModelId());
+ }
+
+ /**
+ * Create a model-element complex type storing the relationship to a Widget model.
+ *
+ * @param widget
+ * the Widget model storing the relationship data
+ * @return a new Java object for the model-element type storing the Widget relationship
+ */
+ private ModelElement createRelationshipModelElement(Widget widget) {
+ return createRelationshipModelElement(widget.getDeleteFlag(), widget.getId(), widget.getWidgetId());
+ }
+
+ /**
+ * Method to create the <model-element></model-element> holding the relationship value for a resource/widget model.
+ *
+ * @param newDataDelFlag
+ * new-data-del-flag (mapped from boolean to the string T or F)
+ * @param modelVersionId
+ * model-version-id
+ * @param modelInvariantId
+ * model-invariant-id
+ * @return a new Java object for the model-element type storing the relationship
+ */
+ private ModelElement createRelationshipModelElement(boolean newDataDelFlag, String modelVersionId,
+ String modelInvariantId) {
+ ModelElement relationshipModelElement = new ModelElement();
+ relationshipModelElement.setNewDataDelFlag(newDataDelFlag ? "T" : "F");
+ relationshipModelElement.setCardinality("unbounded");
+ relationshipModelElement.setModelElements(new ModelElements());
+ relationshipModelElement.setRelationshipList(createModelRelationship(modelVersionId, modelInvariantId));
+ return relationshipModelElement;
+ }
+
+ /**
+ * Create the Model Version relationship data.
+ *
+ * @param modelVersionId
+ * model-version-id
+ * @param modelInvariantId
+ * model-invariant-id
+ * @return a new RelationshipList object containing the model-ver relationships
+ */
+ private RelationshipList createModelRelationship(String modelVersionId, String modelInvariantId) {
+ Relationship relationship = new Relationship();
+ relationship.setRelatedTo("model-ver");
+ List<RelationshipData> relationshipDataList = relationship.getRelationshipData();
+ relationshipDataList.add(createRelationshipData("model-ver.model-version-id", modelVersionId));
+ relationshipDataList.add(createRelationshipData("model.model-invariant-id", modelInvariantId));
+
+ RelationshipList relationShipList = new RelationshipList();
+ relationShipList.getRelationship().add(relationship);
+ return relationShipList;
+ }
+
+ /**
+ * Create a new RelationshipData element for the given key/value pair.
+ *
+ * @param key
+ * relationship key
+ * @param value
+ * relationship value
+ * @return a new Java object representing the relationship-data complex type
+ */
+ private RelationshipData createRelationshipData(String key, String value) {
+ RelationshipData data = new RelationshipData();
+ data.setRelationshipKey(key);
+ data.setRelationshipValue(value);
+ return data;
+ }
+
+ /**
+ * 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 widgets
+ * Set of child widgets obtained from the tosca/widget definition
+ */
+ private void generateWidgetChildren(ModelElement parent, Collection<Widget> widgets) {
+ for (Widget widget : widgets) {
+ ModelElement childRelation = createRelationshipModelElement(widget);
+ parent.getModelElements().getModelElement().add(childRelation);
+ // Recursive call to create any child widgets.
+ generateWidgetChildren(childRelation, widget.getWidgets());
+ }
+ }
- public String generateModelFor(Service service) throws XmlArtifactGenerationException;
+ /**
+ * JAXB marshalling helper method to convert the Java object model to XML String.
+ *
+ * @param model
+ * Java Object model of a service/widget/resource
+ * @return XML representation of the Java model in String format
+ */
+ private String getModelAsString(org.onap.aai.babel.xml.generator.xsd.Model model) {
+ JAXBContext jaxbContext;
+ StringWriter modelStringWriter = new StringWriter();
+ try {
+ jaxbContext = JAXBContext.newInstance(org.onap.aai.babel.xml.generator.xsd.Model.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
+ jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING, "US-ASCII");
+ jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
+ jaxbMarshaller.marshal(model, modelStringWriter);
+ } catch (JAXBException jaxbException) {
+ log.error(ApplicationMsgs.INVALID_CSAR_FILE, jaxbException);
+ throw new DOMException(DOMException.SYNTAX_ERR, jaxbException.getMessage());
+ }
- public String generateModelFor(Resource resource) throws XmlArtifactGenerationException;
+ return modelStringWriter.toString();
+ }
}
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
deleted file mode 100644
index 5c6488c..0000000
--- a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.aai.babel.xml.generator.api;
-
-import java.io.StringWriter;
-import java.util.List;
-import java.util.Set;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import org.onap.aai.babel.logging.ApplicationMsgs;
-import org.onap.aai.babel.logging.LogHelper;
-import org.onap.aai.babel.xml.generator.XmlArtifactGenerationException;
-import org.onap.aai.babel.xml.generator.model.Resource;
-import org.onap.aai.babel.xml.generator.model.Service;
-import org.onap.aai.babel.xml.generator.model.Widget;
-import org.onap.aai.babel.xml.generator.xsd.Model;
-import org.onap.aai.babel.xml.generator.xsd.ModelElement;
-import org.onap.aai.babel.xml.generator.xsd.ModelElements;
-import org.onap.aai.babel.xml.generator.xsd.ModelVer;
-import org.onap.aai.babel.xml.generator.xsd.ModelVers;
-import org.onap.aai.babel.xml.generator.xsd.Relationship;
-import org.onap.aai.babel.xml.generator.xsd.RelationshipData;
-import org.onap.aai.babel.xml.generator.xsd.RelationshipList;
-import org.onap.aai.cl.api.Logger;
-import org.w3c.dom.DOMException;
-
-/**
- * Implementation of the {@link AaiModelGenerator} which generates the XML models from the Service/Resource/Widget java
- * models.
- */
-public class AaiModelGeneratorImpl implements AaiModelGenerator {
- private static Logger log = LogHelper.INSTANCE;
-
- /**
- * Method to generate the AAI model for a Service.
- *
- * @param service
- * Java object model representing an AAI {@link Service} model
- * @return XML representation of the service model in String format
- * @throws XmlArtifactGenerationException
- */
- @Override
- public String generateModelFor(Service service) throws XmlArtifactGenerationException {
- // Create a JAXB Model for AAI service model
- Model aaiServiceModel = new Model();
- log.debug("Generating Model for Service with ModelName: " + service.getModelName());
- // after new model
- aaiServiceModel.setModelInvariantId(service.getModelId());
- aaiServiceModel.setModelVers(new ModelVers());
- ModelVer modelVer = new ModelVer();
- modelVer.setModelDescription(service.getModelDescription());
- modelVer.setModelName(service.getModelName());
- modelVer.setModelVersion(service.getModelVersion());
- modelVer.setModelVersionId(service.getModelNameVersionId());
- modelVer.setModelElements(new ModelElements());
- ModelElements modelElements = modelVer.getModelElements();
- // Populate basic model details
- aaiServiceModel.setModelType(service.getModelTypeName());
- List<ModelElement> modelElementList = modelElements.getModelElement();
-
- // Add service base widget model element
- ModelElement serviceWidgetModelRelationshipElement = createRelationshipModelElement(
- getNewDataDelFlagValue(service.getDeleteFlag()), service.getWidgetId(), service.getWidgetInvariantId());
- modelElementList.add(serviceWidgetModelRelationshipElement);
-
- // Add the resource model elements
- ModelElements serviceModelElements = serviceWidgetModelRelationshipElement.getModelElements();
- List<ModelElement> serviceModelElementList = serviceModelElements.getModelElement();
- Set<Resource> serviceResources = service.getResources();
- if (serviceResources != null && !serviceResources.isEmpty()) {
- for (Resource resourceModel : serviceResources) {
- ModelElement aaiResourceModelElement =
- createRelationshipModelElement(getNewDataDelFlagValue(resourceModel.getDeleteFlag()),
- resourceModel.getModelNameVersionId(), resourceModel.getModelId());
- serviceModelElementList.add(aaiResourceModelElement);
- }
- }
-
- // Add the widget model elements
- Set<Widget> serviceWidgets = service.getWidgets();
- if (serviceWidgets != null && !serviceWidgets.isEmpty()) {
- for (Widget widgetModel : serviceWidgets) {
- ModelElement widgetModelElement =
- createRelationshipModelElement(getNewDataDelFlagValue(widgetModel.getDeleteFlag()),
- widgetModel.getId(), widgetModel.getWidgetId());
- serviceModelElementList.add(widgetModelElement);
- }
- }
- ModelVers modelVers = aaiServiceModel.getModelVers();
- List<ModelVer> modelVerList = modelVers.getModelVer();
- modelVerList.add(modelVer);
- return getModelAsString(aaiServiceModel);
- }
-
- /**
- * Method to generate the AAI model for a Resource.
- *
- * @param resource
- * Java object model representing an AAI {@link Resource} model
- * @return XML representation of the resource model in String format
- * @throws XmlArtifactGenerationException
- */
- @Override
- public String generateModelFor(Resource resource) throws XmlArtifactGenerationException {
- // Create a JAXB Model for AAI Resource model
- Model aaiResourceModel = new Model();
- log.debug("Generating Model for Resource with ModelName: " + resource.getModelName());
- aaiResourceModel.setModelInvariantId(resource.getModelId());
- aaiResourceModel.setModelVers(new ModelVers());
- ModelVer modelVer = new ModelVer();
- modelVer.setModelDescription(resource.getModelDescription());
- modelVer.setModelName(resource.getModelName());
- modelVer.setModelVersion(resource.getModelVersion());
- modelVer.setModelVersionId(resource.getModelNameVersionId());
- modelVer.setModelElements(new ModelElements());
- ModelElements modelElements = modelVer.getModelElements();
- aaiResourceModel.setModelType(resource.getModelTypeName());
- List<ModelElement> modelElementList = modelElements.getModelElement();
-
- // Add resource base widget model element
- ModelElement resourceWidgetModelRelationshipElement =
- createRelationshipModelElement(getNewDataDelFlagValue(resource.getDeleteFlag()), resource.getWidgetId(),
- resource.getWidgetInvariantId());
- modelElementList.add(resourceWidgetModelRelationshipElement);
-
- // Add the child resources to the base widget model element list
- ModelElements baseResourceWidgetModelElements = resourceWidgetModelRelationshipElement.getModelElements();
- List<ModelElement> baseResourceWidgetModelElementList = baseResourceWidgetModelElements.getModelElement();
- Set<Resource> childResources = resource.getResources();
- if (childResources != null && !childResources.isEmpty()) {
- for (Resource childResourceModel : childResources) {
- ModelElement aaiChildResourceModelElement =
- createRelationshipModelElement(getNewDataDelFlagValue(childResourceModel.getDeleteFlag()),
- childResourceModel.getModelNameVersionId(), childResourceModel.getModelId());
- baseResourceWidgetModelElementList.add(aaiChildResourceModelElement);
- }
- }
- // Add resource widgets/resources to the resource widget model relationship element
- Set<Widget> resourceWidgets = resource.getWidgets();
- if (resourceWidgets != null && !resourceWidgets.isEmpty()) {
- generateWidgetChildren(resourceWidgetModelRelationshipElement, resourceWidgets);
- }
-
- ModelVers modelVers = aaiResourceModel.getModelVers();
- List<ModelVer> modelVerList = modelVers.getModelVer();
- modelVerList.add(modelVer);
- return getModelAsString(aaiResourceModel);
- }
-
- /**
- * 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
- * @return Java object representation for the <model-element></model-element> holding the relationship
- */
- private ModelElement createRelationshipModelElement(String newDataDelFlag, String modelVersionId,
- String modelInvariantId) {
- ModelElement relationshipModelElement = new ModelElement();
- relationshipModelElement.setNewDataDelFlag(newDataDelFlag); // Set new-data-del-flag value
- relationshipModelElement.setCardinality("unbounded");
- RelationshipList relationShipList = new RelationshipList();
- final List<Relationship> relationships = relationShipList.getRelationship();
- Relationship relationship = new Relationship();
- relationship.setRelatedTo("model-ver");
- List<RelationshipData> relationshipDataList = relationship.getRelationshipData();
-
- RelationshipData modelVersionRelationshipData = new RelationshipData();
- modelVersionRelationshipData.setRelationshipKey("model-ver.model-version-id");
- modelVersionRelationshipData.setRelationshipValue(modelVersionId); // Set the widget/resource name-version-uuid
- // as value
- relationshipDataList.add(modelVersionRelationshipData);
- RelationshipData modelInvariantRelationshipData = new RelationshipData();
- modelInvariantRelationshipData.setRelationshipKey("model.model-invariant-id");
- modelInvariantRelationshipData.setRelationshipValue(modelInvariantId);
- relationshipDataList.add(modelInvariantRelationshipData);
- relationships.add(relationship);
- relationshipModelElement.setRelationshipList(relationShipList);
- relationshipModelElement.setModelElements(new ModelElements());
- return relationshipModelElement;
- }
-
- /**
- * 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
- */
- private void generateWidgetChildren(ModelElement parent, Set<Widget> widgetChildrenSet) {
- for (Widget widget : widgetChildrenSet) {
- Set<Widget> widgetSubChildren = widget.getWidgets();
- if (widgetSubChildren != null && !widgetSubChildren.isEmpty()) {
- ModelElement widgetChildRelationshipElement = createRelationshipModelElement(
- getNewDataDelFlagValue(widget.getDeleteFlag()), widget.getId(), widget.getWidgetId());
- // Recursive call for getting the children of widgets (if any)
- generateWidgetChildren(widgetChildRelationshipElement, widgetSubChildren);
- parent.getModelElements().getModelElement().add(widgetChildRelationshipElement);
- } else {
- ModelElement widgetChildRelationshipElement = createRelationshipModelElement(
- getNewDataDelFlagValue(widget.getDeleteFlag()), widget.getId(), widget.getWidgetId());
- parent.getModelElements().getModelElement().add(widgetChildRelationshipElement);
- }
- }
- }
-
- /**
- * Converts the data delete flag value from boolean to String as per AAI model.
- *
- * @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) {
- 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
- * @return XML representation of the Java model in String format
- */
- private String getModelAsString(Model model) {
- JAXBContext jaxbContext;
- StringWriter modelStringWriter = new StringWriter();
- try {
- jaxbContext = JAXBContext.newInstance(Model.class);
- Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
- jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING, "US-ASCII");
- jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
- jaxbMarshaller.marshal(model, modelStringWriter);
- } catch (JAXBException jaxbException) {
- log.error(ApplicationMsgs.INVALID_CSAR_FILE, jaxbException);
- throw new DOMException(DOMException.SYNTAX_ERR, jaxbException.getMessage());
- }
-
- return modelStringWriter.toString();
- }
-}
diff --git a/src/main/java/org/onap/aai/babel/xml/generator/model/Model.java b/src/main/java/org/onap/aai/babel/xml/generator/model/Model.java
index c67d67f..12f1ac8 100644
--- a/src/main/java/org/onap/aai/babel/xml/generator/model/Model.java
+++ b/src/main/java/org/onap/aai/babel/xml/generator/model/Model.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2019 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.
@@ -99,9 +99,9 @@ public abstract class Model {
public abstract void populate(Model model, String value);
}
- private String modelId;
+ private String modelId; // model-invariant-id
private String modelName;
- private String modelNameVersionId;
+ private String modelNameVersionId; // model-version-id
private String modelVersion;
private String modelDescription;