Exemplo n.º 1
0
 private String createText(String email, Notification notification) {
   String text = notification.project.getSubscriberNotificationTemplate();
   if (notification.subject instanceof ReferenceSupport) {
     text =
         text.replace(
             "${entity.reference}", ((ReferenceSupport) notification.subject).getReference());
   }
   if (notification.subject instanceof LabelSupport) {
     text = text.replace("${entity.label}", ((LabelSupport) notification.subject).getLabel());
   }
   text = text.replace("${change.message}", notification.message);
   text = text.replace("${project.label}", notification.project.getLabel());
   text = text.replace("${project.id}", notification.project.getId());
   if (notification.project.isProductLabelSet())
     text = text.replace("${product.label}", notification.project.getProductLabel());
   if (notification.project.isHomepageUrlSet())
     text = text.replace("${homepage.url}", notification.project.getHomepageUrl());
   text = text.replace("${unsubscribe.url}", createUnsubscribeUrl(email, notification));
   text = text.replace("${unsubscribeall.url}", createUnsubscribeUrl(email, notification));
   text = text.replace("${kunagi.instance}", systemConfig.getInstanceNameWithApplicationLabel());
   text = text.replace("${kunagi.url}", systemConfig.getUrl());
   return text;
 }