public Element fullPath(ManagedObjectReference obj) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg, FinderException {
  List<ObjectContent> set=ancestrySet(obj);
  Map<MoRef,Element> childToParent=new HashMap<>();
  for (  ObjectContent cont : set) {
    MoRef key=new MoRef(cont.getObj());
    ManagedObjectReference parentRef=getParent(cont);
    Element parent;
    if (parentRef != null) {
      parent=Element.make(parentRef,getName(cont));
    }
 else {
      parent=Element.make(cont.getObj(),getName(cont));
    }
    childToParent.put(key,parent);
  }
  MoRef next=new MoRef(obj);
  List<String> path=new ArrayList<>();
  while (true) {
    Element parent=childToParent.get(next);
    path.add(parent.path);
    if (next.equals(new MoRef(parent.object))) {
      break;
    }
    next=new MoRef(parent.object);
  }
  Collections.reverse(path);
  StringBuilder sb=new StringBuilder();
  for (  String s : path) {
    sb.append('/');
    sb.append(s);
  }
  return Element.make(obj,sb.toString());
}

public Element fullPath ( ManagedObjectReference obj ) throws InvalidPropertyFaultMsg , RuntimeFaultFaultMsg , FinderException { List < ObjectContent > set = ancestrySet ( obj ) ; Map < MoRef , Element > childToParent = new HashMap < > ( ) ; for ( ObjectContent cont : set ) { MoRef key = new MoRef ( cont . getObj ( ) ) ; ManagedObjectReference parentRef = getParent ( cont ) ; Element parent ; if ( parentRef != null ) { parent = Element . make ( parentRef , getName ( cont ) ) ; } else { parent = Element . make ( cont . getObj ( ) , getName ( cont ) ) ; } childToParent . put ( key , parent ) ; } MoRef next = new MoRef ( obj ) ; List < String > path = new ArrayList < > ( ) ; while ( true ) { Element parent = childToParent . get ( next ) ; path . add ( parent . path ) ; if ( next . equals ( new MoRef ( parent . object ) ) ) { break ; } next = new MoRef ( parent . object ) ; } Collections . reverse ( path ) ; StringBuilder sb = new StringBuilder ( ) ; for ( String s : path ) { sb . append ( '/' ) ; sb . append ( s ) ; } return Element . make ( obj , sb . toString ( ) ) ; }
walks up the tree until a root object is found .
