001 /* 002 * SonarQube, open source software quality management tool. 003 * Copyright (C) 2008-2014 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * SonarQube is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * SonarQube is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020 package org.sonar.api.platform; 021 022 import com.google.common.base.Preconditions; 023 import org.sonar.api.ServerExtension; 024 025 import javax.annotation.Nullable; 026 027 /** 028 * @since 3.2 029 */ 030 public interface NewUserHandler extends ServerExtension { 031 032 final class Context { 033 private String login; 034 private String name; 035 private String email; 036 037 private Context(String login, String name, @Nullable String email) { 038 Preconditions.checkNotNull(login); 039 Preconditions.checkNotNull(name); 040 this.login = login; 041 this.name = name; 042 this.email = email; 043 } 044 045 public String getLogin() { 046 return login; 047 } 048 049 public String getName() { 050 return name; 051 } 052 053 public String getEmail() { 054 return email; 055 } 056 057 public static Builder builder() { 058 return new Builder(); 059 } 060 061 public static final class Builder { 062 private String login; 063 private String name; 064 private String email; 065 066 private Builder() { 067 } 068 069 public Builder setLogin(String s) { 070 this.login = s; 071 return this; 072 } 073 074 public Builder setName(String s) { 075 this.name = s; 076 return this; 077 } 078 079 public Builder setEmail(@Nullable String s) { 080 this.email = s; 081 return this; 082 } 083 084 public Context build() { 085 return new Context(login, name, email); 086 } 087 } 088 } 089 090 void doOnNewUser(Context context); 091 }