Esempio n. 1
0
 private void stashDifferentialStructure(Profile differential, Profile.ProfileStructureComponent structure)
 {
     structure.Name += "-differential";
     structure.SetStructureForm(StructureForm.Differential);
     structure.SetStructureBaseUri(StructureLoader.BuildBaseStructureUri(structure.TypeElement).ToString());
     structure.Publish = false;
 }
Esempio n. 2
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);
        }