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     */
020    package org.sonar.core.review;
021    
022    import org.apache.commons.lang.builder.ToStringBuilder;
023    import org.apache.commons.lang.builder.ToStringStyle;
024    
025    import javax.annotation.Nullable;
026    import java.util.Date;
027    
028    /**
029     * @since 2.13
030     */
031    public final class ReviewDto {
032    
033      public static final String STATUS_OPEN = "OPEN";
034      public static final String STATUS_REOPENED = "REOPENED";
035      public static final String STATUS_RESOLVED = "RESOLVED";
036      public static final String STATUS_CLOSED = "CLOSED";
037    
038      public static final String RESOLUTION_FALSE_POSITIVE = "FALSE-POSITIVE";
039      public static final String RESOLUTION_FIXED = "FIXED";
040    
041      private Long id;
042      private Integer userId;
043      private Integer assigneeId;
044      private String title;
045      private String status;
046      private String resolution;
047      private Integer violationPermanentId;
048      private Integer projectId;
049      private Integer resourceId;
050      private Integer line;
051      private Date createdAt;
052      private Date updatedAt;
053      private String severity;
054      private Integer ruleId;
055      private boolean manualViolation;
056      private boolean manualSeverity;
057      private Integer actionPlanId;
058    
059      public Long getId() {
060        return id;
061      }
062    
063      public ReviewDto setId(Long id) {
064        this.id = id;
065        return this;
066      }
067    
068      public Integer getUserId() {
069        return userId;
070      }
071    
072      public ReviewDto setUserId(Integer userId) {
073        this.userId = userId;
074        return this;
075      }
076    
077      public Integer getAssigneeId() {
078        return assigneeId;
079      }
080    
081      public ReviewDto setAssigneeId(@Nullable Integer assigneeId) {
082        this.assigneeId = assigneeId;
083        return this;
084      }
085    
086      public String getTitle() {
087        return title;
088      }
089    
090      public ReviewDto setTitle(String title) {
091        this.title = title;
092        return this;
093      }
094    
095      public String getStatus() {
096        return status;
097      }
098    
099      public ReviewDto setStatus(@Nullable String status) {
100        this.status = status;
101        return this;
102      }
103    
104      public String getResolution() {
105        return resolution;
106      }
107    
108      public ReviewDto setResolution(@Nullable String resolution) {
109        this.resolution = resolution;
110        return this;
111      }
112    
113      public Integer getViolationPermanentId() {
114        return violationPermanentId;
115      }
116    
117      public ReviewDto setViolationPermanentId(Integer violationPermanentId) {
118        this.violationPermanentId = violationPermanentId;
119        return this;
120      }
121    
122      public Integer getProjectId() {
123        return projectId;
124      }
125    
126      public ReviewDto setProjectId(Integer projectId) {
127        this.projectId = projectId;
128        return this;
129      }
130    
131      public Integer getResourceId() {
132        return resourceId;
133      }
134    
135      public ReviewDto setResourceId(Integer resourceId) {
136        this.resourceId = resourceId;
137        return this;
138      }
139    
140      public Integer getLine() {
141        return line;
142      }
143    
144      public ReviewDto setLine(@Nullable Integer line) {
145        this.line = line;
146        return this;
147      }
148    
149      public Date getCreatedAt() {
150        return createdAt;
151      }
152    
153      public ReviewDto setCreatedAt(Date createdAt) {
154        this.createdAt = createdAt;
155        return this;
156      }
157    
158      public Date getUpdatedAt() {
159        return updatedAt;
160      }
161    
162      public ReviewDto setUpdatedAt(Date updatedAt) {
163        this.updatedAt = updatedAt;
164        return this;
165      }
166    
167      public String getSeverity() {
168        return severity;
169      }
170    
171      public ReviewDto setSeverity(@Nullable String severity) {
172        this.severity = severity;
173        return this;
174      }
175    
176      public Integer getRuleId() {
177        return ruleId;
178      }
179    
180      public ReviewDto setRuleId(Integer ruleId) {
181        this.ruleId = ruleId;
182        return this;
183      }
184    
185      public boolean getManualViolation() {
186        return manualViolation;
187      }
188    
189      public boolean isManualViolation() {
190        return manualViolation;
191      }
192    
193      public ReviewDto setManualViolation(boolean b) {
194        this.manualViolation = b;
195        return this;
196      }
197    
198      public boolean getManualSeverity() {
199        return manualSeverity;
200      }
201    
202      public ReviewDto setManualSeverity(boolean b) {
203        this.manualSeverity = b;
204        return this;
205      }
206    
207      public boolean isManualSeverity() {
208        return manualSeverity;
209      }
210    
211      public Integer getActionPlanId() {
212        return actionPlanId;
213      }
214    
215      public ReviewDto setActionPlanId(@Nullable Integer i) {
216        this.actionPlanId = i;
217        return this;
218      }
219    
220      @Override
221      public String toString() {
222        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
223      }
224    
225      @Override
226      public boolean equals(Object o) {
227        if (this == o) {
228          return true;
229        }
230        if (o == null || getClass() != o.getClass()) {
231          return false;
232        }
233    
234        ReviewDto reviewDto = (ReviewDto) o;
235        return !(id != null ? !id.equals(reviewDto.id) : reviewDto.id != null);
236      }
237    
238      @Override
239      public int hashCode() {
240        return id != null ? id.hashCode() : 0;
241      }
242    }