Make PUT on /projects/<name>/parent return the new parent name
PUT on /projects/<name>/parent should return the same as GET on the same URL will return after the PUT was done. GET on /projects/<name>/parent returns the name of the parent project and PUT should do the same. At the moment PUT on /projects/<name>/parent returns the updated ProjectInfo entity of the project for which the parent was updated. The documentation of this REST endpoint already describes the new behaviour. Change-Id: Iac2623a5d31ea76ebe13a8a7da1ba844468f9bb2 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -54,7 +54,7 @@ class SetParent implements RestModifyView<ProjectResource, Input> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object apply(ProjectResource resource, Input input)
|
public String apply(ProjectResource resource, Input input)
|
||||||
throws AuthException, BadRequestException, ResourceConflictException,
|
throws AuthException, BadRequestException, ResourceConflictException,
|
||||||
Exception {
|
Exception {
|
||||||
ProjectControl ctl = resource.getControl();
|
ProjectControl ctl = resource.getControl();
|
||||||
@@ -83,11 +83,8 @@ class SetParent implements RestModifyView<ProjectResource, Input> {
|
|||||||
config.commit(md);
|
config.commit(md);
|
||||||
cache.evict(ctl.getProject());
|
cache.evict(ctl.getProject());
|
||||||
|
|
||||||
ListProjects.ProjectInfo info = new ListProjects.ProjectInfo();
|
Project.NameKey parentName = project.getParent(allProjects);
|
||||||
info.setName(resource.getName());
|
return parentName != null ? parentName.get() : "";
|
||||||
info.parent = project.getParentName();
|
|
||||||
info.description = project.getDescription();
|
|
||||||
return info;
|
|
||||||
} finally {
|
} finally {
|
||||||
md.close();
|
md.close();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user