mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
api rest
This commit is contained in:
parent
9edea47dbd
commit
b4c69133f5
@ -76,9 +76,10 @@ public class LabelController extends BaseController {
|
||||
return new RestLabelList(all);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/labels/{id}/maps", consumes = {"text/plain"})
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/labels/maps", consumes = {"application/json"})
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void linkToMindMaps(@PathVariable int id, @RequestBody String ids) throws WiseMappingException {
|
||||
public void linkToMindMaps(@RequestBody RestLabel restLabel, @RequestParam(required = true) String ids) throws WiseMappingException {
|
||||
int id = restLabel.getId();
|
||||
final Label label = labelService.getLabelById(id);
|
||||
if (label == null) {
|
||||
throw new LabelCouldNotFoundException("Label could not be found. Id: " + id);
|
||||
|
@ -21,6 +21,7 @@ package com.wisemapping.rest.model;
|
||||
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.Label;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
@ -35,6 +36,8 @@ import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@XmlRootElement(name = "map")
|
||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||
@ -93,6 +96,13 @@ public class RestMindmapInfo {
|
||||
public void setTitle(String title) {
|
||||
mindmap.setTitle(title);
|
||||
}
|
||||
public Set<RestLabel> getLabels() {
|
||||
final Set<RestLabel> result = new HashSet<>();
|
||||
for (Label label : mindmap.getLabels()) {
|
||||
result.add(new RestLabel(label));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return mindmap.getId();
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
<set name = "labels"
|
||||
table="R_LABEL_MINDMAP"
|
||||
cascade="all,delete-orphan,save-update">
|
||||
cascade="all">
|
||||
<key column="mindmap_id" not-null="true"/>
|
||||
<many-to-many column="label_id" class="com.wisemapping.model.Label"/>
|
||||
</set>
|
||||
|
Loading…
Reference in New Issue
Block a user