diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-09-07 18:03:11 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-09-28 16:35:00 +0200 |
commit | f16b5672621fa152414a1f8afb24340c67668029 (patch) | |
tree | e8e8e514a760262243f70e8ff1e6d21a94c865f3 /sonar-db | |
parent | e7af578fb13af943b5beb6f10299cdd5ec4d876e (diff) | |
download | sonarqube-f16b5672621fa152414a1f8afb24340c67668029.tar.gz sonarqube-f16b5672621fa152414a1f8afb24340c67668029.zip |
Remove business classes in permission domain
- GroupWithPermissionQueryResult
- UserWithPermissionQueryResult
- UserWithPermission
- GroupWithPermission
Diffstat (limited to 'sonar-db')
8 files changed, 0 insertions, 424 deletions
diff --git a/sonar-db/src/main/java/org/sonar/core/permission/GroupWithPermission.java b/sonar-db/src/main/java/org/sonar/core/permission/GroupWithPermission.java deleted file mode 100644 index 29f3a296c2b..00000000000 --- a/sonar-db/src/main/java/org/sonar/core/permission/GroupWithPermission.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.core.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -public class GroupWithPermission { - - private long id; - private String name; - private String description; - private boolean hasPermission; - - public long id() { - return id; - } - - public GroupWithPermission setId(Long id) { - this.id = id; - return this; - } - - public String name() { - return name; - } - - public GroupWithPermission setName(String name) { - this.name = name; - return this; - } - - @CheckForNull - public String description() { - return description; - } - - public GroupWithPermission setDescription(@Nullable String description) { - this.description = description; - return this; - } - - public boolean hasPermission() { - return hasPermission; - } - - public GroupWithPermission hasPermission(boolean hasPermission) { - this.hasPermission = hasPermission; - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GroupWithPermission that = (GroupWithPermission) o; - return name.equals(that.name); - } - - @Override - public int hashCode() { - return name.hashCode(); - } -} diff --git a/sonar-db/src/main/java/org/sonar/core/permission/UserWithPermission.java b/sonar-db/src/main/java/org/sonar/core/permission/UserWithPermission.java deleted file mode 100644 index 7e8080d4ccb..00000000000 --- a/sonar-db/src/main/java/org/sonar/core/permission/UserWithPermission.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.core.permission; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -public class UserWithPermission { - - private String login; - private String name; - private String email; - private boolean hasPermission; - - public String login() { - return login; - } - - public UserWithPermission setLogin(String login) { - this.login = login; - return this; - } - - public String name() { - return name; - } - - public UserWithPermission setName(String name) { - this.name = name; - return this; - } - - public String email() { - return email; - } - - public UserWithPermission setEmail(String email) { - this.email = email; - return this; - } - - public boolean hasPermission() { - return hasPermission; - } - - public UserWithPermission hasPermission(boolean hasPermission) { - this.hasPermission = hasPermission; - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UserWithPermission that = (UserWithPermission) o; - return login.equals(that.login); - } - - @Override - public int hashCode() { - return login.hashCode(); - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/permission/GroupWithPermissionDto.java b/sonar-db/src/main/java/org/sonar/db/permission/GroupWithPermissionDto.java index 3df694d5814..521a87439d8 100644 --- a/sonar-db/src/main/java/org/sonar/db/permission/GroupWithPermissionDto.java +++ b/sonar-db/src/main/java/org/sonar/db/permission/GroupWithPermissionDto.java @@ -22,7 +22,6 @@ package org.sonar.db.permission; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.core.permission.GroupWithPermission; public class GroupWithPermissionDto { @@ -67,12 +66,4 @@ public class GroupWithPermissionDto { this.description = description; return this; } - - public GroupWithPermission toGroupWithPermission() { - return new GroupWithPermission() - .setId(id) - .setName(name) - .setDescription(description) - .hasPermission(permission != null); - } } diff --git a/sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java b/sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java index efa0d17c07c..15ed345eb11 100644 --- a/sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java +++ b/sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java @@ -22,7 +22,6 @@ package org.sonar.db.permission; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.core.permission.UserWithPermission; public class UserWithPermissionDto { @@ -67,12 +66,4 @@ public class UserWithPermissionDto { this.permission = permission; return this; } - - public UserWithPermission toUserWithPermission() { - return new UserWithPermission() - .setLogin(login) - .setName(name) - .setEmail(email) - .hasPermission(permission != null); - } } diff --git a/sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionDtoTest.java b/sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionDtoTest.java deleted file mode 100644 index 04101abeb04..00000000000 --- a/sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionDtoTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.db.permission; - -import org.junit.Test; -import org.sonar.core.permission.GroupWithPermission; - -import static org.assertj.core.api.Assertions.assertThat; - -public class GroupWithPermissionDtoTest { - - @Test - public void to_group_with_permission_having_permission() { - GroupWithPermission group = new GroupWithPermissionDto() - .setName("users") - .setDescription("desc") - .setPermission("user") - .toGroupWithPermission(); - - assertThat(group.name()).isEqualTo("users"); - assertThat(group.description()).isEqualTo("desc"); - assertThat(group.hasPermission()).isTrue(); - } - - @Test - public void to_group_with_permission_not_having_permission() { - GroupWithPermission group = new GroupWithPermissionDto() - .setName("users") - .setPermission(null) - .toGroupWithPermission(); - - assertThat(group.name()).isEqualTo("users"); - assertThat(group.description()).isNull(); - assertThat(group.hasPermission()).isFalse(); - } -} diff --git a/sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionTest.java b/sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionTest.java deleted file mode 100644 index 7ddc78d1308..00000000000 --- a/sonar-db/src/test/java/org/sonar/db/permission/GroupWithPermissionTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.db.permission; - -import org.junit.Test; -import org.sonar.core.permission.GroupWithPermission; - -import static org.assertj.core.api.Assertions.assertThat; - -public class GroupWithPermissionTest { - - @Test - public void test_setters_and_getters() throws Exception { - GroupWithPermission user = new GroupWithPermission() - .setName("users") - .hasPermission(true); - - assertThat(user.name()).isEqualTo("users"); - assertThat(user.hasPermission()).isTrue(); - } - - @Test - public void test_equals() throws Exception { - assertThat(new GroupWithPermission().setName("users")).isEqualTo(new GroupWithPermission().setName("users")); - assertThat(new GroupWithPermission().setName("users")).isNotEqualTo(new GroupWithPermission().setName("reviewers")); - - GroupWithPermission group = new GroupWithPermission() - .setName("users") - .hasPermission(true); - assertThat(group).isEqualTo(group); - } - - @Test - public void test_hashcode() throws Exception { - assertThat(new GroupWithPermission().setName("users").hashCode()).isEqualTo(new GroupWithPermission().setName("users").hashCode()); - assertThat(new GroupWithPermission().setName("users").hashCode()).isNotEqualTo(new GroupWithPermission().setName("reviewers").hashCode()); - } - -} diff --git a/sonar-db/src/test/java/org/sonar/db/permission/UserWithPermissionDtoTest.java b/sonar-db/src/test/java/org/sonar/db/permission/UserWithPermissionDtoTest.java deleted file mode 100644 index 56d951ebb2d..00000000000 --- a/sonar-db/src/test/java/org/sonar/db/permission/UserWithPermissionDtoTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.db.permission; - -import org.junit.Test; -import org.sonar.core.permission.UserWithPermission; - -import static org.assertj.core.api.Assertions.assertThat; - -public class UserWithPermissionDtoTest { - - @Test - public void to_user_with_permission_having_permission() { - UserWithPermission user = new UserWithPermissionDto() - .setName("Arthur") - .setLogin("arthur") - .setPermission("user") - .toUserWithPermission(); - - assertThat(user.name()).isEqualTo("Arthur"); - assertThat(user.login()).isEqualTo("arthur"); - assertThat(user.hasPermission()).isTrue(); - } - - @Test - public void to_user_with_permission_not_having_permission() { - UserWithPermission user = new UserWithPermissionDto() - .setName("Arthur") - .setLogin("arthur") - .setPermission(null) - .toUserWithPermission(); - - assertThat(user.name()).isEqualTo("Arthur"); - assertThat(user.login()).isEqualTo("arthur"); - assertThat(user.hasPermission()).isFalse(); - } -} diff --git a/sonar-db/src/test/java/org/sonar/db/permission/UserWithPermissionTest.java b/sonar-db/src/test/java/org/sonar/db/permission/UserWithPermissionTest.java deleted file mode 100644 index baada745f8c..00000000000 --- a/sonar-db/src/test/java/org/sonar/db/permission/UserWithPermissionTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.db.permission; - -import org.junit.Test; -import org.sonar.core.permission.UserWithPermission; - -import static org.assertj.core.api.Assertions.assertThat; - -public class UserWithPermissionTest { - - @Test - public void test_setters_and_getters() throws Exception { - UserWithPermission user = new UserWithPermission() - .setName("Arthur") - .setLogin("arthur") - .hasPermission(true); - - assertThat(user.name()).isEqualTo("Arthur"); - assertThat(user.login()).isEqualTo("arthur"); - assertThat(user.hasPermission()).isTrue(); - } - - @Test - public void test_equals() throws Exception { - assertThat(new UserWithPermission().setLogin("arthur")).isEqualTo(new UserWithPermission().setLogin("arthur")); - assertThat(new UserWithPermission().setLogin("arthur")).isNotEqualTo(new UserWithPermission().setLogin("john")); - - UserWithPermission user = new UserWithPermission() - .setName("Arthur") - .setLogin("arthur") - .hasPermission(true); - assertThat(user).isEqualTo(user); - } - - @Test - public void test_hashcode() throws Exception { - assertThat(new UserWithPermission().setLogin("arthur").hashCode()).isEqualTo(new UserWithPermission().setLogin("arthur").hashCode()); - assertThat(new UserWithPermission().setLogin("arthur").hashCode()).isNotEqualTo(new UserWithPermission().setLogin("john").hashCode()); - } - -} |