org.sonar.api.database.model
Class ResourceModel

java.lang.Object
  extended by org.sonar.api.database.BaseIdentifiable
      extended by org.sonar.api.database.model.ResourceModel
All Implemented Interfaces:
Cloneable

public class ResourceModel
extends BaseIdentifiable
implements Cloneable

Class to map resource with hibernate model


Field Summary
static int DESCRIPTION_COLUMN_SIZE
           
static int KEY_SIZE
           
static int NAME_COLUMN_SIZE
           
static String QUALIFIER_PROJECT_TRUNK
           
static String SCOPE_PROJECT
           
 
Constructor Summary
ResourceModel()
          Default constructor
ResourceModel(String scope, String key, String qualifier, Integer rootId, String name)
          Creates a resource model
 
Method Summary
static ResourceModel build(Resource resource)
          Maps a resource to a resource model and returns the resource
 Object clone()
           
 boolean equals(Object obj)
           
 Integer getCopyResourceId()
           
 String getDescription()
          Only available at project level.
 Boolean getEnabled()
           
 String getKey()
           
 String getLanguageKey()
           
 String getLongName()
           
 String getName()
           
 ProjectLink getProjectLink(String key)
           
 List<ProjectLink> getProjectLinks()
          Only available at project level.
 String getQualifier()
           
 Integer getRootId()
           
 RulesProfile getRulesProfile()
           
 String getScope()
           
 int hashCode()
           
 void setCopyResourceId(Integer copyResourceId)
           
 void setDescription(String description)
          Sets the resource description, truncated to DESCRIPTION_COLUMN_SIZE
 void setEnabled(Boolean enabled)
           
 void setKey(String key)
           
 void setLanguageKey(String lang)
           
 void setLongName(String s)
          Sets the long name of the resource, truncated to NAME_COLUMN_SIZE
 void setName(String name)
          Sets the resource name, truncated to NAME_COLUMN_SIZE
 void setProjectLinks(List<ProjectLink> projectLinks)
           
 void setQualifier(String qualifier)
           
 void setRootId(Integer rootId)
           
 void setRulesProfile(RulesProfile rulesProfile)
           
 void setScope(String scope)
           
 String toString()
           
 
Methods inherited from class org.sonar.api.database.BaseIdentifiable
getId, setId
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SCOPE_PROJECT

public static final String SCOPE_PROJECT
See Also:
Constant Field Values

QUALIFIER_PROJECT_TRUNK

public static final String QUALIFIER_PROJECT_TRUNK
See Also:
Constant Field Values

DESCRIPTION_COLUMN_SIZE

public static final int DESCRIPTION_COLUMN_SIZE
See Also:
Constant Field Values

NAME_COLUMN_SIZE

public static final int NAME_COLUMN_SIZE
See Also:
Constant Field Values

KEY_SIZE

public static final int KEY_SIZE
See Also:
Constant Field Values
Constructor Detail

ResourceModel

public ResourceModel()
Default constructor


ResourceModel

public ResourceModel(String scope,
                     String key,
                     String qualifier,
                     Integer rootId,
                     String name)

Creates a resource model

Parameters:
scope - the scope the rule will apply on
key - the rule key. This is the name of the resource, including the path
qualifier - the resource qualifier
rootId - the rootId for the resource
name - the short name of the resource
Method Detail

getProjectLinks

public List<ProjectLink> getProjectLinks()
Only available at project level.


setProjectLinks

public void setProjectLinks(List<ProjectLink> projectLinks)

getProjectLink

public ProjectLink getProjectLink(String key)
Returns:
a project link given its key if exists, null otherwise

getDescription

public String getDescription()
Only available at project level.


setDescription

public void setDescription(String description)
Sets the resource description, truncated to DESCRIPTION_COLUMN_SIZE


getName

public String getName()

setName

public void setName(String name)
Sets the resource name, truncated to NAME_COLUMN_SIZE


getLongName

public String getLongName()

setLongName

public void setLongName(String s)
Sets the long name of the resource, truncated to NAME_COLUMN_SIZE


getEnabled

public Boolean getEnabled()

setEnabled

public void setEnabled(Boolean enabled)

getScope

public String getScope()

setScope

public void setScope(String scope)

getKey

public String getKey()

getLanguageKey

public String getLanguageKey()

setLanguageKey

public void setLanguageKey(String lang)

getCopyResourceId

public Integer getCopyResourceId()

setCopyResourceId

public void setCopyResourceId(Integer copyResourceId)

setKey

public void setKey(String key)
Throws:
IllegalArgumentException - if the key is longer than KEY_SIZE

getRootId

public Integer getRootId()

setRootId

public void setRootId(Integer rootId)

getRulesProfile

public RulesProfile getRulesProfile()

setRulesProfile

public void setRulesProfile(RulesProfile rulesProfile)

getQualifier

public String getQualifier()

setQualifier

public void setQualifier(String qualifier)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
Overrides:
clone in class Object

build

public static ResourceModel build(Resource resource)
Maps a resource to a resource model and returns the resource



Copyright © 2009-2010 SonarSource. All Rights Reserved.