retrieveList api for labels

This commit is contained in:
Ezequiel Bergamaschi
2014-01-26 18:21:01 -03:00
committed by Ezequiel Bergamaschi
parent 0c43bb4ad3
commit 306a2a2ada
7 changed files with 73 additions and 1 deletions

View File

@@ -3,7 +3,10 @@ package com.wisemapping.rest.model;
import com.wisemapping.model.Label;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@@ -18,6 +21,7 @@ import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONL
isGetterVisibility = NONE,
getterVisibility = PUBLIC_ONLY
)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RestLabel {
@JsonIgnore
@@ -32,6 +36,15 @@ public class RestLabel {
this.label = label;
}
public void setParent(@NotNull final Label parent) {
this.label.setParent(parent);
}
@Nullable
public Label getParent() {
return this.label.getParent();
}
public String getTitle() {
return this.label.getTitle();
}

View File

@@ -0,0 +1,26 @@
package com.wisemapping.rest.model;
import com.wisemapping.model.Label;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlElement;
import java.util.ArrayList;
import java.util.List;
public class RestLabelList {
@NotNull private final List<RestLabel> restLabels;
public RestLabelList(@NotNull final List<Label> labels) {
this.restLabels = new ArrayList<>(labels.size());
for (Label label : labels) {
this.restLabels.add(new RestLabel(label));
}
}
@NotNull @XmlElement(name = "label")
public List<RestLabel> getLabels() {
return restLabels;
}
}