These change address Component Address being available to display

on the certificate details page.
This commit is contained in:
Cyrus 2024-02-16 13:18:03 -05:00
parent c135d17934
commit c1b2abba19
6 changed files with 39 additions and 13 deletions

View File

@ -11,5 +11,4 @@ import java.util.UUID;
public interface ComponentResultRepository extends JpaRepository<ComponentResult, UUID> { public interface ComponentResultRepository extends JpaRepository<ComponentResult, UUID> {
List<ComponentResult> findByBoardSerialNumber(String boardSerialNumber); List<ComponentResult> findByBoardSerialNumber(String boardSerialNumber);
List<ComponentResult> findByCertificateSerialNumberAndMismatched(String boardSerialNumber, boolean mismatched);
} }

View File

@ -12,6 +12,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
@ -26,9 +27,9 @@ public class ComponentResult extends ArchivableEntity {
private String boardSerialNumber; private String boardSerialNumber;
@Setter @Setter
private String expected; private String expected = "";
@Setter @Setter
private String actual; private String actual = "";
// embedded component info // embedded component info
private String manufacturer; private String manufacturer;
@ -39,8 +40,9 @@ public class ComponentResult extends ArchivableEntity {
// this is a string because component class doesn't inherit serializable. // this is a string because component class doesn't inherit serializable.
private String componentClass; private String componentClass;
private AttributeStatus attributeStatus; private AttributeStatus attributeStatus;
private List<ComponentAddress> componentAddress; private String componentAddress;
private boolean version2 = false; private boolean version2 = false;
private boolean mismatched = false;
private String certificateType; private String certificateType;
@ -60,7 +62,13 @@ public class ComponentResult extends ArchivableEntity {
if (componentIdentifier.getFieldReplaceable() != null) { if (componentIdentifier.getFieldReplaceable() != null) {
this.fieldReplaceable = componentIdentifier.getFieldReplaceable().isTrue(); this.fieldReplaceable = componentIdentifier.getFieldReplaceable().isTrue();
} }
this.componentAddress.addAll(componentIdentifier.getComponentAddress()); StringBuilder sb = new StringBuilder();
for (ComponentAddress element : componentIdentifier.getComponentAddress()) {
sb.append(String.format("%s:%s;",element.getAddressTypeValue(),
element.getAddressValue().toString()));
}
componentAddress = sb.toString();
// V2 fields // V2 fields
if (componentIdentifier.isVersion2()) { if (componentIdentifier.isVersion2()) {
ComponentIdentifierV2 ciV2 = (ComponentIdentifierV2) componentIdentifier; ComponentIdentifierV2 ciV2 = (ComponentIdentifierV2) componentIdentifier;
@ -68,14 +76,30 @@ public class ComponentResult extends ArchivableEntity {
this.attributeStatus = ciV2.getAttributeStatus(); this.attributeStatus = ciV2.getAttributeStatus();
this.version2 = true; this.version2 = true;
} }
checkMatchedStatus();
} }
/** /**
* This getting is used to set the component display to red. * This method is used to update the mismatched status flag for
* @return result of expected and actual string. * displaying red if there is a failure.
*/ */
public boolean isMismatched() { public void checkMatchedStatus() {
return this.actual.equals(this.expected); this.mismatched = this.actual.equals(this.expected);
}
public List<ComponentAddress> getComponentAddresses() {
List<ComponentAddress> addresses = new LinkedList<>();
ComponentAddress address;
if (componentAddress != null && !componentAddress.isEmpty()) {
for (String s : componentAddress.split(";", 0)) {
address = new ComponentAddress();
address.setAddressTypeString(s.split(":")[0]);
address.setAddressValueString(s.split(":")[1]);
addresses.add(address);
}
}
return addresses;
} }
/** /**

View File

@ -32,6 +32,8 @@ public class ComponentAddress {
private ASN1ObjectIdentifier addressType; private ASN1ObjectIdentifier addressType;
private ASN1UTF8String addressValue; private ASN1UTF8String addressValue;
private String addressTypeString;
private String addressValueString;
/** /**
* Default constructor. * Default constructor.

View File

@ -366,6 +366,7 @@ public final class CertificateStringMapBuilder {
data.put("componentResults", componentResultRepository data.put("componentResults", componentResultRepository
.findByBoardSerialNumber(certificate.getPlatformSerial())); .findByBoardSerialNumber(certificate.getPlatformSerial()));
//Get platform Configuration values and set map with it //Get platform Configuration values and set map with it
PlatformConfiguration platformConfiguration = certificate.getPlatformConfiguration(); PlatformConfiguration platformConfiguration = certificate.getPlatformConfiguration();
if (platformConfiguration != null) { if (platformConfiguration != null) {

View File

@ -648,9 +648,9 @@
<span class="fieldHeader">Revision:</span> <span class="fieldHeader">Revision:</span>
<span class="fieldValue">${component.getRevisionNumber()}</span><br/> <span class="fieldValue">${component.getRevisionNumber()}</span><br/>
</c:if> </c:if>
<c:forEach items="${component.getComponentAddress()}" var="address"> <c:forEach items="${component.getComponentAddresses()}" var="address">
<span class="fieldHeader">${address.getAddressTypeValue()} address:</span> <span class="fieldHeader">${address.getAddressTypeString()} address:</span>
<span class="fieldValue">${address.getAddressValue()}</span><br/> <span class="fieldValue">${address.getAddressValueString()}</span><br/>
</c:forEach> </c:forEach>
<c:choose> <c:choose>
<c:when test="${component.getFieldReplaceable()=='TRUE'}"> <c:when test="${component.getFieldReplaceable()=='TRUE'}">

View File

@ -59,7 +59,7 @@ public final class VersionHelper {
try { try {
version = getFileContents(filename.toString()); version = getFileContents(filename.toString());
} catch (IOException ioEx) { } catch (IOException ioEx) {
log.error(ioEx.getMessage()); log.info(ioEx.getMessage());
version = ""; version = "";
} }