Skip to content

Commit

Permalink
Added a persistent column for supplier, bom upload processing for sup…
Browse files Browse the repository at this point in the history
…plier, still tweaking how to add supplier contact info; addressing Issue DependencyTrack#2737

Signed-off-by: Melba Lopez <[email protected]>
  • Loading branch information
melba-lopez committed Jul 6, 2023
1 parent f95b5a1 commit e585ff1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/dependencytrack/model/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ public enum FetchGroup {
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The publisher may only contain printable characters")
private String publisher;

@Persistent /**Issue #2373, #2737 */
@Column(name = "SUPPLIER", jdbcType = "VARCHAR")
@Size(max = 255)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The supplier may only contain printable characters")
private OrganizationalEntity supplier;

@Persistent
@Column(name = "GROUP", jdbcType = "VARCHAR")
@Index(name = "PROJECT_GROUP_IDX")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,11 @@ public static org.cyclonedx.model.Metadata createMetadata(final Project project)
}
if (project.getSupplier().getContacts() != null) {
List<OrganizationalContact> contacts = new ArrayList<>();

for (org.cyclonedx.model.OrganizationalContact supplierContact: project.getSupplier().getContacts()) {
for (org.cyclonedx.model.OrganizationalContact OrganizationalContact: project.getSupplier().getContacts()) {
OrganizationalContact contact = new OrganizationalContact();
contact.setName(supplierContact.getName());
contact.setEmail(supplierContact.getEmail());
contact.setPhone(supplierContact.getPhone());
contact.setName(OrganizationalContact.getName());
contact.setEmail(OrganizationalContact.getEmail());
contact.setPhone(OrganizationalContact.getPhone());
contacts.add(contact);
}
supplier.setContacts(contacts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public void informTest() throws Exception {
assertThat(components).hasSize(1);

final Component component = components.get(0);
assertThat(component.getSupplier()).isEqualTo("Example Incorporated"); /*Issue #2373, #2737 */
assertThat(component.getAuthor()).isEqualTo("Sometimes this field is long because it is composed of a list of authors......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................");
assertThat(component.getPublisher()).isEqualTo("Example Incorporated");
assertThat(component.getGroup()).isEqualTo("com.example");
Expand Down

0 comments on commit e585ff1

Please sign in to comment.