Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Koller2019-02-21 07:56:12 -0500
committerMatthias Koller2019-02-21 07:56:12 -0500
commit0399d24c206df2e04919ef679b2cc0dabb53d8e9 (patch)
treec52868b3a772b5700e8ab1418b578302a7ec2544
parentf72c19775534e23f95613daa74973577e4b1c7bb (diff)
parentc2b0e02a50bf0d7e35e7db34232568b3f8651a3c (diff)
downloadorg.eclipse.mdm.api.base-0399d24c206df2e04919ef679b2cc0dabb53d8e9.tar.gz
org.eclipse.mdm.api.base-0399d24c206df2e04919ef679b2cc0dabb53d8e9.tar.xz
org.eclipse.mdm.api.base-0399d24c206df2e04919ef679b2cc0dabb53d8e9.zip
Merge branch 'mkoller/atfxadapter' into dev
-rw-r--r--NOTICE.txt27
-rw-r--r--build.gradle9
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java8
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/adapter/Core.java10
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java11
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java8
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java115
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java11
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java46
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java6
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java10
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java81
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/model/Measurement.java24
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java12
-rw-r--r--src/main/java/org/eclipse/mdm/api/base/model/TestStep.java16
-rwxr-xr-xsrc/test/java/org/eclipse/mdm/api/base/CoreImpl.java6
-rwxr-xr-xsrc/test/java/org/eclipse/mdm/api/base/RelationImpl.java5
-rwxr-xr-xsrc/test/java/org/eclipse/mdm/api/base/model/ModelTest.java6
18 files changed, 369 insertions, 42 deletions
diff --git a/NOTICE.txt b/NOTICE.txt
index 8bbd2e1..0dc71e0 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -17,13 +17,13 @@ For more information regarding authorship of content, please consult the listed
source code repository logs.
Copyright (c) 2016-2018 Gigatronik Ingolstadt GmbH
-Copyright (c) 2016-2018 Peak Solution GmbH
+Copyright (c) 2016-2019 Peak Solution GmbH
Copyright (c) 2017-2018 science + computing AG Tuebingen (ATOS SE)
Copyright (c) 2017-2018 Canoo Engineering AG
Copyright (c) 2017 Florian Schmitt
-Copyright (c) 2017-2018 Angelika Wittek
+Copyright (c) 2017-2019 Angelika Wittek
Copyright (c) 2018 Elektronische Fahrwerksysteme GMBH
-Copyright (c) 2018 Karakun AG
+Copyright (c) 2018-2019 Karakun AG
## Declared Project Licenses
@@ -61,7 +61,13 @@ commons-codec-1.2.jar (1.2)
commons-httpclient-3.1.jar (3.1)
* License: Apache License, 2.0
-commons-lang3-3.4.jar (3.4)
+commons-lang3-3.8.1.jar (3.8.1)
+ * License: Apache License, 2.0
+
+commons-text-1.6.jar (1.6)
+ * License: Apache License, 2.0
+
+commons-math-2.2.jar (2.2)
* License: Apache License, 2.0
gson-2.7.jar (2.7)
@@ -71,7 +77,7 @@ Google Guava Version: 25.0-jre (25.0)
* License: Apache License, 2.0
Gradle Wrapper (4.10.2)
- * License: Apache License, 2.0
+ * License: Apache License, 2.0
hk2-api-2.5.0-b05.jar (2.5.0-b05)
* License: CDDL-1.1
@@ -130,6 +136,9 @@ jersey-media-jaxb-2.23.2.jar(2.23.2)
jersey-media-sse-2.23.2.jar (2.23.2)
* License: CDDL
+jersey-media-multipart-2.23.2.jar (2.23.2)
+ * License: CDDL
+
jersey-server-2.23.2.jar (2.23.2)
* License: Apache-2.0
@@ -317,10 +326,10 @@ Permission of use:
From Dr. Ralph Noerenberg
Date: 08/15/2016
"Herewith, we release the generated Client-Source-Code generated from our CORBA IDLs, namely
-* CORBANotification Service (generated from „AvalonEvent.idl”)
-* CORBAFileServer (generated from „CorbaFileServer.idl“),
-Under the Eclipse Public License (EPL). This agreement does not include the „AvalonEvent.idl“ and
-„CorbaFileServer.idl“ itself, which remain protected property of HighQSoft. "
+* CORBANotification Service (generated from AvalonEvent.idl)
+* CORBAFileServer (generated from CorbaFileServer.idl),
+Under the Eclipse Public License (EPL). This agreement does not include the AvalonEvent.idl and
+CorbaFileServer.idl itself, which remain protected property of HighQSoft. "
OMG Notification Service Specification Version: 1.1
The terms of use are defined in section "Freely Available And Available
diff --git a/build.gradle b/build.gradle
index 2b15f4b..768c495 100644
--- a/build.gradle
+++ b/build.gradle
@@ -36,4 +36,13 @@ dependencies {
jar {
metaInf { from 'NOTICE.txt' }
metaInf { from 'LICENSE.txt' }
+}
+
+task sourcesJar(type: Jar, dependsOn: classes) {
+ classifier = 'sources'
+ from sourceSets.main.allSource
+}
+
+artifacts {
+ archives sourcesJar
} \ No newline at end of file
diff --git a/src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java b/src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java
index 9a24edb..989518b 100644
--- a/src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java
+++ b/src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java
@@ -270,6 +270,14 @@ public interface BaseEntityManager {
*/
Map<ContextType, ContextRoot> loadContexts(ContextDescribable contextDescribable, ContextType... contextTypes)
throws DataAccessException;
+
+ /**
+ * @param entity The entity
+ * @param relationName The name of the relation, which entities should be loaded.
+ * @param relatedClass Class of the related entities.
+ * @return The related entities for the given {@link Entity} and relationName
+ */
+ <T extends Entity> List<T> loadRelatedEntities(Entity entity, String relationName, Class<T> relatedClass);
/**
* Retrieves the {@link MeasuredValues} as specified by the given
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/Core.java b/src/main/java/org/eclipse/mdm/api/base/adapter/Core.java
index 0726073..ac806d4 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/Core.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/Core.java
@@ -195,6 +195,14 @@ public interface Core {
// TODO (8.11.2017; Florian Schmitt, Angelika Wittek)
// Entities with more than one related entity that do not refer to children, have also to go here,
// as it is not permitted to go to the other stores. Does this work at all?
- ChildrenStore getChildrenStore();
+ ChildrenStore getChildrenStore();
+
+ /**
+ * Returns the {@link RelationStore}. This store holds related
+ * entities for N to M relations.
+ *
+ * @return The {@link RelationStore} is returned
+ */
+ RelationStore getNtoMStore();
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java b/src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java
index 47958b6..ecdc6c1 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java
@@ -47,7 +47,8 @@ public class DefaultCore implements Core {
private final EntityStore permanentEntityStorage = new EntityStore();
private final EntityStore mutableEntityStorage = new EntityStore();
- private final ChildrenStore childrenStore = new ChildrenStore();
+ private final ChildrenStore childrenStore = new ChildrenStore();
+ private final RelationStore ntoMStore = new RelationStore();
private final Map<String, Value> values = new HashMap<>();
private final Map<String, Value> hiddenValues = new HashMap<>();
@@ -192,6 +193,14 @@ public class DefaultCore implements Core {
@Override
public ChildrenStore getChildrenStore() {
return childrenStore;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public RelationStore getNtoMStore() {
+ return ntoMStore;
}
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java b/src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java
index 5257061..0b4c7ab 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java
@@ -110,5 +110,11 @@ public interface Relation {
* equal with the given one and it is is an incoming relation.
*/
boolean isIncoming(RelationType relationType);
-
+
+ /**
+ * Checks whether this relation is a N to M relation.
+ *
+ * @return Returns {@code true} if this relation is N to M.
+ */
+ boolean isNtoM();
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java b/src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java
new file mode 100644
index 0000000..f7dacb9
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java
@@ -0,0 +1,115 @@
+/********************************************************************************
+ * 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.base.adapter;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.mdm.api.base.model.Deletable;
+
+/**
+ * Holds related entities of any kind and keeps track of modifications.
+ */
+public final class RelationStore {
+
+ private final Map<String, List<? extends Deletable>> added = new HashMap<>(0);
+ private final Map<String, List<? extends Deletable>> removed = new HashMap<>(0);
+
+ /**
+ * Returns current set of related children mapped by their type.
+ *
+ * @return Returned {@code Map} is unmodifiable.
+ */
+ public Map<String, List<? extends Deletable>> getAdded() {
+ return Collections.unmodifiableMap(added);
+ }
+
+ /**
+ * Returns current set of removed related children mapped by their type.
+ *
+ * @return Returned {@code Map} is unmodifiable.
+ */
+ public Map<String, List<? extends Deletable>> getRemoved() {
+ return Collections.unmodifiableMap(removed);
+ }
+
+ /**
+ * Returns related child entities of given type.
+ *
+ * @param <T>
+ * Desired entity type.
+ * @param entityClass
+ * Used as identifier.
+ * @return Returned {@code List} is unmodifiable.
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Deletable> List<T> get(String relation) {
+ return Collections.unmodifiableList((List<T>) added.computeIfAbsent(relation, k -> new ArrayList<>()));
+ }
+
+ /**
+ * Sorts the child entities with given {@code Comparator}.
+ *
+ * @param <T>
+ * Desired entity type.
+ * @param entityClass
+ * Used as identifier.
+ * @param comparator
+ * Used for sorting.
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Deletable> void sort(String relation, Comparator<? super T> comparator) {
+ List<T> children = (List<T>) added.get(relation);
+ if (children != null) {
+ children.sort(comparator);
+ }
+ }
+
+ /**
+ * Adds given child entity.
+ *
+ * @param child
+ * The new child.
+ */
+ @SuppressWarnings("unchecked")
+ public void add(String relation, Deletable relatedEntity) {
+ removed.getOrDefault(relation, new ArrayList<>()).remove(relatedEntity);
+ ((List<Deletable>) added.computeIfAbsent(relation, k -> new ArrayList<>())).add(relatedEntity);
+ }
+
+ /**
+ * Removes given child entity.
+ *
+ * @param relatedEntity
+ * The child which will be removed.
+ */
+ @SuppressWarnings("unchecked")
+ public void remove(String relation, Deletable relatedEntity) {
+ added.getOrDefault(relation, new ArrayList<>()).remove(relatedEntity);
+ ((List<Deletable>) removed.computeIfAbsent(relation, k -> new ArrayList<>())).add(relatedEntity);
+ }
+
+ /**
+ * Clean up list of removed entities.
+ */
+ void apply() {
+ removed.clear();
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java
index c7dcff4..8449aa8 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java
@@ -69,6 +69,17 @@ public class IndependentBuilder extends WriteRequestFinalizer {
public final WriteRequestFinalizer independent() {
getWriteRequest().setIndependent();
return this;
+ }
+
+ /**
+ * Triggers the measured values of the underlying {@link Channel} to be
+ * independent or not, depending on the value specified.
+ *
+ * @return The {@link WriteRequestFinalizer} is returned.
+ */
+ public final WriteRequestFinalizer independent(boolean independent) {
+ getWriteRequest().setIndependent(independent);
+ return this;
}
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java
index c664cfb..126bf65 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java
@@ -20,7 +20,8 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.mdm.api.base.model.Channel;
-import org.eclipse.mdm.api.base.model.ChannelGroup;
+import org.eclipse.mdm.api.base.model.ChannelGroup;
+import org.eclipse.mdm.api.base.model.SequenceRepresentation;
import org.eclipse.mdm.api.base.model.Unit;
/**
@@ -30,7 +31,21 @@ import org.eclipse.mdm.api.base.model.Unit;
* @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
* @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
*/
-public final class ReadRequest {
+public final class ReadRequest {
+ public enum ValuesMode
+ {
+ /**
+ * MeasuredValues will contain the final values, calculated for non-explicit sequence representations
+ * using generation parameters and, if applicable, the raw values.
+ * No generation parameters are returned in the resulting MeasuredValues, {@link SequenceRepresentation} will
+ * be EXPLICIT.
+ */
+ CALCULATED,
+ /**
+ * MeasuredValues will contain the (raw) values and generation parameters as present in the storage.
+ */
+ STORAGE
+ }
// ======================================================================
// Instance variables
@@ -42,7 +57,9 @@ public final class ReadRequest {
private boolean loadAllChannels;
private int requestSize = 100_000;
- private int startIndex;
+ private int startIndex;
+
+ private ValuesMode valuesMode = ValuesMode.CALCULATED;
// ======================================================================
// Constructors
@@ -59,7 +76,8 @@ public final class ReadRequest {
channels.putAll(readRequest.getChannels());
loadAllChannels = readRequest.loadAllChannels;
requestSize = readRequest.getRequestSize();
- startIndex = readRequest.getStartIndex() + readRequest.getRequestSize();
+ startIndex = readRequest.getStartIndex() + readRequest.getRequestSize();
+ valuesMode = readRequest.getValuesMode();
}
/**
@@ -160,6 +178,15 @@ public final class ReadRequest {
*/
public int getStartIndex() {
return startIndex;
+ }
+
+ /**
+ * Returns the {link ValuesMode} for measured values retrieval.
+ *
+ * @return The valuesMode is returned.
+ */
+ public ValuesMode getValuesMode() {
+ return valuesMode;
}
// ======================================================================
@@ -228,6 +255,17 @@ public final class ReadRequest {
*/
void setStartIndex(int startIndex) {
this.startIndex = startIndex;
+ }
+
+ /**
+ * Sets the {@link ValuesMode} for measured values retrieval.
+ *
+ * @param valuesMode
+ * The {@link VAluesMode} to set.
+ */
+ void setValuesMode(ValuesMode valuesMode)
+ {
+ this.valuesMode = valuesMode;
}
/**
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java
index 458e39d..7839e70 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java
@@ -154,6 +154,12 @@ public final class ReadRequestBuilder {
readRequest.setStartIndex(startIndex);
return this;
+ }
+
+ public ReadRequestBuilder valuesMode(ReadRequest.ValuesMode valuesMode)
+ {
+ readRequest.setValuesMode(valuesMode);
+ return this;
}
/**
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java b/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java
index 6b2a70b..cabfb2b 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java
@@ -299,6 +299,16 @@ public final class WriteRequest {
*/
void setIndependent() {
independent = true;
+ }
+
+ /**
+ * Sets the independent flag for this request to the value specified.
+ *
+ * @param independent
+ * The independent flag.
+ */
+ void setIndependent(boolean independent) {
+ this.independent = independent;
}
/**
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java b/src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java
index fe0ffca..95a1909 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java
@@ -15,13 +15,13 @@
package org.eclipse.mdm.api.base.model;
-import static java.util.stream.IntStream.range;
-import static org.eclipse.mdm.api.base.model.Value.readAt;
-
-import java.lang.reflect.Array;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
+import static java.util.stream.IntStream.range;
+import static org.eclipse.mdm.api.base.model.Value.readAt;
+
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
import java.util.stream.Collectors;
/**
@@ -43,14 +43,19 @@ public final class MeasuredValues {
/*
* TODO: - replace name and unit with the corresponding Channel & Unit
- * entities - provide AxisType, Independent flag and further informations if
- * required - provide an overall offset for this value sequence
+ * entities - provide further information if required
+ * - provide an overall offset for this value sequence
*/
private final String name;
private final String unit;
- private final int length;
+ private final int length;
+
+ private final SequenceRepresentation sequenceRepresentation;
+ private final double[] generationParameters;
+ private final boolean independent;
+ private final AxisType axisType;
// ======================================================================
// Constructors
@@ -64,7 +69,15 @@ public final class MeasuredValues {
* @param name
* This is the name of the corresponding {@link Channel}.
* @param unit
- * Name of the unit the contained values are of.
+ * Name of the unit the contained values are of.
+ * @param sequenceRepresentation
+ * The {@link SequenceRepresentation} of the measured values.
+ * @param generationParameters
+ * The generation parameters for the measured values.
+ * @param independent
+ * The independent flag of the measured values.
+ * @param axisType
+ * The {@link AxisType} of the measured values.
* @param values
* The measured values.
* @param flags
@@ -73,10 +86,14 @@ public final class MeasuredValues {
* Thrown if values or flags is null or length of values and
* flags is not equal.
*/
- MeasuredValues(ScalarType scalarType, String name, String unit, Object values, boolean[] flags) {
+ MeasuredValues(ScalarType scalarType, String name, String unit, SequenceRepresentation sequenceRepresentation, double[] generationParameters, boolean independent, AxisType axisType, Object values, boolean[] flags) {
this.name = name;
- this.unit = unit == null ? "" : unit;
- this.scalarType = scalarType;
+ this.unit = (unit == null ? "" : unit);
+ this.scalarType = scalarType;
+ this.sequenceRepresentation = sequenceRepresentation;
+ this.generationParameters = generationParameters;
+ this.independent = independent;
+ this.axisType = axisType;
this.values = values;
if (values == null || flags == null) {
@@ -127,6 +144,42 @@ public final class MeasuredValues {
*/
public int getLength() {
return length;
+ }
+
+ /**
+ * Returns the {@link SequenceRepresentation} of this measured values sequence.
+ *
+ * @return The {@code SequenceRepresentation} is returned.
+ */
+ public SequenceRepresentation getSequenceRepresentation() {
+ return sequenceRepresentation;
+ }
+
+ /**
+ * Returns the generation parameters for this measured values sequence.
+ *
+ * @return The generation parameters are returned.
+ */
+ public double[] getGenerationParameters() {
+ return generationParameters;
+ }
+
+ /**
+ * Returns the independent flag of this measured values sequence.
+ *
+ * @return The independent flag is returned.
+ */
+ public boolean isIndependent() {
+ return independent;
+ }
+
+ /**
+ * Returns the {@link AxisType} of this measured values sequence.
+ *
+ * @return The {@code AxisType} is returned.
+ */
+ public AxisType getAxisType() {
+ return axisType;
}
/**
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Measurement.java b/src/main/java/org/eclipse/mdm/api/base/model/Measurement.java
index d4c1917..e3e30d7 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Measurement.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Measurement.java
@@ -15,7 +15,8 @@
package org.eclipse.mdm.api.base.model;
-import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -152,10 +153,23 @@ public class Measurement extends BaseEntity
/**
* {@inheritDoc}
*/
- @Override
- public Map<ContextType, ContextRoot> loadContexts(BaseEntityManager manager,
- ContextType... contextTypes) throws DataAccessException {
- return manager.loadContexts(this, contextTypes);
+ @Override
+ public Map<ContextType, ContextRoot> loadContexts(BaseEntityManager manager, ContextType... contextTypes)
+ throws DataAccessException {
+
+ Map<ContextType, ContextRoot> map = new HashMap<>();
+
+ for (ContextType contextType : contextTypes) {
+ ContextRoot c = getCore().getMutableStore().get(ContextRoot.class, contextType);
+ if (c != null) {
+ map.put(contextType, c);
+ }
+ }
+ if (map.isEmpty()) {
+ return manager.loadContexts(this, contextTypes);
+ } else {
+ return map;
+ }
}
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java b/src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java
index fb3784e..6ddb0e1 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java
@@ -173,7 +173,13 @@ public final class ScalarType extends EnumerationValue {
* @param name
* This is the name of the corresponding {@link Channel}.
* @param unit
- * Name of the unit the contained values are of.
+ * Name of the unit the contained values are of.
+ * @param sequenceRepresentation
+ * The {@link SequenceRepresentation} of the measured values.
+ * @param independent
+ * The independent flag of the measured values.
+ * @param axisType
+ * The {@link AxisType} of the measured values.
* @param input
* The measured values.
* @param flags
@@ -185,14 +191,14 @@ public final class ScalarType extends EnumerationValue {
* @throws IllegalArgumentException
* Thrown if given values are not assignment compatible.
*/
- public MeasuredValues createMeasuredValues(String name, String unit, Object input, boolean[] flags) {
+ public MeasuredValues createMeasuredValues(String name, String unit, SequenceRepresentation sequenceRepresentation, double[] generationParameters, boolean independent, AxisType axisType, Object input, boolean[] flags) {
if (isEnumeration() || isUnknown()) {
throw new IllegalStateException("It is not allowed to create measured values of type '" + this + "'.");
} else if (!arrayType.isInstance(input)) {
throw new IllegalArgumentException("Given values of type '" + input.getClass() + "'.");
}
- return new MeasuredValues(this, name, unit, input, flags);
+ return new MeasuredValues(this, name, unit, sequenceRepresentation, generationParameters, independent, axisType, input, flags);
}
/**
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/TestStep.java b/src/main/java/org/eclipse/mdm/api/base/model/TestStep.java
index 85e07af..c06106a 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/TestStep.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/TestStep.java
@@ -15,6 +15,7 @@
package org.eclipse.mdm.api.base.model;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -113,7 +114,20 @@ public class TestStep extends BaseEntity implements ContextDescribable, Datable,
@Override
public Map<ContextType, ContextRoot> loadContexts(BaseEntityManager manager,
ContextType... contextTypes) throws DataAccessException {
- return manager.loadContexts(this, contextTypes);
+
+ Map<ContextType, ContextRoot> map = new HashMap<>();
+
+ for (ContextType contextType : contextTypes) {
+ ContextRoot c = getCore().getMutableStore().get(ContextRoot.class, contextType);
+ if (c != null) {
+ map.put(contextType, c);
+ }
+ }
+ if (map.isEmpty()) {
+ return manager.loadContexts(this, contextTypes);
+ } else {
+ return map;
+ }
}
}
diff --git a/src/test/java/org/eclipse/mdm/api/base/CoreImpl.java b/src/test/java/org/eclipse/mdm/api/base/CoreImpl.java
index 82356db..9eb7f84 100755
--- a/src/test/java/org/eclipse/mdm/api/base/CoreImpl.java
+++ b/src/test/java/org/eclipse/mdm/api/base/CoreImpl.java
@@ -21,6 +21,7 @@ import java.util.Map;
import org.eclipse.mdm.api.base.adapter.ChildrenStore;
import org.eclipse.mdm.api.base.adapter.Core;
import org.eclipse.mdm.api.base.adapter.EntityStore;
+import org.eclipse.mdm.api.base.adapter.RelationStore;
import org.eclipse.mdm.api.base.model.Value;
/**
@@ -91,4 +92,9 @@ public class CoreImpl implements Core {
return new ChildrenStore();
}
+ @Override
+ public RelationStore getNtoMStore() {
+ return new RelationStore();
+ }
+
} \ No newline at end of file
diff --git a/src/test/java/org/eclipse/mdm/api/base/RelationImpl.java b/src/test/java/org/eclipse/mdm/api/base/RelationImpl.java
index 576c8e9..fde52e5 100755
--- a/src/test/java/org/eclipse/mdm/api/base/RelationImpl.java
+++ b/src/test/java/org/eclipse/mdm/api/base/RelationImpl.java
@@ -71,4 +71,9 @@ public class RelationImpl implements Relation {
public boolean isIncoming(RelationType relationType) {
return false;
}
+
+ @Override
+ public boolean isNtoM() {
+ return false;
+ }
}
diff --git a/src/test/java/org/eclipse/mdm/api/base/model/ModelTest.java b/src/test/java/org/eclipse/mdm/api/base/model/ModelTest.java
index 1c115d1..e5befa7 100755
--- a/src/test/java/org/eclipse/mdm/api/base/model/ModelTest.java
+++ b/src/test/java/org/eclipse/mdm/api/base/model/ModelTest.java
@@ -70,7 +70,7 @@ public class ModelTest {
public void measuredValueFloat() {
Float[] vals = { 1.0f, 2.0f, 3.7f, 2.1f };
boolean[] flags = { true, true, false, true };
- MeasuredValues mv = new MeasuredValues(ScalarType.FLOAT, "Value1", "lightyears", vals, flags);
+ MeasuredValues mv = new MeasuredValues(ScalarType.FLOAT, "Value1", "lightyears", SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
ValueIterator<Float> valueIterator = mv.iterator();
int i = 0;
while (valueIterator.hasNext()) {
@@ -90,7 +90,7 @@ public class ModelTest {
public void measuredValueDouble() {
Double[] vals = { 1.0d, 2.0d, 3.7d, 2.1d };
boolean[] flags = { true, true, false, true };
- MeasuredValues mv = new MeasuredValues(ScalarType.DOUBLE, "Value1", "lightyears", vals, flags);
+ MeasuredValues mv = new MeasuredValues(ScalarType.DOUBLE, "Value1", "lightyears", SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
ValueIterator<Double> valueIterator = mv.iterator();
int i = 0;
while (valueIterator.hasNext()) {
@@ -110,7 +110,7 @@ public class ModelTest {
public void measuredValueString() {
String[] vals = { "str1", "str2", "str3", "str4" };
boolean[] flags = { true, true, false, true };
- MeasuredValues mv = new MeasuredValues(ScalarType.STRING, "Value1", "lightyears", vals, flags);
+ MeasuredValues mv = new MeasuredValues(ScalarType.STRING, "Value1", "lightyears", SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
ValueIterator<String> valueIterator = mv.iterator();
int i = 0;
while (valueIterator.hasNext()) {

Back to the top