Firt version of publish dialog.
This commit is contained in:
@@ -110,10 +110,26 @@ public class MindmapController extends BaseController {
|
||||
updateMindmap(true, mindMap, user);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json", "text/html", "application/xml"})
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void changeMapPublish(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
||||
|
||||
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
if (!mindMap.getOwner().equals(user)) {
|
||||
throw new IllegalArgumentException("No enough to execute this operation");
|
||||
}
|
||||
|
||||
// Update map status ...
|
||||
mindMap.setPublic(Boolean.parseBoolean(value));
|
||||
updateMindmap(true, mindMap, user);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/{id}")
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateMap(@PathVariable int id) throws IOException, WiseMappingException {
|
||||
public void updateMap( @PathVariable int id) throws IOException, WiseMappingException {
|
||||
final User user = Utils.getUser();
|
||||
final MindMap mindmap = mindmapService.getMindmapById(id);
|
||||
mindmapService.removeMindmap(mindmap, user);
|
||||
@@ -187,7 +203,7 @@ public class MindmapController extends BaseController {
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"})
|
||||
@ResponseStatus(value = HttpStatus.CREATED)
|
||||
public void copyMap(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
|
||||
// Validate ...
|
||||
// Validate ...
|
||||
final BindingResult result = new BeanPropertyBindingResult(restMindmap, "");
|
||||
new MapInfoValidator(mindmapService).validate(restMindmap.getDelegated(), result);
|
||||
if (result.hasErrors()) {
|
||||
|
@@ -70,6 +70,15 @@ public class RestMindmapInfo {
|
||||
return mindmap.getCreator();
|
||||
}
|
||||
|
||||
public String getOwnerEmail() {
|
||||
return mindmap.getOwner().getEmail();
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
final User owner = mindmap.getOwner();
|
||||
return owner.getUsername();
|
||||
}
|
||||
|
||||
public String getLastModifierUser() {
|
||||
return mindmap.getLastModifierUser();
|
||||
}
|
||||
@@ -109,6 +118,12 @@ public class RestMindmapInfo {
|
||||
public void setLastModifierUser(String value) {
|
||||
}
|
||||
|
||||
public void setOwnerEmail(String value) {
|
||||
}
|
||||
|
||||
public void setOwner(String value) {
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public MindMap getDelegated() {
|
||||
return this.mindmap;
|
||||
|
Reference in New Issue
Block a user