mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-02-28 12:21:10 +00:00
These change address Component Address being available to display
on the certificate details page.
This commit is contained in:
parent
c135d17934
commit
c1b2abba19
@ -11,5 +11,4 @@ import java.util.UUID;
|
||||
public interface ComponentResultRepository extends JpaRepository<ComponentResult, UUID> {
|
||||
|
||||
List<ComponentResult> findByBoardSerialNumber(String boardSerialNumber);
|
||||
List<ComponentResult> findByCertificateSerialNumberAndMismatched(String boardSerialNumber, boolean mismatched);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -26,9 +27,9 @@ public class ComponentResult extends ArchivableEntity {
|
||||
|
||||
private String boardSerialNumber;
|
||||
@Setter
|
||||
private String expected;
|
||||
private String expected = "";
|
||||
@Setter
|
||||
private String actual;
|
||||
private String actual = "";
|
||||
|
||||
// embedded component info
|
||||
private String manufacturer;
|
||||
@ -39,8 +40,9 @@ public class ComponentResult extends ArchivableEntity {
|
||||
// this is a string because component class doesn't inherit serializable.
|
||||
private String componentClass;
|
||||
private AttributeStatus attributeStatus;
|
||||
private List<ComponentAddress> componentAddress;
|
||||
private String componentAddress;
|
||||
private boolean version2 = false;
|
||||
private boolean mismatched = false;
|
||||
private String certificateType;
|
||||
|
||||
|
||||
@ -60,7 +62,13 @@ public class ComponentResult extends ArchivableEntity {
|
||||
if (componentIdentifier.getFieldReplaceable() != null) {
|
||||
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
|
||||
if (componentIdentifier.isVersion2()) {
|
||||
ComponentIdentifierV2 ciV2 = (ComponentIdentifierV2) componentIdentifier;
|
||||
@ -68,14 +76,30 @@ public class ComponentResult extends ArchivableEntity {
|
||||
this.attributeStatus = ciV2.getAttributeStatus();
|
||||
this.version2 = true;
|
||||
}
|
||||
|
||||
checkMatchedStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* This getting is used to set the component display to red.
|
||||
* @return result of expected and actual string.
|
||||
* This method is used to update the mismatched status flag for
|
||||
* displaying red if there is a failure.
|
||||
*/
|
||||
public boolean isMismatched() {
|
||||
return this.actual.equals(this.expected);
|
||||
public void checkMatchedStatus() {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +32,8 @@ public class ComponentAddress {
|
||||
|
||||
private ASN1ObjectIdentifier addressType;
|
||||
private ASN1UTF8String addressValue;
|
||||
private String addressTypeString;
|
||||
private String addressValueString;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -366,6 +366,7 @@ public final class CertificateStringMapBuilder {
|
||||
data.put("componentResults", componentResultRepository
|
||||
.findByBoardSerialNumber(certificate.getPlatformSerial()));
|
||||
|
||||
|
||||
//Get platform Configuration values and set map with it
|
||||
PlatformConfiguration platformConfiguration = certificate.getPlatformConfiguration();
|
||||
if (platformConfiguration != null) {
|
||||
|
@ -648,9 +648,9 @@
|
||||
<span class="fieldHeader">Revision:</span>
|
||||
<span class="fieldValue">${component.getRevisionNumber()}</span><br/>
|
||||
</c:if>
|
||||
<c:forEach items="${component.getComponentAddress()}" var="address">
|
||||
<span class="fieldHeader">${address.getAddressTypeValue()} address:</span>
|
||||
<span class="fieldValue">${address.getAddressValue()}</span><br/>
|
||||
<c:forEach items="${component.getComponentAddresses()}" var="address">
|
||||
<span class="fieldHeader">${address.getAddressTypeString()} address:</span>
|
||||
<span class="fieldValue">${address.getAddressValueString()}</span><br/>
|
||||
</c:forEach>
|
||||
<c:choose>
|
||||
<c:when test="${component.getFieldReplaceable()=='TRUE'}">
|
||||
|
@ -59,7 +59,7 @@ public final class VersionHelper {
|
||||
try {
|
||||
version = getFileContents(filename.toString());
|
||||
} catch (IOException ioEx) {
|
||||
log.error(ioEx.getMessage());
|
||||
log.info(ioEx.getMessage());
|
||||
version = "";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user