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.wsclient.services;
021
022/**
023 * @since 2.9
024 */
025public class ReviewCreateQuery extends CreateQuery<Review> {
026
027  private Long violationId;
028  private String comment;
029  private String assignee;
030  private String status;
031  private String resolution;
032
033  public ReviewCreateQuery() {
034  }
035
036  public Long getViolationId() {
037    return violationId;
038  }
039
040  public ReviewCreateQuery setViolationId(Long violationId) {
041    this.violationId = violationId;
042    return this;
043  }
044
045  public String getComment() {
046    return comment;
047  }
048
049  public ReviewCreateQuery setComment(String comment) {
050    this.comment = comment;
051    return this;
052  }
053
054  public String getAssignee() {
055    return assignee;
056  }
057
058  public ReviewCreateQuery setAssignee(String userLogin) {
059    this.assignee = userLogin;
060    return this;
061  }
062
063  public String getStatus() {
064    return status;
065  }
066
067  public ReviewCreateQuery setStatus(String status) {
068    this.status = status;
069    return this;
070  }
071
072  public String getResolution() {
073    return resolution;
074  }
075
076  public ReviewCreateQuery setResolution(String resolution) {
077    this.resolution = resolution;
078    return this;
079  }
080
081  @Override
082  public String getUrl() {
083    StringBuilder url = new StringBuilder();
084    url.append(ReviewQuery.BASE_URL).append('?');
085    appendUrlParameter(url, "violation_id", getViolationId());
086    appendUrlParameter(url, "assignee", getAssignee());
087    appendUrlParameter(url, "status", getStatus());
088    appendUrlParameter(url, "resolution", getResolution());
089    return url.toString();
090  }
091
092  /**
093   * Property {@link #comment} is transmitted through request body as content may exceed URL size allowed by the server.
094   */
095  @Override
096  public String getBody() {
097    return comment;
098  }
099
100  @Override
101  public Class<Review> getModelClass() {
102    return Review.class;
103  }
104}