001/*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2012 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * Sonar is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * Sonar is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public
017 * License along with Sonar; if not, write to the Free Software
018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019 */
020package org.sonar.api.batch;
021
022/**
023 * Barriers are used to define the order of execution of Decorators. Decorators must be annotated with the following :
024 *
025 * <ul>
026 *   <li>{@code @DependsUpon(BARRIER)} in order to be executed after BARRIER</li>
027 *   <li>{@code @DependedUpon(BARRIER)} in order to be executed before BARRIER</li>
028 * </ul>
029 *
030 * @since 2.3
031 */
032public interface DecoratorBarriers {
033
034  String START_VIOLATIONS_GENERATION = "START_VIOLATIONS_GENERATION";
035
036  /**
037   * This barrier is used by a decorator in order to :
038   * <ul>
039   * <li>be executed after all the decorators which generate violations :
040   * {@code @DependsUpon(value=DecoratorBarriers.END_OF_VIOLATIONS_GENERATION}</li>
041   * <li>declare that it generates violations : {@code @DependedUpon(value=DecoratorBarriers.END_OF_VIOLATIONS_GENERATION}</li>
042   * </ul>
043   */
044  String END_OF_VIOLATIONS_GENERATION = "END_OF_VIOLATIONS_GENERATION";
045
046  /**
047   * Extensions which call the method {@code Violation#setSwitchedOff} must be executed before this barrier
048   * ({@code @DependedUpon(value=DecoratorBarriers.VIOLATION_TRACKING})
049   *
050   * This barrier is after {@code END_OF_VIOLATIONS_GENERATION}
051   *
052   * @since 2.8
053   */
054  String START_VIOLATION_TRACKING = "START_VIOLATION_TRACKING";
055
056  /**
057   * This barrier is after {@code END_OF_VIOLATIONS_GENERATION} and {@code START_VIOLATION_TRACKING}.
058   * Decorators executed after this barrier ({@code @DependsUpon(value=DecoratorBarriers.END_OF_VIOLATION_TRACKING})
059   * can benefit from all the features of violation tracking :
060   * <ul>
061   *   <li>{@code Violation#getCreatedAt()}</li>
062   *   <li>{@code Violation#isSwitchedOff()}, usually to know if a violation has been flagged as false-positives in UI</li>
063   * </ul>
064   *
065   * @since 2.8
066   */
067  String END_OF_VIOLATION_TRACKING = "END_OF_VIOLATION_TRACKING";
068
069  /**
070   * @since 2.13
071   */
072  String START_VIOLATION_PERSISTENCE = "START_VIOLATION_PERSISTENCE";
073
074  /**
075   * @since 2.13
076   */
077  String END_OF_VIOLATION_PERSISTENCE = "END_OF_VIOLATION_PERSISTENCE";
078
079  /**
080   * Any kinds of time machine data are calculated before this barrier. Decorators executed after this barrier can use
081   * Measure#getVariationValue() and Measure#getTendency() methods.
082   *
083   * @since 2.5
084   */
085  String END_OF_TIME_MACHINE = "END_OF_TIME_MACHINE";
086}