From 4fb6d70b7a4dc0d297710ec08945f53477e91582 Mon Sep 17 00:00:00 2001 From: Matthias Koller Date: Thu, 18 Oct 2018 15:59:13 +0200 Subject: TestStep#loadContexts returns cached values if present Signed-off-by: Matthias Koller --- build.gradle | 2 +- .../java/org/eclipse/mdm/api/base/model/TestStep.java | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 29cc999..aa8faae 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ description = 'MDM API - Base Model' group = 'org.eclipse.mdm' -version = '5.0.0M5-SNAPSHOT' +version = '5.0.0M5-ATFX-SNAPSHOT' apply plugin: 'java' apply plugin: 'maven' 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 loadContexts(BaseEntityManager manager, ContextType... contextTypes) throws DataAccessException { - return manager.loadContexts(this, contextTypes); + + Map 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; + } } } -- cgit v1.2.3 From 7b75ef0be7f1ca630f6eb5ad71df2bd94d6ab8b8 Mon Sep 17 00:00:00 2001 From: Matthias Koller Date: Fri, 19 Oct 2018 13:46:16 +0200 Subject: Added sourceJar Signed-off-by: Matthias Koller --- build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle b/build.gradle index aa8faae..8b27484 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 -- cgit v1.2.3 From ac26b72971a856945de19dfb741fb1e37d6b9ea6 Mon Sep 17 00:00:00 2001 From: Martin Fleischer Date: Fri, 26 Oct 2018 18:50:22 +0200 Subject: SequenceRepresentation etc. for LocalColumns. Signed-off-by: Martin Fleischer --- .../mdm/api/base/massdata/IndependentBuilder.java | 11 +++ .../eclipse/mdm/api/base/massdata/ReadRequest.java | 46 ++++++++++-- .../mdm/api/base/massdata/ReadRequestBuilder.java | 6 ++ .../mdm/api/base/massdata/WriteRequest.java | 10 +++ .../eclipse/mdm/api/base/model/MeasuredValues.java | 81 ++++++++++++++++++---- .../org/eclipse/mdm/api/base/model/ScalarType.java | 12 +++- .../org/eclipse/mdm/api/base/model/ModelTest.java | 6 +- 7 files changed, 148 insertions(+), 24 deletions(-) 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/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/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 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 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 valueIterator = mv.iterator(); int i = 0; while (valueIterator.hasNext()) { -- cgit v1.2.3 From 47b06fc64a71bdbd2714526d4ff8d477f051717c Mon Sep 17 00:00:00 2001 From: Martin Fleischer Date: Fri, 9 Nov 2018 17:23:52 +0100 Subject: Modified Measurement#loadContexts so non-committed ContextRoots are returned. Signed-off-by: Martin Fleischer --- .../eclipse/mdm/api/base/model/Measurement.java | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) 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 efbcc07..ea67d0e 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 loadContexts(BaseEntityManager manager, - ContextType... contextTypes) throws DataAccessException { - return manager.loadContexts(this, contextTypes); + @Override + public Map loadContexts(BaseEntityManager manager, ContextType... contextTypes) + throws DataAccessException { + + Map 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; + } } } -- cgit v1.2.3 From 1f5574b1a23ee5722d1481f4901c94117bf48149 Mon Sep 17 00:00:00 2001 From: Matthias Koller Date: Thu, 15 Nov 2018 13:33:59 +0100 Subject: Added support for n-to-m relations Change-Id: I713855e85703f718066fd48c9052a97787eb88e2 Signed-off-by: Matthias Koller --- .../eclipse/mdm/api/base/BaseEntityManager.java | 8 ++ .../org/eclipse/mdm/api/base/adapter/Core.java | 10 +- .../eclipse/mdm/api/base/adapter/DefaultCore.java | 11 +- .../org/eclipse/mdm/api/base/adapter/Relation.java | 8 +- .../mdm/api/base/adapter/RelationStore.java | 115 +++++++++++++++++++++ .../java/org/eclipse/mdm/api/base/CoreImpl.java | 6 ++ .../org/eclipse/mdm/api/base/RelationImpl.java | 5 + 7 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java 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 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 + */ + List loadRelatedEntities(Entity entity, String relationName, Class 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 values = new HashMap<>(); private final Map 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> added = new HashMap<>(0); + private final Map> removed = new HashMap<>(0); + + /** + * Returns current set of related children mapped by their type. + * + * @return Returned {@code Map} is unmodifiable. + */ + public Map> getAdded() { + return Collections.unmodifiableMap(added); + } + + /** + * Returns current set of removed related children mapped by their type. + * + * @return Returned {@code Map} is unmodifiable. + */ + public Map> getRemoved() { + return Collections.unmodifiableMap(removed); + } + + /** + * Returns related child entities of given type. + * + * @param + * Desired entity type. + * @param entityClass + * Used as identifier. + * @return Returned {@code List} is unmodifiable. + */ + @SuppressWarnings("unchecked") + public List get(String relation) { + return Collections.unmodifiableList((List) added.computeIfAbsent(relation, k -> new ArrayList<>())); + } + + /** + * Sorts the child entities with given {@code Comparator}. + * + * @param + * Desired entity type. + * @param entityClass + * Used as identifier. + * @param comparator + * Used for sorting. + */ + @SuppressWarnings("unchecked") + public void sort(String relation, Comparator comparator) { + List children = (List) 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) 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) 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/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; + } } -- cgit v1.2.3 From c37da6b15b9f30ead609f18d5fe303a7e0ecac0e Mon Sep 17 00:00:00 2001 From: Matthias Koller Date: Wed, 20 Feb 2019 14:08:27 +0100 Subject: Updated notice file Signed-off-by: Matthias Koller --- NOTICE.txt | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 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 -- cgit v1.2.3