예제 #1
0
        public Profile.ProfileStructureComponent Expand(Profile.ProfileStructureComponent differential)
        {
            var baseStructure = _loader.LocateBaseStructure(differential.TypeElement);

            if (baseStructure == null)
            {
                throw Error.InvalidOperation("Could not locate the base profile for type {0}", differential.TypeElement.ToString());
            }

            var baseUri = StructureLoader.BuildBaseStructureUri(differential.TypeElement).ToString();

            var snapshot = (Profile.ProfileStructureComponent)baseStructure.DeepCopy();

            snapshot.SetStructureForm(StructureForm.Snapshot);
            snapshot.SetStructureBaseUri(baseUri.ToString());

            mergeStructure(snapshot, differential);

            var fullDifferential = new DifferentialTreeConstructor(differential).MakeTree();

            var snapNav = new ElementNavigator(snapshot);

            snapNav.MoveToFirstChild();

            var diffNav = new ElementNavigator(fullDifferential);

            diffNav.MoveToFirstChild();

            merge(snapNav, diffNav);

            //TODO: Merge search params?

            snapNav.CommitChanges();
            return(snapshot);
        }
 private static ElementNavigator resolveStructureReference(StructureLoader loader, Code code)
 {
     var result = loader.LocateBaseStructure(code);
     return result != null ? new ElementNavigator(result) : null;
 }
        private static ElementNavigator resolveStructureReference(StructureLoader loader, Code code)
        {
            var result = loader.LocateBaseStructure(code);

            return(result != null ? new ElementNavigator(result) : null);
        }