Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 3413b96

Browse files
author
sowerstl
committed
Trim Software Title value on notification emails.
1 parent c0a651b commit 3413b96

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/gov/osti/services/Metadata.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,14 +2332,16 @@ private static void sendStatusNotification(DOECodeMetadata md) {
23322332
email.setSubject("DOE CODE Record " + md.getWorkflowStatus().toString());
23332333
email.addTo(EMAIL_SUBMISSION);
23342334

2335+
String softwareTitle = md.getSoftwareTitle().replaceAll("^\\h+|\\h+$","");
2336+
23352337
StringBuilder msg = new StringBuilder();
23362338
msg.append("<html>");
23372339
msg.append("A new DOE CODE record has been ")
23382340
.append(md.getWorkflowStatus())
23392341
.append(" and is awaiting approval:");
23402342

23412343
msg.append("<P>Code ID: ").append(md.getCodeId());
2342-
msg.append("<BR>Software Title: ").append(md.getSoftwareTitle());
2344+
msg.append("<BR>Software Title: ").append(softwareTitle);
23432345
msg.append("</html>");
23442346

23452347
email.setHtmlMsg(msg.toString());
@@ -2379,8 +2381,10 @@ private static void sendApprovalNotification(DOECodeMetadata md) {
23792381
return;
23802382
}
23812383

2384+
String softwareTitle = md.getSoftwareTitle().replaceAll("^\\h+|\\h+$","");
2385+
23822386
email.setFrom(EMAIL_FROM);
2383-
email.setSubject("Approved -- DOE CODE ID: " + md.getCodeId() + ", " + md.getSoftwareTitle());
2387+
email.setSubject("Approved -- DOE CODE ID: " + md.getCodeId() + ", " + softwareTitle);
23842388
email.addTo(md.getOwner());
23852389

23862390
// if email is provided, BCC the Project Manager
@@ -2488,8 +2492,10 @@ private static void sendPOCNotification(DOECodeMetadata md) {
24882492
String lab = site.getLab();
24892493
lab = lab.isEmpty() ? siteCode : lab;
24902494

2495+
String softwareTitle = md.getSoftwareTitle().replaceAll("^\\h+|\\h+$","");
2496+
24912497
email.setFrom(EMAIL_FROM);
2492-
email.setSubject("POC Notification -- " + workflowStatus + " -- DOE CODE ID: " + codeId + ", " + md.getSoftwareTitle());
2498+
email.setSubject("POC Notification -- " + workflowStatus + " -- DOE CODE ID: " + codeId + ", " + softwareTitle);
24932499

24942500
for (String pocEmail : emails)
24952501
email.addTo(pocEmail);
@@ -2506,7 +2512,7 @@ private static void sendPOCNotification(DOECodeMetadata md) {
25062512
String biblioLink = SITE_URL + "/biblio/" + codeId;
25072513

25082514
msg.append("<p>As a point of contact for ").append(lab).append(", we wanted to inform you that a software project, titled ")
2509-
.append(md.getSoftwareTitle())
2515+
.append(softwareTitle)
25102516
.append(", associated with your organization was ").append(lastApprovalFor).append(" to DOE CODE and assigned DOE CODE ID: ")
25112517
.append(codeId)
25122518
.append(". This project record is discoverable in <a href=\"")

0 commit comments

Comments
 (0)