552401 - Model mapping in atfxadapter with ExtSystem
added entities related to ExtSystem
Signed-off-by: Juergen Kleck <j.kleck@peak-solution.de>
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java b/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
index 22b40d4..a582ec4 100644
--- a/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
@@ -990,6 +990,51 @@
}
/**
+ * Create a new {@link ExtSystem}
+ * @param name The name of the external system
+ * @return
+ */
+ public ExtSystem createExtSystem(String name) {
+ ExtSystem extSystem = new ExtSystem(createCore(ExtSystem.class));
+ extSystem.setName(name);
+ return extSystem;
+ }
+
+ /**
+ * Create a new {@link ExtSystemAttribute}
+ * @param name The name of the external system attribute
+ * @param extSystem The parent {@link ExtSystem}
+ * @return
+ */
+ public ExtSystemAttribute createExtSystemAttribute(String name, ExtSystem extSystem) {
+ ExtSystemAttribute extSystemAttribute = new ExtSystemAttribute(createCore(ExtSystemAttribute.class));
+ getCore(extSystemAttribute).getPermanentStore().set(extSystem);
+ getCore(extSystem).getChildrenStore().add(extSystemAttribute);
+ extSystemAttribute.setName(name);
+ return extSystemAttribute;
+ }
+
+ /**
+ * Create a new {@link MDMAttribute}
+ * @param name The name of the mdm attribute
+ * @param extSystemAttribute The parent {@link ExtSystemAttribute}
+ * @return
+ */
+ public MDMAttribute createMDMAttribute(String name, ExtSystemAttribute extSystemAttribute) {
+ MDMAttribute mdmAttribute = new MDMAttribute(createCore(MDMAttribute.class));
+ getCore(mdmAttribute).getPermanentStore().set(extSystemAttribute);
+ getCore(extSystemAttribute).getChildrenStore().add(mdmAttribute);
+ mdmAttribute.setName(name);
+ String[] values = name.split("\\.");
+ if(values.length == 3) {
+ mdmAttribute.setComponentType(values[0]);
+ mdmAttribute.setComponentName(values[1]);
+ mdmAttribute.setAttributeName(values[2]);
+ }
+ return mdmAttribute;
+ }
+
+ /**
* Creates a new {@link Test} for given {@link Pool}.
*
* @param name Name of the created {@code Test}.
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/ExtSystem.java b/src/main/java/org/eclipse/mdm/api/dflt/model/ExtSystem.java
new file mode 100644
index 0000000..bd420bc
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/ExtSystem.java
@@ -0,0 +1,74 @@
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.dflt.model;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.model.BaseEntity;
+import org.eclipse.mdm.api.base.model.Deletable;
+import org.eclipse.mdm.api.base.model.Describable;
+
+import java.util.List;
+
+/**
+ * Implementation of an external system entity type. An external system attribute contains several mdm attributes.
+ *
+ * @author Juergen Kleck, Peak Solution GmbH
+ *
+ */
+public class ExtSystem extends BaseEntity implements Describable, Deletable {
+
+ // ======================================================================
+ // Class variables
+ // ======================================================================
+
+
+ // ======================================================================
+ // Instance variables
+ // ======================================================================
+
+
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ protected ExtSystem(Core core) {
+ super(core);
+ }
+
+ // ======================================================================
+ // Public methods
+ // ======================================================================
+
+ public List<ExtSystemAttribute> getAttributes() {
+ return getExtSystemAttributes();
+ }
+
+ /**
+ * Returns all available {@link ExtSystemAttribute}s related to this external
+ * system.
+ *
+ * @return The returned {@code List} is unmodifiable.
+ */
+ public List<ExtSystemAttribute> getExtSystemAttributes() {
+ return getCore().getChildrenStore().get(ExtSystemAttribute.class);
+ }
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/ExtSystemAttribute.java b/src/main/java/org/eclipse/mdm/api/dflt/model/ExtSystemAttribute.java
new file mode 100644
index 0000000..e36da7a
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/ExtSystemAttribute.java
@@ -0,0 +1,76 @@
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.dflt.model;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.model.BaseEntity;
+import org.eclipse.mdm.api.base.model.Deletable;
+import org.eclipse.mdm.api.base.model.Describable;
+
+import java.util.List;
+
+/**
+ * Implementation of an external system attribute entity type. An external system attribute contains several mdm attributes.
+ *
+ * @author Juergen Kleck, Peak Solution GmbH
+ *
+ */
+public class ExtSystemAttribute extends BaseEntity implements Describable, Deletable {
+
+ // ======================================================================
+ // Class variables
+ // ======================================================================
+
+
+ // ======================================================================
+ // Instance variables
+ // ======================================================================
+
+
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ protected ExtSystemAttribute(Core core) {
+ super(core);
+ }
+
+ // ======================================================================
+ // Public methods
+ // ======================================================================
+
+
+ public List<MDMAttribute> getAttributes() {
+ return getMDMAttributes();
+ }
+
+ /**
+ * Returns all available {@link MDMAttribute}s related to this external
+ * system attribute.
+ *
+ * @return The returned {@code List} is unmodifiable.
+ */
+ public List<MDMAttribute> getMDMAttributes() {
+ return getCore().getChildrenStore().get(MDMAttribute.class);
+ }
+
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/MDMAttribute.java b/src/main/java/org/eclipse/mdm/api/dflt/model/MDMAttribute.java
new file mode 100644
index 0000000..cda7b5c
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/MDMAttribute.java
@@ -0,0 +1,118 @@
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.dflt.model;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.model.BaseEntity;
+import org.eclipse.mdm.api.base.model.Deletable;
+import org.eclipse.mdm.api.base.model.Describable;
+import org.eclipse.mdm.api.base.model.Value;
+
+import java.util.List;
+
+/**
+ * Implementation of an external system entity type. An external system attribute contains several mdm attributes.
+ *
+ * @author Juergen Kleck, Peak Solution GmbH
+ *
+ */
+public class MDMAttribute extends BaseEntity implements Describable, Deletable {
+
+ // ======================================================================
+ // Class variables
+ // ======================================================================
+
+ public static final String ATTR_COMPONENT_TYPE = "CompType";
+ public static final String ATTR_COMPONENT_NAME = "CompName";
+ public static final String ATTR_ATTRIBUTE_NAME = "AttrName";
+
+ // ======================================================================
+ // Instance variables
+ // ======================================================================
+
+
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ protected MDMAttribute(Core core) {
+ super(core);
+ }
+
+ // ======================================================================
+ // Public methods
+ // ======================================================================
+
+ /**
+ * Returns the component type for this attribute
+ *
+ * @return Returns the component type
+ */
+ public String getComponentType() {
+ return getValue(ATTR_COMPONENT_TYPE).extract();
+ }
+
+ /**
+ * Sets the component type for this attribute
+ *
+ * @param compType The component type
+ */
+ public void setComponentType(String compType) {
+ getValue(ATTR_COMPONENT_TYPE).set(compType);
+ }
+
+ /**
+ * Returns the component name for this attribute
+ *
+ * @return Returns the component name
+ */
+ public String getComponentName() {
+ return getValue(ATTR_COMPONENT_NAME).extract();
+ }
+
+ /**
+ * Sets the component name for this attribute
+ *
+ * @param compName The component name
+ */
+ public void setComponentName(String compName) {
+ getValue(ATTR_COMPONENT_NAME).set(compName);
+ }
+
+ /**
+ * Returns the attribute name for this attribute
+ *
+ * @return Returns the attribute name
+ */
+ public String getAttributeName() {
+ return getValue(ATTR_ATTRIBUTE_NAME).extract();
+ }
+
+ /**
+ * Sets the attribute name for this attribute
+ *
+ * @param attrName The attribute name
+ */
+ public void setAttributeName(String attrName) {
+ getValue(ATTR_ATTRIBUTE_NAME).set(attrName);
+ }
+
+}