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.checks.profiles;
021    
022    import org.apache.commons.lang.builder.ToStringBuilder;
023    import org.sonar.check.Priority;
024    
025    import java.util.HashMap;
026    import java.util.Map;
027    
028    /**
029     * @since 2.1 (experimental)
030     * @deprecated since 2.3
031     */
032    @Deprecated
033    public class Check {
034    
035      private String repositoryKey;
036      private String templateKey;
037      private Priority priority = null;
038      private final Map<String, String> properties = new HashMap<String,String>();
039    
040      public Check() {
041      }
042    
043      public Check(String repositoryKey, String templateKey) {
044        this.repositoryKey = repositoryKey;
045        this.templateKey = templateKey;
046      }
047    
048      public String getTemplateKey() {
049        return templateKey;
050      }
051    
052      public String getRepositoryKey() {
053        return repositoryKey;
054      }
055    
056      public void setRepositoryKey(String repositoryKey) {
057        this.repositoryKey = repositoryKey;
058      }
059    
060      public void setTemplateKey(String templateKey) {
061        this.templateKey = templateKey;
062      }
063    
064      public Priority getPriority() {
065        return priority;
066      }
067    
068      public void setPriority(Priority priority) {
069        this.priority = priority;
070      }
071    
072      public Map<String, String> getProperties() {
073        return properties;
074      }
075    
076      public String getProperty(String key) {
077        return properties.get(key);
078      }
079    
080      public void addProperty(String key, Object value) {
081        properties.put(key, value.toString());
082      }
083    
084      public void addProperties(Map<String, String> properties) {
085        this.properties.putAll(properties);
086      }
087    
088      public void setProperties(Map<String, String> properties) {
089        this.properties.clear();
090        this.properties.putAll(properties);
091      }
092    
093      @Override
094      public boolean equals(Object o) {
095        return o == this;
096      }
097    
098      @Override
099      public int hashCode() {
100        return super.hashCode();
101      }
102    
103      @Override
104      public String toString() {
105        return new ToStringBuilder(this)
106            .append("repository", repositoryKey)
107            .append("template", templateKey)
108            .append("priority", priority)
109            .toString();
110      }
111    }