From ff4d30779e2b145efd7cc7ae8dee259721a7e20e Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 25 May 2012 15:50:43 +0200 Subject: [PATCH] SONAR-2706 add Review#getRuleKey() and getRuleRepository() and remove methods that return primary keys --- .../review/workflow/ReviewDatabaseStore.java | 6 +-- .../core/review/workflow/ReviewStore.java | 3 +- .../core/review/workflow/WorkflowEngine.java | 6 +-- .../condition/HasReviewPropertyCondition.java | 6 ++- .../workflow/function/TransitionFunction.java | 47 ------------------- .../core/review/workflow/review/Comment.java | 2 +- .../review/workflow/review/DefaultReview.java | 34 +++++++------- .../workflow/review/ImmutableReview.java | 19 ++++++-- .../review/workflow/review/MutableReview.java | 2 - .../core/review/workflow/review/Review.java | 8 +--- .../workflow/ReviewDatabaseStoreTest.java | 3 +- .../review/workflow/WorkflowEngineTest.java | 10 ++-- .../core/review/workflow/WorkflowTest.java | 7 +-- .../condition/ResolutionConditionTest.java | 12 +++++ .../condition/StatusConditionTest.java | 13 +++++ .../ReviewDatabaseStoreTest/store-result.xml | 2 +- .../ReviewDatabaseStoreTest/store.xml | 2 +- .../java/org/sonar/server/ui/JRubyFacade.java | 5 +- .../webapp/WEB-INF/app/models/rule_failure.rb | 4 +- 19 files changed, 88 insertions(+), 103 deletions(-) delete mode 100644 sonar-core/src/main/java/org/sonar/core/review/workflow/function/TransitionFunction.java diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/ReviewDatabaseStore.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/ReviewDatabaseStore.java index a9a3646ff8c..b48ea94bf5f 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/ReviewDatabaseStore.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/ReviewDatabaseStore.java @@ -34,6 +34,7 @@ import org.sonar.core.review.ReviewCommentMapper; import org.sonar.core.review.ReviewDto; import org.sonar.core.review.ReviewMapper; import org.sonar.core.review.workflow.review.Comment; +import org.sonar.core.review.workflow.review.DefaultReview; import org.sonar.core.review.workflow.review.MutableReview; import java.util.Date; @@ -48,12 +49,12 @@ public class ReviewDatabaseStore implements ReviewStore, ServerComponent { this.mybatis = mb; } - public void store(MutableReview review) { + public void store(DefaultReview review) { store(review, new Date()); } @VisibleForTesting - void store(MutableReview review, Date now) { + void store(DefaultReview review, Date now) { if (review.getReviewId() == null) { LOG.error("Review has no id. Violation id is: " + review.getViolationId()); return; @@ -66,7 +67,6 @@ public class ReviewDatabaseStore implements ReviewStore, ServerComponent { ReviewDto dto = mapper.findById(review.getReviewId()); dto.setResolution(review.getResolution()); dto.setStatus(review.getStatus()); - dto.setAssigneeId(review.getAssigneeId()); dto.setData(KeyValueFormat.format(review.getProperties())); dto.setUpdatedAt(now); mapper.update(dto); diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/ReviewStore.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/ReviewStore.java index 708d78249d3..22a298e1ed1 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/ReviewStore.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/ReviewStore.java @@ -20,12 +20,13 @@ package org.sonar.core.review.workflow; import org.sonar.api.config.Settings; +import org.sonar.core.review.workflow.review.DefaultReview; import org.sonar.core.review.workflow.review.MutableReview; import java.util.List; public interface ReviewStore { - void store(MutableReview review); + void store(DefaultReview review); void completeProjectSettings(Long projectId, Settings settings, List propertyKeys); } diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java index 08261723eed..22e821cf508 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java @@ -56,7 +56,7 @@ public class WorkflowEngine implements ServerComponent { /** * @return non-null list of screens per review#violationId */ - public ListMultimap listAvailableScreens(Review[] reviews, DefaultWorkflowContext context, boolean verifyConditions) { + public ListMultimap listAvailableScreens(DefaultReview[] reviews, DefaultWorkflowContext context, boolean verifyConditions) { ListMultimap result = ArrayListMultimap.create(); completeProjectSettings(context); @@ -64,7 +64,7 @@ public class WorkflowEngine implements ServerComponent { for (Map.Entry entry : workflow.getScreensByCommand().entrySet()) { String commandKey = entry.getKey(); if (!verifyConditions || verifyConditionsQuietly(null, context, workflow.getContextConditions(commandKey))) { - for (Review review : reviews) { + for (DefaultReview review : reviews) { if (!verifyConditions || verifyConditionsQuietly(review, context, workflow.getReviewConditions(commandKey))) { result.put(review.getViolationId(), entry.getValue()); } @@ -94,7 +94,7 @@ public class WorkflowEngine implements ServerComponent { return workflow.getScreen(commandKey); } - public void execute(String commandKey, MutableReview review, DefaultWorkflowContext context, Map parameters) { + public void execute(String commandKey, DefaultReview review, DefaultWorkflowContext context, Map parameters) { Preconditions.checkArgument(!Strings.isNullOrEmpty(commandKey), "Missing command"); Preconditions.checkArgument(workflow.hasCommand(commandKey), "Unknown command: " + commandKey); diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/condition/HasReviewPropertyCondition.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/condition/HasReviewPropertyCondition.java index f1870634ada..a9922a98b9d 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/condition/HasReviewPropertyCondition.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/condition/HasReviewPropertyCondition.java @@ -25,6 +25,8 @@ import com.google.common.base.Strings; import org.sonar.core.review.workflow.review.Review; import org.sonar.core.review.workflow.review.WorkflowContext; +import javax.annotation.Nullable; + /** * @since 3.1 */ @@ -44,7 +46,7 @@ public final class HasReviewPropertyCondition extends Condition { } @Override - public boolean doVerify(Review review, WorkflowContext context) { - return !Strings.isNullOrEmpty(review.getProperties().get(propertyKey)); + public boolean doVerify(@Nullable Review review, WorkflowContext context) { + return review != null && !Strings.isNullOrEmpty(review.getProperties().get(propertyKey)); } } diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/function/TransitionFunction.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/function/TransitionFunction.java deleted file mode 100644 index 2c09374c528..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/function/TransitionFunction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.core.review.workflow.function; - -import com.google.common.base.Preconditions; -import com.google.common.base.Strings; -import org.sonar.core.review.workflow.review.MutableReview; -import org.sonar.core.review.workflow.review.Review; -import org.sonar.core.review.workflow.review.WorkflowContext; - -import javax.annotation.Nullable; -import java.util.Map; - -public final class TransitionFunction extends Function { - - private final String targetStatus; - private final String targetResolution; - - public TransitionFunction(String targetStatus, @Nullable String targetResolution) { - Preconditions.checkArgument(!Strings.isNullOrEmpty(targetStatus), "Empty target status"); - this.targetStatus = targetStatus; - this.targetResolution = targetResolution; - } - - @Override - public void doExecute(MutableReview review, Review initialReview, WorkflowContext context, Map parameters) { - review.setStatus(targetStatus); - review.setResolution(targetResolution); - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java index a3a332eb5a5..250e761593f 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java @@ -22,7 +22,7 @@ package org.sonar.core.review.workflow.review; import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; -public class Comment implements Cloneable { +public final class Comment implements Cloneable { private String markdownText; private Long userId; diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java index 55adaa16a14..51a52790000 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java @@ -37,8 +37,8 @@ public final class DefaultReview implements MutableReview { private Long violationId; private Long reviewId; - private Long ruleId; - private Long assigneeId; + private String ruleRepositoryKey; + private String ruleKey; private Long line; private boolean switchedOff = false; private boolean manual = false; @@ -67,12 +67,21 @@ public final class DefaultReview implements MutableReview { return this; } - public Long getRuleId() { - return ruleId; + public String getRuleRepositoryKey() { + return ruleRepositoryKey; } - public DefaultReview setRuleId(Long ruleId) { - this.ruleId = ruleId; + 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; } @@ -112,15 +121,6 @@ public final class DefaultReview implements MutableReview { return this; } - public Long getAssigneeId() { - return assigneeId; - } - - public DefaultReview setAssigneeId(Long l) { - this.assigneeId = l; - return this; - } - public String getStatus() { return status; } @@ -202,14 +202,14 @@ public final class DefaultReview implements MutableReview { */ public ImmutableReview cloneImmutable() { ImmutableReview clone = new ImmutableReview(); - clone.setAssigneeId(assigneeId); clone.setLine(line); clone.setManual(manual); clone.setMessage(message); clone.setProperties(ImmutableMap.copyOf(getProperties())); clone.setResolution(resolution); clone.setReviewId(reviewId); - clone.setRuleId(ruleId); + clone.setRuleKey(ruleKey); + clone.setRuleRepositoryKey(ruleRepositoryKey); clone.setSeverity(severity); clone.setStatus(status); clone.setSwitchedOff(switchedOff); diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/ImmutableReview.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/ImmutableReview.java index 94a6941e87a..1f3b7e9e022 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/ImmutableReview.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/ImmutableReview.java @@ -25,7 +25,8 @@ public class ImmutableReview implements Review { private Long violationId; private Long reviewId; private Long ruleId; - private Long assigneeId; + private String ruleRepositoryKey; + private String ruleKey; private Long line; private boolean switchedOff = false; private boolean manual = false; @@ -59,12 +60,20 @@ public class ImmutableReview implements Review { this.ruleId = ruleId; } - public Long getAssigneeId() { - return assigneeId; + public String getRuleRepositoryKey() { + return ruleRepositoryKey; } - void setAssigneeId(Long assigneeId) { - this.assigneeId = assigneeId; + void setRuleRepositoryKey(String ruleRepositoryKey) { + this.ruleRepositoryKey = ruleRepositoryKey; + } + + public String getRuleKey() { + return ruleKey; + } + + void setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; } public Long getLine() { diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/MutableReview.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/MutableReview.java index 420583b0cef..286254dcdb8 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/MutableReview.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/MutableReview.java @@ -24,8 +24,6 @@ import java.util.List; public interface MutableReview extends Review { - MutableReview setAssigneeId(Long assigneeId); - MutableReview setStatus(String s); MutableReview setResolution(@Nullable String resolution); diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Review.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Review.java index f40b88d80f1..95c8e28080a 100644 --- a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Review.java +++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/Review.java @@ -23,13 +23,9 @@ import java.util.Map; public interface Review { - Long getViolationId(); + String getRuleRepositoryKey(); - Long getReviewId(); - - Long getRuleId(); - - Long getAssigneeId(); + String getRuleKey(); boolean isSwitchedOff(); diff --git a/sonar-core/src/test/java/org/sonar/core/review/workflow/ReviewDatabaseStoreTest.java b/sonar-core/src/test/java/org/sonar/core/review/workflow/ReviewDatabaseStoreTest.java index d1e548c43f2..99eae6f7330 100644 --- a/sonar-core/src/test/java/org/sonar/core/review/workflow/ReviewDatabaseStoreTest.java +++ b/sonar-core/src/test/java/org/sonar/core/review/workflow/ReviewDatabaseStoreTest.java @@ -34,8 +34,7 @@ public class ReviewDatabaseStoreTest extends DaoTestCase { public void store() { setupData("store"); ReviewDatabaseStore store = new ReviewDatabaseStore(getMyBatis()); - MutableReview review = new DefaultReview().setReviewId(1234L); - review.setAssigneeId(33L); + DefaultReview review = new DefaultReview().setReviewId(1234L); review.setStatus("CLOSED"); review.setResolution("RESOLVED"); review.setProperty("who", "me"); diff --git a/sonar-core/src/test/java/org/sonar/core/review/workflow/WorkflowEngineTest.java b/sonar-core/src/test/java/org/sonar/core/review/workflow/WorkflowEngineTest.java index 6e8c1950f25..29f86a9b1be 100644 --- a/sonar-core/src/test/java/org/sonar/core/review/workflow/WorkflowEngineTest.java +++ b/sonar-core/src/test/java/org/sonar/core/review/workflow/WorkflowEngineTest.java @@ -86,7 +86,7 @@ public class WorkflowEngineTest { public void listAvailableScreensForReviews_empty() { WorkflowEngine engine = new WorkflowEngine(new Workflow(), mock(ReviewStore.class), new Settings()); ListMultimap screens = engine.listAvailableScreens( - new Review[]{new DefaultReview().setViolationId(1000L), new DefaultReview().setViolationId(2000L)}, + new DefaultReview[]{new DefaultReview().setViolationId(1000L), new DefaultReview().setViolationId(2000L)}, new DefaultWorkflowContext(), true); assertThat(screens.size()).isEqualTo(0); } @@ -100,7 +100,7 @@ public class WorkflowEngineTest { workflow.setScreen("resolve", screen); WorkflowEngine engine = new WorkflowEngine(workflow, mock(ReviewStore.class), new Settings()); ListMultimap screens = engine.listAvailableScreens( - new Review[]{new DefaultReview().setViolationId(1000L), new DefaultReview().setViolationId(2000L)}, + new DefaultReview[]{new DefaultReview().setViolationId(1000L), new DefaultReview().setViolationId(2000L)}, new DefaultWorkflowContext(), true); assertThat(screens.size()).isEqualTo(2); assertThat(screens.get(1000L)).containsExactly(screen); @@ -117,7 +117,7 @@ public class WorkflowEngineTest { WorkflowEngine engine = new WorkflowEngine(workflow, store, new Settings()); engine.listAvailableScreens( - new Review[]{new DefaultReview().setViolationId(1000L), new DefaultReview().setViolationId(2000L)}, + new DefaultReview[]{new DefaultReview().setViolationId(1000L), new DefaultReview().setViolationId(2000L)}, new DefaultWorkflowContext().setProjectId(300L), true); @@ -137,7 +137,7 @@ public class WorkflowEngineTest { settings.setProperty("foo", "bar"); WorkflowEngine engine = new WorkflowEngine(workflow, store, settings); - MutableReview review = new DefaultReview().setViolationId(1000L); + DefaultReview review = new DefaultReview().setViolationId(1000L); Map parameters = Maps.newHashMap(); DefaultWorkflowContext context = new DefaultWorkflowContext().setProjectId(300L); @@ -162,7 +162,7 @@ public class WorkflowEngineTest { Settings settings = new Settings();// missing property 'foo' WorkflowEngine engine = new WorkflowEngine(workflow, store, settings); - MutableReview review = new DefaultReview().setViolationId(1000L); + DefaultReview review = new DefaultReview().setViolationId(1000L); Map parameters = Maps.newHashMap(); DefaultWorkflowContext context = new DefaultWorkflowContext().setProjectId(300L); diff --git a/sonar-core/src/test/java/org/sonar/core/review/workflow/WorkflowTest.java b/sonar-core/src/test/java/org/sonar/core/review/workflow/WorkflowTest.java index e4e7dc40205..00502cd6148 100644 --- a/sonar-core/src/test/java/org/sonar/core/review/workflow/WorkflowTest.java +++ b/sonar-core/src/test/java/org/sonar/core/review/workflow/WorkflowTest.java @@ -26,7 +26,8 @@ import org.junit.rules.ExpectedException; import org.sonar.core.review.workflow.condition.Condition; import org.sonar.core.review.workflow.condition.HasProjectPropertyCondition; import org.sonar.core.review.workflow.condition.StatusCondition; -import org.sonar.core.review.workflow.function.TransitionFunction; +import org.sonar.core.review.workflow.function.CommentFunction; +import org.sonar.core.review.workflow.function.Function; import org.sonar.core.review.workflow.screen.CommentScreen; import static org.fest.assertions.Assertions.assertThat; @@ -127,7 +128,7 @@ public class WorkflowTest { Workflow workflow = new Workflow(); workflow.addCommand("resolve"); - TransitionFunction function = new TransitionFunction("OPEN", "resolved"); + Function function = new CommentFunction(); workflow.addFunction("resolve", function); assertThat(workflow.getFunctions("resolve")).containsExactly(function); @@ -145,7 +146,7 @@ public class WorkflowTest { thrown.expectMessage("Unknown command: resolve"); Workflow workflow = new Workflow(); - workflow.addFunction("resolve", new TransitionFunction("OPEN", "resolved")); + workflow.addFunction("resolve", new CommentFunction()); } @Test diff --git a/sonar-core/src/test/java/org/sonar/core/review/workflow/condition/ResolutionConditionTest.java b/sonar-core/src/test/java/org/sonar/core/review/workflow/condition/ResolutionConditionTest.java index 0967df59d78..caa79784e3c 100644 --- a/sonar-core/src/test/java/org/sonar/core/review/workflow/condition/ResolutionConditionTest.java +++ b/sonar-core/src/test/java/org/sonar/core/review/workflow/condition/ResolutionConditionTest.java @@ -19,7 +19,9 @@ */ package org.sonar.core.review.workflow.condition; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.sonar.core.review.workflow.review.DefaultReview; import org.sonar.core.review.workflow.review.DefaultWorkflowContext; import org.sonar.core.review.workflow.review.Review; @@ -27,6 +29,16 @@ import org.sonar.core.review.workflow.review.Review; 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"); diff --git a/sonar-core/src/test/java/org/sonar/core/review/workflow/condition/StatusConditionTest.java b/sonar-core/src/test/java/org/sonar/core/review/workflow/condition/StatusConditionTest.java index 80e2023f967..46c2a2c5ed5 100644 --- a/sonar-core/src/test/java/org/sonar/core/review/workflow/condition/StatusConditionTest.java +++ b/sonar-core/src/test/java/org/sonar/core/review/workflow/condition/StatusConditionTest.java @@ -19,7 +19,9 @@ */ package org.sonar.core.review.workflow.condition; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.sonar.core.review.workflow.review.DefaultReview; import org.sonar.core.review.workflow.review.DefaultWorkflowContext; import org.sonar.core.review.workflow.review.Review; @@ -27,6 +29,17 @@ import org.sonar.core.review.workflow.review.Review; 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"); diff --git a/sonar-core/src/test/resources/org/sonar/core/review/workflow/ReviewDatabaseStoreTest/store-result.xml b/sonar-core/src/test/resources/org/sonar/core/review/workflow/ReviewDatabaseStoreTest/store-result.xml index 6b344b546ae..a389f7ff88c 100644 --- a/sonar-core/src/test/resources/org/sonar/core/review/workflow/ReviewDatabaseStoreTest/store-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/review/workflow/ReviewDatabaseStoreTest/store-result.xml @@ -9,6 +9,7 @@ resource_line="200" severity="BLOCKER" user_id="300" + assignee_id="33" resource_id="400" rule_id="500" manual_violation="[true]" @@ -17,7 +18,6 @@ updated_at="2012-05-18" status="CLOSED" resolution="RESOLVED" - assignee_id="33" data="who=me;why=because" /> diff --git a/sonar-core/src/test/resources/org/sonar/core/review/workflow/ReviewDatabaseStoreTest/store.xml b/sonar-core/src/test/resources/org/sonar/core/review/workflow/ReviewDatabaseStoreTest/store.xml index edc3d7f31af..8de7eda9f7c 100644 --- a/sonar-core/src/test/resources/org/sonar/core/review/workflow/ReviewDatabaseStoreTest/store.xml +++ b/sonar-core/src/test/resources/org/sonar/core/review/workflow/ReviewDatabaseStoreTest/store.xml @@ -9,6 +9,7 @@ resource_line="200" severity="BLOCKER" user_id="300" + assignee_id="33" resource_id="400" rule_id="500" manual_violation="[true]" @@ -17,7 +18,6 @@ updated_at="[null]" status="OPEN" resolution="[null]" - assignee_id="[null]" data="[null]" /> diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index b51f00db207..d5c066d5576 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -44,6 +44,7 @@ import org.sonar.core.persistence.DatabaseMigrator; import org.sonar.core.purge.PurgeDao; import org.sonar.core.resource.ResourceIndexerDao; import org.sonar.core.review.workflow.WorkflowEngine; +import org.sonar.core.review.workflow.review.DefaultReview; import org.sonar.core.review.workflow.review.DefaultWorkflowContext; import org.sonar.core.review.workflow.review.MutableReview; import org.sonar.core.review.workflow.review.Review; @@ -478,7 +479,7 @@ public final class JRubyFacade { return getContainer().getComponentByType(WorkflowEngine.class).listAvailableScreens(review, context, true); } - public ListMultimap listAvailableReviewsScreens(Review[] reviews, DefaultWorkflowContext context) { + public ListMultimap listAvailableReviewsScreens(DefaultReview[] reviews, DefaultWorkflowContext context) { return getContainer().getComponentByType(WorkflowEngine.class).listAvailableScreens(reviews, context, true); } @@ -486,7 +487,7 @@ public final class JRubyFacade { return getContainer().getComponentByType(WorkflowEngine.class).getScreen(commandKey); } - public void executeReviewCommand(String commandKey, MutableReview review, DefaultWorkflowContext context, Map parameters) { + public void executeReviewCommand(String commandKey, DefaultReview review, DefaultWorkflowContext context, Map parameters) { getContainer().getComponentByType(WorkflowEngine.class).execute(commandKey, review, context, parameters); } } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb index 421c2e6ef9b..5121cd144c1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb @@ -278,7 +278,8 @@ class RuleFailure < ActiveRecord::Base java_review=Java::OrgSonarCoreReviewWorkflowReview::DefaultReview.new java_review.setViolationId(violation.id) java_review.setSeverity(violation.severity.to_s) - java_review.setRuleId(violation.rule_id) + java_review.setRuleKey(violation.rule.plugin_rule_key) + java_review.setRuleRepositoryKey(violation.rule.repository_key) java_review.setSwitchedOff(violation.switched_off||false) java_review.setMessage(violation.message) java_review.setLine(violation.line) @@ -288,7 +289,6 @@ class RuleFailure < ActiveRecord::Base java_review.setReviewId(review.id) java_review.setStatus(review.status) java_review.setResolution(review.resolution) - java_review.setAssigneeId(review.assignee_id) java_review.setManual(review.manual_violation) java_review.setPropertiesAsString(review.data) else -- 2.39.5