@@ -163,6 +163,11 @@ public class Metadata {
163163 private static String ARCHIVER_URL = DoeServletContextListener .getConfigurationProperty ("archiver.url" );
164164 // get the SITE URL base for applications
165165 private static String SITE_URL = DoeServletContextListener .getConfigurationProperty ("site.url" );
166+ // get the SITE URL base for applications
167+ private static String PM_NAME = DoeServletContextListener .getConfigurationProperty ("project.manager.name" );
168+ // get the SITE URL base for applications
169+ private static String PM_EMAIL = DoeServletContextListener .getConfigurationProperty ("project.manager.email" );
170+
166171 // create and start a ConnectorFactory for use by "autopopulate" service
167172 static {
168173 try {
@@ -2357,10 +2362,11 @@ private static void sendApprovalNotification(DOECodeMetadata md) {
23572362 email .setCharset (org .apache .commons .mail .EmailConstants .UTF_8 );
23582363 email .setHostName (EMAIL_HOST );
23592364
2360- // if HOST or record OWNER isn't set, cannot send
2365+ // if HOST or record OWNER or PROJECT MANAGER NAME isn't set, cannot send
23612366 if (StringUtils .isEmpty (EMAIL_HOST ) ||
23622367 null ==md ||
2363- StringUtils .isEmpty (md .getOwner ()))
2368+ StringUtils .isEmpty (md .getOwner ()) ||
2369+ StringUtils .isEmpty (PM_NAME ))
23642370 return ;
23652371 // only has meaning for APPROVED records
23662372 if (!Status .Approved .equals (md .getWorkflowStatus ()))
@@ -2378,6 +2384,10 @@ private static void sendApprovalNotification(DOECodeMetadata md) {
23782384 email .setSubject ("Approved -- DOE CODE ID: " + md .getCodeId () + ", " + md .getSoftwareTitle ());
23792385 email .addTo (md .getOwner ());
23802386
2387+ // if email is provided, BCC the Project Manager
2388+ if (!StringUtils .isEmpty (PM_EMAIL ))
2389+ email .addBcc (PM_EMAIL , PM_NAME );
2390+
23812391 StringBuilder msg = new StringBuilder ();
23822392
23832393 msg .append ("<html>" );
@@ -2411,7 +2421,7 @@ private static void sendApprovalNotification(DOECodeMetadata md) {
24112421 .append ("/faq\" >DOE CODE FAQs</a>.</P>" );
24122422 msg .
append (
"<P>If we can be of assistance, please do not hesitate to <a href=\" mailto:[email protected] \" >Contact Us</a>.</P>" );
24132423 msg .append ("<P>Sincerely,</P>" );
2414- msg .append ("<P>Lynn Davis <BR/>Product Manager for DOE CODE<BR/>USDOE/OSTI</P>" );
2424+ msg .append ("<P>" + PM_NAME + " <BR/>Product Manager for DOE CODE<BR/>USDOE/OSTI</P>" );
24152425
24162426 msg .append ("</html>" );
24172427
@@ -2430,9 +2440,10 @@ private static void sendApprovalNotification(DOECodeMetadata md) {
24302440 * @param md the METADATA to send notification for
24312441 */
24322442 private static void sendPOCNotification (DOECodeMetadata md ) {
2433- // if HOST or MD isn't set, cannot send
2443+ // if HOST or MD or PROJECT MANAGER NAME isn't set, cannot send
24342444 if (StringUtils .isEmpty (EMAIL_HOST ) ||
2435- null == md )
2445+ null == md ||
2446+ StringUtils .isEmpty (PM_NAME ))
24362447 return ;
24372448
24382449 Long codeId = md .getCodeId ();
@@ -2455,10 +2466,10 @@ private static void sendPOCNotification(DOECodeMetadata md) {
24552466 return ;
24562467 }
24572468
2458- List <String > emails = site .getPocEmails ();
2469+ List <String > emails = site .getPocEmails ();
24592470
24602471 // if POC is setup
2461- for ( String pocEmail : emails ) {
2472+ if ( emails != null && ! emails . isEmpty () ) {
24622473 try {
24632474 HtmlEmail email = new HtmlEmail ();
24642475 email .setCharset (org .apache .commons .mail .EmailConstants .UTF_8 );
@@ -2469,7 +2480,13 @@ private static void sendPOCNotification(DOECodeMetadata md) {
24692480
24702481 email .setFrom (EMAIL_FROM );
24712482 email .setSubject ("POC Notification -- " + workflowStatus + " -- DOE CODE ID: " + codeId + ", " + md .getSoftwareTitle ());
2472- email .addTo (pocEmail );
2483+
2484+ for (String pocEmail : emails )
2485+ email .addTo (pocEmail );
2486+
2487+ // if email is provided, BCC the Project Manager
2488+ if (!StringUtils .isEmpty (PM_EMAIL ))
2489+ email .addBcc (PM_EMAIL , PM_NAME );
24732490
24742491 StringBuilder msg = new StringBuilder ();
24752492
@@ -2491,15 +2508,15 @@ private static void sendPOCNotification(DOECodeMetadata md) {
24912508
24922509 msg .
append (
"<P>If you have any questions, please do not hesitate to <a href=\" mailto:[email protected] \" >Contact Us</a>.</P>" );
24932510 msg .append ("<P>Sincerely,</P>" );
2494- msg .append ("<P>Lynn Davis <BR/>Product Manager for DOE CODE<BR/>USDOE/OSTI</P>" );
2511+ msg .append ("<P>" + PM_NAME + " <BR/>Product Manager for DOE CODE<BR/>USDOE/OSTI</P>" );
24952512
24962513 msg .append ("</html>" );
24972514
24982515 email .setHtmlMsg (msg .toString ());
24992516
25002517 email .send ();
25012518 } catch ( EmailException e ) {
2502- log .error ("Unable to send POC notification to " + pocEmail + " for #" + md .getCodeId ());
2519+ log .error ("Unable to send POC notification to " + Arrays . toString ( emails . toArray ()) + " for #" + md .getCodeId ());
25032520 log .error ("Message: " + e .getMessage ());
25042521 }
25052522 }
0 commit comments