aboutsummaryrefslogtreecommitdiffstats
path: root/it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java
diff options
context:
space:
mode:
Diffstat (limited to 'it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java')
-rw-r--r--it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java b/it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java
index 84f5e6c5a6a..1af4f7ef152 100644
--- a/it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java
+++ b/it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java
@@ -22,10 +22,14 @@ import org.sonar.api.ServerExtension;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.action.Actions;
import org.sonar.api.issue.action.Function;
+import org.sonar.api.issue.condition.HasIssuePropertyCondition;
import org.sonar.api.issue.condition.HasResolution;
+import org.sonar.api.issue.condition.NotCondition;
public class ActionDefinition implements ServerExtension {
+ public static final String FAKE_PROPERTY = "fake";
+
private final Actions actions;
public ActionDefinition(Actions actions) {
@@ -34,11 +38,14 @@ public class ActionDefinition implements ServerExtension {
public void start() {
actions.add("fake")
- .setConditions(new HasResolution(Issue.RESOLUTION_FIXED))
+ .setConditions(
+ new HasResolution(Issue.RESOLUTION_FIXED),
+ new NotCondition(new HasIssuePropertyCondition(FAKE_PROPERTY))
+ )
.setFunctions(new Function() {
@Override
public void execute(Context context) {
- context.setAttribute("fake", "fake action");
+ context.setAttribute(FAKE_PROPERTY, "fake action");
context.addComment("New Comment from fake action");
}
});