org.sonar.api.batch
Interface DecoratorContext


public interface DecoratorContext

Since:
1.10

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

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

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


getChildrenMeasures

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,
                             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

Set<Dependency> getDependencies()

getIncomingDependencies

Collection<Dependency> getIncomingDependencies()

getOutgoingDependencies

Collection<Dependency> getOutgoingDependencies()

getViolations

List<Violation> getViolations()
Read-only rule violations.


saveViolation

DecoratorContext saveViolation(Violation violation,
                               boolean force)
Save a coding rule violation. The decorator which calls this method must be depended upon BatchBarriers.END_OF_VIOLATIONS_GENERATION.

Parameters:
force - allows to force creation of violation even if it was suppressed by ViolationFilter
Since:
2.5

saveViolation

DecoratorContext saveViolation(Violation violation)
Save a coding rule violation. The decorator which calls this method must be depended upon BatchBarriers.END_OF_VIOLATIONS_GENERATION.


getEvents

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

createEvent

Event createEvent(String name,
                  String description,
                  String category,
                  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-2011 SonarSource. All Rights Reserved.