*/
package org.onap.aai.babel.xml.generator.model;
-import static org.onap.aai.babel.xml.generator.data.GeneratorConstants.GENERATOR_AAI_CONFIGLPROP_NOT_FOUND;
-
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import org.onap.aai.babel.xml.generator.data.ArtifactType;
-import org.onap.aai.babel.xml.generator.data.GeneratorConstants;
import org.onap.aai.babel.xml.generator.data.WidgetConfigurationUtil;
import org.onap.aai.babel.xml.generator.error.IllegalAccessException;
import org.onap.aai.babel.xml.generator.types.ModelType;
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 enum Type {
+ SERVICE, VF, VFC, VSERVER, VOLUME, FLAVOR, TENANT, VOLUME_GROUP, LINT, L3_NET, VFMODULE, IMAGE, OAM_NETWORK, ALLOTTED_RESOURCE, TUNNEL_XCONNECT, CONFIGURATION;
+ }
+
private Set<String> keys = new HashSet<>();
/**
* Gets widget.
*
- * @param type the type
+ * @param type
+ * the type
* @return the widget
*/
public static Widget getWidget(Type type) {
-
switch (type) {
case SERVICE:
return new ServiceWidget();
return new AllotedResourceWidget();
case TUNNEL_XCONNECT:
return new TunnelXconnectWidget();
+ case CONFIGURATION:
+ return new ConfigurationWidget();
default:
return null;
}
}
- /**
- * Gets id.
- *
- * @return the id
- */
public String getId() {
Properties properties = WidgetConfigurationUtil.getConfig();
String id = properties.getProperty(ArtifactType.AAI.name() + ".model-version-id." + getName());
/**
* Equals.
*
- * @param obj Object
+ * @param obj
+ * Object
* @return the boolean
*/
@Override
/**
* Member of boolean.
*
- * @param keys the keys
+ * @param keys
+ * the keys
* @return the boolean
*/
public boolean memberOf(List<String> keys) {
/**
* All instances used boolean.
*
- * @param collection the collection
+ * @param collection
+ * the collection
* @return the boolean
*/
public boolean allInstancesUsed(Set<String> collection) {
@Override
public boolean addResource(Resource resource) {
- throw new IllegalAccessException(GeneratorConstants.GENERATOR_AAI_ERROR_UNSUPPORTED_WIDGET_OPERATION);
+ throw new IllegalAccessException(Model.GENERATOR_AAI_ERROR_UNSUPPORTED_WIDGET_OPERATION);
}
@Override
return true;
}
- public enum Type {
- SERVICE,
- VF,
- VFC,
- VSERVER,
- VOLUME,
- FLAVOR,
- TENANT,
- VOLUME_GROUP,
- LINT,
- L3_NET,
- VFMODULE,
- IMAGE,
- OAM_NETWORK,
- ALLOTTED_RESOURCE,
- TUNNEL_XCONNECT
- }
}