Merge branch 'dev'
Change-Id: I92b14044b8beef37eb15f1211d1e39a910dc88e0
diff --git a/build.gradle b/build.gradle
index 07491e9..26035f0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,7 +14,7 @@
description = 'MDM API - Default Model'
group = 'org.eclipse.mdm'
-version = '5.1.0'
+version = '5.2.0M1-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'maven'
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..d18d760 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
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2015-2019 Contributors to the Eclipse Foundation
+ * Copyright (c) 2015-2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -990,6 +990,109 @@
}
/**
+ * 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 TestStep} for given {@link Test} using given
+ * {@link TemplateTestStep} and {@link Classification}. Doesn't create context
+ * roots
+ *
+ * @param test The parent {@code Test}.
+ * @param templateTestStep The template the returned {@code TestStep} will be
+ * derived from.
+ * @param classification The {@link Classification} for the created
+ * {@link TestStep}.
+ * @return The created {@code TestStep} is returned.
+ */
+ public TestStep createTestStepWithOutContextRoots(Test test, TemplateTestStep templateTestStep,
+ Classification classification) {
+ TestStep testStep = createTestStepWithOutContextRoots(test, templateTestStep);
+ getCore(testStep).getMutableStore().set(classification);
+ return testStep;
+ }
+
+ /**
+ * Creates a new {@link TestStep} for given {@link Test} using given
+ * {@link TemplateTestStep}. Doesn't create context roots
+ *
+ * @param test The parent {@code Test}.
+ * @param templateTestStep The template the returned {@code TestStep} will be
+ * derived from.
+ * @return The created {@code TestStep} is returned.
+ */
+ public TestStep createTestStepWithOutContextRoots(Test test, TemplateTestStep templateTestStep) {
+ return createTestStepWithOutContextRoots(test, null, templateTestStep);
+ }
+
+ /**
+ * Creates a new {@link TestStep} for given {@link Test} using given
+ * {@link TemplateTestStep}.
+ *
+ * @param test The parent {@code Test}.
+ * @param status The related {@link Status}.
+ * @param templateTestStep The template the returned {@code TestStep} will be
+ * derived from.
+ * @return The created {@code TestStep} is returned.
+ */
+ // TODO make a decision: status in or out!
+ protected TestStep createTestStepWithOutContextRoots(Test test, Status status, TemplateTestStep templateTestStep) {
+ TemplateTest templateTest = TemplateTest.of(test)
+ .orElseThrow(() -> new IllegalArgumentException("Template test is not available."));
+ if (!templateTest.contains(templateTestStep)) {
+ throw new IllegalArgumentException("Template test step is not part of the test template.");
+ }
+
+ TestStep testStep = createTestStep(templateTestStep.getName(), test, status);
+
+ // relations
+ getCore(testStep).getMutableStore().set(templateTestStep);
+
+ return testStep;
+ }
+
+ /**
* Creates a new {@link Test} for given {@link Pool}.
*
* @param name Name of the created {@code Test}.
@@ -1033,16 +1136,8 @@
*/
// TODO make a decision: status in or out!
protected TestStep createTestStep(Test test, Status status, TemplateTestStep templateTestStep) {
- TemplateTest templateTest = TemplateTest.of(test)
- .orElseThrow(() -> new IllegalArgumentException("Template test is not available."));
- if (!templateTest.contains(templateTestStep)) {
- throw new IllegalArgumentException("Template test step is not part of the test template.");
- }
- TestStep testStep = createTestStep(templateTestStep.getName(), test, status);
-
- // relations
- getCore(testStep).getMutableStore().set(templateTestStep);
+ TestStep testStep = createTestStepWithOutContextRoots(test, status, templateTestStep);
// create initial context roots
templateTestStep.getTemplateRoots().forEach(templateRoot -> createContextRoot(testStep, templateRoot));
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..a6c45b2
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/ExtSystem.java
@@ -0,0 +1,56 @@
+/********************************************************************************
+ * Copyright (c) 2015-2020 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 java.util.List;
+
+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;
+
+/**
+ * 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 {
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ protected ExtSystem(Core core) {
+ super(core);
+ }
+
+ 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..806ba57
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/ExtSystemAttribute.java
@@ -0,0 +1,56 @@
+/********************************************************************************
+ * Copyright (c) 2015-2020 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 java.util.List;
+
+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;
+
+/**
+ * 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 {
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ protected ExtSystemAttribute(Core core) {
+ super(core);
+ }
+
+ 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..85b049d
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/MDMAttribute.java
@@ -0,0 +1,98 @@
+/********************************************************************************
+ * Copyright (c) 2015-2020 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;
+
+/**
+ * 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 {
+
+ public static final String ATTR_COMPONENT_TYPE = "CompType";
+ public static final String ATTR_COMPONENT_NAME = "CompName";
+ public static final String ATTR_ATTRIBUTE_NAME = "AttrName";
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ protected MDMAttribute(Core core) {
+ super(core);
+ }
+
+ /**
+ * 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);
+ }
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/SystemParameter.java b/src/main/java/org/eclipse/mdm/api/dflt/model/SystemParameter.java
new file mode 100644
index 0000000..310a654
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/SystemParameter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2020 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;
+
+/**
+ * @author akn
+ *
+ */
+public class SystemParameter extends BaseEntity {
+
+ SystemParameter(Core core) {
+ super(core);
+ }
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/TemplateAttribute.java b/src/main/java/org/eclipse/mdm/api/dflt/model/TemplateAttribute.java
index 27c9790..998862b 100644
--- a/src/main/java/org/eclipse/mdm/api/dflt/model/TemplateAttribute.java
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/TemplateAttribute.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2015-2019 Contributors to the Eclipse Foundation
+ * Copyright (c) 2015-2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -397,7 +397,7 @@
if (fl.isRemote()) {
sb.append(fl.getRemotePath());
} else if (fl.isLocal()) {
- sb.append(FileLinkParser.LOCAL_MARKER).append(fl.getLocalPath());
+ sb.append(FileLinkParser.LOCAL_MARKER).append(fl.getLocalStream());
} else {
throw new IllegalStateException("File link is neither in local nor remote state: " + fl);
}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/UserParameter.java b/src/main/java/org/eclipse/mdm/api/dflt/model/UserParameter.java
new file mode 100644
index 0000000..7997ab7
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/UserParameter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2020 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;
+
+/**
+ * @author akn
+ *
+ */
+public class UserParameter extends BaseEntity {
+
+ UserParameter(Core core) {
+ super(core);
+ }
+
+}