diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-07-15 08:33:56 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-07-15 16:19:14 +0200 |
commit | 184756cd798fa9c5120b3d25c068e1f90767eaf0 (patch) | |
tree | fa448f4a6001c212ea4b80a2fae9934b3f0d2c04 /sonar-core/src/main | |
parent | a2eee9d6cd812e3a0a37491bc7124add940d4995 (diff) | |
download | sonarqube-184756cd798fa9c5120b3d25c068e1f90767eaf0.tar.gz sonarqube-184756cd798fa9c5120b3d25c068e1f90767eaf0.zip |
SONAR-4419 Roles page: improve search engine to add ability to search by project key
Diffstat (limited to 'sonar-core/src/main')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java index e18f0e4bfb1..9c9b4bd71f3 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java @@ -19,6 +19,8 @@ */ package org.sonar.core.resource; +import com.google.common.base.Function; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import org.apache.ibatis.session.SqlSession; import org.sonar.api.component.Component; @@ -199,7 +201,7 @@ public class ResourceDao { } } - public ComponentDto toComponent(ResourceDto resourceDto){ + public static ComponentDto toComponent(ResourceDto resourceDto){ return new ComponentDto() .setKey(resourceDto.getKey()) .setLongName(resourceDto.getLongName()) @@ -207,6 +209,15 @@ public class ResourceDao { .setQualifier(resourceDto.getQualifier()); } + public static List<ComponentDto> toComponents(List<ResourceDto> resourceDto){ + return newArrayList(Iterables.transform(resourceDto, new Function<ResourceDto, ComponentDto>() { + @Override + public ComponentDto apply(ResourceDto resourceDto) { + return toComponent(resourceDto); + } + })); + } + public void insertUsingExistingSession(ResourceDto resourceDto, SqlSession session) { ResourceMapper resourceMapper = session.getMapper(ResourceMapper.class); resourceMapper.insert(resourceDto); |