aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/java/org/sonar/server/issue/DefaultActions.java
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-server/src/main/java/org/sonar/server/issue/DefaultActions.java')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/issue/DefaultActions.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/issue/DefaultActions.java b/sonar-server/src/main/java/org/sonar/server/issue/DefaultActions.java
new file mode 100644
index 00000000000..7e80303bb7a
--- /dev/null
+++ b/sonar-server/src/main/java/org/sonar/server/issue/DefaultActions.java
@@ -0,0 +1,58 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.issue;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+import org.sonar.api.issue.action.Action;
+import org.sonar.api.issue.action.Actions;
+
+import javax.annotation.CheckForNull;
+
+import java.util.Set;
+
+/**
+ * @since 3.6
+ */
+public final class DefaultActions implements Actions {
+
+ private Set<Action> actions = Sets.newLinkedHashSet();
+
+ public DefaultActions addAction(Action action) {
+ actions.add(action);
+ return this;
+ }
+
+ public Set<Action> getActions() {
+ return actions;
+ }
+
+ @CheckForNull
+ public Action getAction(final String actionKey) {
+ return Iterables.find(actions, new Predicate<Action>() {
+ @Override
+ public boolean apply(Action action) {
+ return action.key().equals(actionKey);
+ }
+ }, null);
+ }
+
+}