org.sonar.api.database.model
Class MeasureModel

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

public class MeasureModel
extends Object
implements Cloneable

This class is the Hibernate model to store a measure in the DB


Field Summary
static int TEXT_VALUE_LENGTH
           
 
Constructor Summary
MeasureModel()
          Creates an empty measure
MeasureModel(int metricId, Double val)
          Creates a measure based on a metric and a double value
MeasureModel(int metricId, Metric.Level level)
          Creates a measure based on a metric and an alert level
MeasureModel(int metricId, String val)
          Creates a measure based on a metric and a string value
 
Method Summary
 Object clone()
           
 Metric.Level getAlertStatus()
           
 String getAlertText()
           
 Integer getCharacteristicId()
           
 String getData(Metric metric)
           
 String getDescription()
           
 Long getId()
           
 Metric.Level getLevelValue()
           
 Date getMeasureDate()
           
 Integer getMetricId()
           
 Integer getPersonId()
           
 Integer getProjectId()
           
 Integer getRuleId()
           
 RulePriority getRulePriority()
           
 Integer getSnapshotId()
           
 Integer getTendency()
           
 String getTextValue()
          Use getData() instead
 String getUrl()
           
 Double getValue()
           
 Double getVariationValue1()
           
 Double getVariationValue2()
           
 Double getVariationValue3()
           
 Double getVariationValue4()
           
 Double getVariationValue5()
           
 boolean isRuleMeasure()
           
 MeasureModel save(DatabaseSession session)
          Saves the current object to database
 MeasureModel setAlertStatus(Metric.Level level)
          Sets the measure alert status
 void setAlertText(String alertText)
          Sets the text for the alert
 MeasureModel setCharacteristicId(Integer characteristicId)
           
 void setData(String data)
          Sets the measure data
 void setDescription(String description)
          Sets the measure description
 void setId(Long id)
           
 MeasureModel setMeasureDate(Date measureDate)
          Sets the date for the measure
 void setMetricId(Integer metricId)
           
 MeasureModel setPersonId(Integer i)
           
 void setProjectId(Integer projectId)
          Sets the project id
 MeasureModel setRuleId(Integer ruleId)
          Sets the rule for the measure
 void setRulePriority(RulePriority rulePriority)
          Sets the rule priority
 MeasureModel setSnapshotId(Integer snapshotId)
          Sets the snapshot id
 MeasureModel setTendency(Integer tendency)
          Sets the measure tendency
 void setTextValue(String textValue)
          Use setData() instead
 void setUrl(String url)
          Sets the measure URL
 MeasureModel setValue(Double value)
          Sets the measure value
 void setVariationValue1(Double d)
           
 void setVariationValue2(Double d)
           
 void setVariationValue3(Double d)
           
 void setVariationValue4(Double d)
           
 void setVariationValue5(Double d)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT_VALUE_LENGTH

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

MeasureModel

public MeasureModel(int metricId,
                    Double val)
Creates a measure based on a metric and a double value


MeasureModel

public MeasureModel(int metricId,
                    Metric.Level level)
Creates a measure based on a metric and an alert level


MeasureModel

public MeasureModel(int metricId,
                    String val)
Creates a measure based on a metric and a string value


MeasureModel

public MeasureModel()
Creates an empty measure

Method Detail

getId

public Long getId()

setId

public void setId(Long id)

getValue

public Double getValue()
Returns:
the measure double value

getDescription

public String getDescription()
Returns:
the measure description

setDescription

public void setDescription(String description)
Sets the measure description


setValue

public MeasureModel setValue(Double value)
Sets the measure value

Throws:
IllegalArgumentException - in case value is not a valid double

getLevelValue

public Metric.Level getLevelValue()
Returns:
the measure alert level

getTextValue

public String getTextValue()
Use getData() instead


setTextValue

public void setTextValue(String textValue)
Use setData() instead


getTendency

public Integer getTendency()
Returns:
the measure tendency

isRuleMeasure

public boolean isRuleMeasure()
Returns:
whether the measure is about rule

setTendency

public MeasureModel setTendency(Integer tendency)
Sets the measure tendency

Returns:
the current object

getMetricId

public Integer getMetricId()

setMetricId

public void setMetricId(Integer metricId)

getSnapshotId

public Integer getSnapshotId()
Returns:
the snapshot id the measure is attached to

setSnapshotId

public MeasureModel setSnapshotId(Integer snapshotId)
Sets the snapshot id

Returns:
the current object

getRuleId

public Integer getRuleId()

setRuleId

public MeasureModel setRuleId(Integer ruleId)
Sets the rule for the measure

Returns:
the current object

getRulePriority

public RulePriority getRulePriority()
Returns:
the rule priority

setRulePriority

public void setRulePriority(RulePriority rulePriority)
Sets the rule priority


getProjectId

public Integer getProjectId()
Returns:
the project id

setProjectId

public void setProjectId(Integer projectId)
Sets the project id


getMeasureDate

public Date getMeasureDate()
Returns:
the date of the measure

setMeasureDate

public MeasureModel setMeasureDate(Date measureDate)
Sets the date for the measure

Returns:
the current object

getAlertStatus

public Metric.Level getAlertStatus()
Returns:
the alert status if there is one, null otherwise

setAlertStatus

public MeasureModel setAlertStatus(Metric.Level level)
Sets the measure alert status

Returns:
the current object

getData

public String getData(Metric metric)
Returns:
the measure data

setData

public final void setData(String data)
Sets the measure data


getAlertText

public String getAlertText()
Returns:
the text of the alert

setAlertText

public void setAlertText(String alertText)
Sets the text for the alert


getUrl

public String getUrl()
Returns:
the measure URL

setUrl

public void setUrl(String url)
Sets the measure URL


toString

public String toString()
Overrides:
toString in class Object

getVariationValue1

public Double getVariationValue1()

setVariationValue1

public void setVariationValue1(Double d)

getVariationValue2

public Double getVariationValue2()

setVariationValue2

public void setVariationValue2(Double d)

getVariationValue3

public Double getVariationValue3()

setVariationValue3

public void setVariationValue3(Double d)

getVariationValue4

public Double getVariationValue4()

setVariationValue4

public void setVariationValue4(Double d)

getVariationValue5

public Double getVariationValue5()

setVariationValue5

public void setVariationValue5(Double d)

save

public MeasureModel save(DatabaseSession session)
Saves the current object to database

Returns:
the current object

getCharacteristicId

public Integer getCharacteristicId()

setCharacteristicId

public MeasureModel setCharacteristicId(Integer characteristicId)

getPersonId

public Integer getPersonId()

setPersonId

public MeasureModel setPersonId(Integer i)

clone

public Object clone()
Overrides:
clone in class Object


Copyright © 2009–2015 SonarSource. All rights reserved.