From: Julien Lancelot Date: Mon, 17 Jun 2013 16:36:38 +0000 (+0200) Subject: SONAR-4392 List and edit existing issues filter X-Git-Tag: 3.7~470 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ec362118f5482b294fc657c00be6288142106428;p=sonarqube.git SONAR-4392 List and edit existing issues filter --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index 6caab7f672a..4c36dc7c676 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -531,9 +531,15 @@ issue_filter.criteria.status=Status issue_filter.max_results_reached=Only the first {0} issues matching the search criteria have been retrieved. Add some additional criteria to get fewer results to be able to sort this list. issue_filter.no_result=No matching issues found. issue_filter.save_filter=Save Filter +issue_filter.edit_filter=Edit Filter issue_filter.form.name=Name issue_filter.form.description=Description issue_filter.form.share=Shared with all users +issue_filter.favourite_filters=Favourite Filters +issue_filter.manage.my_filters=My Filters +issue_filter.no_filters=No filters +issue_filter.delete_confirm_title=Delete Filter +issue_filter.are_you_sure_want_delete_filter_x=Are you sure that you want to delete the filter "{0}"? #------------------------------------------------------------------------------ diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueFilter.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueFilter.java index 03ec5dac42b..db2b2b9fbf7 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueFilter.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueFilter.java @@ -25,8 +25,6 @@ import com.google.common.base.Splitter; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; -import javax.annotation.CheckForNull; - import java.util.Date; import java.util.Iterator; import java.util.List; @@ -63,7 +61,7 @@ public class DefaultIssueFilter { } public DefaultIssueFilter(Map mapData) { - this.data = mapAsdata(mapData); + setData(mapData); } public Long id() { @@ -84,7 +82,6 @@ public class DefaultIssueFilter { return this; } - @CheckForNull public String user() { return user; } @@ -139,6 +136,11 @@ public class DefaultIssueFilter { return this; } + public final DefaultIssueFilter setData(Map mapData) { + this.data = mapAsdata(mapData); + return this; + } + /** * Used by ui */ diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java index 2ac8a80265c..679b02e7915 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java @@ -26,6 +26,7 @@ import org.sonar.api.ServerComponent; import org.sonar.core.persistence.MyBatis; import javax.annotation.CheckForNull; +import javax.annotation.Nullable; import java.util.List; @@ -51,6 +52,17 @@ public class IssueFilterDao implements BatchComponent, ServerComponent { } } + @CheckForNull + public IssueFilterDto selectByNameAndUser(String name, String user, @Nullable Long existingId) { + SqlSession session = mybatis.openSession(); + try { + session.getMapper(IssueFilterMapper.class); + return getMapper(session).selectByNameAndUser(name, user, existingId); + } finally { + MyBatis.closeQuietly(session); + } + } + public List selectByUser(String user) { SqlSession session = mybatis.openSession(); try { diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterMapper.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterMapper.java index c4e8520febb..86f10e01c7b 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterMapper.java @@ -19,7 +19,10 @@ */ package org.sonar.core.issue.db; +import org.apache.ibatis.annotations.Param; + import javax.annotation.CheckForNull; +import javax.annotation.Nullable; import java.util.List; @@ -31,6 +34,9 @@ public interface IssueFilterMapper { @CheckForNull IssueFilterDto selectById(Long id); + @CheckForNull + IssueFilterDto selectByNameAndUser(@Param("name") String name, @Param("userLogin") String userLogin, @Nullable @Param("existingId") Long existingId); + List selectByUser(String user); void insert(IssueFilterDto filter); diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml index 8a5ed2fc971..291f90db47f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml @@ -23,6 +23,18 @@ + + +
+ + + +
+ + \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_favourites.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_favourites.html.erb new file mode 100644 index 00000000000..0a288c80ae2 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_favourites.html.erb @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_save_as_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_save_as_form.html.erb index 10dcaf7a402..77797e3616a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_save_as_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_save_as_form.html.erb @@ -7,13 +7,7 @@