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
          Deprecated. in 4.2. Use your own constant.
static String SONAR_WAY_NAME
          Deprecated. in 4.2. Use your own constant.
static String SUN_CONVENTIONS_NAME
          Deprecated. in 4.2. Use your own constant.
 
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 optionalSeverity)
           
 RulesProfile addActiveRule(ActiveRule activeRule)
           
 Object clone()
           
static RulesProfile create()
           
static RulesProfile create(String name, String language)
           
 boolean equals(Object obj)
           
 ActiveRule getActiveRule(Rule rule)
          Note: disabled rules are excluded.
 ActiveRule getActiveRule(String repositoryKey, String ruleKey)
          Note: disabled rules are excluded.
 ActiveRule getActiveRuleByConfigKey(String repositoryKey, String configKey)
          Note: disabled rules are excluded.
 List<ActiveRule> getActiveRules()
           
 List<ActiveRule> getActiveRules(boolean acceptDisabledRules)
           
 List<ActiveRule> getActiveRules(RulePriority severity)
          Note: disabled rules are excluded.
 List<ActiveRule> getActiveRulesByPlugin(String repositoryKey)
          Deprecated. since 2.3 use getActiveRulesByRepository(String) instead.
 List<ActiveRule> getActiveRulesByRepository(String repositoryKey)
          Get the active rules of a specific repository.
 Boolean getDefaultProfile()
           
 Boolean getEnabled()
          Deprecated. since 3.3. Always return true.
 Integer getId()
           
 String getLanguage()
           
 String getName()
           
 String getParentName()
          For internal use only.
 Boolean getProvided()
          Deprecated. since 3.3 not replaced
 Boolean getUsed()
           
 int getVersion()
           
 int hashCode()
           
 boolean isEnabled()
          Deprecated. since 3.3. Always return true.
 RulesProfile removeActiveRule(ActiveRule activeRule)
           
 void setActiveRules(List<ActiveRule> activeRules)
          Set the list of active rules
 void setDefaultProfile(Boolean b)
          Set whether this is the default profile for the language.
 RulesProfile setEnabled(Boolean b)
          Deprecated. since 3.3.
 RulesProfile setLanguage(String s)
          Set the profile language
 RulesProfile setName(String s)
          Set the profile name.
 void setParentName(String parentName)
          For internal use only.
 void setProvided(Boolean b)
          Deprecated. since 3.3 not replaced
 RulesProfile setUsed(Boolean used)
           
 RulesProfile setVersion(int version)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SONAR_WAY_NAME

@Deprecated
public static final String SONAR_WAY_NAME
Deprecated. in 4.2. Use your own constant.
Name of the default profile "Sonar Way"

See Also:
Constant Field Values

SONAR_WAY_FINDBUGS_NAME

@Deprecated
public static final String SONAR_WAY_FINDBUGS_NAME
Deprecated. in 4.2. Use your own constant.
Name of the default java profile "Sonar way with Findbugs"

See Also:
Constant Field Values

SUN_CONVENTIONS_NAME

@Deprecated
public static final String SUN_CONVENTIONS_NAME
Deprecated. in 4.2. Use your own constant.
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.


getVersion

public int getVersion()

setVersion

public RulesProfile setVersion(int version)

getUsed

public Boolean getUsed()

setUsed

public RulesProfile setUsed(Boolean used)

getActiveRules

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

getActiveRules

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

removeActiveRule

public RulesProfile removeActiveRule(ActiveRule activeRule)

addActiveRule

public RulesProfile addActiveRule(ActiveRule activeRule)

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

@Deprecated
public Boolean getProvided()
Deprecated. since 3.3 not replaced


setProvided

@Deprecated
public void setProvided(Boolean b)
Deprecated. since 3.3 not replaced


getEnabled

@Deprecated
public Boolean getEnabled()
Deprecated. since 3.3. Always return true.


isEnabled

@Deprecated
public boolean isEnabled()
Deprecated. since 3.3. Always return true.


setEnabled

@Deprecated
public RulesProfile setEnabled(Boolean b)
Deprecated. since 3.3.


getLanguage

public String getLanguage()
Returns:
the profile language

setLanguage

public RulesProfile setLanguage(String s)
Set the profile language


getParentName

@CheckForNull
public String getParentName()
For internal use only.

Since:
2.5

setParentName

public void setParentName(String parentName)
For internal use only.

Since:
2.5

getActiveRules

public List<ActiveRule> getActiveRules(RulePriority severity)
Note: disabled rules are excluded.

Returns:
the list of active rules for a given severity

getActiveRulesByPlugin

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


getActiveRulesByRepository

public List<ActiveRule> getActiveRulesByRepository(String repositoryKey)
Get the active rules of a specific repository. Only enabled rules are selected. Disabled rules are excluded.


getActiveRule

@CheckForNull
public ActiveRule getActiveRule(String repositoryKey,
                                             String ruleKey)
Note: disabled rules are excluded.

Returns:
an active rule from a plugin key and a rule key if the rule is activated, null otherwise

getActiveRuleByConfigKey

@CheckForNull
public ActiveRule getActiveRuleByConfigKey(String repositoryKey,
                                                        String configKey)
Note: disabled rules are excluded.


getActiveRule

@CheckForNull
public ActiveRule getActiveRule(Rule rule)
Note: disabled rules are excluded.


activateRule

public ActiveRule activateRule(Rule rule,
                               RulePriority optionalSeverity)
Parameters:
optionalSeverity - if null, then the default rule severity is used

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-2014 SonarSource. All Rights Reserved.