Fix checkstyle issues including javadoc
[aai/babel.git] / src / main / java / org / onap / aai / babel / xml / generator / model / Widget.java
index 49e3811..be84526 100644 (file)
@@ -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.
@@ -25,6 +25,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumMap;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import org.onap.aai.babel.logging.ApplicationMsgs;
@@ -38,10 +39,11 @@ import org.onap.aai.cl.api.Logger;
 
 public abstract class Widget extends Model {
 
-    public static final String GENERATOR_AAI_CONFIGLPROP_NOT_FOUND = "Cannot generate artifacts. Widget configuration not found for %s";
+    public static final String GENERATOR_AAI_CONFIGLPROP_NOT_FOUND =
+            "Cannot generate artifacts. Widget configuration not found for %s";
 
     public enum Type {
-        SERVICE, VF, VFC, VSERVER, VOLUME, FLAVOR, TENANT, VOLUME_GROUP, LINT, L3_NET, VFMODULE, IMAGE, OAM_NETWORK, ALLOTTED_RESOURCE, TUNNEL_XCONNECT, CONFIGURATION, CR;
+        SERVICE, VF, VFC, VSERVER, VOLUME, FLAVOR, TENANT, VOLUME_GROUP, LINT, L3_NET, VFMODULE, IMAGE, OAM_NETWORK, ALLOTTED_RESOURCE, TUNNEL_XCONNECT, CONFIGURATION, CR, INSTANCE_GROUP;
     }
 
     private static Logger log = LogHelper.INSTANCE;
@@ -67,6 +69,7 @@ public abstract class Widget extends Model {
         typeToWidget.put(Type.TUNNEL_XCONNECT, TunnelXconnectWidget.class);
         typeToWidget.put(Type.CONFIGURATION, ConfigurationWidget.class);
         typeToWidget.put(Type.CR, CRWidget.class);
+        typeToWidget.put(Type.INSTANCE_GROUP, InstanceGroupWidget.class);
     }
 
     /**
@@ -90,9 +93,14 @@ public abstract class Widget extends Model {
         return widget;
     }
 
+    @Override
+    public boolean isResource() {
+        return false;
+    }
+
     public String getId() {
-        Properties properties = WidgetConfigurationUtil.getConfig();
-        String id = properties.getProperty(ArtifactType.AAI.name() + ".model-version-id." + getName());
+        String id = WidgetConfigurationUtil.getConfig()
+                .getProperty(ArtifactType.AAI.name() + ".model-version-id." + getName());
         if (id == null) {
             throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGLPROP_NOT_FOUND,
                     ArtifactType.AAI.name() + ".model-version-id." + getName()));
@@ -106,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();
     }
 
     /**
@@ -184,4 +191,8 @@ public abstract class Widget extends Model {
         return true;
     }
 
+    @Override
+    public Map<String, Object> getProperties() {
+        return Collections.emptyMap();
+    }
 }