|
1 | 1 | package org.hydev.mcpm.client.commands.controllers;
|
2 | 2 |
|
3 | 3 | import org.hydev.mcpm.client.list.ListAllBoundary;
|
| 4 | +import org.hydev.mcpm.client.updater.CheckForUpdatesBoundary; |
4 | 5 |
|
5 | 6 | import java.util.List;
|
6 | 7 | import java.util.function.Consumer;
|
|
11 | 12 | * Controller class for the ListAll use case.
|
12 | 13 | *
|
13 | 14 | * @author Kevin Chen
|
14 |
| -*/ |
15 |
| -public class ListController |
16 |
| -{ |
| 15 | + */ |
| 16 | +public class ListController { |
17 | 17 | private final ListAllBoundary listAllBoundary;
|
| 18 | + private final CheckForUpdatesBoundary checkForUpdatesBoundary; |
18 | 19 |
|
19 | 20 | /**
|
20 | 21 | * Constructor for ListAllController.
|
21 | 22 | *
|
22 | 23 | * @param listAllBoundary The boundary class for ListAllController.
|
23 | 24 | */
|
24 |
| - public ListController(ListAllBoundary listAllBoundary) { |
| 25 | + public ListController(ListAllBoundary listAllBoundary, CheckForUpdatesBoundary checkForUpdatesBoundary) { |
25 | 26 | this.listAllBoundary = listAllBoundary;
|
| 27 | + this.checkForUpdatesBoundary = checkForUpdatesBoundary; |
26 | 28 | }
|
27 | 29 |
|
28 | 30 | /**
|
29 | 31 | * Executes the ListAll use case.
|
30 | 32 | *
|
31 | 33 | * @param parameter The parameter for the ListAll use case.
|
32 |
| - * @param log Logger |
| 34 | + * @param log Logger |
33 | 35 | */
|
34 | 36 | public void listAll(String parameter, Consumer<String> log) {
|
35 |
| - var list = listAllBoundary.listAll(parameter); |
| 37 | + var list = listAllBoundary.listAll(parameter, checkForUpdatesBoundary); |
36 | 38 |
|
37 | 39 | // Tabulate result
|
38 |
| - var table = tabulate(list.stream().map(p -> |
39 |
| - List.of("&a" + p.name(), "&e" + p.getFirstAuthor(), p.version())).toList(), |
40 |
| - List.of(":Name", "Author", "Version:")); |
| 40 | + var table = tabulate( |
| 41 | + list.stream().map(p -> List.of("&a" + p.name(), "&e" + p.getFirstAuthor(), p.version())).toList(), |
| 42 | + List.of(":Name", "Author", "Version:")); |
41 | 43 |
|
42 | 44 | log.accept(table);
|
43 | 45 | }
|
|
0 commit comments