[Building Sakai] EmailTemplateService

Brian Jones bjones86 at uwo.ca
Wed Jul 18 07:55:44 PDT 2012


Hi everyone,

I've been doing some work with the EmailTemplateService, and noticed some
strange behaviour; specifically with the templateExists() method.

Let's say I added a template with a key of 'templateKey' and the local is an
empty string (translated to null in the DB).
If I call any of the following:

   emailTemplateService.templateExists( "templateKey", null );
   emailTemplateService.templateExists( "templateKey", new Locale( "" ) );
   emailTemplateService.templateExists( "templateKey", Locale.getDefault()
);

They all return 'false', even though I'm literally looking at the template
in the database; it's definitely there! I can do the following as a
workaround:

   EmailTemplate origTemplate = emailTemplateService.getEmailTemplate(
"templateKey", new Locale( "" ) );
   if( origTemplate != null ) { // Do some stuff }

This will return me the actual email template; but I don't understand why
the templateExists() function isn't returning 'true'.

Any ideas?

Thanks in advance,

Brian Jones
Applications Development
Information Technology Services
Support Services Building, Room 4326
Western University
(519) 661-2111 x86969
bjones86 at uwo.ca





More information about the sakai-dev mailing list