Skip to content

Commit

Permalink
Merge pull request #2259 from bosch-io/bug/issue-2172_noDublicatedMap…
Browse files Browse the repository at this point in the history
…pingKeys

Prevent properties from being added multiple times. Fixes #2172
  • Loading branch information
kolotu authored Jan 29, 2020
2 parents ad8ee26 + 4fdcda1 commit 499bf7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ private static List<Property> getFlatStatusProperties(FunctionblockModel fbm) {
if (objectType.getType() instanceof Entity) { // only flatten entities
Entity entity = (Entity) ((ObjectPropertyType) property.getType()).getType();
EList<Property> entityProperties = getFlatProperties(entity);
entity.getProperties().clear();
entity.getProperties().addAll(entityProperties);
if (entity.getSuperType() != null) {
removeSuperTypeModelReference(entity);
Expand All @@ -235,6 +236,7 @@ private static Property copyProperty(Property property) {
newProperty.setPresence(property.getPresence());
newProperty.setMultiplicity(property.isMultiplicity());
newProperty.setDescription(property.getDescription());
newProperty.setConstraintRule(property.getConstraintRule());

if (property.getType() instanceof PrimitivePropertyType) {
PrimitivePropertyType newPrimitiveType =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public void testFlatInheritanceFBwithDatatypes() {

ObjectPropertyType type = (ObjectPropertyType) colorLightProperty.getType();
Entity colorLight = (Entity) type.getType();
assertEquals(3, colorLight.getProperties().size());
assertEquals(2, colorLight.getProperties().size());
assertEquals(1, colorLight.getReferences().size());

assertEquals(1, infomodel.getProperties().get(0).getType().getReferences().size());
Expand Down

0 comments on commit 499bf7a

Please sign in to comment.