ordering labels on mindmap retreive

This commit is contained in:
Ezequiel Bergamaschi 2014-02-02 01:26:28 -03:00 committed by Ezequiel Bergamaschi
parent a4aa1c5436
commit 632a9a6e00
3 changed files with 5 additions and 3 deletions

View File

@ -29,6 +29,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
public class Mindmap { public class Mindmap {
@ -44,7 +45,7 @@ public class Mindmap {
private User lastEditor; private User lastEditor;
private Set<Collaboration> collaborations = new HashSet<Collaboration>(); private Set<Collaboration> collaborations = new HashSet<Collaboration>();
private Set<Label> labels = new HashSet<Label>(); private Set<Label> labels = new LinkedHashSet<>();
private User creator; private User creator;
private String tags; private String tags;

View File

@ -37,6 +37,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
@XmlRootElement(name = "map") @XmlRootElement(name = "map")
@ -97,7 +98,7 @@ public class RestMindmapInfo {
mindmap.setTitle(title); mindmap.setTitle(title);
} }
public Set<RestLabel> getLabels() { public Set<RestLabel> getLabels() {
final Set<RestLabel> result = new HashSet<>(); final Set<RestLabel> result = new LinkedHashSet<>();
for (Label label : mindmap.getLabels()) { for (Label label : mindmap.getLabels()) {
result.add(new RestLabel(label)); result.add(new RestLabel(label));
} }

View File

@ -27,7 +27,7 @@
</set> </set>
<set name = "labels" <set name = "labels"
table="R_LABEL_MINDMAP"> table="R_LABEL_MINDMAP" order-by="label_id">
<key column="mindmap_id" not-null="true"/> <key column="mindmap_id" not-null="true"/>
<many-to-many column="label_id" class="com.wisemapping.model.Label"/> <many-to-many column="label_id" class="com.wisemapping.model.Label"/>
</set> </set>