diff options
Diffstat (limited to 'sonar-core/src')
4 files changed, 13 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java index a886424f247..1043ad3ca61 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java @@ -23,11 +23,21 @@ import org.sonar.api.component.Component; public class ComponentDto implements Component { + private Long id; private String key; private String name; private String longName; private String qualifier; + public Long getId() { + return id; + } + + public ComponentDto setId(Long id) { + this.id = id; + return this; + } + @Override public String key() { return key; diff --git a/sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java b/sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java index b455aa61679..f681635865a 100644 --- a/sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java +++ b/sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java @@ -141,7 +141,6 @@ public class ComponentPermissionFacade implements TaskComponent, ServerComponent if(usersPermissions != null) { for (PermissionTemplateUserDto userPermission : usersPermissions) { addUserPermission(resourceId, userPermission.getUserLogin(), userPermission.getPermission(), session); - } } List<PermissionTemplateGroupDto> groupsPermissions = permissionTemplate.getGroupsPermissions(); 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 18bb0ec788c..6d68359fe07 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 @@ -220,6 +220,7 @@ public class ResourceDao { public static ComponentDto toComponent(ResourceDto resourceDto){ return new ComponentDto() + .setId(resourceDto.getId()) .setKey(resourceDto.getKey()) .setLongName(resourceDto.getLongName()) .setName(resourceDto.getName()) diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java index 11a7edcd71e..2b38ad2e31f 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java @@ -25,6 +25,7 @@ import org.junit.Test; import org.sonar.api.component.Component; import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.Scopes; +import org.sonar.core.component.ComponentDto; import org.sonar.core.persistence.AbstractDaoTestCase; import java.util.Collection; @@ -316,6 +317,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase { List<Component> components = dao.selectComponentsByQualifiers(newArrayList("TRK")); assertThat(components).hasSize(1); assertThat(components.get(0).key()).isEqualTo("org.struts:struts"); + assertThat(((ComponentDto)components.get(0)).getId()).isEqualTo(1L); assertThat(dao.selectComponentsByQualifiers(newArrayList("unknown"))).isEmpty(); assertThat(dao.selectComponentsByQualifiers(Collections.<String>emptyList())).isEmpty(); |