From 707abff4b46a4240481a47d9b3437bf6ce5bc82b Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Fri, 9 Dec 2011 14:37:03 +0400 Subject: [PATCH] Add DecoratorBarriers START_VIOLATION_PERSISTENCE and END_OF_VIOLATION_PERSISTENCE --- .../core/sensors/CloseReviewsDecorator.java | 2 +- .../ViolationPersisterDecorator.java | 8 ++--- .../sonar/api/batch/DecoratorBarriers.java | 36 ++++++++++++------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java index 26c697bf542..e7c897d9fb3 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java @@ -41,7 +41,7 @@ import java.util.List; * Decorator that handles the life cycle of a review (for instance, closes a review when its corresponding violation has been fixed). */ @NotDryRun -@DependsUpon(DecoratorBarriers.END_OF_VIOLATION_TRACKING) +@DependsUpon(DecoratorBarriers.END_OF_VIOLATION_PERSISTENCE) @DependedUpon(CloseReviewsDecorator.REVIEW_LIFECYCLE_BARRIER) public class CloseReviewsDecorator implements Decorator { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java index 1b49a41caf1..0c84c9859e5 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java @@ -35,7 +35,8 @@ import org.sonar.core.NotDryRun; import java.util.List; @NotDryRun -@Phase(name = Phase.Name.POST) +@DependsUpon({ DecoratorBarriers.END_OF_VIOLATION_TRACKING, DecoratorBarriers.START_VIOLATION_PERSISTENCE }) +@DependedUpon(DecoratorBarriers.END_OF_VIOLATION_PERSISTENCE) public class ViolationPersisterDecorator implements Decorator { private ViolationTrackingDecorator tracker; @@ -54,11 +55,6 @@ public class ViolationPersisterDecorator implements Decorator { return true; } - @DependsUpon - public Class dependsOnTracker() { - return ViolationTrackingDecorator.class; - } - public void decorate(Resource resource, DecoratorContext context) { saveViolations(context.getProject(), context.getViolations(ViolationQuery.create().forResource(resource).setSwitchMode(ViolationQuery.SwitchMode.BOTH))); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java index 526c87c6c9e..9d5b632cb56 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java @@ -23,8 +23,8 @@ package org.sonar.api.batch; * Barriers are used to define the order of execution of Decorators. Decorators must be annotated with the following : * * * * @since 2.3 @@ -53,19 +53,29 @@ public interface DecoratorBarriers { */ String START_VIOLATION_TRACKING = "START_VIOLATION_TRACKING"; - /* - * This barrier is after {@code END_OF_VIOLATIONS_GENERATION} and {@code START_VIOLATION_TRACKING}. - * Decorators executed after this barrier ({@code @DependsUpon(value=DecoratorBarriers.END_OF_VIOLATION_TRACKING}) - * can benefit from all the features of violation tracking : - * - * - * @since 2.8 - */ + /** + * This barrier is after {@code END_OF_VIOLATIONS_GENERATION} and {@code START_VIOLATION_TRACKING}. + * Decorators executed after this barrier ({@code @DependsUpon(value=DecoratorBarriers.END_OF_VIOLATION_TRACKING}) + * can benefit from all the features of violation tracking : + * + * + * @since 2.8 + */ String END_OF_VIOLATION_TRACKING = "END_OF_VIOLATION_TRACKING"; + /** + * @since 2.13 + */ + String START_VIOLATION_PERSISTENCE = "START_VIOLATION_PERSISTENCE"; + + /** + * @since 2.13 + */ + String END_OF_VIOLATION_PERSISTENCE = "END_OF_VIOLATION_PERSISTENCE"; + /** * Any kinds of time machine data are calculated before this barrier. Decorators executed after this barrier can use * Measure#getVariationValue() and Measure#getTendency() methods. -- 2.39.5