From da7e1de7f3b6f6b8dfb062b532a08d4b4ae9d892 Mon Sep 17 00:00:00 2001 From: chubtub <43381989+chubtub@users.noreply.github.com> Date: Tue, 11 May 2021 13:06:21 -0400 Subject: [PATCH] Support -m|--manufacturer and -s|--serial filter options from commandline in controller class. --- .../ValidationReportsPageController.java | 51 ++++++++++--------- scripts/download_validation_reports.sh | 2 +- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ValidationReportsPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ValidationReportsPageController.java index a53c97cc..8883d6a7 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ValidationReportsPageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ValidationReportsPageController.java @@ -159,6 +159,8 @@ public class ValidationReportsPageController extends PageController> parsedComponents = parseComponents(pc); - for (ArrayList component : parsedComponents) { - for (String data : component) { - reportData.append(data + ","); + if ((filterManufacturer.isEmpty() || filterManufacturer.equals( + pc.getManufacturer())) + && (filterSerial.isEmpty() || filterSerial.equals( + pc.getPlatformSerial()))) { + if (!componentOnly) { + reportData.append(pc.getManufacturer() + "," + + pc.getModel() + "," + + pc.getPlatformSerial() + "," + + LocalDateTime.now().toString() + "," + + pc.getDevice().getSupplyChainStatus() + ","); + } + if (!systemOnly) { + ArrayList> parsedComponents = parseComponents(pc); + for (ArrayList component : parsedComponents) { + for (String data : component) { + reportData.append(data + ","); + } + reportData.deleteCharAt(reportData.length() - 1); + reportData.append("\n,,,,,"); } - reportData.deleteCharAt(reportData.length() - 1); - reportData.append("\n,,,,,"); } } } @@ -284,8 +289,6 @@ public class ValidationReportsPageController extends PageController