001 /*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2011 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.wsclient.services;
021
022 import java.util.Date;
023
024 public class Violation extends Model {
025
026 private String message = null;
027 private String severity = null;
028 private Integer line = null;
029 private String ruleKey = null;
030 private String ruleName = null;
031 private String resourceKey = null;
032 private String resourceName = null;
033 private String resourceScope = null;
034 private String resourceQualifier = null;
035 private Date createdAt = null;
036
037 public String getMessage() {
038 return message;
039 }
040
041 public void setMessage(String message) {
042 this.message = message;
043 }
044
045 /**
046 * @since 2.5
047 */
048 public String getSeverity() {
049 return severity;
050 }
051
052 /**
053 * @since 2.5
054 */
055 public void setSeverity(String severity) {
056 this.severity = severity;
057 }
058
059 /**
060 * @deprecated since 2.5 use {@link #getSeverity()} instead. See http://jira.codehaus.org/browse/SONAR-1829
061 */
062 @Deprecated
063 public String getPriority() {
064 return severity;
065 }
066
067 /**
068 * @deprecated since 2.5 use {@link #setSeverity(String)} instead. See http://jira.codehaus.org/browse/SONAR-1829
069 */
070 @Deprecated
071 public void setPriority(String priority) {
072 this.severity = priority;
073 }
074
075 public Integer getLine() {
076 return line;
077 }
078
079 public void setLine(Integer line) {
080 this.line = line;
081 }
082
083 public String getResourceKey() {
084 return resourceKey;
085 }
086
087 public void setResourceKey(String resourceKey) {
088 this.resourceKey = resourceKey;
089 }
090
091 public String getRuleKey() {
092 return ruleKey;
093 }
094
095 public Violation setRuleKey(String s) {
096 this.ruleKey = s;
097 return this;
098 }
099
100 public String getRuleName() {
101 return ruleName;
102 }
103
104 public Violation setRuleName(String ruleName) {
105 this.ruleName = ruleName;
106 return this;
107 }
108
109 public String getResourceName() {
110 return resourceName;
111 }
112
113 public Violation setResourceName(String resourceName) {
114 this.resourceName = resourceName;
115 return this;
116 }
117
118 public String getResourceScope() {
119 return resourceScope;
120 }
121
122 public Violation setResourceScope(String resourceScope) {
123 this.resourceScope = resourceScope;
124 return this;
125 }
126
127 public String getResourceQualifier() {
128 return resourceQualifier;
129 }
130
131 public Violation setResourceQualifier(String resourceQualifier) {
132 this.resourceQualifier = resourceQualifier;
133 return this;
134 }
135
136 /**
137 * @since 2.5
138 */
139 public Date getCreatedAt() {
140 return createdAt;
141 }
142
143 /**
144 * @since 2.5
145 */
146 public Violation setCreatedAt(Date createdAt) {
147 this.createdAt = createdAt;
148 return this;
149 }
150
151 /**
152 * @since 2.5
153 */
154 public boolean isCreatedAfter(Date date) {
155 return createdAt!=null && date!=null && createdAt.after(date);
156 }
157 }