From aa13572f2404b304d767981ae94db512a3d0508d Mon Sep 17 00:00:00 2001 From: Melba <101211710+melba-lopez@users.noreply.github.com> Date: Sun, 24 Sep 2023 15:37:02 -0500 Subject: [PATCH 1/2] Update Component.java - missing ; --- src/main/java/org/dependencytrack/model/Component.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/dependencytrack/model/Component.java b/src/main/java/org/dependencytrack/model/Component.java index 4f015b78ee..6948a198fc 100644 --- a/src/main/java/org/dependencytrack/model/Component.java +++ b/src/main/java/org/dependencytrack/model/Component.java @@ -28,7 +28,7 @@ import com.github.packageurl.MalformedPackageURLException; import com.github.packageurl.PackageURL; import org.apache.commons.lang3.StringUtils; -import org.cyclonedx.model.OrganizationalEntity +import org.cyclonedx.model.OrganizationalEntity; import org.dependencytrack.model.validation.ValidSpdxExpression; import org.dependencytrack.resources.v1.serializers.CustomPackageURLSerializer; import javax.jdo.annotations.Column; From 798583638317165f79467c53ba37b8818e837f21 Mon Sep 17 00:00:00 2001 From: Melba <101211710+melba-lopez@users.noreply.github.com> Date: Sun, 24 Sep 2023 15:43:45 -0500 Subject: [PATCH 2/2] Update ModelConverter.java Putting back code (mouse is acting up on me and accidentally deleted code) --- .../parser/cyclonedx/util/ModelConverter.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/dependencytrack/parser/cyclonedx/util/ModelConverter.java b/src/main/java/org/dependencytrack/parser/cyclonedx/util/ModelConverter.java index 01314cc528..9c39fff838 100644 --- a/src/main/java/org/dependencytrack/parser/cyclonedx/util/ModelConverter.java +++ b/src/main/java/org/dependencytrack/parser/cyclonedx/util/ModelConverter.java @@ -453,7 +453,28 @@ public static ServiceComponent convert(final QueryManager qm, final org.cycloned service.setProject(project); } service.setBomRef(StringUtils.trimToNull(cycloneDxService.getBomRef())); - + if (cycloneDxService.getProvider() != null) { + OrganizationalEntity provider = new OrganizationalEntity();; + provider.setName(cycloneDxService.getProvider().getName()); + if (cycloneDxService.getProvider().getUrls() != null && cycloneDxService.getProvider().getUrls().size() > 0) { + provider.setUrls(cycloneDxService.getProvider().getUrls().toArray(new String[0])); + } else { + provider.setUrls(null); + } + if (cycloneDxService.getProvider().getContacts() != null) { + List contacts = new ArrayList<>(); + for (org.cyclonedx.model.OrganizationalContact cycloneDxContact: cycloneDxService.getProvider().getContacts()) { + OrganizationalContact contact = new OrganizationalContact(); + contact.setName(cycloneDxContact.getName()); + contact.setEmail(cycloneDxContact.getEmail()); + contact.setPhone(cycloneDxContact.getPhone()); + contacts.add(contact); + } + provider.setContacts(contacts); + } + service.setProvider(provider); + } else { + service.setProvider(null); } service.setGroup(StringUtils.trimToNull(cycloneDxService.getGroup())); service.setName(StringUtils.trimToNull(cycloneDxService.getName()));