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()
          Deprecated. in 3.6, replaced by Issuable
 List<Violation> getViolations(ViolationQuery violationQuery)
          Deprecated. in 3.6, replaced by Issuable
 Dependency saveDependency(Dependency dependency)
           
 DecoratorContext saveMeasure(Measure measure)
          Add a new measure on the current resource.
 DecoratorContext saveMeasure(Metric metric, Double value)
          Add a new measure on the current resource.
 DecoratorContext saveViolation(Violation violation)
          Deprecated. in 3.6, replaced by Issuable
 DecoratorContext saveViolation(Violation violation, boolean force)
          Deprecated. in 3.6, replaced by Issuable
 

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

@Deprecated
List<Violation> getViolations(ViolationQuery violationQuery)
Deprecated. in 3.6, replaced by Issuable

Returns the violations that match the ViolationQuery parameters.

Parameters:
violationQuery - the request parameters specified as a ViolationQuery
Returns:
the list of violations that match those parameters
Since:
2.8

getViolations

@Deprecated
List<Violation> getViolations()
Deprecated. in 3.6, replaced by Issuable

Returns all the active (= non switched-off) violations found on the current resource.

Returns:
the list of violations

saveViolation

@Deprecated
DecoratorContext saveViolation(Violation violation,
                                          boolean force)
Deprecated. in 3.6, replaced by Issuable

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

@Deprecated
DecoratorContext saveViolation(Violation violation)
Deprecated. in 3.6, replaced by Issuable

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–2015 SonarSource. All rights reserved.