Ejemplo n.º 1
0
  public ExternalAccount getOrCreateExternalAccount(
      UserViewpoint viewpoint, ExternalAccountType type) {
    Account a = viewpoint.getViewer().getAccount();
    if (!em.contains(a))
      throw new RuntimeException("detached account in getOrCreateExternalAccount");

    ExternalAccount external = a.getExternalAccount(type);
    if (external == null) {
      external = new ExternalAccount(type);
      external.setAccount(a);
      em.persist(external);
      a.getExternalAccounts().add(external);

      notifier.onExternalAccountCreated(a.getOwner(), external);
    }
    return external;
  }
Ejemplo n.º 2
0
 public void onAccountAdminDisabledToggled(Account account) {
   for (ExternalAccount external : account.getExternalAccounts()) {
     // this is why we have "maybe changed" since we really don't know.
     notifier.onExternalAccountLovedAndEnabledMaybeChanged(account.getOwner(), external);
   }
 }