These are some minor updates while investigating a bug.

This commit is contained in:
Cyrus 2024-03-14 10:12:40 -04:00
parent 6a13d8dbb1
commit 350cf2b802
4 changed files with 27 additions and 23 deletions

View File

@ -225,7 +225,13 @@ public class IdentityClaimProcessor extends AbstractProcessor {
platformCredential.getSerialNumber().toString(),
platformCredential.getPlatformSerial());
if (componentResults.isEmpty()) {
handlePlatformComponents(platformCredential);
savePlatformComponents(platformCredential);
} else {
componentResults.stream().forEach((componentResult) -> {
componentResult.restore();
componentResult.resetCreateTime();
componentResultRepository.save(componentResult);
});
}
}
@ -628,7 +634,7 @@ public class IdentityClaimProcessor extends AbstractProcessor {
return true;
}
private int handlePlatformComponents(final Certificate certificate) {
private void savePlatformComponents(final Certificate certificate) {
PlatformCredential platformCredential;
int componentResults = 0;
if (certificate instanceof PlatformCredential) {
@ -647,7 +653,6 @@ public class IdentityClaimProcessor extends AbstractProcessor {
componentResults++;
}
}
return componentResults;
}
private int handleDeviceComponents(final String hostName, final String paccorString) {

View File

@ -264,10 +264,14 @@ public class CertificateAttributeScvValidator extends SupplyChainCredentialValid
// first create hash map based on hashCode
List<ComponentResult> remainingComponentResults = checkDeviceHashMap(
componentInfos, componentResults);
//this is used to get a unique count
List<UUID> componentIdList = new ArrayList<>();
int numOfAttributes = 0;
if (!remainingComponentResults.isEmpty()) {
List<ComponentAttributeResult> attributeResults = checkComponentClassMap(
componentInfos, remainingComponentResults);
numOfAttributes = attributeResults.size();
boolean saveAttributeResult;
for (ComponentAttributeResult componentAttributeResult : attributeResults) {
saveAttributeResult = true;
@ -279,17 +283,18 @@ public class CertificateAttributeScvValidator extends SupplyChainCredentialValid
componentAttributeResult.setProvisionSessionId(provisionSessionId);
componentAttributeRepository.save(componentAttributeResult);
fieldValidation &= componentAttributeResult.checkMatchedStatus();
componentIdList.add(componentAttributeResult.getComponentId());
} else {
numOfAttributes--;
}
}
numOfAttributes = attributeResults.size();
}
StringBuilder additionalInfo = new StringBuilder();
if (!remainingComponentResults.isEmpty()) {
resultMessage.append(String.format("There are %d components not matched%n",
remainingComponentResults.size()));
resultMessage.append(String.format("\twith %d total attributes mismatched.",
numOfAttributes));
if (numOfAttributes > 0) {
resultMessage.append(String.format("There are %d component(s) not matched%n "
+ "with %d total attributes mismatched.",
componentIdList.stream().distinct().count(), numOfAttributes));
}
passesValidation &= fieldValidation;

View File

@ -973,9 +973,9 @@ public class CertificatePageController extends PageController<NoPageParams> {
log.error(failMessage);
}
private int handlePlatformComponents(final Certificate certificate) {
private void handlePlatformComponents(final Certificate certificate) {
PlatformCredential platformCredential;
int componentResults = 0;
if (certificate instanceof PlatformCredential) {
platformCredential = (PlatformCredential) certificate;
ComponentResult componentResult;
@ -987,10 +987,8 @@ public class CertificatePageController extends PageController<NoPageParams> {
platformCredential.getPlatformChainType(),
componentIdentifier);
componentResultRepository.save(componentResult);
componentResults++;
}
}
return componentResults;
}
private void deleteComponentResults(final String platformSerial) {

View File

@ -653,16 +653,12 @@
<span class="fieldValue">${address.getAddressValueString()}</span><br/>
</c:forEach>
<c:choose>
<c:when test="${component.isDelta()}">
<c:choose>
<c:when test="${component.isFieldReplaceable()=='TRUE'}">
<span class="label label-success">Replaceable</span><br/>
</c:when>
<c:otherwise>
<span class="label label-danger">Irreplaceable</span><br/>
</c:otherwise>
</c:choose>
</c:when>
<c:when test="${component.isFieldReplaceable()=='TRUE'}">
<span class="label label-success">Replaceable</span><br/>
</c:when>
<c:otherwise>
<span class="label label-danger">Irreplaceable</span><br/>
</c:otherwise>
</c:choose>
<c:if test="${component.isVersion2()}">
<c:if test="${not empty component.getIssuerDN()}">