org.sonar.batch
Class DefaultDecoratorContext
java.lang.Object
org.sonar.batch.DefaultDecoratorContext
- All Implemented Interfaces:
- DecoratorContext
public class DefaultDecoratorContext
- extends Object
- implements DecoratorContext
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultDecoratorContext
public DefaultDecoratorContext(Resource resource,
DefaultSonarIndex index,
List<DecoratorContext> childrenContexts,
DatabaseSession session,
ViolationsDao violationsDao)
setReadOnly
public DefaultDecoratorContext setReadOnly(boolean b)
getProject
public Project getProject()
- Specified by:
getProject in interface DecoratorContext
- Returns:
- the project in which the decorator is
getChildren
public List<DecoratorContext> getChildren()
- Description copied from interface:
DecoratorContext
- Child contexts are read only
- Specified by:
getChildren in interface DecoratorContext
getMeasures
public <M> M getMeasures(MeasuresFilter<M> filter)
- Description copied from interface:
DecoratorContext
- Never return null.
- Specified by:
getMeasures in interface DecoratorContext
getMeasure
public Measure getMeasure(Metric metric)
- Description copied from interface:
DecoratorContext
- Find a measure for the resource
- Specified by:
getMeasure in interface DecoratorContext
getChildrenMeasures
public Collection<Measure> getChildrenMeasures(MeasuresFilter filter)
- Description copied from interface:
DecoratorContext
- Never return null.
- Specified by:
getChildrenMeasures in interface DecoratorContext
getChildrenMeasures
public Collection<Measure> getChildrenMeasures(Metric metric)
- Specified by:
getChildrenMeasures in interface DecoratorContext
- Returns:
- the resource children measures for the given metric
getResource
public Resource getResource()
- Specified by:
getResource in interface DecoratorContext
- Returns:
- the resource that is currently decorated
saveMeasure
public DecoratorContext saveMeasure(Measure measure)
- Description copied from interface:
DecoratorContext
- Add a measure on the current resource. It can not be executed from children contexts.
- Specified by:
saveMeasure in interface DecoratorContext
- Returns:
- the same context
saveMeasure
public DecoratorContext saveMeasure(Metric metric,
Double value)
- Description copied from interface:
DecoratorContext
- Add a measure on the current resource. It can not be executed from children contexts.
- Specified by:
saveMeasure in interface DecoratorContext
- Returns:
- the current object
getViolations
public List<Violation> getViolations()
- Description copied from interface:
DecoratorContext
- Read-only rule failures.
- Specified by:
getViolations in interface DecoratorContext
- Returns:
- the rule failures for file/classes resources, null for the others
saveDependency
public Dependency saveDependency(Dependency dependency)
- Specified by:
saveDependency in interface DecoratorContext
getDependencies
public Set<Dependency> getDependencies()
- Specified by:
getDependencies in interface DecoratorContext
getIncomingDependencies
public Collection<Dependency> getIncomingDependencies()
- Specified by:
getIncomingDependencies in interface DecoratorContext
getOutgoingDependencies
public Collection<Dependency> getOutgoingDependencies()
- Specified by:
getOutgoingDependencies in interface DecoratorContext
getSession
protected DatabaseSession getSession()
getEvents
public List<Event> getEvents()
- Specified by:
getEvents in interface DecoratorContext
- Returns:
- the list of events associated to the current resource
createEvent
public Event createEvent(String name,
String description,
String category,
Date date)
- Description copied from interface:
DecoratorContext
- Creates an event for a given date
- Specified by:
createEvent in interface DecoratorContext
- Parameters:
name - the event namedescription - the event descriptioncategory - the event categorydate - the event date
- Returns:
- the created event
deleteEvent
public void deleteEvent(Event event)
- Description copied from interface:
DecoratorContext
- Deletes an event
- Specified by:
deleteEvent in interface DecoratorContext
- Parameters:
event - the event to delete
saveViolation
public DefaultDecoratorContext saveViolation(Violation violation)
- Description copied from interface:
DecoratorContext
- Save a coding rule violation. The decorator which calls this method must implement org.sonar.api.batch.GeneratesViolations
- Specified by:
saveViolation in interface DecoratorContext
Copyright © 2009-2010 SonarSource SA. All Rights Reserved.