org.sonar.plugins.api.jobs
Interface JobContext

All Known Implementing Classes:
JobContextImpl

public interface JobContext

A JobContext is linked to a resource (class, package, project, file...). It is used to read and write measures.


Method Summary
 Measure addMeasure(Measure measure)
          Adds a measure
 Measure addMeasure(Metric metric, java.lang.Double value)
          Adds a measure for the given metric and numeric value
 Measure addMeasure(Metric metric, java.lang.String value)
          Adds a measure for the given metric and string value
 Event createEvent(java.lang.String name, java.lang.String description, java.lang.String category, java.util.Date date)
          Creates an event for a given date
 Event createEventOnCurrentSnapshot(java.lang.String name, java.lang.String description, java.lang.String category)
          Creates an event for the given analysis
 void deleteEvent(Event event)
          Deletes an event
 java.util.List<JobContext> getChildren()
          The list of child job contexts
 java.util.List<Measure> getChildrenMeasures()
          The list of children measures (first child level)
 java.util.List<Measure> getChildrenMeasures(MeasureKey key)
          The list of children measures (first child level) for a given key
 java.util.List<Measure> getChildrenMeasures(Metric metric)
          The list of children measures (first child level) for a given key
 java.util.List<Event> getEvents()
          All events, on projects only
 Measure getMeasure(MeasureKey key)
          Find a measure for the given key
 Measure getMeasure(Metric metric)
          Find a measure for the given metric
 java.util.List<Measure> getMeasures()
          Read-only measures
 java.util.List<Measure> getMeasures(MeasureKey key)
          Finds measures for the given key
 java.util.List<Measure> getMeasures(Metric metric)
          Finds measures for the given metric
 Measure getPastMeasure(Metric metric)
          Find the previous analysis measure for a given metric
 Resource getResource()
          The currently analysed resource
 java.lang.String getResourceVersion()
          The version of the job context resource
 java.util.List<RuleFailure> getRuleFailures()
          Read-only rule failures.
 java.util.Date getSnapshotDate()
          The snapshot creation date
 Measure updateMeasure(Measure measure)
          Update a measure
 

Method Detail

getResource

Resource getResource()
The currently analysed resource

Returns:
the resource cannot be null

getSnapshotDate

java.util.Date getSnapshotDate()
The snapshot creation date

Returns:
creation date

getResourceVersion

java.lang.String getResourceVersion()
The version of the job context resource

Returns:
the version, cannot be null

getRuleFailures

java.util.List<RuleFailure> getRuleFailures()
Read-only rule failures.

Returns:
the rule failures for file/classes resources, null for the others

getMeasures

java.util.List<Measure> getMeasures()
Read-only measures

Returns:
the measures, cannot be null

getMeasure

Measure getMeasure(MeasureKey key)
Find a measure for the given key

Parameters:
key - the measure key
Returns:
the matching measure or null

getMeasure

Measure getMeasure(Metric metric)
Find a measure for the given metric

Parameters:
metric - the measure metric
Returns:
the matching measure or null if nothing found

getPastMeasure

Measure getPastMeasure(Metric metric)
Find the previous analysis measure for a given metric

Parameters:
metric - the metric
Returns:
the past measure or null if nothing found

getMeasures

java.util.List<Measure> getMeasures(MeasureKey key)
Finds measures for the given key

Parameters:
key - the measure key
Returns:
a list containing matching measures, or an empty list

getMeasures

java.util.List<Measure> getMeasures(Metric metric)
Finds measures for the given metric

Parameters:
metric - the measure metric
Returns:
a list containing matching measures, or an empty list

getChildren

java.util.List<JobContext> getChildren()
The list of child job contexts

Returns:
the children, or an emtpy list

getChildrenMeasures

java.util.List<Measure> getChildrenMeasures()
The list of children measures (first child level)

Returns:
the list of measures, or an empty list

getChildrenMeasures

java.util.List<Measure> getChildrenMeasures(MeasureKey key)
The list of children measures (first child level) for a given key

Parameters:
key - the measure key
Returns:
the list of matching child measures, or an empty list

getChildrenMeasures

java.util.List<Measure> getChildrenMeasures(Metric metric)
The list of children measures (first child level) for a given key

Parameters:
metric - the measure metric
Returns:
the list of matching child measures, or an empty list

addMeasure

Measure addMeasure(Measure measure)
Adds a measure

Parameters:
measure - the measure to add
Returns:
the added measure object

addMeasure

Measure addMeasure(Metric metric,
                   java.lang.Double value)
Adds a measure for the given metric and numeric value

Parameters:
metric - the measure metric
value - the measure value
Returns:
the added measure object

addMeasure

Measure addMeasure(Metric metric,
                   java.lang.String value)
Adds a measure for the given metric and string value

Parameters:
metric - the measure metric
value - the measure value
Returns:
the added measure object

updateMeasure

Measure updateMeasure(Measure measure)
Update a measure

Parameters:
measure - the measure to update
Returns:
the updated measure

getEvents

java.util.List<Event> getEvents()
All events, on projects only

Returns:
the events list, or an empty list

createEvent

Event createEvent(java.lang.String name,
                  java.lang.String description,
                  java.lang.String category,
                  java.util.Date date)
Creates an event for a given date

Parameters:
name - the event name
description - the event description
category - the event category
date - the event date
Returns:
the created event

createEventOnCurrentSnapshot

Event createEventOnCurrentSnapshot(java.lang.String name,
                                   java.lang.String description,
                                   java.lang.String category)
Creates an event for the given analysis

Parameters:
name - the event name
description - the event description
category - the event category
Returns:
the created event

deleteEvent

void deleteEvent(Event event)
Deletes an event

Parameters:
event - the event to delete


Copyright © 2009 SonarSource SA. All Rights Reserved.