001/*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2012 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * Sonar 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 * Sonar 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
017 * License along with Sonar; if not, write to the Free Software
018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019 */
020package org.sonar.api.workflow.internal;
021
022import com.google.common.annotations.Beta;
023import org.apache.commons.lang.builder.ReflectionToStringBuilder;
024import org.apache.commons.lang.builder.ToStringStyle;
025import org.sonar.api.config.Settings;
026import org.sonar.api.workflow.WorkflowContext;
027
028/**
029 * @since 3.1
030 */
031@Beta
032public final class DefaultWorkflowContext implements WorkflowContext {
033
034  private Long userId;
035  private String userLogin;
036  private String userName;
037  private String userEmail;
038  private boolean isAdmin = false;
039  private Long projectId;
040  private Settings settings;
041
042  public Long getUserId() {
043    return userId;
044  }
045
046  public DefaultWorkflowContext setUserId(Long l) {
047    this.userId = l;
048    return this;
049  }
050
051  public String getUserLogin() {
052    return userLogin;
053  }
054
055  public DefaultWorkflowContext setUserLogin(String s) {
056    this.userLogin = s;
057    return this;
058  }
059
060  public String getUserName() {
061    return userName;
062  }
063
064  public DefaultWorkflowContext setUserName(String s) {
065    this.userName = s;
066    return this;
067  }
068
069  public String getUserEmail() {
070    return userEmail;
071  }
072
073  public DefaultWorkflowContext setUserEmail(String userEmail) {
074    this.userEmail = userEmail;
075    return this;
076  }
077
078  public boolean isAdmin() {
079    return isAdmin;
080  }
081
082  public DefaultWorkflowContext setIsAdmin(boolean b) {
083    isAdmin = b;
084    return this;
085  }
086
087  public Long getProjectId() {
088    return projectId;
089  }
090
091  public DefaultWorkflowContext setProjectId(Long l) {
092    this.projectId = l;
093    return this;
094  }
095
096  public Settings getProjectSettings() {
097    return settings;
098  }
099
100  public DefaultWorkflowContext setSettings(Settings s) {
101    this.settings = s;
102    return this;
103  }
104
105  @Override
106  public String toString() {
107    return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
108  }
109}