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.wsclient.issue.internal;
021    
022    import org.sonar.wsclient.issue.ActionPlan;
023    import org.sonar.wsclient.unmarshallers.JsonUtils;
024    
025    import javax.annotation.CheckForNull;
026    import java.util.Date;
027    import java.util.Map;
028    
029    /**
030     * @since 3.6
031     */
032    public class DefaultActionPlan implements ActionPlan {
033    
034      private final Map json;
035    
036      DefaultActionPlan(Map json) {
037        this.json = json;
038      }
039    
040      /**
041       * Unique key
042       */
043      public String key() {
044        return JsonUtils.getString(json, "key");
045      }
046    
047      public String project() {
048        return JsonUtils.getString(json, "project");
049      }
050    
051      public String name() {
052        return JsonUtils.getString(json, "name");
053      }
054    
055      @CheckForNull
056      public String description() {
057        return JsonUtils.getString(json, "desc");
058      }
059    
060      public String status() {
061        return JsonUtils.getString(json, "status");
062      }
063    
064      /**
065       * Login of the user who created the action plan.
066       */
067      public String userLogin() {
068        return JsonUtils.getString(json, "userLogin");
069      }
070    
071      @CheckForNull
072      public Date deadLine() {
073        return JsonUtils.getDateTime(json, "deadLine");
074      }
075    
076      public Date createdAt() {
077        return JsonUtils.getDateTime(json, "createdAt");
078      }
079    
080      public Date updatedAt() {
081        return JsonUtils.getDateTime(json, "updatedAt");
082      }
083    
084      @CheckForNull
085      public Integer totalIssues() {
086        return JsonUtils.getInteger(json, "totalIssues");
087      }
088    
089      @CheckForNull
090      public Integer unresolvedIssues() {
091        return JsonUtils.getInteger(json, "unresolvedIssues");
092      }
093    
094    }