Fixing code

This commit is contained in:
Luca Frosini 2023-02-06 18:52:08 +01:00
parent affa4a4f7b
commit ba30725032
5 changed files with 15 additions and 14 deletions

View File

@ -6,12 +6,12 @@ package org.gcube.informationsystem.discovery;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
@ -29,8 +29,8 @@ public class Discovery<E extends Element> {
protected final Class<E> root;
protected final Set<Package> packages;
protected final Set<Class<E>> discoveredElement;
protected final Set<DiscoveredElementAction<Element>> discoveredElementActions;
protected final List<Class<E>> discoveredElement;
protected final List<DiscoveredElementAction<Element>> discoveredElementActions;
protected boolean discovered;
@ -38,12 +38,12 @@ public class Discovery<E extends Element> {
this.root = root;
this.packages = new HashSet<>();
this.discovered = false;
this.discoveredElement = new TreeSet<>();
this.discoveredElementActions = new TreeSet<>();
this.discoveredElement = new ArrayList<>();
this.discoveredElementActions = new ArrayList<>();
add(root);
}
public Set<Class<E>> getDiscoveredElement() {
public List<Class<E>> getDiscoveredElement() {
return discoveredElement;
}

View File

@ -25,7 +25,7 @@ public class Node<T> implements Comparable<Node<T>> {
return tree;
}
private void setTree(Tree<T> tree) {
void setTree(Tree<T> tree) {
this.tree = tree;
}
@ -77,7 +77,7 @@ public class Node<T> implements Comparable<Node<T>> {
for (int i = 0; i < level; ++i) {
stringBuffer.append(Node.INDENTATION);
}
stringBuffer.append(tree.getNodeInformation().getIdentifier(t));
stringBuffer.append(tree.getNodeInformation().getIdentifier(node.getNodeElement()));
stringBuffer.append("\n");
}

View File

@ -19,8 +19,10 @@ public class Tree<T> {
this.allowMultipleInheritance = true;
this.ni = ni;
this.locate = new HashMap<>();
this.root = addNode(t);
this.root = new Node<>(t);
this.root.setTree(this);
String identifier = ni.getIdentifier(t);
this.locate.put(identifier, root);
}
public void setAllowMultipleInheritance(boolean allowMultipleInheritance) {
@ -39,6 +41,7 @@ public class Tree<T> {
}
Node<T> node = new Node<>(t);
node.setTree(this);
Set<String> parentIdentifiers = ni.getParentIdentifiers(root.getNodeElement(), t);
for(String parentIdentifier : parentIdentifiers) {

View File

@ -9,11 +9,9 @@
</appender>
<logger name="org.gcube" level="TRACE" />
<logger name="org.gcube" level="WARN" />
<logger name="org.gcube.informationsystem" level="TRACE" />
<logger name="org.gcube.informationsystem.types" level="TRACE" />
<logger name="org.gcube.informationsystem.resourceregistry.dbinitialization" level="INFO" />
<logger name="org.gcube.informationsystem.utils.discovery" level="ERROR" />
<logger name="org.gcube.informationsystem.resourceregistry.dbinitialization" level="WARN" />
<root level="WARN">
<appender-ref ref="STDOUT" />