Search in sources :

Example 6 with StrSubstitutor

use of org.apache.commons.lang.text.StrSubstitutor in project mica2 by obiba.

the class MailService method getSubject.

public String getSubject(String subjectFormat, Map<String, String> ctx, String defaultSubject) {
    StrSubstitutor sub = new StrSubstitutor(ctx, "${", "}");
    String temp = // 
    Optional.ofNullable(subjectFormat).filter(// 
    s -> !s.isEmpty()).orElse(defaultSubject);
    return sub.replace(temp);
}
Also used : Async(org.springframework.scheduling.annotation.Async) UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) Logger(org.slf4j.Logger) HttpHeaders(org.springframework.http.HttpHeaders) Collection(java.util.Collection) MediaType(org.springframework.http.MediaType) LoggerFactory(org.slf4j.LoggerFactory) HttpMethod(org.springframework.http.HttpMethod) URLEncoder.encode(java.net.URLEncoder.encode) Strings(com.google.common.base.Strings) HttpEntity(org.springframework.http.HttpEntity) Collectors.toList(java.util.stream.Collectors.toList) Stream(java.util.stream.Stream) Service(org.springframework.stereotype.Service) Map(java.util.Map) StrSubstitutor(org.apache.commons.lang.text.StrSubstitutor) Optional(java.util.Optional) ResponseEntity(org.springframework.http.ResponseEntity) UnsupportedEncodingException(java.io.UnsupportedEncodingException) RestTemplate(org.springframework.web.client.RestTemplate) Joiner(com.google.common.base.Joiner) StrSubstitutor(org.apache.commons.lang.text.StrSubstitutor)

Aggregations

StrSubstitutor (org.apache.commons.lang.text.StrSubstitutor)6 IOException (java.io.IOException)2 Context (com.datatorrent.api.Context)1 StreamingContainer (com.datatorrent.stram.engine.StreamingContainer)1 PTOperator (com.datatorrent.stram.plan.physical.PTOperator)1 Joiner (com.google.common.base.Joiner)1 Strings (com.google.common.base.Strings)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 URLEncoder.encode (java.net.URLEncoder.encode)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Collectors.toList (java.util.stream.Collectors.toList)1 Stream (java.util.stream.Stream)1 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)1 ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)1