/**
 * @license
 * Copyright 2019 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'foam.nanos.notification.email',
  name: 'EmailServiceDAO',
  extends: 'foam.dao.ProxyDAO',

  requires: [
    'foam.nanos.notification.email.EmailMessage',
    'foam.nanos.notification.email.EmailService'
  ],

  imports: [
    'email?'
  ],

  properties: [
    {
      name: 'emailService',
      documentation: `This property determines how to process the email.`,
      of: 'foam.nanos.notification.email.EmailService',
      class: 'FObjectProperty',
      javaFactory: `
      return (EmailService)getEmail();
      `
    }
  ],

  methods: [
    {
      name: 'put_',
      javaCode:
      `
        EmailService service = getEmailService();
        if ( service != null ) {
          ((foam.nanos.logger.Logger) x.get("logger")).debug("EmailServiceDAO emailService null");
          service.sendEmail(x, (EmailMessage)obj);
        }
        return getDelegate().inX(x).put(obj);
      `
    }
  ]
});


@@ -824,16 +824,84 @@
 ull ) %7B%0A
+          service.sendEmail(x, (EmailMessage)obj);%0A        %7D else %7B%0A
         
@@ -995,59 +995,8 @@
 %22);%0A
-          service.sendEmail(x, (EmailMessage)obj);%0A
     

Move log message to else block, incorrectly report null when not null