X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fstructure%2Ftree%2FTreeSRegistry.java;h=10125678c4fb5181a402dc0e210247eae192e80a;hb=e860e15db1fd6dc797205de434c75a22f6e5f9a4;hp=e38f31e9d3337595006b2b169bdf42632fa33278;hpb=90b484c35a563691c0923011bb43e2a881db2d5e;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.core/src/main/java/org/argeo/slc/core/structure/tree/TreeSRegistry.java b/org.argeo.slc.core/src/main/java/org/argeo/slc/core/structure/tree/TreeSRegistry.java index e38f31e9d..10125678c 100644 --- a/org.argeo.slc.core/src/main/java/org/argeo/slc/core/structure/tree/TreeSRegistry.java +++ b/org.argeo.slc.core/src/main/java/org/argeo/slc/core/structure/tree/TreeSRegistry.java @@ -8,13 +8,12 @@ import java.util.Vector; import org.argeo.slc.core.UnsupportedException; import org.argeo.slc.core.structure.SimpleSElement; import org.argeo.slc.core.structure.StructureElement; -import org.argeo.slc.core.structure.StructurePath; import org.argeo.slc.core.structure.StructureRegistry; /** Tree based implementation of a structure registry. */ -public class TreeSRegistry implements StructureRegistry { +public class TreeSRegistry implements StructureRegistry { public final static String STATUS_ACTIVE = "STATUS_ACTIVE"; - + /** For ORM */ private Long tid; private String status; @@ -22,21 +21,21 @@ public class TreeSRegistry implements StructureRegistry { private String mode = StructureRegistry.ALL; - private List activePaths; + private List activePaths; - public StructureElement getElement(StructurePath path) { - return elements.get(path); + public T getElement(TreeSPath path) { + return (T)elements.get(path); } public List listElements() { return new Vector(elements.values()); } - public List listPaths() { - return new Vector(elements.keySet()); + public List listPaths() { + return new Vector(elements.keySet()); } - public void register(StructurePath path, StructureElement element) { + public void register(TreeSPath path, StructureElement element) { final SimpleSElement simpleSElement; if (element instanceof SimpleSElement) { simpleSElement = (SimpleSElement) element; @@ -44,10 +43,10 @@ public class TreeSRegistry implements StructureRegistry { simpleSElement = new SimpleSElement(element.getLabel()); } - if (!(path instanceof TreeSPath)) - throw new UnsupportedException("path", path); + if (path == null) + throw new UnsupportedException("Path cannot be null."); - elements.put((TreeSPath) path, simpleSElement); + elements.put(path, simpleSElement); } @@ -59,15 +58,14 @@ public class TreeSRegistry implements StructureRegistry { this.mode = mode; } - public List getActivePaths() { + public List getActivePaths() { return activePaths; } - public void setActivePaths(List activePaths) { + public void setActivePaths(List activePaths) { this.activePaths = activePaths; } - public String getStatus() { return status; }