Beispiel #1
0
        /// <summary>
        /// Process a field into a custom index data element
        /// </summary>
        /// <param name="field">The field to process</param>
        /// <param name="settings">field processor settings</param>
        public virtual void ProcessCustomField(ItemField field, FieldProcessorSettings settings = null)
        {
            IndexField targetField = settings.CustomFieldTarget(field.Name);
            //indexing behaviour is more specific for custom fields:
            //1. For keyword or component link fields, the kw or linked component item id is indexed
            //2. For date fields, the date (in standard format) is indexed
            //3. For number fields the number is indexed
            //4. For text fields, the text content (no markup) is indexed
            IList <string> values = new List <string>();

            if (field is KeywordField)
            {
                values = ((KeywordField)field).Values.Select(k => k.Id.ItemId.ToString()).ToList();
            }
            else if (field is ComponentLinkField)
            {
                values = ((ComponentLinkField)field).Values.Select(c => c.Id.ItemId.ToString()).ToList();
            }
            else if (field is DateField)
            {
                values = ((DateField)field).Values.Select(d => d.ToString("o") + "Z").ToList();
            }
            else if (field is NumberField)
            {
                values = ((NumberField)field).Values.Select(n => n.ToString()).ToList();
            }
            else if (field is TextField)
            {
                values = ((TextField)field).Values;
            }
            AddToData(values, (field is XhtmlField), targetField);
        }
 public ItemModification(RaftMod owner, Item item, ItemField field, object newValue)
 {
     this.owner    = owner;
     this.item     = item;
     this.field    = field;
     this.newValue = newValue;
 }
        public async Task <IActionResult> PutItemField(int id, ItemField itemField)
        {
            if (id != itemField.ItemId)
            {
                return(BadRequest());
            }

            _context.Entry(itemField).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ItemFieldExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #4
0
 public void FieldCalledItem()
 {
     ItemField message = new ItemField { Item = 3 };
     FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
     Assert.NotNull(field);
     Assert.AreEqual(3, (int)field.Accessor.GetValue(message));
 }
Beispiel #5
0
        /// <summary>
        /// Retrieves multiple <see cref="T:System.String" /> XML field values.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:System.String" /> XML values</returns>
        public static IList <String> XMLValues(this ItemField itemField)
        {
            List <String> results = new List <String>();

            if (itemField != null)
            {
                TextField field = itemField as TextField;

                if (field != null && field.Values.Count > 0)
                {
                    XmlDocument xDoc = new XmlDocument();

                    foreach (String value in field.Values)
                    {
                        xDoc.LoadXml("<x>" + value + "</x>");

                        String xml = xDoc.RemoveNameSpaces();
                        xml = xml.Substring(3, xml.Length - 7);

                        results.Add(xml);
                    }
                }
            }

            return(results);
        }
        protected DateTime GetItemFieldDateTimeValue(string sFldName, bool bTime)
        {
            ItemField ItemFld = null;

            //--- Get the item field and the date only or date time value
            ItemFld = GetItemField(Item, sFldName);
            return(ItemFld.IsNullValue() ?  Global.DateTimeNull : bTime?ItemFld.GetDateTimeValue() : ItemFld.GetDateOnlyValue());
        }
Beispiel #7
0
    public static Entry Parse(string entry)
    {
        var item = new Entry();

        item._fields.AddRange(entry.Split(' ').Select(data => ItemField.Parse(data)));

        return(item);
    }
Beispiel #8
0
 public void FieldCalledItem()
 {
     ItemField message = new ItemField { Item = 3 };
     FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
     Assert.NotNull(field);
     // TODO(jonskeet): Reflection...
     // Assert.AreEqual(3, (int)message[field]);
 }
Beispiel #9
0
        public IActionResult Delete(int id)
        {
            ItemField itemField = new ItemField();

            itemField.ID = id;
            db.ItemFields.Remove(itemField);
            db.SaveChanges();
            return(Ok());
        }
Beispiel #10
0
        private Field[,] SetDataToPlayGround(string[] rawData)
        {
            int rows    = int.Parse(rawData[1]);
            int columns = int.Parse(rawData[0]);

            Field[,] playground = new Field[columns, rows];

            for (int line = 2; line < rows + 2; line++)
            {
                for (int sign = 0; sign < columns; sign++)
                {
                    Field field = new EmptyField()
                    {
                        Location = new System.Drawing.Point(sign, line - 2)
                    };
                    switch (rawData[line].Substring(sign, 1))
                    {
                    case CommonConstants.POINT: field = new ItemField()
                    {
                            Location = new System.Drawing.Point(sign, line - 2)
                    };
                        break;

                    case CommonConstants.ITEM_SIGN:
                        field = new ItemField()
                        {
                            Location = new System.Drawing.Point(sign, line - 2)
                        };
                        break;

                    case CommonConstants.PAWN:
                        field = new PlayerField()
                        {
                            Location = new System.Drawing.Point(sign, line - 2)
                        };
                        break;

                    case CommonConstants.WALL:
                        field = new WallField()
                        {
                            Location = new System.Drawing.Point(sign, line - 2)
                        };
                        break;

                    default:
                        field = new EmptyField()
                        {
                            Location = new System.Drawing.Point(sign, line - 2)
                        };
                        break;
                    }
                    playground[sign, line - 2] = field;
                }
            }
            return(playground);
        }
 private static bool TryGetValueFromField(ItemField field, out string value)
 {
     value = null;
     if (field is TextField)
     {
         value = ((TextField)field).Value;
         return(true);
     }
     return(false);
 }
Beispiel #12
0
        public IActionResult Post([FromBody] ItemField itemField)
        {
            // TODO: Add data validation
            int categoryQuery = Convert.ToInt32(HttpContext.Request.Query["Category"]);

            itemField.Category = db.Categories.Find(categoryQuery);
            db.ItemFields.Add(itemField);
            db.SaveChanges();
            return(Ok(itemField.ID));
        }
Beispiel #13
0
        public void FieldCalledItem()
        {
            ItemField message = new ItemField {
                Item = 3
            };
            FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");

            Assert.NotNull(field);
            Assert.AreEqual(3, (int)field.Accessor.GetValue(message));
        }
Beispiel #14
0
        public void FieldCalledItem()
        {
            ItemField message = new ItemField {
                Item = 3
            };
            FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");

            Assert.NotNull(field);
            // TODO(jonskeet): Reflection...
            // Assert.AreEqual(3, (int)message[field]);
        }
Beispiel #15
0
 /// <summary>
 /// Process an individual field
 /// </summary>
 /// <param name="field">The field to process</param>
 /// <param name="settings">field processor settings</param>
 public virtual void ProcessField(ItemField field, FieldProcessorSettings settings)
 {
     if (settings.HasCustomMapping(field.Name))
     {
         ProcessCustomField(field, settings);
     }
     else
     {
         ProcessCatchAllField(field, settings);
     }
 }
        public void Delete(int id)
        {
            ItemField itemField = new ItemField();

            itemField.ID = id;
            using (var dataContext = new APIDBContext())
            {
                dataContext.ItemFields.Remove(itemField);
                dataContext.SaveChanges();
            }
        }
Beispiel #17
0
        public static string ToRFC822Date(this ItemField inputDate)
        {
            string       formattedDate    = inputDate.ToString();
            const string RFC822DateFormat = "yyyyMMddHHmmss";
            var          dt = new DateTime();

            if (DateTime.TryParse(formattedDate, out dt))
            {
                formattedDate = dt.ToString(RFC822DateFormat);
            }
            return(formattedDate);
        }
Beispiel #18
0
        public static int GetUpdateField(ItemField itemField)
        {
            var typeString = string.Format("WowPacketParser.Enums.Version.{0}.ItemField", ClientVersion.GetVersionString());

            var newEnumType = _assembly.GetType(typeString);

            foreach (int val in Enum.GetValues(newEnumType))
                if (Enum.GetName(newEnumType, val) == itemField.ToString())
                    return val;

            return (int)itemField;
        }
        public void Post([FromBody] ItemField itemField)
        {
            // TODO: Add data validation
            using (var dataContext = new APIDBContext())
            {
                int categoryQuery = Convert.ToInt32(HttpContext.Request.Query["Category"]);

                itemField.Category = dataContext.Categories.Find(categoryQuery);
                dataContext.ItemFields.Add(itemField);
                dataContext.SaveChanges();
            }
        }
        protected ItemField GetSBMItemFieldByDatabaseName(Item Item, string sFldName)
        {
            ItemField Fld = null;

            //--- Get the field
            if ((Fld = Item.Fields.FindByDatabaseName(sFldName)) == null)
            {
                throw new SBMException(ErrMsg_SBMFldNotExi.Replace("%name%", sFldName));
            }

            return(Fld);
        }
        protected ItemField GetItemField(Item Item, string sFldName)
        {
            ItemField ItemFld = null;

            //--- Get the item field
            if ((ItemFld = Item.Fields.FindByDatabaseName(sFldName)) == null)
            {
                throw new Exception(ErrMsg_ItemFldNotExi.Replace("%name%", sFldName));
            }

            return(ItemFld);
        }
Beispiel #22
0
        protected void ClearChartObjectReferences(AuxiliaryItem ChaObjItem, string sFldName)
        {
            ItemField Fld = null;

            //--- Get the field and check exists
            if ((Fld = ChaObjItem.Fields.FindByDatabaseName(sFldName)) == null)
            {
                return;
            }

            //--- Clear the field value
            Fld.SetNullValue();
        }
Beispiel #23
0
    public void SetValue(List <string> inNames)
    {
        for (int i = 0; i < inNames.Count; i++)
        {
            string classname = Stringer.FirstLetterUp(inNames[i]);

            ItemField field = new ItemField("Dictionary<string," + classname + ">", classname + "Dic", "new " + "Dictionary<string," + classname + ">()");
            field.SetAttributes(MemberAttributes.Final | MemberAttributes.Public);
            field.AddAttributes("ProtoMember", i + 1);
            fieldList.Add(field);
        }
        // Create();
    }
Beispiel #24
0
        /// <summary>
        /// Saves changes of current <see cref="BusinessObject"/> to the operations list.
        /// </summary>
        /// <param name="document">Xml document containing operation list to execute.</param>
        public override void SaveChanges(XDocument document)
        {
            if (this.Status != BusinessObjectStatus.Unchanged && this.Status != BusinessObjectStatus.Unknown)
            {
                if (this.Id == null)
                {
                    this.GenerateId();
                }

                ItemField field = DictionaryMapper.Instance.GetItemField(this.ItemFieldId);
                BusinessObjectHelper.SaveBusinessObjectChanges(this, document, null, field.Metadata.Element("dataType").Value);
            }
        }
        public static bool HasValue(this ItemField field)
        {
            if (field == null)
            {
                return(false);
            }

            var textField = field as TextField;

            if (textField != null)
            {
                return(TridionExtensions.HasValue(textField));
            }

            var componentLinkField = field as ComponentLinkField;

            if (componentLinkField != null)
            {
                return(TridionExtensions.HasValue(componentLinkField));
            }

            var dateField = field as DateField;

            if (dateField != null)
            {
                return(TridionExtensions.HasValue(dateField));
            }

            var embeddedSchemaField = field as EmbeddedSchemaField;

            if (embeddedSchemaField != null)
            {
                return(TridionExtensions.HasValue(embeddedSchemaField));
            }

            var keywordField = field as KeywordField;

            if (keywordField != null)
            {
                return(TridionExtensions.HasValue(keywordField));
            }

            var numberField = field as NumberField;

            if (numberField != null)
            {
                return(TridionExtensions.HasValue(numberField));
            }

            return(false);
        }
Beispiel #26
0
        /// <summary>
        /// Retrieves multiple <see cref="T:System.DateTime" /> field values.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:System.DateTime" /> values</returns>
        public static IList <DateTime> DateValues(this ItemField itemField)
        {
            if (itemField != null)
            {
                DateField field = itemField as DateField;

                if (field != null && field.Values.Count > 0)
                {
                    return(field.Values);
                }
            }

            return(new List <DateTime>());
        }
Beispiel #27
0
        /// <summary>
        /// Retrieves a <see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /> field value.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemFields" /></returns>
        public static ItemFields EmbeddedValue(this ItemField itemField)
        {
            if (itemField != null)
            {
                IList <ItemFields> values = itemField.EmbeddedValues();

                if (values.Count > 0)
                {
                    return(values[0]);
                }
            }

            return(null);
        }
Beispiel #28
0
        /// <summary>
        /// Retrieves multiple <see cref="T:Tridion.ContentManager.ContentManagement.Keyword" /> field values.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:Tridion.ContentManager.ContentManagement.Keyword" /> values</returns>
        public static IList <Keyword> KeywordValues(this ItemField itemField)
        {
            if (itemField != null)
            {
                KeywordField field = itemField as KeywordField;

                if (field != null && field.Values.Count > 0)
                {
                    return(field.Values);
                }
            }

            return(new List <Keyword>());
        }
Beispiel #29
0
        /// <summary>
        /// Retrieves multiple <see cref="T:System.Double" /> field values.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:System.Double" /> values</returns>
        public static IList <Double> NumberValues(this ItemField itemField)
        {
            if (itemField != null)
            {
                NumberField field = itemField as NumberField;

                if (field != null && field.Values.Count > 0)
                {
                    return(field.Values);
                }
            }

            return(new List <Double>());
        }
Beispiel #30
0
        /// <summary>
        /// Retrieves multiple <see cref="T:System.String" /> XHTML field values.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:System.String" /> XHTML values</returns>
        public static IList <String> XHTMLValues(this ItemField itemField)
        {
            if (itemField != null)
            {
                XhtmlField field = itemField as XhtmlField;

                if (field != null && field.Values.Count > 0)
                {
                    return(field.Values);
                }
            }

            return(new List <String>());
        }
Beispiel #31
0
        /// <summary>
        /// Retrieves a <see cref="T:Tridion.ContentManager.ContentManagement.Component" /> field value.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:Tridion.ContentManager.ContentManagement.Component" /></returns>
        public static Component ComponentValue(this ItemField itemField)
        {
            if (itemField != null)
            {
                IList <Component> values = itemField.ComponentValues();

                if (values.Count > 0)
                {
                    return(values[0]);
                }
            }

            return(null);
        }
Beispiel #32
0
        /// <summary>
        /// Retrieves a <see cref="T:System.DateTime" /> field value.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:System.DateTime" /></returns>
        public static DateTime DateValue(this ItemField itemField)
        {
            if (itemField != null)
            {
                IList <DateTime> values = itemField.DateValues();

                if (values.Count > 0)
                {
                    return(values[0]);
                }
            }

            return(default(DateTime));
        }
Beispiel #33
0
        /// <summary>
        /// Retrieves a <see cref="T:System.String" /> external link field value.
        /// </summary>
        /// <param name="itemField"><see cref="T:Tridion.ContentManager.ContentManagement.Fields.ItemField" /></param>
        /// <returns><see cref="T:System.String" /> external link value</returns>
        public static String ExternalLinkValue(this ItemField itemField)
        {
            if (itemField != null)
            {
                IList <String> values = itemField.ExternalLinkValues();

                if (values.Count > 0)
                {
                    return(values[0]);
                }
            }

            return(String.Empty);
        }
Beispiel #34
0
        public void SetValue(List<string> inNames)
        {
            usingList.Add("ProtoBuf");
            usingList.Add("System.Collections.Generic");

            classer.CustomAttributes.Add(new CodeAttributeDeclaration("ProtoContract"));

            for (int i = 0; i < inNames.Count; i++)
            {
                string classname = Stringer.FirstLetterUp(inNames[i]);
                ItemField field = new ItemField("Dictionary<string," + classname + ">", classname + "Dic", "new " + "Dictionary<string," + classname + ">()");
                field.SetAttributes(MemberAttributes.Final | MemberAttributes.Public);
                field.AddAttributes("ProtoMember", i + 1);
                fieldList.Add(field);
            }
            Create();
        }
        public override Field BuildField(ItemField tcmItemField, int currentLinkLevel)
        {
            Field dd4tField = base.BuildField(tcmItemField, currentLinkLevel);

            KeywordField tcmKeywordField = tcmItemField as KeywordField;
            if (tcmKeywordField != null)
            {
                int i = 0;
                foreach (Keyword dd4tKeyword in dd4tField.KeywordValues)
                {
                    TcmKeyword tcmKeyword = tcmKeywordField.Values[i++];
                    if (tcmKeyword.MetadataSchema != null)
                    {
                        dd4tKeyword.AddExtensionProperty(DxaExtensionDataSectionName, "MetadataSchemaId", tcmKeyword.MetadataSchema.Id);
                    }
                }
            }

            return dd4tField;
        }
        /// <summary>
        /// Gets the field value.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="position">The position.</param>
        /// <returns>The field's value[position]</returns>
        internal string GetFieldValue(ItemField field, int position)
        {
            string value = String.Empty;
            if (field != null)
            {
                bool MultiValue = field.Definition.MaxOccurs != 1;
                switch (field.GetType().Name)
                {
                    case "ExternalLinkField":
                        ExternalLinkField extfield = (ExternalLinkField)field;
                        value = extfield.Value;
                        break;
                    case "NumberField":
                        NumberField numField = (NumberField)field;
                        if (_returnAllValues)
                        {
                            foreach (Double fieldValue in numField.Values)
                            {
                                value += Convert.ToString(fieldValue);
                                value += _multipleValueSeparator;
                            }
                            if (value.EndsWith(_multipleValueSeparator))
                                value = value.Substring(0, value.LastIndexOf(_multipleValueSeparator));
                        }
                        else if (numField.Values.Count > position)
                            value = Convert.ToString(numField.Values[position]);
                        break;
                    case "SingleLineTextField":
                    case "MultiLineTextField":
                        TextField textField = (TextField)field;
                        if (_returnAllValues)
                        {
                            foreach (String fieldValue in textField.Values)
                            {
                                value += fieldValue;
                                value += _multipleValueSeparator;
                            }
                            if (value.EndsWith(_multipleValueSeparator))
                                value = value.Substring(0, value.LastIndexOf(_multipleValueSeparator));
                        }
                        else if (textField.Values.Count > position)
                            value = textField.Values[position];

                        if (_escapeOutput)
                            value = System.Security.SecurityElement.Escape(value);
                        break;
                    case "XhtmlField":
                        XhtmlField XhtmlField = (XhtmlField)field;
                        if (_returnAllValues)
                        {
                            foreach (String fieldValue in XhtmlField.Values)
                            {
                                value += fieldValue;
                                value += _multipleValueSeparator;
                            }
                            if (value.EndsWith(_multipleValueSeparator))
                                value = value.Substring(0, value.LastIndexOf(_multipleValueSeparator));
                        }
                        else if (XhtmlField.Values.Count > position)
                        {
                            String XhtmlSource = XhtmlField.Values[position];
                            value = ConvertLinksInRtf(XhtmlSource);
                            value = TemplateUtilities.ResolveRichTextFieldXhtml(value);
                        }
                        break;
                    case "KeywordField":
                        KeywordField keywordField = (KeywordField)field;
                        if (_returnAllValues)
                        {
                            foreach (Keyword fieldValue in keywordField.Values)
                            {
                                value += fieldValue.Title;
                                value += _multipleValueSeparator;
                            }
                            if (value.EndsWith(_multipleValueSeparator))
                                value = value.Substring(0, value.LastIndexOf(_multipleValueSeparator));
                        }
                        else if (keywordField.Values.Count > position)
                            value = keywordField.Values[position].Title;

                        if (_escapeOutput)
                            value = System.Security.SecurityElement.Escape(value);
                        break;
                    case "MultimediaLinkField":
                        MultimediaLinkField mmField = (MultimediaLinkField)field;
                        if (mmField.Values.Count > position)
                        {
                            if (_pushBinariesToPackage)
                                _package.PushItem(_package.CreateMultimediaItem(mmField.Values[position].Id));
                            value = mmField.Values[position].Id.ToString();
                        }
                        _disableSiteEdit = true;
                        break;
                    case "ComponentLinkField":
                        ComponentLinkField clField = (ComponentLinkField)field;
                        if (clField.Values.Count > position)
                        {
                            if (clField.Values[position].ComponentType == ComponentType.Multimedia)
                                _package.PushItem(_package.CreateMultimediaItem(clField.Values[position].Id));
                            value = clField.Values[position].Id.ToString();
                        }
                        _disableSiteEdit = true;
                        break;
                    case "DateField":
                        DateField dateField = (DateField)field;
                        if (_returnAllValues)
                        {
                            foreach (DateTime fieldValue in dateField.Values)
                            {
                                value += fieldValue.ToString(_dateFormat, _culture);
                                value += _multipleValueSeparator;
                            }
                            if (value.EndsWith(_multipleValueSeparator))
                                value = value.Substring(0, value.LastIndexOf(_multipleValueSeparator));
                        }
                        if (dateField.Values.Count > position)
                        {
                            value = dateField.Values[position].ToString(_dateFormat, _culture);
                        }
                        break;
                }
            }
            return value;
        }
 private static bool TryGetValueFromField(ItemField field, out string value)
 {
     value = null;
     if (field is TextField)
     {
         value = ((TextField)field).Value;
         return true;
     }
     return false;
 }
Beispiel #38
0
 /// <summary>
 /// Process a field into a custom index data element
 /// </summary>
 /// <param name="field">The field to process</param>
 /// <param name="settings">field processor settings</param>
 public virtual void ProcessCustomField(ItemField field, FieldProcessorSettings settings = null)
 {
     IndexField targetField = settings.CustomFieldTarget(field.Name);
     //indexing behaviour is more specific for custom fields:
     //1. For keyword or component link fields, the kw or linked component item id is indexed
     //2. For date fields, the date (in standard format) is indexed
     //3. For number fields the number is indexed
     //4. For text fields, the text content (no markup) is indexed
     IList<string> values = new List<string>();
     if (field is KeywordField)
     {
         values = ((KeywordField)field).Values.Select(k => k.Id.ItemId.ToString()).ToList();
     }
     else if (field is ComponentLinkField)
     {
         values = ((ComponentLinkField)field).Values.Select(c => c.Id.ItemId.ToString()).ToList();
     }
     else if (field is DateField)
     {
         values = ((DateField)field).Values.Select(d => d.ToString("o") + "Z").ToList();
     }
     else if (field is NumberField)
     {
         values = ((NumberField)field).Values.Select(n => n.ToString()).ToList();
     }
     else if (field is TextField)
     {
         values = ((TextField)field).Values;
     }
     AddToData(values, (field is XhtmlField), targetField);
 }
Beispiel #39
0
 /// <summary>
 /// Process a field into the catchall index data
 /// </summary>
 /// <param name="field">The field to process</param>
 /// <param name="settings">field processor settings</param>
 public virtual void ProcessCatchAllField(ItemField field, FieldProcessorSettings settings = null)
 {
     //only process text fields
     if (field is TextField)
     {
         AddToData(((TextField)field).Values, (field is XhtmlField));
     }
     if (field is ComponentLinkField && settings.IsLinkToBeFollowed(field.Name))
     {
         foreach (var comp in ((ComponentLinkField)field).Values)
         {
             //avoid circular links, and indexing the items that are linked more than once
             if (!IsComponentAlreadyProcessed(comp.Id))
             {
                 SetComponentAsProcessed(comp.Id);
                 ProcessData(new ItemFields(comp.Content, comp.Schema), settings);
             }
         }
     }
 }
Beispiel #40
0
 /// <summary>
 /// Process an individual field
 /// </summary>
 /// <param name="field">The field to process</param>
 /// <param name="settings">field processor settings</param>
 public virtual void ProcessField(ItemField field, FieldProcessorSettings settings)
 {
     if (settings.HasCustomMapping(field.Name))
     {
         ProcessCustomField(field, settings);
     }
     else
     {
         ProcessCatchAllField(field, settings);
     }
 }
 private String GetFieldType(ItemField field)
 {
     String type;
     if (field is XhtmlField)
     {
         type = "Xhtml";
     }
     else if (field is TextField)
     {
         type = "Text";
     }
     else if (field is NumberField)
     {
         type = "Number";
     }
     else if (field is DateField)
     {
         type = "Date";
     }
     else if (field is EmbeddedSchemaField)
     {
         type = "Embedded";
     }
     else if (field is MultimediaLinkField)
     {
         type = "MultiMediaLink";
     }
     else if (field is ComponentLinkField)
     {
         type = "ComponentLink";
     }
     else if (field is KeywordField)
     {
         type = "Keyword";
     }
     else
     {
         type = "Unknown";
     }
     return type;
 }
        private void OutputFieldValues(ItemField field, StringBuilder sb)
        {
            // Multiline field???

            // TODO: Can this selector be smarter by using overloading instead???

            if (field is XhtmlField)
            {
                this.OutputXhtmlValues((XhtmlField)field, sb);
            }
            else if (field is TextField)
            {
                this.OutputTextValues((TextField)field, sb);
            }
            else if (field is NumberField)
            {
                this.OutputNumberValues((NumberField)field, sb);
            }
            else if (field is DateField)
            {
                this.OutputDateValues((DateField)field, sb);
            }
            else if (field is EmbeddedSchemaField)
            {
                this.OutputEmbeddedValues((EmbeddedSchemaField)field, sb);
            }
            else if (field is MultimediaLinkField)
            {
                this.OutputMultimediaValues((MultimediaLinkField)field, sb);
            }
            else if (field is ComponentLinkField)
            {
                this.OutputComponentLinkValues((ComponentLinkField)field, sb);
            }
            else if (field is KeywordField)
            {
                this.OutputKeywordValues((KeywordField)field, sb);
            }
        }