All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jbpm.identity.mail.IdentityAddressResolver Maven / Gradle / Ivy

There is a newer version: 3.2.19.ayg
Show newest version
package org.jbpm.identity.mail;

import org.jbpm.identity.User;
import org.jbpm.identity.hibernate.IdentitySession;
import org.jbpm.mail.AddressResolver;
import org.jbpm.svc.Service;

/**
 * translates actorIds into email addresses with the jBPM identity module. Only
 * user actorIds are resolved to their email addresses. Group actorIds return
 * null.
 */
public class IdentityAddressResolver implements AddressResolver {

  private static final long serialVersionUID = 1L;

  public Object resolveAddress(String actorId) {
    String emailAddress = null;
    IdentitySession identitySession = new IdentitySession();
    User user = identitySession.getUserByName(actorId);
    if (user != null) {
      emailAddress = user.getEmail();
    }
    return emailAddress;
  }

  /**
   * @deprecated this address resolver does not fit the {@linkplain Service
   * service} model.
   */
  public Service openService() {
    return null;
  }

  /**
   * @deprecated this address resolver does not fit the {@linkplain Service
   * service} model.
   */
  public void close() {
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy