--- /dev/null
+/*
+ * 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.api.issue.condition;
+
+import org.sonar.api.issue.Issue;
+
+/**
+ * @since 3.6
+ */
+public class IsUnResolved implements Condition {
+
+ @Override
+ public boolean matches(Issue issue) {
+ return issue.resolution() == null;
+ }
+}
+++ /dev/null
-/*
- * 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.api.workflow;
-
-import com.google.common.annotations.Beta;
-
-/**
- * @since 3.1
- */
-@Beta
-public interface Comment {
- String getMarkdownText();
-
- Long getUserId();
-
- Comment setMarkdownText(String s);
-
- Comment setUserId(Long l);
-}
+++ /dev/null
-/*
- * 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.api.workflow;
-
-import com.google.common.annotations.Beta;
-
-import javax.annotation.Nullable;
-import java.util.List;
-
-/**
- * Review that can be changed by functions. It does not support (yet) changes
- * on creation date, author, severity, existing comments or switched-off attribute.
- *
- * @since 3.1
- */
-@Beta
-public interface MutableReview extends Review {
-
- MutableReview setStatus(String s);
-
- MutableReview setResolution(@Nullable String resolution);
-
- MutableReview setProperty(String key, @Nullable String value);
-
- Comment createComment();
-
- List<Comment> getNewComments();
-}
+++ /dev/null
-/*
- * 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.api.workflow;
-
-import com.google.common.annotations.Beta;
-
-import java.util.Map;
-
-/**
- * @since 3.1
- */
-@Beta
-public interface Review {
-
- /**
- * This method will probably be removed in order to decrease
- * coupling with database.
- *
- * @return not-null review id (primary key of the table REVIEWS).
- */
- Long getReviewId();
-
- /**
- * @return not-null rule repository, for example "checkstyle"
- */
- String getRuleRepositoryKey();
-
- /**
- * @return not-null rule key
- */
- String getRuleKey();
-
- /**
- * @return not-null rule name, in English.
- */
- String getRuleName();
-
- boolean isSwitchedOff();
-
- String getMessage();
-
- /**
- * @return not-null properties
- */
- Map<String, String> getProperties();
-
- String getStatus();
-
- String getResolution();
-
- /**
- * @return not-null severity, from INFO to BLOCKER
- */
- String getSeverity();
-
- /**
- * @return optional line, starting from 1
- */
- Long getLine();
-
- /**
- * @return true if the violation has been created by an automated rule engine,
- * false if created by an end-user.
- */
- boolean isManual();
-}
+++ /dev/null
-/*
- * 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.api.workflow;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.config.Settings;
-
-/**
- * @since 3.1
- */
-@Beta
-public interface WorkflowContext {
-
- /**
- * TODO : to be replaced by getProjectKey()
- */
- Long getProjectId();
-
- Long getUserId();
-
- String getUserLogin();
-
- String getUserName();
-
- String getUserEmail();
-
- boolean isAdmin();
-
- Settings getProjectSettings();
-
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * Checks that user has admin rights on project.
- *
- * @since 3.1
- */
-@Beta
-public final class AdminRoleCondition extends Condition {
-
- public AdminRoleCondition() {
- super(true);
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return context.isAdmin();
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * Conditions control who can perform a command (i.e. who can see the screen
- * associated to the command).
- *
- * @since 3.1
- */
-@Beta
-public abstract class Condition {
-
- private final boolean onContext;
-
- protected Condition(boolean onContext) {
- this.onContext = onContext;
- }
-
- /**
- * @return true if the condition relates to a review, false if it relates to the resource
- * context (selected file, end-user, ...)
- */
- public final boolean isOnContext() {
- return onContext;
- }
-
- /**
- * @param review the review on "review conditions" like StatusCondition, null on "context conditions"
- * like AdminRoleCondition or ProjectPropertyCondition
- * @param context
- * @return is the condition verified ?
- */
- public abstract boolean doVerify(@Nullable Review review, WorkflowContext context);
-
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Static utility methods pertaining to {@link Condition} instances.
- *
- * @since 3.1
- */
-@Beta
-public final class Conditions {
-
- private Conditions() {
- }
-
- public static Condition not(Condition c) {
- return new NotCondition(c);
- }
-
- public static Condition hasReviewProperty(String propertyKey) {
- return new HasReviewPropertyCondition(propertyKey);
- }
-
- public static Condition hasProjectProperty(String propertyKey) {
- return new HasProjectPropertyCondition(propertyKey);
- }
-
- public static Condition hasAdminRole() {
- return new AdminRoleCondition();
- }
-
- public static Condition statuses(String... statuses) {
- return new StatusCondition(statuses);
- }
-
- public static Condition resolutions(String... resolutions) {
- return new ResolutionCondition(resolutions);
- }
-
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.config.Settings;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * Checks that a project property is set, whatever its value.
- *
- * @since 3.1
- */
-@Beta
-public final class HasProjectPropertyCondition extends ProjectPropertyCondition {
-
- public HasProjectPropertyCondition(String propertyKey) {
- super(propertyKey);
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- Settings settings = context.getProjectSettings();
- return settings.hasKey(getPropertyKey()) || settings.getDefaultValue(getPropertyKey()) != null;
- }
-
- @Override
- public String toString() {
- return "Property " + getPropertyKey() + " must be set";
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class HasReviewPropertyCondition extends Condition {
-
- private final String propertyKey;
-
- public HasReviewPropertyCondition(String propertyKey) {
- super(false);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(propertyKey));
- this.propertyKey = propertyKey;
- }
-
- public String getPropertyKey() {
- return propertyKey;
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return review != null && !Strings.isNullOrEmpty(review.getProperties().get(propertyKey));
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class NotCondition extends Condition {
-
- private Condition condition;
-
- public NotCondition(Condition c) {
- super(c.isOnContext());
- this.condition = c;
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return !condition.doVerify(review, context);
- }
-
- @VisibleForTesting
- Condition getCondition() {
- return condition;
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-
-/**
- * @since 3.1
- */
-@Beta
-public abstract class ProjectPropertyCondition extends Condition {
- private final String propertyKey;
-
- protected ProjectPropertyCondition(String propertyKey) {
- super(true);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(propertyKey));
- this.propertyKey = propertyKey;
- }
-
- public final String getPropertyKey() {
- return propertyKey;
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-import java.util.Arrays;
-import java.util.Set;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class ResolutionCondition extends Condition {
- private final Set<String> resolutions;
-
- public ResolutionCondition(Set<String> resolutions) {
- super(false);
- Preconditions.checkNotNull(resolutions);
- Preconditions.checkArgument(!resolutions.isEmpty(), "No resolutions defined");
- this.resolutions = resolutions;
- }
-
- public ResolutionCondition(String... resolutions) {
- this(Sets.newLinkedHashSet(Arrays.asList(resolutions)));
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return review != null && resolutions.contains(review.getResolution());
- }
-
- @VisibleForTesting
- Set<String> getResolutions() {
- return ImmutableSet.copyOf(resolutions);
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-import java.util.Arrays;
-import java.util.Set;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class StatusCondition extends Condition {
- private final Set<String> statuses;
-
- public StatusCondition(Set<String> statuses) {
- super(false);
- Preconditions.checkNotNull(statuses);
- Preconditions.checkArgument(!statuses.isEmpty(), "No statuses defined");
- this.statuses = statuses;
- }
-
- public StatusCondition(String... statuses) {
- this(Sets.newLinkedHashSet(Arrays.asList(statuses)));
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return review != null && statuses.contains(review.getStatus());
- }
-
- @VisibleForTesting
- Set<String> getStatuses() {
- return ImmutableSet.copyOf(statuses);
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.api.workflow.condition;
-
-import javax.annotation.ParametersAreNonnullByDefault;
\ No newline at end of file
+++ /dev/null
-/*
- * 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.api.workflow.internal;
-
-import com.google.common.annotations.Beta;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.workflow.Comment;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class DefaultComment implements Comment {
- private String markdownText;
- private Long userId;
-
- DefaultComment() {
- }
-
- public String getMarkdownText() {
- return markdownText;
- }
-
- public DefaultComment setMarkdownText(String s) {
- this.markdownText = s;
- return this;
- }
-
- public Long getUserId() {
- return userId;
- }
-
- public DefaultComment setUserId(Long l) {
- this.userId = l;
- return this;
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.internal;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.workflow.Comment;
-import org.sonar.api.workflow.MutableReview;
-import org.sonar.api.utils.KeyValueFormat;
-
-import javax.annotation.Nullable;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class DefaultReview implements MutableReview {
-
- private Long violationId;
- private Long reviewId;
- private String ruleRepositoryKey;
- private String ruleKey;
- private String ruleName;
- private Long line;
- private boolean switchedOff = false;
- private boolean manual = false;
- private String message;
- private String status;
- private String resolution;
- private String severity;
- private Map<String, String> properties;
- private List<Comment> newComments;
-
- public Long getViolationId() {
- return violationId;
- }
-
- public DefaultReview setViolationId(Long violationId) {
- this.violationId = violationId;
- return this;
- }
-
- public Long getReviewId() {
- return reviewId;
- }
-
- public DefaultReview setReviewId(Long reviewId) {
- this.reviewId = reviewId;
- return this;
- }
-
- public String getRuleRepositoryKey() {
- return ruleRepositoryKey;
- }
-
- public DefaultReview setRuleRepositoryKey(String s) {
- this.ruleRepositoryKey = s;
- return this;
- }
-
- public String getRuleKey() {
- return ruleKey;
- }
-
- public DefaultReview setRuleKey(String s) {
- this.ruleKey = s;
- return this;
- }
-
- public String getRuleName() {
- return ruleName;
- }
-
- public DefaultReview setRuleName(String s) {
- this.ruleName = s;
- return this;
- }
-
- public Long getLine() {
- return line;
- }
-
- public DefaultReview setLine(Long line) {
- this.line = line;
- return this;
- }
-
- public boolean isSwitchedOff() {
- return switchedOff;
- }
-
- public DefaultReview setSwitchedOff(boolean b) {
- this.switchedOff = b;
- return this;
- }
-
- public boolean isManual() {
- return manual;
- }
-
- public DefaultReview setManual(boolean manual) {
- this.manual = manual;
- return this;
- }
-
- public String getMessage() {
- return message;
- }
-
- public DefaultReview setMessage(String message) {
- this.message = message;
- return this;
- }
-
- public String getStatus() {
- return status;
- }
-
- public DefaultReview setStatus(String s) {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(s));
- this.status = s;
- return this;
- }
-
- public String getResolution() {
- return resolution;
- }
-
- public DefaultReview setResolution(@Nullable String s) {
- this.resolution = s;
- return this;
- }
-
- public String getSeverity() {
- return severity;
- }
-
- public DefaultReview setSeverity(String s) {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(s));
- this.severity = s;
- return this;
- }
-
- public Map<String, String> getProperties() {
- if (properties == null) {
- return Collections.emptyMap();
- }
- return properties;
- }
-
- public DefaultReview setProperties(Map<String, String> properties) {
- this.properties = properties;
- return this;
- }
-
- public DefaultReview setPropertiesAsString(@Nullable String s) {
- this.properties = (s == null ? null : KeyValueFormat.parse(s));
- return this;
- }
-
- public Comment createComment() {
- if (newComments == null) {
- newComments = Lists.newArrayList();
- }
- Comment comment = new DefaultComment();
- newComments.add(comment);
- return comment;
- }
-
- public List<Comment> getNewComments() {
- if (newComments == null) {
- return Collections.emptyList();
- }
- return newComments;
- }
-
- public DefaultReview setProperty(String key, @Nullable String value) {
- if (properties == null) {
- // keeping entries ordered by key allows to have consistent behavior in unit tests
- properties = Maps.newLinkedHashMap();
- }
- properties.put(key, value);
- return this;
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * 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.api.workflow.internal;
-
-import com.google.common.annotations.Beta;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.config.Settings;
-import org.sonar.api.workflow.WorkflowContext;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class DefaultWorkflowContext implements WorkflowContext {
-
- private Long userId;
- private String userLogin;
- private String userName;
- private String userEmail;
- private boolean isAdmin = false;
- private Long projectId;
- private Settings settings;
-
- public Long getUserId() {
- return userId;
- }
-
- public DefaultWorkflowContext setUserId(Long l) {
- this.userId = l;
- return this;
- }
-
- public String getUserLogin() {
- return userLogin;
- }
-
- public DefaultWorkflowContext setUserLogin(String s) {
- this.userLogin = s;
- return this;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public DefaultWorkflowContext setUserName(String s) {
- this.userName = s;
- return this;
- }
-
- public String getUserEmail() {
- return userEmail;
- }
-
- public DefaultWorkflowContext setUserEmail(String userEmail) {
- this.userEmail = userEmail;
- return this;
- }
-
- public boolean isAdmin() {
- return isAdmin;
- }
-
- public DefaultWorkflowContext setIsAdmin(boolean b) {
- isAdmin = b;
- return this;
- }
-
- public Long getProjectId() {
- return projectId;
- }
-
- public DefaultWorkflowContext setProjectId(Long l) {
- this.projectId = l;
- return this;
- }
-
- public Settings getProjectSettings() {
- return settings;
- }
-
- public DefaultWorkflowContext setSettings(Settings s) {
- this.settings = s;
- return this;
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-
-/**
- This package is not considered as API and future versions can break backward-compatibility.
- <p>
- It provides some classes that can be helpful for unit tests but must
- <b>ABSOLUTELY NOT</b> be used by plugins production code.
- </p>
- */
-@ParametersAreNonnullByDefault
-package org.sonar.api.workflow.internal;
-
-import javax.annotation.ParametersAreNonnullByDefault;
\ No newline at end of file
+++ /dev/null
-/*
- * 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.
- */
-
-@ParametersAreNonnullByDefault
-package org.sonar.api.workflow;
-
-import javax.annotation.ParametersAreNonnullByDefault;
\ No newline at end of file
+++ /dev/null
-/*
- * 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.api.workflow.screen;
-
-/**
- * Form with only a textarea field to type a comment.
- */
-
-import com.google.common.annotations.Beta;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class CommentScreen extends Screen {
-
- public CommentScreen() {
- super("comment");
- }
-
-}
+++ /dev/null
-/*
- * 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.api.workflow.screen;
-
-import com.google.common.annotations.Beta;
-
-/**
- * <h2>Localization</h2>
- * <p>At least two buttons must have labels :</p>
- * <ul>
- * <li>the button in the violation toolbar that displays the form screen. Key is 'reviews.command.<command_key>.button'.</li>
- * <li>the button in the form screen that submits the command. Key is 'reviews.command.<command_key>.submit'.</li>
- * </ul>
- * @since 3.1
- */
-@Beta
-public abstract class Screen {
- private final String key;
- private String commandKey;
-
- protected Screen(String key) {
- this.key = key;
- }
-
- public final String getKey() {
- return key;
- }
-
- public final String getCommandKey() {
- return commandKey;
- }
-
- public final Screen setCommandKey(String commandKey) {
- this.commandKey = commandKey;
- return this;
- }
-}
+++ /dev/null
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.api.workflow.screen;
-
-import javax.annotation.ParametersAreNonnullByDefault;
\ No newline at end of file
package org.sonar.api.issue.condition;
import org.junit.Test;
+import org.sonar.api.issue.Issue;
import org.sonar.api.issue.internal.DefaultIssue;
import static org.fest.assertions.Assertions.assertThat;
@Test
public void should_match() throws Exception {
- HasResolution condition = new HasResolution("OPEN", "FIXED", "FALSE-POSITIVE");
+ HasResolution condition = new HasResolution(Issue.RESOLUTION_FIXED, Issue.RESOLUTION_FALSE_POSITIVE);
- assertThat(condition.matches(issue.setResolution("OPEN"))).isTrue();
assertThat(condition.matches(issue.setResolution("FIXED"))).isTrue();
assertThat(condition.matches(issue.setResolution("FALSE-POSITIVE"))).isTrue();
- assertThat(condition.matches(issue.setResolution("open"))).isFalse();
assertThat(condition.matches(issue.setResolution("Fixed"))).isFalse();
}
}
--- /dev/null
+/*
+ * 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.api.issue.condition;
+
+import org.junit.Test;
+import org.sonar.api.issue.internal.DefaultIssue;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class IsUnResolvedTest {
+
+ DefaultIssue issue = new DefaultIssue();
+
+ @Test
+ public void should_match() throws Exception {
+ IsUnResolved condition = new IsUnResolved();
+
+ assertThat(condition.matches(issue)).isTrue();
+ assertThat(condition.matches(issue.setResolution("FIXED"))).isFalse();
+ }
+}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Test;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class AdminRoleConditionTest {
- @Test
- public void verifiedIfAdminRole() {
- AdminRoleCondition condition = new AdminRoleCondition();
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setIsAdmin(true);
- assertThat(condition.doVerify(new DefaultReview(), context)).isTrue();
- }
-
- @Test
- public void failIfNotAdminRole() {
- AdminRoleCondition condition = new AdminRoleCondition();
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setIsAdmin(false);
- assertThat(condition.doVerify(new DefaultReview(), context)).isFalse();
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Test;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ConditionTest {
- @Test
- public void checkedOncePerGroupOfReviews() {
- Condition condition = new Condition(true) {
- @Override
- public boolean doVerify(Review review, WorkflowContext context) {
- return false;
- }
- };
- assertThat(condition.isOnContext()).isTrue();
- }
-
- @Test
- public void checkedForEveryReview() {
- Condition condition = new Condition(false) {
- @Override
- public boolean doVerify(Review review, WorkflowContext context) {
- return false;
- }
- };
- assertThat(condition.isOnContext()).isFalse();
- }
-
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Test;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ConditionsTest {
- @Test
- public void not() {
- StatusCondition target = new StatusCondition("OPEN");
- Condition not = Conditions.not(target);
- assertThat(not).isInstanceOf(NotCondition.class);
- assertThat(((NotCondition) not).getCondition()).isSameAs(target);
- }
-
- @Test
- public void hasReviewProperty() {
- Condition condition = Conditions.hasReviewProperty("foo");
- assertThat(condition).isInstanceOf(HasReviewPropertyCondition.class);
- assertThat(((HasReviewPropertyCondition) condition).getPropertyKey()).isEqualTo("foo");
- }
-
- @Test
- public void hasProjectProperty() {
- Condition condition = Conditions.hasProjectProperty("foo");
- assertThat(condition).isInstanceOf(HasProjectPropertyCondition.class);
- assertThat(((HasProjectPropertyCondition) condition).getPropertyKey()).isEqualTo("foo");
- }
-
- @Test
- public void hasAdminRole() {
- Condition condition = Conditions.hasAdminRole();
- assertThat(condition).isInstanceOf(AdminRoleCondition.class);
- }
-
- @Test
- public void statuses() {
- Condition condition = Conditions.statuses("OPEN", "CLOSED");
- assertThat(condition).isInstanceOf(StatusCondition.class);
- assertThat(((StatusCondition) condition).getStatuses()).containsOnly("OPEN", "CLOSED");
- }
-
- @Test
- public void resolutions() {
- Condition condition = Conditions.resolutions("", "RESOLVED");
- assertThat(condition).isInstanceOf(ResolutionCondition.class);
- assertThat(((ResolutionCondition) condition).getResolutions()).containsOnly("", "RESOLVED");
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Test;
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.api.config.Settings;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class HasProjectPropertyConditionTest {
- @Test
- public void doVerify() {
- HasProjectPropertyCondition condition = new HasProjectPropertyCondition("jira.url");
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setSettings(new Settings().setProperty("jira.url", "http://jira"));
- assertThat(condition.doVerify(new DefaultReview(), context)).isTrue();
- }
-
- @Test
- public void missingProperty() {
- HasProjectPropertyCondition condition = new HasProjectPropertyCondition("jira.url");
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setSettings(new Settings());
- assertThat(condition.doVerify(new DefaultReview(), context)).isFalse();
- }
-
- @Test
- public void returnTrueIfDefaultValue() {
- HasProjectPropertyCondition condition = new HasProjectPropertyCondition("jira.url");
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setSettings(new Settings(new PropertyDefinitions().addComponent(WithDefaultValue.class)));
- assertThat(condition.doVerify(new DefaultReview(), context)).isTrue();
- }
-
- @Properties({
- @Property(key = "jira.url", name = "JIRA URL", defaultValue = "http://jira.com")
- })
- private static class WithDefaultValue {
-
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class HasReviewPropertyConditionTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void doVerify() {
- HasReviewPropertyCondition condition = new HasReviewPropertyCondition("foo");
-
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- assertThat(condition.doVerify(new DefaultReview(), context)).isFalse();
- assertThat(condition.doVerify(new DefaultReview().setProperty("foo", ""), context)).isFalse();
- assertThat(condition.doVerify(new DefaultReview().setProperty("foo", "bar"), context)).isTrue();
- }
-
- @Test
- public void getPropertyKey() {
- HasReviewPropertyCondition condition = new HasReviewPropertyCondition("foo");
- assertThat(condition.getPropertyKey()).isEqualTo("foo");
- }
-
- @Test
- public void failIfNullProperty() {
- thrown.expect(IllegalArgumentException.class);
- new HasReviewPropertyCondition(null);
- }
-
- @Test
- public void failIfEmptyProperty() {
- thrown.expect(IllegalArgumentException.class);
- new HasReviewPropertyCondition("");
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Test;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class NotConditionTest {
- @Test
- public void doVerifyInverse() {
- Condition target = new TargetCondition(true);
- assertThat(new NotCondition(target).doVerify(new DefaultReview(), new DefaultWorkflowContext())).isFalse();
-
- target = new TargetCondition(false);
- assertThat(new NotCondition(target).doVerify(new DefaultReview(), new DefaultWorkflowContext())).isTrue();
- }
-
- private static class TargetCondition extends Condition {
- private boolean returns;
-
- private TargetCondition(boolean returns) {
- super(false);
- this.returns = returns;
- }
-
- @Override
- public boolean doVerify(Review review, WorkflowContext context) {
- return returns;
- }
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ProjectPropertyConditionTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void getPropertyKey() {
- ProjectPropertyCondition condition = new ProjectPropertyCondition("foo") {
- @Override
- public boolean doVerify(Review review, WorkflowContext context) {
- return false;
- }
- };
- assertThat(condition.getPropertyKey()).isEqualTo("foo");
- }
-
- @Test
- public void keyIsMandatory() {
- thrown.expect(IllegalArgumentException.class);
- new ProjectPropertyCondition(""){
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return false;
- }
- };
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ResolutionConditionTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void failIfNoResolution() {
- thrown.expect(IllegalArgumentException.class);
- new ResolutionCondition();
- }
-
- @Test
- public void getResolutions() {
- ResolutionCondition condition = new ResolutionCondition("", "RESOLVED");
- assertThat(condition.getResolutions()).containsOnly("", "RESOLVED");
- }
-
- @Test
- public void doVerify_review_has_resolution() {
- Condition condition = new ResolutionCondition("", "RESOLVED");
- Review review = new DefaultReview().setResolution("");
- assertThat(condition.doVerify(review, new DefaultWorkflowContext())).isTrue();
- }
-
- @Test
- public void doVerify_review_does_not_have_resolution() {
- Condition condition = new ResolutionCondition("", "RESOLVED");
- Review review = new DefaultReview().setResolution("OTHER");
- assertThat(condition.doVerify(review, new DefaultWorkflowContext())).isFalse();
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.condition;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class StatusConditionTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void failIfNoStatus() {
- thrown.expect(IllegalArgumentException.class);
- new StatusCondition();
- }
-
-
- @Test
- public void getStatuses() {
- StatusCondition condition = new StatusCondition("OPEN", "CLOSED");
- assertThat(condition.getStatuses()).containsOnly("OPEN", "CLOSED");
- }
-
- @Test
- public void doVerify_review_has_status() {
- Condition condition = new StatusCondition("OPEN", "CLOSED");
- Review review = new DefaultReview().setStatus("CLOSED");
- assertThat(condition.doVerify(review, new DefaultWorkflowContext())).isTrue();
- }
-
- @Test
- public void doVerify_review_does_not_have_status() {
- Condition condition = new StatusCondition("OPEN", "CLOSED");
- Review review = new DefaultReview().setStatus("OTHER");
- assertThat(condition.doVerify(review, new DefaultWorkflowContext())).isFalse();
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.internal;
-
-import org.junit.Test;
-import org.sonar.api.workflow.MutableReview;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class DefaultReviewTest {
- @Test
- public void createComment_keep_order() {
- MutableReview review = new DefaultReview();
- review.createComment().setMarkdownText("first");
- review.createComment().setMarkdownText("second");
- assertThat(review.getNewComments()).hasSize(2);
- assertThat(review.getNewComments().get(0).getMarkdownText()).isEqualTo("first");
- assertThat(review.getNewComments().get(1).getMarkdownText()).isEqualTo("second");
- }
-}
+++ /dev/null
-/*
- * 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.api.workflow.screen;
-
-import org.junit.Test;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class CommentScreenTest {
- @Test
- public void testCommentScreen() {
- CommentScreen screen = new CommentScreen();
-
- assertThat(screen.getKey()).isEqualTo("comment");
-
- assertThat(screen.getCommandKey()).isNull();
- assertThat(screen.setCommandKey("create-jira-issue"));
- assertThat(screen.getCommandKey()).isEqualTo("create-jira-issue");
- }
-}
this.actionService = actionService;
}
- public IssueStatsFinder.IssueStatsResult findIssueAssignees(Map<String, Object> params){
+ public IssueStatsFinder.IssueStatsResult findIssueAssignees(Map<String, Object> params) {
return issueStatsFinder.findIssueAssignees(PublicRubyIssueService.toQuery(params));
}
return changeService.changelog(issueKey);
}
- public Issue doTransition(String issueKey, String transitionKey) {
- return issueService.doTransition(issueKey, transitionKey, UserSession.get());
+ public Result<Issue> doTransition(String issueKey, String transitionKey) {
+ Result<Issue> result = Result.of();
+ try {
+ result.set(issueService.doTransition(issueKey, transitionKey, UserSession.get()));
+ } catch (Exception e) {
+ result.addError(e.getMessage());
+ }
+ return result;
}
- public Issue assign(String issueKey, @Nullable String assignee) {
- return issueService.assign(issueKey, StringUtils.defaultIfBlank(assignee, null), UserSession.get());
+ public Result<Issue> assign(String issueKey, @Nullable String assignee) {
+ Result<Issue> result = Result.of();
+ try {
+ result.set(issueService.assign(issueKey, StringUtils.defaultIfBlank(assignee, null), UserSession.get()));
+ } catch (Exception e) {
+ result.addError(e.getMessage());
+ }
+ return result;
}
- public Issue setSeverity(String issueKey, String severity) {
- return issueService.setSeverity(issueKey, severity, UserSession.get());
+ public Result<Issue> setSeverity(String issueKey, String severity) {
+ Result<Issue> result = Result.of();
+ try {
+ result.set(issueService.setSeverity(issueKey, severity, UserSession.get()));
+ } catch (Exception e) {
+ result.addError(e.getMessage());
+ }
+ return result;
}
- public Issue plan(String issueKey, @Nullable String actionPlanKey) {
- return issueService.plan(issueKey, actionPlanKey, UserSession.get());
+ public Result<Issue> plan(String issueKey, @Nullable String actionPlanKey) {
+ Result<Issue> result = Result.of();
+ try {
+ result.set(issueService.plan(issueKey, actionPlanKey, UserSession.get()));
+ } catch (Exception e) {
+ result.addError(e.getMessage());
+ }
+ return result;
}
- public IssueComment addComment(String issueKey, String text) {
- return changeService.addComment(issueKey, text, UserSession.get());
+ public Result<IssueComment> addComment(String issueKey, String text) {
+ Result<IssueComment> result = Result.of();
+ try {
+ result.set(changeService.addComment(issueKey, text, UserSession.get()));
+ } catch (Exception e) {
+ result.addError(e.getMessage());
+ }
+ return result;
}
public IssueComment deleteComment(String commentKey) {
return result;
}
- public Issue executeAction(String issueKey, String actionKey) {
- return actionService.execute(issueKey, actionKey, UserSession.get());
+ public Result<Issue> executeAction(String issueKey, String actionKey) {
+ // TODO verify authorization
+
+ Result<Issue> result = Result.of();
+ try {
+ result.set(actionService.execute(issueKey, actionKey, UserSession.get()));
+ } catch (Exception e) {
+ result.addError(e.getMessage());
+ result.addError(e.getMessage());
+ }
+ return result;
}
- public List<Action> listActions(String issueKey){
+ public List<Action> listActions(String issueKey) {
return actionService.listAvailableActions(issueKey);
}
public List<Action> listActions(Issue issue) {
return actionService.listAvailableActions(issue);
}
+
}
\ No newline at end of file
verify_post_request
require_parameters :issue, :transition
- issue = Internal.issues.doTransition(params[:issue], params[:transition])
- if issue
- render :json => jsonp({
- :issue => Issue.to_hash(issue)
- })
- else
- render :status => 400
- end
+ result = Internal.issues.doTransition(params[:issue], params[:transition])
+ render_result_issue(result)
end
#
require_parameters :issue, :text
text = Api::Utils.read_post_request_param(params[:text])
- comment = Internal.issues.addComment(params[:issue], text)
- render :json => jsonp({:comment => Issue.comment_to_hash(comment)})
+ result = Internal.issues.addComment(params[:issue], text)
+
+ http_status = (result.ok ? 200 : 400)
+ hash = result_to_hash(result)
+ hash[:comment] = Issue.comment_to_hash(result.get) if result.get
+
+ respond_to do |format|
+ # if the request header "Accept" is "*/*", then the default format is the first one (json)
+ format.json { render :json => jsonp(hash), :status => result.httpStatus }
+ format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'sonar', :status => http_status) }
+ end
end
#
verify_post_request
require_parameters :issue
- issue = Internal.issues.assign(params[:issue], params[:assignee])
- render :json => jsonp({:issue => Issue.to_hash(issue)})
+ result = Internal.issues.assign(params[:issue], params[:assignee])
+ render_result_issue(result)
end
verify_post_request
require_parameters :issue, :severity
- issue = Internal.issues.setSeverity(params[:issue], params[:severity])
-
- render :json => jsonp({:issue => Issue.to_hash(issue)})
+ result = Internal.issues.setSeverity(params[:issue], params[:severity])
+ render_result_issue(result)
end
#
plan = nil
plan = params[:plan] if params[:plan] && !params[:plan].blank?
- issue = Internal.issues.plan(params[:issue], plan)
-
- render :json => jsonp({:issue => Issue.to_hash(issue)})
+ result = Internal.issues.plan(params[:issue], plan)
+ render_result_issue(result)
end
#
verify_post_request
issue_result = Internal.issues.create(params)
-
- http_status = (issue_result.ok ? 200 : 400)
- hash = result_to_hash(issue_result)
- hash[:issue] = Issue.to_hash(issue_result.get) if issue_result.get
-
- respond_to do |format|
- # if the request header "Accept" is "*/*", then the default format is the first one (json)
- format.json { render :json => jsonp(hash), :status => issue_result.httpStatus }
- format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'sonar', :status => http_status) }
- end
+ render_result_issue(issue_result)
end
#
verify_post_request
require_parameters :issue, :actionKey
- issue = Internal.issues.executeAction(params[:issue], params[:actionKey])
- if issue
- render :json => jsonp({
- :issue => Issue.to_hash(issue)
- })
- else
- render :status => 400
- end
+ result = Internal.issues.executeAction(params[:issue], params[:actionKey])
+ render_result_issue(result)
end
+
protected
+ def render_result_issue(result)
+ http_status = (result.ok ? 200 : 400)
+ hash = result_to_hash(result)
+ hash[:issue] = Issue.to_hash(result.get) if result.get
+
+ respond_to do |format|
+ # if the request header "Accept" is "*/*", then the default format is the first one (json)
+ format.json { render :json => jsonp(hash), :status => result.httpStatus }
+ format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'sonar', :status => http_status) }
+ end
+ end
+
def component_to_hash(component)
hash = {
:key => component.key,
require_parameters :id, :issue
@issue_result = Api.issues.find(params[:issue])
- @issue = @issue_result.issues().get(0)
+ @issue = @issue_result.first
bad_request('Unknown issue') unless @issue
issue_key = params[:issue]
if action_type=='comment'
- Internal.issues.addComment(issue_key, params[:text])
+ issue_result = Internal.issues.addComment(issue_key, params[:text])
elsif action_type=='assign'
assignee = (params[:me]=='true' ? current_user.login : params[:assignee])
- Internal.issues.assign(issue_key, assignee)
+ issue_result = Internal.issues.assign(issue_key, assignee)
elsif action_type=='transition'
- Internal.issues.doTransition(issue_key, params[:transition])
+ issue_result = Internal.issues.doTransition(issue_key, params[:transition])
elsif action_type=='severity'
- Internal.issues.setSeverity(issue_key, params[:severity])
+ issue_result = Internal.issues.setSeverity(issue_key, params[:severity])
elsif action_type=='plan'
- Internal.issues.plan(issue_key, params[:plan])
+ issue_result = Internal.issues.plan(issue_key, params[:plan])
elsif action_type=='unplan'
- Internal.issues.plan(issue_key, nil)
+ issue_result = Internal.issues.plan(issue_key, nil)
else
# Execute action defined by plugin
- Internal.issues.executeAction(issue_key, action_type)
+ issue_result = Internal.issues.executeAction(issue_key, action_type)
+ end
+
+ if issue_result.ok
+ @issue_results = Api.issues.find(issue_key)
+ render :partial => 'issue/issue', :locals => {:issue => @issue_results.first}
+ else
+ @errors = issue_result.errors
+ render :partial => 'issue/error', :status => issue_result.httpStatus
end
- @issue_results = Api.issues.find(issue_key)
- render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)}
end
# Form used to edit comment
--- /dev/null
+<div class="error">
+ <% @errors.each do |msg| %>
+ <div><%= h (msg.text ? msg.text : Api::Utils.message(msg.l10nKey, :params => msg.l10nParams)) -%></div>
+ <% end %>
+ <%= link_to_function message('close'), 'refreshIssue(this)' -%>
+</div>
<% end %>
<% if current_user %>
+
<div class="code-issue-actions">
<a href='#' onclick="return issueForm('comment', this)" class="link-action spacer-right"><%= message('issue.comment.formlink') -%></a>
<% unless issue.resolution %>
<%
plugin_actions = Internal.issues.listActions(issue)
- puts "### "
shouldDisplayDropDown = transitions.size > 1 || !issue.resolution || !plugin_actions.empty?
if shouldDisplayDropDown
transitions.remove(0)
notifyIssueChange(issueKey);
}
).fail(function (jqXHR, textStatus) {
- closeIssueForm(elt);
- alert(textStatus);
+ issueElt.find('.code-issue-actions').replaceWith(jqXHR.responseText);
});
return false;
}