Beispiel #1
0
        private List<ImportAttributeSet> GetImportAttributeSets(IEnumerable<XElement> xAttributeSets)
        {
            var importAttributeSets = new List<ImportAttributeSet>();

            // Loop through AttributeSets
            foreach (var attributeSet in xAttributeSets)
            {
                var attributes = new List<ImportAttribute>();
                var titleAttribute = new ImportAttribute();

                foreach (var xElementAttribute in attributeSet.Element("Attributes").Elements("Attribute"))
                {
                    var attribute = new ImportAttribute
                    {
                        StaticName = xElementAttribute.Attribute("StaticName").Value,
                        Type = xElementAttribute.Attribute("Type").Value,
                        AttributeMetaData = GetImportEntities(xElementAttribute.Elements("Entity"), Constants.AssignmentObjectTypeIdFieldProperties)
                    };

                    attributes.Add(attribute);

                    // Set Title Attribute
                    if (Boolean.Parse(xElementAttribute.Attribute("IsTitle").Value))
                        titleAttribute = attribute;
                }

                // Add AttributeSet
                importAttributeSets.Add(new ImportAttributeSet
                {
                    StaticName = attributeSet.Attribute("StaticName").Value,
                    Name = attributeSet.Attribute("Name").Value,
                    Description = attributeSet.Attribute("Description").Value,
                    Attributes = attributes,
                    Scope = attributeSet.Attributes("Scope").Any() ? attributeSet.Attribute("Scope").Value : SexyContent.AttributeSetScope,
                    AlwaysShareConfiguration = AllowSystemChanges && attributeSet.Attributes("AlwaysShareConfiguration").Any() && Boolean.Parse(attributeSet.Attribute("AlwaysShareConfiguration").Value),
                    TitleAttribute = titleAttribute
                });
            }

            return importAttributeSets;
        }
Beispiel #2
0
 /// <summary>
 /// Get an Import-Attribute
 /// </summary>
 public static ImportAttribute StringAttribute(string staticName, string name, string notes, bool? visibleInEditUi, string inputType = null, int? rowCount = null, string defaultValue = null)
 {
     var attribute = new ImportAttribute(staticName, name, AttributeTypeEnum.String, notes, visibleInEditUi, defaultValue);
     attribute.AttributeMetaData.Add(GetStringAttributeMetaData(inputType, rowCount));
     return attribute;
 }
Beispiel #3
0
		private List<ImportAttributeSet> GetImportAttributeSets(IEnumerable<XElement> xAttributeSets)
		{
            var importAttributeSets = new List<ImportAttributeSet>();

			// Loop through AttributeSets
			foreach (var attributeSet in xAttributeSets)
			{
				var attributes = new List<ImportAttribute>();
                var titleAttribute = new ImportAttribute();
			    var attsetElem = attributeSet.Element(XmlConstants.Attributes);
                if (attsetElem != null)
                    foreach (var xElementAttribute in attsetElem.Elements(XmlConstants.Attribute))
                    {
                        var attribute = new ImportAttribute
                        {
                            StaticName = xElementAttribute.Attribute("StaticName").Value,
                            Type = xElementAttribute.Attribute("Type").Value,
                            AttributeMetaData = GetImportEntities(xElementAttribute.Elements(XmlConstants.Entity), Constants.MetadataForField)//.AssignmentObjectTypeIdFieldProperties)
                        };

                        attributes.Add(attribute);

                        // Set Title Attribute
                        if (Parse(xElementAttribute.Attribute("IsTitle").Value))
                            titleAttribute = attribute;
                    }

				// Add AttributeSet
                importAttributeSets.Add(new ImportAttributeSet
				{
					StaticName = attributeSet.Attribute(Const2.Static).Value,
					Name = attributeSet.Attribute(Const2.Name).Value,
					Description = attributeSet.Attribute(Const2.Description).Value,
					Attributes = attributes,
					Scope = attributeSet.Attributes(Const2.Scope).Any() ? attributeSet.Attribute(Const2.Scope).Value : Settings.AttributeSetScope,
					AlwaysShareConfiguration = AllowSystemChanges && attributeSet.Attributes(Const2.AlwaysShareConfig).Any() && Parse(attributeSet.Attribute(Const2.AlwaysShareConfig).Value),
                    UsesConfigurationOfAttributeSet = attributeSet.Attributes("UsesConfigurationOfAttributeSet").Any() ? attributeSet.Attribute("UsesConfigurationOfAttributeSet").Value : "",
                    TitleAttribute = titleAttribute,
                    SortAttributes = attributeSet.Attributes(Const2.SortAttributes).Any() && bool.Parse(attributeSet.Attribute(Const2.SortAttributes).Value)
				});
			}

			return importAttributeSets;
		}
Beispiel #4
0
 /// <summary>
 /// Get an Import-Attribute
 /// </summary>
 public static ImportAttribute BooleanAttribute(string staticName, string name, string notes, bool? visibleInEditUi, bool? defaultValue = null)
 {
     var attribute = new ImportAttribute(staticName, name, AttributeTypeEnum.Boolean, notes, visibleInEditUi, defaultValue);
     return attribute;
 }