diff options
-rw-r--r-- | src/main/java/org/onap/aai/graphgraph/ModelExporter.java | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/aai/graphgraph/velocity/VelocityEntity.java | 9 | ||||
-rw-r--r-- | src/main/resources/model_export.vm | 3 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/onap/aai/graphgraph/ModelExporter.java b/src/main/java/org/onap/aai/graphgraph/ModelExporter.java index 60a4231..36070db 100644 --- a/src/main/java/org/onap/aai/graphgraph/ModelExporter.java +++ b/src/main/java/org/onap/aai/graphgraph/ModelExporter.java @@ -39,6 +39,7 @@ import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader; +import org.eclipse.jetty.util.StringUtil; import org.onap.aai.edges.EdgeRule; import org.onap.aai.edges.enums.DirectionNotation; import org.onap.aai.edges.enums.EdgeField; @@ -48,6 +49,7 @@ import org.onap.aai.graphgraph.velocity.VelocityAssociation; import org.onap.aai.graphgraph.velocity.VelocityEntity; import org.onap.aai.graphgraph.velocity.VelocityEntityProperty; import org.onap.aai.introspection.Introspector; +import org.onap.aai.schema.enums.ObjectMetadata; import org.onap.aai.setup.SchemaVersion; public class ModelExporter { @@ -150,6 +152,8 @@ public class ModelExporter { .filter(a -> a.getFromEntityId().equals(e.getId())).collect( Collectors.toList()); updateNeighbour(entityList, associations); + String description = allEntities.get(e.getName()).getMetadata(ObjectMetadata.DESCRIPTION); + e.setDescription(StringUtil.isBlank(description) ? "no description is available" : description); }); entityList.forEach(entity -> entity.setProperties(getPropertiesForEntity(allObjects.get(entity.getName()), entityList))); diff --git a/src/main/java/org/onap/aai/graphgraph/velocity/VelocityEntity.java b/src/main/java/org/onap/aai/graphgraph/velocity/VelocityEntity.java index 39b92d4..99f94f3 100644 --- a/src/main/java/org/onap/aai/graphgraph/velocity/VelocityEntity.java +++ b/src/main/java/org/onap/aai/graphgraph/velocity/VelocityEntity.java @@ -25,6 +25,7 @@ import java.util.Set; public class VelocityEntity extends VelocityId { private String name; + private String description; private List<VelocityAssociation> neighbours = new LinkedList<>(); private Set<VelocityEntityProperty> properties; @@ -36,6 +37,14 @@ public class VelocityEntity extends VelocityId { this.properties = properties; } + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public VelocityEntity(String name) { this.name = name; } diff --git a/src/main/resources/model_export.vm b/src/main/resources/model_export.vm index 184d21a..01e62d4 100644 --- a/src/main/resources/model_export.vm +++ b/src/main/resources/model_export.vm @@ -52,6 +52,9 @@ <packagedElement xmi:type="uml:Package" xmi:id="_rBN-QLIqEemXwfLFUQ7Icw" name="ObjectClasses"> #foreach($entity in $entityList) <packagedElement xmi:type="uml:Class" xmi:id="$entity.id" name="$entity.name"> + <ownedComment xmi:type="uml:Comment" xmi:id="$entity.randomId" annotatedElement="$entity.id"> + <body>$entity.description</body> + </ownedComment> #foreach($association in $entity.neighbours) #if( $association.isComposition) <ownedAttribute xmi:type="uml:Property" xmi:id="$association.toId" |