Skip to content

Commit 182509f

Browse files
author
Alexander Ben Nasrallah
committed
Fix boolean expression
1 parent c6ab116 commit 182509f

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<groupId>org.verinice</groupId>
1616
<artifactId>verinice-rest-service</artifactId>
1717
<packaging>pom</packaging>
18-
<version>0.2-beta4</version>
18+
<version>0.2-beta5</version>
1919

2020
<organization>
2121
<name>SerNet Service Network GmbH</name>

verinice-interface/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>org.verinice</groupId>
1010
<artifactId>verinice-rest-service</artifactId>
11-
<version>0.2-beta4</version>
11+
<version>0.2-beta5</version>
1212
</parent>
1313

1414
<artifactId>verinice-interface</artifactId>

verinice-persistence/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<parent>
1010
<groupId>org.verinice</groupId>
1111
<artifactId>verinice-rest-service</artifactId>
12-
<version>0.2-beta4</version>
12+
<version>0.2-beta5</version>
1313
</parent>
1414

1515
<artifactId>verinice-persistence</artifactId>

verinice-persistence/src/main/java/org/verinice/persistence/entities/ElementConverter.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.verinice.model.Velement;
2626

2727
import java.util.*;
28+
import java.util.stream.Collectors;
2829

2930
/**
3031
* This class provides methods to convert an instance of one class to an
@@ -112,14 +113,16 @@ private static Map<String, List<String>> convertPropertyLists(CnaTreeElement dbE
112113
Map<String, List<String>> propertyMap = new HashMap<>();
113114
dbEntity.getEntity().getPropertyLists().forEach((listIdx, propertyList) -> {
114115
Set<Property> properties = propertyList.getProperties();
115-
if (properties != null || !properties.isEmpty()) {
116-
List<String> values = new ArrayList<>();
117-
String type = properties.iterator().next().getPropertytype();
118-
properties.forEach(property -> values.add(property.getPropertyvalue()));
119-
propertyMap.put(type, values);
120-
116+
if (properties != null && !properties.isEmpty()) {
117+
// We assume all properties have the save type. So the type of the list is
118+
// is the type of the first element.
119+
String type = properties.iterator().next().getPropertytype();
120+
List<String> values = properties.stream().map(Property::getPropertyvalue)
121+
.collect(Collectors.toList());
122+
propertyMap.put(type, values);
121123
} else {
122-
LOG.error("properties are null or empty for propertyList : " + propertyList.getUuid());
124+
LOG.error("properties are null or empty for propertyList : " + propertyList
125+
.getUuid());
123126
}
124127
});
125128
return propertyMap;

verinice-rest/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>org.verinice</groupId>
1010
<artifactId>verinice-rest-service</artifactId>
11-
<version>0.2-beta4</version>
11+
<version>0.2-beta5</version>
1212
</parent>
1313

1414

verinice-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>org.verinice</groupId>
1010
<artifactId>verinice-rest-service</artifactId>
11-
<version>0.2-beta4</version>
11+
<version>0.2-beta5</version>
1212
</parent>
1313

1414
<artifactId>verinice-service</artifactId>

0 commit comments

Comments
 (0)