- private static EnumMap<Widget.Type, Class<? extends Widget>> typeToWidget = new EnumMap<>(Widget.Type.class);
- static {
- typeToWidget.put(Type.SERVICE, ServiceWidget.class);
- typeToWidget.put(Type.VF, VfWidget.class);
- typeToWidget.put(Type.VFC, VfcWidget.class);
- typeToWidget.put(Type.VSERVER, VServerWidget.class);
- typeToWidget.put(Type.VOLUME, VolumeWidget.class);
- typeToWidget.put(Type.FLAVOR, FlavorWidget.class);
- typeToWidget.put(Type.TENANT, TenantWidget.class);
- typeToWidget.put(Type.VOLUME_GROUP, VolumeGroupWidget.class);
- typeToWidget.put(Type.LINT, LIntfWidget.class);
- typeToWidget.put(Type.L3_NET, L3NetworkWidget.class);
- typeToWidget.put(Type.VFMODULE, VfModuleWidget.class);
- typeToWidget.put(Type.IMAGE, ImageWidget.class);
- typeToWidget.put(Type.OAM_NETWORK, OamNetwork.class);
- typeToWidget.put(Type.ALLOTTED_RESOURCE, AllotedResourceWidget.class);
- 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);
+ protected String name;
+ protected Type type;
+ protected boolean deleteFlag = false;
+
+ public Widget(Type widgetType, String name, boolean deleteFlag) {
+ type = widgetType;
+ this.name = name;
+ this.deleteFlag = deleteFlag;
+ }
+
+ /**
+ * Copy Constructor.
+ *
+ * @param baseWidget
+ * @throws XmlArtifactGenerationException
+ */
+ public Widget(Widget baseWidget) throws XmlArtifactGenerationException {
+ this(baseWidget.getWidgetType(), baseWidget.getName(), baseWidget.getDeleteFlag());
+ if (type == Type.VSERVER) {
+ widgets.add(getWidget(Type.FLAVOR));
+ widgets.add(getWidget(Type.IMAGE));
+ widgets.add(getWidget(Type.TENANT));
+ widgets.add(getWidget(Type.VFC));
+ }