Esempio n. 1
0
        internal XElement ToXElement()
        {
            XElement sampleElement = new XElement(NamespaceHelper.GetXName("Sample"));

            //// Export attributes of all implemented interfaces
            sampleElement.ImportISignableItemWithName(this);
            sampleElement.ImportISourceDataLocation(this);

            //// Export all other attributes
            sampleElement.AddAttribute("sampleID", this.SampleId);
            sampleElement.AddAttributeIfValueNotNullOrEmpty("barcode", this.Barcode);
            sampleElement.AddAttributeIfValueNotNullOrEmpty("comment", this.Comment);
            sampleElement.AddAttributeIfNotNull("derived", this.Derived);
            sampleElement.AddAttributeIfNotNull("containerType", this.ContainerType);
            sampleElement.AddAttributeIfValueNotNullOrEmpty("containerID", this.ContainerId);
            sampleElement.AddAttributeIfValueNotNullOrEmpty("locationInContainer", this.LocationInContainer);

            //// Export the child elements of the current object

            //// Do not export an empty TagSet
            if (this.TagSet?.Tags.Count > 0)
            {
                sampleElement.Add(this.TagSet.ToXElement());
            }

            this.Categories.ForEach(c => sampleElement.Add(c.ToXElement()));

            return(sampleElement);
        }
Esempio n. 2
0
        internal XElement ToXElement()
        {
            XElement methodElement = new XElement(NamespaceHelper.GetXName("Method"));

            //// Export attributes of all implemented interfaces
            methodElement.ImportISignableItem(this);

            //// Export all other attributes
            methodElement.AddAttributeIfValueNotNullOrEmpty("name", this.Name);

            //// Export the child elements of the current object
            if (this.Author != null)
            {
                methodElement.Add(this.Author.ToXElement());
            }

            if (this.Device != null)
            {
                methodElement.Add(this.Device.ToXElement());
            }

            if (this.Software != null)
            {
                methodElement.Add(this.Software.ToXElement());
            }

            if (this.Categories?.Count > 0)
            {
                this.Categories.ForEach(c => methodElement.Add(c.ToXElement()));
            }

            return(methodElement);
        }
Esempio n. 3
0
        internal XElement ToXElement()
        {
            XElement tagElement = new XElement(NamespaceHelper.GetXName("Tag"));

            // Export all attributes
            tagElement.AddAttribute("name", this.Name);
            tagElement.AddAttributeIfValueNotNullOrEmpty("value", this.Value);

            return(tagElement);
        }
Esempio n. 4
0
        internal XElement ToXElement()
        {
            XElement extensionElement = new XElement(NamespaceHelper.GetXName("Extension"));

            //// Export all attributes
            extensionElement.AddAttribute("uri", this.Uri.OriginalString);
            extensionElement.AddAttribute("name", this.Name);
            extensionElement.AddAttributeIfValueNotNullOrEmpty("sha256", this.Sha256);

            return(extensionElement);
        }
Esempio n. 5
0
        internal XElement ToXElement()
        {
            XElement experimentStepElement = new XElement(NamespaceHelper.GetXName("ExperimentStep"));

            //// Export attributes of all implemented interfaces
            experimentStepElement.ImportISignableItemWithName(this);
            experimentStepElement.ImportISourceDataLocation(this);

            //// Export all other attributes
            experimentStepElement.AddAttribute("experimentStepID", this.ExperimentStepId);
            experimentStepElement.AddAttributeIfValueNotNullOrEmpty("templateUsed", this.TemplateUsed);
            experimentStepElement.AddAttributeIfValueNotNullOrEmpty("comment", this.Comment);

            //// Export the child elements of the current object
            if (this.TagSet?.Tags.Count > 0)
            {
                experimentStepElement.Add(this.TagSet.ToXElement());
            }

            if (this.Technique != null)
            {
                experimentStepElement.Add(this.Technique.ToXElement());
            }

            if (this.Infrastructure != null)
            {
                experimentStepElement.Add(this.Infrastructure.ToXElement());
            }

            if (this.Method != null)
            {
                experimentStepElement.Add(this.Method.ToXElement());
            }

            this.Results.ForEach(e => experimentStepElement.Add(e.ToXElement()));

            return(experimentStepElement);
        }
Esempio n. 6
0
        internal XElement ToXElement()
        {
            XElement techniqueElement = new XElement(NamespaceHelper.GetXName("Technique"));

            //// Export attributes of all implemented interfaces
            techniqueElement.ImportISignableItemWithName(this);

            //// Export all other attributes
            techniqueElement.AddAttribute("uri", this.Uri.OriginalString);
            techniqueElement.AddAttributeIfValueNotNullOrEmpty("sha256", this.Sha256);

            //// Export the child elements of the current object
            this.Extensions.ForEach(e => techniqueElement.Add(e.ToXElement()));

            return(techniqueElement);
        }
 internal static void ImportISourceDataLocation(this XElement sourceDataLocationElement, ISourceDataLocation sourceDataLocation)
 {
     sourceDataLocationElement.AddAttributeIfValueNotNullOrEmpty("sourceDataLocation", sourceDataLocation.SourceDataLocation);
 }
Esempio n. 8
0
 internal static void ImportISignableItem(this XElement signableItemElement, ISignableItem signableItem)
 {
     signableItemElement.AddAttributeIfValueNotNullOrEmpty("id", signableItem.Id);
 }