[Building Sakai] EmailTemplateService

Brian Jones bjones86 at uwo.ca
Thu Jul 19 10:37:17 PDT 2012


Hey Steve,

Yes, it seems that it is the cause of the bug:
https://jira.sakaiproject.org/browse/SAK-21835.

We run 2.8.x (ETS v0.5.7-SNAPSHOT) with Oracle DBs for our dev/qat/prd
environments; for local development we use MySQL.

We have duplicates in our Oracle DBs for templates with en_GB and NULL as
the locale, but not in our MySQL DBs; just like Mark had reported.
Duplicates get added every time Tomcat is restarted.

I would think that tweaking the query performed by the templateExists
function should rectify the issue, and allow for enforcement of uniqueness
in the database as stated in this bug:
https://jira.sakaiproject.org/browse/SAK-21739.

Thanks for the info!

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

From: Steve Swinsburg [mailto:steve.swinsburg at gmail.com] 
Sent: Wednesday, July 18, 2012 8:04 PM
To: Brian Jones
Cc: 'sakai-dev'
Subject: Re: [Building Sakai] EmailTemplateService

Hi Brian,

Are you on Oracle? If so, you might have found the cause of this bug:
https://jira.sakaiproject.org/browse/SAK-21835

Do you have multiples in your database? It seems like an intermittent
problem so it would be good to put this one to rest.

cheers,
Steve

references:
http://collab.sakaiproject.org/pipermail/sakai-dev/2011-September/014132.htm
l
https://jira.sakaiproject.org/browse/SAK-20987
https://jira.sakaiproject.org/browse/SAK-20825


On 19/07/2012, at 12:55 AM, Brian Jones wrote:


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



_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
with a subject of "unsubscribe"




More information about the sakai-dev mailing list