001 /*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2009 SonarSource SA
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.api.web.gwt.client.webservices;
021
022 import java.util.Date;
023 import java.util.Map;
024 import java.util.TreeMap;
025
026 /**
027 * @deprecated since 2.5, use {@link org.sonar.wsclient.services.Measure} instead.
028 */
029 @Deprecated
030 public class Measure {
031 private String metric;
032 private String metricName;
033 private Double value;
034 private String formattedValue;
035 private String data;
036
037 private String ruleKey;
038 private String ruleName;
039 private String rulePriority;
040
041 private Date date;
042
043 public Measure() {
044 }
045
046 public Measure(String metric, Double value, String formattedValue) {
047 this.metric = metric;
048 this.value = value;
049 this.formattedValue = formattedValue;
050 }
051
052 public String getMetric() {
053 return metric;
054 }
055
056 public void setMetric(String metric) {
057 this.metric = metric;
058 }
059
060 public Double getValue() {
061 return value;
062 }
063
064 public void setValue(Double value) {
065 this.value = value;
066 }
067
068 public String getFormattedValue() {
069 return formattedValue;
070 }
071
072 public void setFormattedValue(String formattedValue) {
073 this.formattedValue = formattedValue;
074 }
075
076 public String getData() {
077 return data;
078 }
079
080 public Map<String, String> getDataAsMap() {
081 Map<String, String> map = new TreeMap<String, String>();
082 if (data != null) {
083 String[] strings = data.split(";");
084 for (String string : strings) {
085 String[] keyValue = string.split("=");
086 map.put(keyValue[0], keyValue[1]);
087 }
088 }
089 return map;
090
091 }
092
093 public void setData(String data) {
094 this.data = data;
095 }
096
097 public String getMetricName() {
098 return metricName;
099 }
100
101 public void setMetricName(String metricName) {
102 this.metricName = metricName;
103 }
104
105 public String getRuleKey() {
106 return ruleKey;
107 }
108
109 public void setRuleKey(String s) {
110 this.ruleKey = s;
111 }
112
113 public String getRuleName() {
114 return ruleName;
115 }
116
117 public void setRuleName(String ruleName) {
118 this.ruleName = ruleName;
119 }
120
121 /**
122 * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
123 */
124 @Deprecated
125 public String getRuleCategory() {
126 return null;
127 }
128
129 public String getRulePriority() {
130 return rulePriority;
131 }
132
133 public void setRulePriority(String rulePriority) {
134 this.rulePriority = rulePriority;
135 }
136
137 public Date getDate() {
138 return date;
139 }
140
141 public void setDate(Date date) {
142 this.date = date;
143 }
144
145 @Override
146 public String toString() {
147 return "Measure{" +
148 "metric='" + metric + '\'' +
149 ", metric_name='" + metricName + '\'' +
150 ", val='" + value + '\'' +
151 ", f_val='" + formattedValue + '\'' +
152 '}';
153 }
154
155 }