org.sonar.api.batch
Interface DecoratorContext


public interface DecoratorContext

Since:
1.10

Method Summary
 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
 void deleteEvent(Event event)
          Deletes an event
 java.util.List<DecoratorContext> getChildren()
          Child contexts are read only
 java.util.Collection<Measure> getChildrenMeasures(MeasuresFilter filter)
          Never return null.
 java.util.Collection<Measure> getChildrenMeasures(Metric metric)
           
 java.util.Set<Dependency> getDependencies()
           
 java.util.List<Event> getEvents()
           
 java.util.Collection<Dependency> getIncomingDependencies()
           
 Measure getMeasure(Metric metric)
          Find a measure for the resource
<M> M
getMeasures(MeasuresFilter<M> filter)
          Never return null.
 java.util.Collection<Dependency> getOutgoingDependencies()
           
 Project getProject()
           
 Resource getResource()
           
 java.util.List<Violation> getViolations()
          Read-only rule failures.
 Dependency saveDependency(Dependency dependency)
           
 DecoratorContext saveMeasure(Measure measure)
          Add a measure on the current resource.
 DecoratorContext saveMeasure(Metric metric, java.lang.Double value)
          Add a measure on the current resource.
 DecoratorContext saveViolation(Violation violation)
          Save a coding rule violation.
 

Method Detail

getProject

Project getProject()
Returns:
the project in which the decorator is

getResource

Resource getResource()
Returns:
the resource that is currently decorated

getChildren

java.util.List<DecoratorContext> getChildren()
Child contexts are read only


getMeasure

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


getMeasures

<M> M getMeasures(MeasuresFilter<M> filter)
Never return null.


getChildrenMeasures

java.util.Collection<Measure> getChildrenMeasures(MeasuresFilter filter)
Never return null.


getChildrenMeasures

java.util.Collection<Measure> getChildrenMeasures(Metric metric)
Returns:
the resource children measures for the given metric

saveMeasure

DecoratorContext saveMeasure(Measure measure)
Add a measure on the current resource. It can not be executed from children contexts.

Returns:
the same context

saveMeasure

DecoratorContext saveMeasure(Metric metric,
                             java.lang.Double value)
Add a measure on the current resource. It can not be executed from children contexts.

Returns:
the current object

saveDependency

Dependency saveDependency(Dependency dependency)

getDependencies

java.util.Set<Dependency> getDependencies()

getIncomingDependencies

java.util.Collection<Dependency> getIncomingDependencies()

getOutgoingDependencies

java.util.Collection<Dependency> getOutgoingDependencies()

getViolations

java.util.List<Violation> getViolations()
Read-only rule failures.

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

saveViolation

DecoratorContext saveViolation(Violation violation)
Save a coding rule violation. The decorator which calls this method must implement org.sonar.api.batch.GeneratesViolations


getEvents

java.util.List<Event> getEvents()
Returns:
the list of events associated to the current resource

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

deleteEvent

void deleteEvent(Event event)
Deletes an event

Parameters:
event - the event to delete


Copyright © 2009-2010 SonarSource SA. All Rights Reserved.