Ejemplo n.º 1
0
        public static void RefreshPHTMLContent(CloudBlob webPageBlob, bool skipIfSourcesIntact = false)
        {
            // Refresh only PHTML blobs
            if (webPageBlob.Name.EndsWith(".phtml") == false)
            {
                return;
            }
            InformationSourceCollection sources = webPageBlob.GetBlobInformationSources();

            if (sources == null)
            {
                throw new InvalidDataException("Web page to refresh is missing information sources: " + webPageBlob.Name);
            }
            if (skipIfSourcesIntact)
            {
                bool sourcesIntact = sources.HasAnySourceChanged() == false;
                if (sourcesIntact)
                {
                    return;
                }
            }
            InformationSource templateSource = sources.CollectionContent.First(src => src.IsWebTemplateSource);

            if (templateSource == null)
            {
                throw new InvalidDataException("Web page to refresh is missing template source: " + webPageBlob.Name);
            }
            CloudBlob templateBlob =
                StorageSupport.CurrActiveContainer.GetBlockBlobReference(templateSource.SourceLocation);

            RenderTemplateWithContentToBlob(templateBlob, webPageBlob);
        }
Ejemplo n.º 2
0
        private static InformationSource GetMissingRootAsNewSource(ContentItem root, string masterLocation, out bool foundExistingSource)
        {
            InformationSource  source            = root.Source ?? InformationSource.CreateDefault();
            IInformationObject informationObject = (IInformationObject)root.RootObject;

            if (informationObject == null)
            {
                foundExistingSource = false;
                return(null);
            }
            string sourceContentLocation = informationObject.GetLocationRelativeToContentRoot(masterLocation,
                                                                                              root.RootName);
            CloudBlob          blob;
            IInformationObject existingObject = StorageSupport.RetrieveInformationWithBlob(sourceContentLocation,
                                                                                           root.RootType, out blob);

            if (existingObject == null)
            {
                informationObject.SetLocationRelativeToContentRoot(masterLocation, root.RootName);
                blob = StorageSupport.StoreInformation(informationObject);
                foundExistingSource = false;
            }
            else
            {
                informationObject   = existingObject;
                root.RootObject     = existingObject;
                foundExistingSource = true;
            }
            source.SetBlobValuesToSource(blob);
            source.SetInformationObjectValuesToSource(root.RootName, informationObject.GetType().FullName);
            source.IsDynamic = root.IsDynamicRoot;
            return(source);
        }
        public static InformationSource[] Create(InformationSource informationSource)
        {
            var informationSources = new InformationSource[1];

            informationSources[0] = informationSource;
            return(informationSources);
        }
Ejemplo n.º 4
0
 private void PrepareManifestManager(DirectoryPath targetPath, InformationSource infoSource)
 {
     if (!string.IsNullOrWhiteSpace(targetPath.FullPath) && GenerateManifest)
     {
         ManifestManager = new ManifestManager(ProjectFilePath, targetPath.FullPath, infoSource);
     }
 }
Ejemplo n.º 5
0
        private static InformationSourceCollection CreateDefaultSources(CloudBlob template)
        {
            InformationSourceCollection sources = InformationSourceCollection.CreateDefault();
            InformationSource           source  = InformationSource.CreateDefault();

            source.SetBlobValuesToSource(template);
            sources.CollectionContent.Add(source);
            return(sources);
        }
 public InformationSourceDetailWindow (InformationSource inf_source, EventHandler OnSave, Gtk.Window parent) : base(Gtk.WindowType.Toplevel)
 {
     this.Build ();
     this.Modal = true;
     this.OnSaved = OnSave;
     this.TransientFor = parent;
     show.InformationSource = inf_source;
     show.IsEditable = false;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Generates an app manifest without publishing the whole application
        /// </summary>
        /// <param name="publishDirectoryPath">Directory to publish to</param>
        /// <param name="source">Metadata source to use in generating the manifest</param>
        public void GenerateManifest(DirectoryPath publishDirectoryPath,
                                     InformationSource source = InformationSource.Both)
        {
            var mgr = new ManifestManager(new FilePath(ProjectFilePath).MakeAbsolute(Environment).FullPath,
                                          publishDirectoryPath.MakeAbsolute(Environment).FullPath,
                                          source);

            mgr.DeployManifest(mgr.CreateAppManifest());
        }
        public static InformationSource Create(string provider)
        {
            var informationSource = new InformationSource
            {
                rateSource = InformationProviderHelper.Create(provider)
            };

            return(informationSource);
        }
        public static InformationSource Create(string provider, string rateSource, string rateSourcePage)
        {
            var informationSource = new InformationSource
            {
                rateSource     = InformationProviderHelper.Create(provider),
                rateSourcePage = RateSourcePageHelper.Create(rateSourcePage)
            };

            return(informationSource);
        }
        public static InformationSource[] CreateArray(string provider)
        {
            var informationSource = new InformationSource
            {
                rateSource = InformationProviderHelper.Create(provider)
            };
            var result = new[] { informationSource };

            return(result);
        }
Ejemplo n.º 11
0
        private static ContentItem GetRootFromSource(InformationSource source)
        {
            ContentItem contentItem = new ContentItem
            {
                Source        = source,
                RootName      = source.SourceName,
                RootType      = source.SourceInformationObjectType,
                IsDynamicRoot = source.IsDynamic
            };

            return(contentItem);
        }
Ejemplo n.º 12
0
 public ManifestManager(string projectFilePath, string applicationManifestFilePath, InformationSource source = InformationSource.AppManifest) : base(projectFilePath)
 {
     Source = source;
     if (applicationManifestFilePath.EndsWith(".application"))
     {
         ApplicationManifestLocation = applicationManifestFilePath;
     }
     else
     {
         var di = new DirectoryInfo(applicationManifestFilePath);
         ApplicationManifestLocation = di.GetFiles("*.application").First().FullName;
     }
 }
        /// <summary>
        /// A helper to extract properties from a namedvalueset..
        /// </summary>
        /// <param name="propertyCollection">The collection of properties.</param>
        public static InformationSource[] ExtractInformationSources(NamedValueSet propertyCollection)
        {
            InformationSource[] informationSource = null;
            var dictionaryKeys = propertyCollection.ToDictionary();

            if (dictionaryKeys.ContainsKey("InformationSource"))
            {
                var result = propertyCollection.Get("InformationSource").AsValue <string>();
                informationSource    = new InformationSource[1];
                informationSource[0] = InformationSourceHelper.Create(result);
            }
            return(informationSource);
        }
        private static void RemoveFiles(InformationSource informationSource, IEnumerable <int> filesToRemove, CmsContext context)
        {
            if (filesToRemove == null)
            {
                return;
            }
            var contextFilesToRemove = context.Files.Where(x => filesToRemove.Contains(x.Id));

            foreach (var fileToRemove in contextFilesToRemove)
            {
                if (informationSource.Files.Contains(fileToRemove))
                {
                    informationSource.Files.Remove(fileToRemove);
                }
            }
        }
        private static void AddFiles(InformationSource informationSource, IEnumerable <int> filesToAdd, CmsContext context)
        {
            if (filesToAdd == null)
            {
                return;
            }
            var contextFilesToAdd = context.Files.Where(x => filesToAdd.Contains(x.Id));

            if (!contextFilesToAdd.Any())
            {
                return;
            }
            foreach (var fileToAdd in contextFilesToAdd)
            {
                if (!informationSource.Files.Contains(fileToAdd))
                {
                    informationSource.Files.Add(fileToAdd);
                }
            }
        }
Ejemplo n.º 16
0
        public PublishManager(string projectFilePath, InformationSource manifestInformationSource)
            : base(projectFilePath)
        {
            switch (manifestInformationSource)
            {
            case InformationSource.AssemblyInfo:
            case InformationSource.AppManifest:
            case InformationSource.Both:
                GenerateManifest = true;
                break;

            case InformationSource.None:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(manifestInformationSource), manifestInformationSource,
                                                      null);
            }
            ManifestInformationSource = manifestInformationSource;
        }
        public static InformationSource Copy(InformationSource baseSource)
        {
            InformationSource result = null;

            if (baseSource != null)
            {
                result = new InformationSource();
                if (baseSource.rateSource != null)
                {
                    result.rateSource = InformationProviderHelper.Create(baseSource.rateSource.Value);
                }
                if (baseSource.rateSourcePage != null)
                {
                    result.rateSourcePage = RateSourcePageHelper.Create(baseSource.rateSourcePage.Value);
                }
                if (baseSource.rateSourcePageHeading != null)
                {
                    result.rateSourcePageHeading = baseSource.rateSourcePageHeading;
                }
            }
            return(result);
        }
Ejemplo n.º 18
0
 private ManifestManager(string projectFilePath, InformationSource source = InformationSource.AssemblyInfo) : base(projectFilePath)
 {
     Source = source;
 }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicationStatement;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (InformationSource != null)
                {
                    dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopy();
                }
                if (DateAssertedElement != null)
                {
                    dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatus>)StatusElement.DeepCopy();
                }
                if (WasNotTakenElement != null)
                {
                    dest.WasNotTakenElement = (Hl7.Fhir.Model.FhirBoolean)WasNotTakenElement.DeepCopy();
                }
                if (ReasonNotTaken != null)
                {
                    dest.ReasonNotTaken = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonNotTaken.DeepCopy());
                }
                if (ReasonForUse != null)
                {
                    dest.ReasonForUse = (Hl7.Fhir.Model.Element)ReasonForUse.DeepCopy();
                }
                if (Effective != null)
                {
                    dest.Effective = (Hl7.Fhir.Model.Element)Effective.DeepCopy();
                }
                if (NoteElement != null)
                {
                    dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy();
                }
                if (SupportingInformation != null)
                {
                    dest.SupportingInformation = new List <Hl7.Fhir.Model.ResourceReference>(SupportingInformation.DeepCopy());
                }
                if (Medication != null)
                {
                    dest.Medication = (Hl7.Fhir.Model.Element)Medication.DeepCopy();
                }
                if (Dosage != null)
                {
                    dest.Dosage = new List <Hl7.Fhir.Model.MedicationStatement.DosageComponent>(Dosage.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicationStatement;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (BasedOn != null)
            {
                dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy());
            }
            if (PartOf != null)
            {
                dest.PartOf = new List <Hl7.Fhir.Model.ResourceReference>(PartOf.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationStatement.MedicationStatusCodes>)StatusElement.DeepCopy();
            }
            if (StatusReason != null)
            {
                dest.StatusReason = new List <Hl7.Fhir.Model.CodeableConcept>(StatusReason.DeepCopy());
            }
            if (Category != null)
            {
                dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopy();
            }
            if (Medication != null)
            {
                dest.Medication = (Hl7.Fhir.Model.Element)Medication.DeepCopy();
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (Context != null)
            {
                dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopy();
            }
            if (Effective != null)
            {
                dest.Effective = (Hl7.Fhir.Model.Element)Effective.DeepCopy();
            }
            if (DateAssertedElement != null)
            {
                dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopy();
            }
            if (InformationSource != null)
            {
                dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopy();
            }
            if (DerivedFrom != null)
            {
                dest.DerivedFrom = new List <Hl7.Fhir.Model.ResourceReference>(DerivedFrom.DeepCopy());
            }
            if (ReasonCode != null)
            {
                dest.ReasonCode = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonCode.DeepCopy());
            }
            if (ReasonReference != null)
            {
                dest.ReasonReference = new List <Hl7.Fhir.Model.ResourceReference>(ReasonReference.DeepCopy());
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            if (Dosage != null)
            {
                dest.Dosage = new List <Hl7.Fhir.Model.Dosage>(Dosage.DeepCopy());
            }
            return(dest);
        }
Ejemplo n.º 21
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as DeviceUseStatement;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (BasedOn != null)
            {
                dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus>)StatusElement.DeepCopy();
            }
            if (Category != null)
            {
                dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy());
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (DerivedFrom != null)
            {
                dest.DerivedFrom = new List <Hl7.Fhir.Model.ResourceReference>(DerivedFrom.DeepCopy());
            }
            if (Context != null)
            {
                dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopy();
            }
            if (Timing != null)
            {
                dest.Timing = (Hl7.Fhir.Model.Element)Timing.DeepCopy();
            }
            if (DateAssertedElement != null)
            {
                dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopy();
            }
            if (UsageStatus != null)
            {
                dest.UsageStatus = (Hl7.Fhir.Model.CodeableConcept)UsageStatus.DeepCopy();
            }
            if (UsageReason != null)
            {
                dest.UsageReason = new List <Hl7.Fhir.Model.CodeableConcept>(UsageReason.DeepCopy());
            }
            if (InformationSource != null)
            {
                dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopy();
            }
            if (Device != null)
            {
                dest.Device = (Hl7.Fhir.Model.CodeableReference)Device.DeepCopy();
            }
            if (Reason != null)
            {
                dest.Reason = new List <Hl7.Fhir.Model.CodeableReference>(Reason.DeepCopy());
            }
            if (BodySite != null)
            {
                dest.BodySite = (Hl7.Fhir.Model.CodeableReference)BodySite.DeepCopy();
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            return(dest);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Generates a ClickTwice manifest for the application at the given project path
 /// </summary>
 /// <param name="projectFilePath">Path to the project file</param>
 /// <param name="source">Not currently used.</param>
 /// <returns>A publisher for the generated manifest</returns>
 public ManifestPublisher GenerateManifest(string projectFilePath,
                                           InformationSource source = InformationSource.Both)
 {
     return(new ManifestPublisher(this, projectFilePath));
 }
Ejemplo n.º 23
0
 public DirectPublisher(string projectFilePath, InformationSource source = InformationSource.Both) : base(projectFilePath)
 {
     _msBuildPath = MSBuildResolver.GetMSBuildPath();
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Publish the generated manifest at the given path
        /// </summary>
        /// <param name="outputPath">Path to the output file</param>
        /// <param name="source">Used to control the sourcing of app metadata</param>
        public void Publish(string outputPath, InformationSource source = InformationSource.Both)
        {
            var mgr = new ManifestManager(ProjectFilePath.FullPath, outputPath, source);

            mgr.DeployManifest(mgr.CreateAppManifest());
        }
 public static void ManageFiles(this InformationSource informationSource, IEnumerable <int> filesToRemove,
                                IEnumerable <int> filesToAdd, CmsContext context)
 {
     RemoveFiles(informationSource, filesToRemove, context);
     AddFiles(informationSource, filesToAdd, context);
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((BasedOn != null) && (BasedOn.Count != 0))
            {
                writer.WritePropertyName("basedOn");
                writer.WriteStartArray();

                foreach (Reference valBasedOn in BasedOn)
                {
                    valBasedOn.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((PartOf != null) && (PartOf.Count != 0))
            {
                writer.WritePropertyName("partOf");
                writer.WriteStartArray();

                foreach (Reference valPartOf in PartOf)
                {
                    valPartOf.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

            if (_Status != null)
            {
                writer.WritePropertyName("_status");
                _Status.SerializeJson(writer, options);
            }

            if ((StatusReason != null) && (StatusReason.Count != 0))
            {
                writer.WritePropertyName("statusReason");
                writer.WriteStartArray();

                foreach (CodeableConcept valStatusReason in StatusReason)
                {
                    valStatusReason.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Category != null)
            {
                writer.WritePropertyName("category");
                Category.SerializeJson(writer, options);
            }

            if (MedicationCodeableConcept != null)
            {
                writer.WritePropertyName("medicationCodeableConcept");
                MedicationCodeableConcept.SerializeJson(writer, options);
            }

            if (MedicationReference != null)
            {
                writer.WritePropertyName("medicationReference");
                MedicationReference.SerializeJson(writer, options);
            }

            if (Subject != null)
            {
                writer.WritePropertyName("subject");
                Subject.SerializeJson(writer, options);
            }

            if (Context != null)
            {
                writer.WritePropertyName("context");
                Context.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(EffectiveDateTime))
            {
                writer.WriteString("effectiveDateTime", (string)EffectiveDateTime !);
            }

            if (_EffectiveDateTime != null)
            {
                writer.WritePropertyName("_effectiveDateTime");
                _EffectiveDateTime.SerializeJson(writer, options);
            }

            if (EffectivePeriod != null)
            {
                writer.WritePropertyName("effectivePeriod");
                EffectivePeriod.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(DateAsserted))
            {
                writer.WriteString("dateAsserted", (string)DateAsserted !);
            }

            if (_DateAsserted != null)
            {
                writer.WritePropertyName("_dateAsserted");
                _DateAsserted.SerializeJson(writer, options);
            }

            if (InformationSource != null)
            {
                writer.WritePropertyName("informationSource");
                InformationSource.SerializeJson(writer, options);
            }

            if ((DerivedFrom != null) && (DerivedFrom.Count != 0))
            {
                writer.WritePropertyName("derivedFrom");
                writer.WriteStartArray();

                foreach (Reference valDerivedFrom in DerivedFrom)
                {
                    valDerivedFrom.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ReasonCode != null) && (ReasonCode.Count != 0))
            {
                writer.WritePropertyName("reasonCode");
                writer.WriteStartArray();

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ReasonReference != null) && (ReasonReference.Count != 0))
            {
                writer.WritePropertyName("reasonReference");
                writer.WriteStartArray();

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Note != null) && (Note.Count != 0))
            {
                writer.WritePropertyName("note");
                writer.WriteStartArray();

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Dosage != null) && (Dosage.Count != 0))
            {
                writer.WritePropertyName("dosage");
                writer.WriteStartArray();

                foreach (Dosage valDosage in Dosage)
                {
                    valDosage.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Ejemplo n.º 27
0
        public static void RenderTemplateWithContentToBlob(CloudBlob template, CloudBlob renderTarget, InformationSource setAsDefaultSource = null)
        {
            InformationSourceCollection sources = renderTarget.GetBlobInformationSources();

            if (sources == null)
            {
                sources = CreateDefaultSources(template);
            }
            if (setAsDefaultSource != null)
            {
                sources.SetDefaultSource(setAsDefaultSource);
            }
            string             templateContent = template.DownloadText();
            List <ContentItem> existingRoots   = GetExistingRoots(sources);
            string             renderResult    = RenderTemplateWithContentRoots(templateContent, existingRoots);
            bool rerenderRequired = UpdateMismatchedRootsToSources(sources, existingRoots, renderTarget);

            renderTarget.SetBlobInformationSources(sources);
            renderTarget.UploadBlobText(renderResult, StorageSupport.InformationType_RenderedWebPage);
            if (rerenderRequired)
            {
                RenderTemplateWithContentToBlob(template, renderTarget);
            }
            else
            {
                sources.SubscribeTargetToSourceChanges(renderTarget);
            }
        }