41 lines
955 B
Java
41 lines
955 B
Java
package org.gcube.informationsystem.knowledge;
|
|
|
|
import java.util.LinkedHashSet;
|
|
import java.util.Set;
|
|
|
|
import org.gcube.informationsystem.base.reference.AccessType;
|
|
import org.gcube.informationsystem.tree.NodeInformation;
|
|
import org.gcube.informationsystem.types.TypeMapper;
|
|
import org.gcube.informationsystem.types.reference.Type;
|
|
|
|
/**
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
*/
|
|
public class TypeInformation implements NodeInformation<Type> {
|
|
|
|
@Override
|
|
public String getIdentifier(Type type) {
|
|
return type.getName();
|
|
}
|
|
|
|
@Override
|
|
public Set<String> getParentIdentifiers(Type root, Type type) {
|
|
if(type.getName().compareTo(root.getName())==0) {
|
|
return new LinkedHashSet<>();
|
|
}
|
|
|
|
return type.getExtendedTypes();
|
|
}
|
|
|
|
@Override
|
|
public AccessType getAccessType(Type type) {
|
|
return type.getAccessType();
|
|
}
|
|
|
|
@Override
|
|
public Type getRoot(AccessType accessType) {
|
|
return TypeMapper.createTypeDefinition(accessType.getTypeClass());
|
|
}
|
|
|
|
}
|