Committed by
Gerrit Code Review
ONOS-3378 REST DELETE operation on network config subject class key
- delete operation was not working because the incorrect class was being passed to the lookup method. - changed delete operations to return status 204 in lieu of 200 since no actual content is returned. Change-Id: Ibb5294a7b40996fad5d8a4ede48b0f2b7eb923e1
Showing
1 changed file
with
4 additions
and
10 deletions
| ... | @@ -254,17 +254,15 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -254,17 +254,15 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
| 254 | * Clear all network configurations for a subject class. | 254 | * Clear all network configurations for a subject class. |
| 255 | * | 255 | * |
| 256 | * @param subjectClassKey subject class key | 256 | * @param subjectClassKey subject class key |
| 257 | - * @return empty response | ||
| 258 | */ | 257 | */ |
| 259 | @DELETE | 258 | @DELETE |
| 260 | @Path("{subjectClassKey}") | 259 | @Path("{subjectClassKey}") |
| 261 | @SuppressWarnings("unchecked") | 260 | @SuppressWarnings("unchecked") |
| 262 | - public Response delete(@PathParam("subjectClassKey") String subjectClassKey) { | 261 | + public void delete(@PathParam("subjectClassKey") String subjectClassKey) { |
| 263 | NetworkConfigService service = get(NetworkConfigService.class); | 262 | NetworkConfigService service = get(NetworkConfigService.class); |
| 264 | - service.getSubjects(service.getSubjectFactory(subjectClassKey).getClass()) | 263 | + service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass()) |
| 265 | .forEach(subject -> service.getConfigs(subject) | 264 | .forEach(subject -> service.getConfigs(subject) |
| 266 | .forEach(config -> service.removeConfig(subject, config.getClass()))); | 265 | .forEach(config -> service.removeConfig(subject, config.getClass()))); |
| 267 | - return Response.ok().build(); | ||
| 268 | } | 266 | } |
| 269 | 267 | ||
| 270 | /** | 268 | /** |
| ... | @@ -272,17 +270,15 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -272,17 +270,15 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
| 272 | * | 270 | * |
| 273 | * @param subjectClassKey subjectKey class key | 271 | * @param subjectClassKey subjectKey class key |
| 274 | * @param subjectKey subjectKey key | 272 | * @param subjectKey subjectKey key |
| 275 | - * @return empty response | ||
| 276 | */ | 273 | */ |
| 277 | @DELETE | 274 | @DELETE |
| 278 | @Path("{subjectClassKey}/{subjectKey}") | 275 | @Path("{subjectClassKey}/{subjectKey}") |
| 279 | @SuppressWarnings("unchecked") | 276 | @SuppressWarnings("unchecked") |
| 280 | - public Response delete(@PathParam("subjectClassKey") String subjectClassKey, | 277 | + public void delete(@PathParam("subjectClassKey") String subjectClassKey, |
| 281 | @PathParam("subjectKey") String subjectKey) { | 278 | @PathParam("subjectKey") String subjectKey) { |
| 282 | NetworkConfigService service = get(NetworkConfigService.class); | 279 | NetworkConfigService service = get(NetworkConfigService.class); |
| 283 | Object s = service.getSubjectFactory(subjectClassKey).createSubject(subjectKey); | 280 | Object s = service.getSubjectFactory(subjectClassKey).createSubject(subjectKey); |
| 284 | service.getConfigs(s).forEach(c -> service.removeConfig(s, c.getClass())); | 281 | service.getConfigs(s).forEach(c -> service.removeConfig(s, c.getClass())); |
| 285 | - return Response.ok().build(); | ||
| 286 | } | 282 | } |
| 287 | 283 | ||
| 288 | /** | 284 | /** |
| ... | @@ -291,18 +287,16 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -291,18 +287,16 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
| 291 | * @param subjectClassKey subjectKey class key | 287 | * @param subjectClassKey subjectKey class key |
| 292 | * @param subjectKey subjectKey key | 288 | * @param subjectKey subjectKey key |
| 293 | * @param configKey configuration class key | 289 | * @param configKey configuration class key |
| 294 | - * @return empty response | ||
| 295 | */ | 290 | */ |
| 296 | @DELETE | 291 | @DELETE |
| 297 | @Path("{subjectClassKey}/{subjectKey}/{configKey}") | 292 | @Path("{subjectClassKey}/{subjectKey}/{configKey}") |
| 298 | @SuppressWarnings("unchecked") | 293 | @SuppressWarnings("unchecked") |
| 299 | - public Response delete(@PathParam("subjectClassKey") String subjectClassKey, | 294 | + public void delete(@PathParam("subjectClassKey") String subjectClassKey, |
| 300 | @PathParam("subjectKey") String subjectKey, | 295 | @PathParam("subjectKey") String subjectKey, |
| 301 | @PathParam("configKey") String configKey) { | 296 | @PathParam("configKey") String configKey) { |
| 302 | NetworkConfigService service = get(NetworkConfigService.class); | 297 | NetworkConfigService service = get(NetworkConfigService.class); |
| 303 | service.removeConfig(service.getSubjectFactory(subjectClassKey).createSubject(subjectKey), | 298 | service.removeConfig(service.getSubjectFactory(subjectClassKey).createSubject(subjectKey), |
| 304 | service.getConfigClass(subjectClassKey, configKey)); | 299 | service.getConfigClass(subjectClassKey, configKey)); |
| 305 | - return Response.ok().build(); | ||
| 306 | } | 300 | } |
| 307 | 301 | ||
| 308 | } | 302 | } | ... | ... |
-
Please register or login to post a comment