|
21 | 21 | import alpine.event.framework.Event;
|
22 | 22 | import alpine.event.framework.Subscriber;
|
23 | 23 | import alpine.logging.Logger;
|
24 |
| -import alpine.persistence.PaginatedResult; |
25 |
| -import alpine.resources.AlpineRequest; |
26 |
| -import alpine.resources.OrderDirection; |
27 |
| -import alpine.resources.Pagination; |
28 | 24 | import org.apache.commons.lang3.StringUtils;
|
29 | 25 | import org.dependencytrack.event.RepositoryMetaEvent;
|
30 | 26 | import org.dependencytrack.model.Component;
|
@@ -53,30 +49,15 @@ public void inform(final Event e) {
|
53 | 49 | analyze(qm, qm.getObjectById(Component.class, event.getComponent().getId()));
|
54 | 50 | }
|
55 | 51 | } else {
|
56 |
| - final AlpineRequest alpineRequest = new AlpineRequest( |
57 |
| - null, |
58 |
| - new Pagination(Pagination.Strategy.OFFSET, 0, 100), |
59 |
| - null, |
60 |
| - "id", |
61 |
| - OrderDirection.ASCENDING |
62 |
| - ); |
63 |
| - try (final QueryManager qm = new QueryManager(alpineRequest)) { |
64 |
| - final PaginatedResult result = qm.getProjects(false, true); |
65 |
| - long count = 0; |
66 |
| - boolean shouldContinue = true; |
67 |
| - while (count < result.getTotal() && shouldContinue) { |
68 |
| - for (final Project project: result.getList(Project.class)) { |
69 |
| - final List<Component> components = qm.getAllComponents(project); |
70 |
| - LOGGER.info("Performing component repository metadata analysis against " + components.size() + " components in project: " + project.getUuid()); |
71 |
| - for (final Component component: components) { |
72 |
| - analyze(qm, component); |
73 |
| - } |
74 |
| - LOGGER.info("Completed component repository metadata analysis against " + components.size() + " components in project: " + project.getUuid()); |
| 52 | + try (final QueryManager qm = new QueryManager()) { |
| 53 | + final List<Project> projects = qm.getAllProjects(true); |
| 54 | + for (final Project project: projects) { |
| 55 | + final List<Component> components = qm.getAllComponents(project); |
| 56 | + LOGGER.info("Performing component repository metadata analysis against " + components.size() + " components in project: " + project.getUuid()); |
| 57 | + for (final Component component: components) { |
| 58 | + analyze(qm, component); |
75 | 59 | }
|
76 |
| - int lastResult = result.getObjects().size(); |
77 |
| - count += lastResult; |
78 |
| - shouldContinue = lastResult > 0; |
79 |
| - qm.advancePagination(); |
| 60 | + LOGGER.info("Completed component repository metadata analysis against " + components.size() + " components in project: " + project.getUuid()); |
80 | 61 | }
|
81 | 62 | }
|
82 | 63 | LOGGER.info("Portfolio component repository metadata analysis complete");
|
|
0 commit comments