File tree Expand file tree Collapse file tree 2 files changed +6
-20
lines changed
src/main/java/com/redhat/labs/lodestar Expand file tree Collapse file tree 2 files changed +6
-20
lines changed Original file line number Diff line number Diff line change 18
18
import javax .ws .rs .core .Response ;
19
19
import javax .ws .rs .core .UriInfo ;
20
20
import java .util .ArrayList ;
21
- import java .util .Arrays ;
22
- import java .util .List ;
23
21
import java .util .Set ;
24
22
25
23
@ RequestScoped
@@ -42,22 +40,8 @@ public class EngagementCategoryResource {
42
40
@ Operation (summary = "Returns customers list" )
43
41
public Response getAllCategories (@ Context UriInfo uriInfo , @ BeanParam ListFilterOptions filterOptions ) {
44
42
45
- List <String > regions = new ArrayList <>();
46
- if (filterOptions .getSearch ().isPresent ()) {
47
- //TODO convert legacy -
48
- String [] params = filterOptions .getSearch ().get ().split ("&" );
49
-
50
- for (String param : params ) {
51
- String [] keyValues = param .split ("=" );
52
-
53
- if (keyValues [0 ].equals ("engagement_region" )) {
54
- String [] regionsArray = keyValues [1 ].split ("," );
55
- regions = Arrays .asList (regionsArray );
56
- }
57
- }
58
- }
59
-
60
- return engagementService .getCategories (regions , filterOptions );
43
+ Set <String > regions = filterOptions .getV2Regions ();
44
+ return engagementService .getCategories (new ArrayList <>(regions ), filterOptions );
61
45
}
62
46
63
47
//TODO page or limit?
Original file line number Diff line number Diff line change @@ -347,8 +347,10 @@ public Response getEngagementsPaged(ListFilterOptions listFilterOptions) {
347
347
e .addArtifact (Artifact .builder ().type ("temp" ).build ());
348
348
}
349
349
350
- for (String cat : e .getCategoriesV2 ()) {
351
- e .addCategory (cat );
350
+ if (e .getCategoriesV2 () != null ) {
351
+ for (String cat : e .getCategoriesV2 ()) {
352
+ e .addCategory (cat );
353
+ }
352
354
}
353
355
}
354
356
return Response .ok (engagements ).header ("x-total-engagements" , response .getHeaderString ("x-total-engagements" )).build ();
You can’t perform that action at this time.
0 commit comments