File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
src/main/java/com/redhat/labs/omp/service Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change 4
4
import java .util .ArrayList ;
5
5
import java .util .List ;
6
6
import java .util .Optional ;
7
+ import java .util .stream .Collectors ;
7
8
8
9
import javax .annotation .PostConstruct ;
9
10
import javax .enterprise .context .ApplicationScoped ;
@@ -178,19 +179,20 @@ public List<Engagement> getAllEngagements() {
178
179
179
180
List <Project > projects = projectService .getProjectsByGroup (engagementRepositoryId , true );
180
181
181
- List <Engagement > engagementList = new ArrayList <>();
182
+ return
183
+ projects
184
+ .parallelStream ()
185
+ .map (project -> {
186
+ return getEngagement (project , true );
187
+ })
188
+ .filter (optional -> optional .isPresent ())
189
+ .map (optional -> {
190
+ return optional .get ();
191
+ })
192
+ .collect (Collectors .toList ());
182
193
183
- for (Project project : projects ) {
184
- LOGGER .debug ("project id {}" , project .getId ());
185
- Optional <Engagement > engagement = getEngagement (project , true );
186
- if (engagement .isPresent () ) {
187
- engagementList .add (engagement .get ());
188
- }
189
- }
190
-
191
- return engagementList ;
192
194
}
193
-
195
+
194
196
public Engagement getEngagement (String namespaceOrId , boolean includeStatus ) {
195
197
Engagement engagement = null ;
196
198
You can’t perform that action at this time.
0 commit comments