aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-12 11:20:43 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-17 13:40:59 +0100
commit3c3d60d4e50ce70d7038bf1d2a71e98effc3d458 (patch)
treed8d9359140407fbeb553dd3c658c64c4fe12c92d
parent614a6496873c9b8f2149c4ee17a3e738cea1f470 (diff)
downloadsonarqube-3c3d60d4e50ce70d7038bf1d2a71e98effc3d458.tar.gz
sonarqube-3c3d60d4e50ce70d7038bf1d2a71e98effc3d458.zip
SONAR-6947 Improve XXXWsRequest contracts
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java15
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateWsRequest.java4
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupWsRequest.java10
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsWsRequest.java8
4 files changed, 22 insertions, 15 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java
index 6642c58839e..bdd8563b258 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java
@@ -29,17 +29,17 @@ import org.sonar.server.permission.PermissionChange;
import org.sonar.server.permission.PermissionUpdater;
import org.sonarqube.ws.client.permission.AddGroupWsRequest;
-import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
-import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
-import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupIdParameter;
import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupNameParameter;
import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createPermissionParameter;
import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
import static org.sonar.server.permission.ws.WsProjectRef.newOptionalWsProjectRef;
import static org.sonar.server.usergroups.ws.WsGroupRef.newWsGroupRef;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
public class AddGroupAction implements PermissionsWsAction {
@@ -83,11 +83,12 @@ public class AddGroupAction implements PermissionsWsAction {
private void doHandle(AddGroupWsRequest request) throws Exception {
DbSession dbSession = dbClient.openSession(false);
try {
+ Long groupId = request.getGroupId() == null ? null : Long.valueOf(request.getGroupId());
PermissionChange permissionChange = permissionChangeBuilder.buildGroupPermissionChange(
dbSession,
request.getPermission(),
newOptionalWsProjectRef(request.getProjectId(), request.getProjectKey()),
- newWsGroupRef(request.getGroupId(), request.getGroupName()));
+ newWsGroupRef(groupId, request.getGroupName()));
permissionUpdater.addPermission(permissionChange);
} finally {
dbClient.closeSession(dbSession);
@@ -97,7 +98,7 @@ public class AddGroupAction implements PermissionsWsAction {
private static AddGroupWsRequest toAddGroupWsRequest(Request request) {
return new AddGroupWsRequest()
.setPermission(request.mandatoryParam(PARAM_PERMISSION))
- .setGroupId(request.paramAsLong(PARAM_GROUP_ID))
+ .setGroupId(request.param(PARAM_GROUP_ID))
.setGroupName(request.param(PARAM_GROUP_NAME))
.setProjectId(request.param(PARAM_PROJECT_ID))
.setProjectKey(request.param(PARAM_PROJECT_KEY));
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateWsRequest.java
index 2fff2a6928f..3cd273d0903 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateWsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateWsRequest.java
@@ -23,6 +23,8 @@ package org.sonarqube.ws.client.permission;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+import static java.util.Objects.requireNonNull;
+
public class AddGroupToTemplateWsRequest {
private String groupId;
private String groupName;
@@ -55,7 +57,7 @@ public class AddGroupToTemplateWsRequest {
}
public AddGroupToTemplateWsRequest setPermission(String permission) {
- this.permission = permission;
+ this.permission = requireNonNull(permission, "permission must not be null");
return this;
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupWsRequest.java
index 975580862fb..8a7ddbd00e2 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupWsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupWsRequest.java
@@ -23,9 +23,11 @@ package org.sonarqube.ws.client.permission;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+import static java.util.Objects.requireNonNull;
+
public class AddGroupWsRequest {
private String permission;
- private Long groupId;
+ private String groupId;
private String groupName;
private String projectId;
private String projectKey;
@@ -35,16 +37,16 @@ public class AddGroupWsRequest {
}
public AddGroupWsRequest setPermission(String permission) {
- this.permission = permission;
+ this.permission = requireNonNull(permission, "permission must not be null");
return this;
}
@CheckForNull
- public Long getGroupId() {
+ public String getGroupId() {
return groupId;
}
- public AddGroupWsRequest setGroupId(@Nullable Long groupId) {
+ public AddGroupWsRequest setGroupId(@Nullable String groupId) {
this.groupId = groupId;
return this;
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsWsRequest.java
index 535ed11ce37..35690aaf80e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsWsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsWsRequest.java
@@ -22,6 +22,8 @@ package org.sonarqube.ws.client.permission;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+import static java.util.Objects.requireNonNull;
+
public class GroupsWsRequest {
private String permission;
private String projectId;
@@ -36,7 +38,7 @@ public class GroupsWsRequest {
}
public GroupsWsRequest setPermission(String permission) {
- this.permission = permission;
+ this.permission = requireNonNull(permission, "permission must not be null");
return this;
}
@@ -45,7 +47,7 @@ public class GroupsWsRequest {
return projectId;
}
- public GroupsWsRequest setProjectId(String projectId) {
+ public GroupsWsRequest setProjectId(@Nullable String projectId) {
this.projectId = projectId;
return this;
}
@@ -93,7 +95,7 @@ public class GroupsWsRequest {
}
public GroupsWsRequest setSelected(String selected) {
- this.selected = selected;
+ this.selected = requireNonNull(selected, "selected must not be null");
return this;
}
}
value='backport/48090/stable29'>backport/48090/stable29 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/l10n/en_GB.js
blob: b950d42133b5b88f1969a32ffd4c7a4bc5236e64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198