Updated component info to save the registry id

This commit is contained in:
Cyrus 2024-03-22 09:46:04 -04:00
parent ebd36f1d6c
commit 465c9dea51
3 changed files with 15 additions and 7 deletions

View File

@ -56,6 +56,8 @@ public class ComponentInfo extends ArchivableEntity {
@Column @Column
private String componentClass; private String componentClass;
@Column @Column
private String componentClassRegistry;
@Column
private String componentClassStr; private String componentClassStr;
/** /**
@ -122,17 +124,20 @@ public class ComponentInfo extends ArchivableEntity {
* @param componentSerial Component Serial Number (can be null) * @param componentSerial Component Serial Number (can be null)
* @param componentRevision Component Revision or Version (can be null) * @param componentRevision Component Revision or Version (can be null)
* @param componentClass Component Class (can be null) * @param componentClass Component Class (can be null)
* @param componentClassRegistry The id that indicates TCG or SMBIOS
*/ */
public ComponentInfo(final String deviceName, public ComponentInfo(final String deviceName,
final String componentManufacturer, final String componentManufacturer,
final String componentModel, final String componentModel,
final String componentSerial, final String componentSerial,
final String componentRevision, final String componentRevision,
final String componentClass) { final String componentClass,
final String componentClassRegistry) {
this(deviceName, componentManufacturer, componentModel, this(deviceName, componentManufacturer, componentModel,
componentSerial, componentRevision); componentSerial, componentRevision);
this.componentClass = Objects.requireNonNullElse(componentClass, StringUtils.EMPTY); this.componentClass = Objects.requireNonNullElse(componentClass, StringUtils.EMPTY);
this.componentClassRegistry = Objects.requireNonNullElse(componentClassRegistry, StringUtils.EMPTY);
} }
/** /**

View File

@ -301,16 +301,19 @@ public class SupplyChainCredentialValidator {
} else { } else {
// version 2 // version 2
String componentClass = StringUtils.EMPTY; String componentClass = StringUtils.EMPTY;
String componentClassRegistry = StringUtils.EMPTY;
for (JsonNode subNode : compClassNodes) { for (JsonNode subNode : compClassNodes) {
componentClass = getJSONNodeValueAsText(subNode, componentClass = getJSONNodeValueAsText(subNode,
"COMPONENTCLASSVALUE"); "COMPONENTCLASSVALUE");
componentClassRegistry = getJSONNodeValueAsText(subNode,
"COMPONENTCLASSREGISTRY");
} }
componentInfoList.add(new ComponentInfo(hostName, componentInfoList.add(new ComponentInfo(hostName,
getJSONNodeValueAsText(next, "MANUFACTURER"), getJSONNodeValueAsText(next, "MANUFACTURER"),
getJSONNodeValueAsText(next, "MODEL"), getJSONNodeValueAsText(next, "MODEL"),
getJSONNodeValueAsText(next, "SERIAL"), getJSONNodeValueAsText(next, "SERIAL"),
getJSONNodeValueAsText(next, "REVISION"), getJSONNodeValueAsText(next, "REVISION"),
componentClass)); componentClass, componentClassRegistry));
} }
} }
} }

View File

@ -40,11 +40,11 @@
</div> </div>
<br /> <br />
<div id="componentListCollapse" class="row" style="margin: auto 260px auto 125px"> <div id="componentListCollapse" class="row" style="margin: auto 260px auto 125px">
<div class="row" style="display: flex;"> <div class="row" style="display: flex">
<div class="panel panel-default" style="flex: 1"> <div class="panel panel-default" style="flex: 1 1 300px">
<div class="panel-heading"><span class="fieldHeader">Certificate Component</span></div> <div class="panel-heading"><span class="fieldHeader">Certificate Component</span></div>
<div style="display: flex 1; margin: auto"> <div style="margin: auto">
<c:forEach items="${initialData.componentResults}" var="componentResult"> <c:forEach items="${initialData.componentResults}" var="componentResult">
<div class="panel-body" style="background-color: #00ff00; margin-bottom: 5px"> <div class="panel-body" style="background-color: #00ff00; margin-bottom: 5px">
<span class="compHeader">Component Class: </span> ${componentResult.getComponentClassStr()}<br /> <span class="compHeader">Component Class: </span> ${componentResult.getComponentClassStr()}<br />
@ -65,10 +65,10 @@
</c:forEach> </c:forEach>
</div> </div>
</div> </div>
<div class="panel panel-default" style="flex: 2"> <div class="panel panel-default" style="flex: 1 1 300px">
<div class="panel-heading"><span class="fieldHeader">Device Components</span></div> <div class="panel-heading"><span class="fieldHeader">Device Components</span></div>
<div style="display: flex 2; margin: auto"> <div style="margin: auto">
<c:forEach items="${initialData.componentInfos}" var="componentInfo"> <c:forEach items="${initialData.componentInfos}" var="componentInfo">
<div class="panel-body" style="background-color: #00ff00; margin-bottom: 5px"> <div class="panel-body" style="background-color: #00ff00; margin-bottom: 5px">
<span class="compHeader">Component Class: </span> ${componentInfo.getComponentClassStr()}<br /> <span class="compHeader">Component Class: </span> ${componentInfo.getComponentClassStr()}<br />