org.sonar.api.profiles
Class RulesProfile

java.lang.Object
  extended by org.sonar.api.profiles.RulesProfile
All Implemented Interfaces:
Cloneable

public class RulesProfile
extends Object
implements Cloneable

This class is badly named. It should be "QualityProfile". Indeed it does not relate only to rules but to metric thresholds too.


Field Summary
static String SONAR_WAY_FINDBUGS_NAME
          Name of the default java profile "Sonar way with Findbugs"
static String SONAR_WAY_NAME
          Name of the default profile "Sonar Way"
static String SUN_CONVENTIONS_NAME
          Name of the default java profile "Sun checks"
 
Constructor Summary
RulesProfile()
          Deprecated. use the factory method create()
RulesProfile(String name, String language)
          Deprecated. since 2.3. Use the factory method create()
RulesProfile(String name, String language, boolean defaultProfile, boolean provided)
          Deprecated. since 2.3. Use the factory method create()
 
Method Summary
 ActiveRule activateRule(Rule rule, RulePriority optionalPriority)
           
 Object clone()
           
static RulesProfile create()
           
static RulesProfile create(String name, String language)
           
 boolean equals(Object obj)
           
 ActiveRule getActiveRule(Rule rule)
           
 ActiveRule getActiveRule(String repositoryKey, String ruleKey)
           
 ActiveRule getActiveRuleByConfigKey(String repositoryKey, String configKey)
           
 List<ActiveRule> getActiveRules()
           
 List<ActiveRule> getActiveRules(RulePriority priority)
           
 List<ActiveRule> getActiveRulesByPlugin(String repositoryKey)
          Deprecated. since 2.3. Use getActiveRulesByRepository().
 List<ActiveRule> getActiveRulesByRepository(String repositoryKey)
           
 List<Alert> getAlerts()
           
 Boolean getDefaultProfile()
           
 Integer getId()
           
 String getLanguage()
           
 String getName()
           
 List<ResourceModel> getProjects()
           
 Boolean getProvided()
           
 int hashCode()
           
 void setActiveRules(List<ActiveRule> activeRules)
          Set the list of active rules
 void setAlerts(List<Alert> alerts)
          Sets the list of alerts for the profile
 void setDefaultProfile(Boolean b)
          Set whether this is the default profile for the language.
 RulesProfile setLanguage(String s)
          Set the profile language
 RulesProfile setName(String s)
          Set the profile name.
 void setProjects(List<ResourceModel> projects)
          Sets the list of projects attached to the profile
 void setProvided(Boolean b)
          Set whether the profile is provided by a plugin
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SONAR_WAY_NAME

public static final String SONAR_WAY_NAME
Name of the default profile "Sonar Way"

See Also:
Constant Field Values

SONAR_WAY_FINDBUGS_NAME

public static final String SONAR_WAY_FINDBUGS_NAME
Name of the default java profile "Sonar way with Findbugs"

See Also:
Constant Field Values

SUN_CONVENTIONS_NAME

public static final String SUN_CONVENTIONS_NAME
Name of the default java profile "Sun checks"

See Also:
Constant Field Values
Constructor Detail

RulesProfile

@Deprecated
public RulesProfile()
Deprecated. use the factory method create()


RulesProfile

@Deprecated
public RulesProfile(String name,
                               String language)
Deprecated. since 2.3. Use the factory method create()


RulesProfile

@Deprecated
public RulesProfile(String name,
                               String language,
                               boolean defaultProfile,
                               boolean provided)
Deprecated. since 2.3. Use the factory method create()

Method Detail

getId

public Integer getId()

getName

public String getName()
Returns:
the profile name, unique by language.

setName

public RulesProfile setName(String s)
Set the profile name.


getActiveRules

public List<ActiveRule> getActiveRules()
Returns:
the list of active rules

setActiveRules

public void setActiveRules(List<ActiveRule> activeRules)
Set the list of active rules


getDefaultProfile

public Boolean getDefaultProfile()
Returns:
whether this is the default profile for the language

setDefaultProfile

public void setDefaultProfile(Boolean b)
Set whether this is the default profile for the language. The default profile is used when none is explicitly defined when auditing a project.


getProvided

public Boolean getProvided()
Returns:
whether the profile is defined in a plugin. Provided profiles are automatically restored during server startup and can not be updated by end users.

setProvided

public void setProvided(Boolean b)
Set whether the profile is provided by a plugin


getLanguage

public String getLanguage()
Returns:
the profile language

setLanguage

public RulesProfile setLanguage(String s)
Set the profile language


getAlerts

public List<Alert> getAlerts()
Returns:
the list of alerts defined in the profile

setAlerts

public void setAlerts(List<Alert> alerts)
Sets the list of alerts for the profile


getProjects

public List<ResourceModel> getProjects()
Returns:
the list of projects attached to the profile

setProjects

public void setProjects(List<ResourceModel> projects)
Sets the list of projects attached to the profile


getActiveRules

public List<ActiveRule> getActiveRules(RulePriority priority)
Returns:
the list of active rules for a given priority

getActiveRulesByPlugin

@Deprecated
public List<ActiveRule> getActiveRulesByPlugin(String repositoryKey)
Deprecated. since 2.3. Use getActiveRulesByRepository().


getActiveRulesByRepository

public List<ActiveRule> getActiveRulesByRepository(String repositoryKey)

getActiveRule

public ActiveRule getActiveRule(String repositoryKey,
                                String ruleKey)
Returns:
an active rule from a plugin key and a rule key if the rule is activated, null otherwise

getActiveRuleByConfigKey

public ActiveRule getActiveRuleByConfigKey(String repositoryKey,
                                           String configKey)

getActiveRule

public ActiveRule getActiveRule(Rule rule)

activateRule

public ActiveRule activateRule(Rule rule,
                               RulePriority optionalPriority)
Parameters:
rule -
optionalPriority - if null, then the default rule priority is used
Returns:

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public Object clone()
Overrides:
clone in class Object

toString

public String toString()
Overrides:
toString in class Object

create

public static RulesProfile create(String name,
                                  String language)

create

public static RulesProfile create()


Copyright © 2009-2010 SonarSource. All Rights Reserved.