示例#1
0
        /// <summary>
        /// Executes the specified workflow.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="action">The action.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="errorMessages">The error messages.</param>
        /// <returns></returns>
        public override bool Execute(RockContext rockContext, WorkflowAction action, Object entity, out List <string> errorMessages)
        {
            errorMessages = new List <string>();

            if (entity is Model.BinaryFile)
            {
                var binaryFile = (Model.BinaryFile)entity;
                if (binaryFile.BinaryFileType.Guid != new Guid(SystemGuid.BinaryFiletype.CHECKIN_LABEL))
                {
                    errorMessages.Add("Binary file is not a check-in label");
                    action.AddLogEntry("Binary file is not a check-in label", true);
                    return(false);
                }

                StringBuilder sb = new StringBuilder();

                var contentString = binaryFile.ContentsToString();
                foreach (Match match in Regex.Matches(
                             contentString,
                             @"(?<=\^FD)((?!\^FS).)*(?=\^FS)"))
                {
                    sb.AppendFormat("{0}^|", match.Value);
                }

                binaryFile.LoadAttributes();

                var attributeValue = new AttributeValueCache();
                attributeValue.Value = sb.ToString();

                binaryFile.AttributeValues["MergeCodes"] = attributeValue;
                binaryFile.SaveAttributeValues(rockContext);
            }

            return(true);
        }
示例#2
0
        private DateTime GetDateTimeActivated(WorkflowAction action)
        {
            var dateActivated = RockDateTime.Now;

            // Use the current action type' guid as the key for a 'Delay Activated' attribute
            string AttrKey = action.ActionTypeCache.Guid.ToString();

            // Check to see if the action's activity does not yet have the the 'Delay Activated' attribute.
            // The first time this action runs on any workflow instance using this action instance, the
            // attribute will not exist and need to be created
            if (!action.Activity.Attributes.ContainsKey(AttrKey))
            {
                var attribute = new Rock.Model.Attribute();
                attribute.EntityTypeId = action.Activity.TypeId;
                attribute.EntityTypeQualifierColumn = "ActivityTypeId";
                attribute.EntityTypeQualifierValue  = action.Activity.ActivityTypeId.ToString();
                attribute.Name        = "Delay Activated";
                attribute.Key         = AttrKey;
                attribute.FieldTypeId = FieldTypeCache.Read(Rock.SystemGuid.FieldType.TEXT.AsGuid()).Id;

                // Need to save the attribute now (using different context) so that an attribute id is returned.
                using (var newRockContext = new RockContext())
                {
                    new AttributeService(newRockContext).Add(attribute);
                    newRockContext.SaveChanges();
                    AttributeCache.FlushEntityAttributes();
                    WorkflowActivityTypeCache.Flush(action.Activity.ActivityTypeId);
                }

                action.Activity.Attributes.Add(AttrKey, AttributeCache.Read(attribute));
                var attributeValue = new AttributeValueCache();
                attributeValue.AttributeId = attribute.Id;
                attributeValue.Value       = dateActivated.ToString("o");
                action.Activity.AttributeValues.Add(AttrKey, attributeValue);

                action.AddLogEntry(string.Format("Delay Activated at {0}", dateActivated), true);
            }
            else
            {
                // Check to see if this action instance has a value for the 'Delay Activated' attrbute
                DateTime?activated = action.Activity.GetAttributeValue(AttrKey).AsDateTime();
                if (activated.HasValue)
                {
                    return(activated.Value);
                }
                else
                {
                    // If no value exists, set the value to the current time
                    action.Activity.SetAttributeValue(AttrKey, dateActivated.ToString("o"));
                    action.AddLogEntry(string.Format("Delay Activated at {0}", dateActivated), true);
                }
            }

            return(dateActivated);
        }
示例#3
0
        private double HoursElapsed(WorkflowAction action)
        {
            // Use the current action type' guid as the key for a 'DateTime Sent' attribute
            string AttrKey = action.ActionTypeCache.Guid.ToString() + "_DateTimeSent";

            // Check to see if the action's activity does not yet have the the 'DateTime Sent' attribute.
            // The first time this action runs on any workflow instance using this action instance, the
            // attribute will not exist and need to be created
            if (!action.Activity.Attributes.ContainsKey(AttrKey))
            {
                var attribute = new Rock.Model.Attribute();
                attribute.EntityTypeId = action.Activity.TypeId;
                attribute.EntityTypeQualifierColumn = "ActivityTypeId";
                attribute.EntityTypeQualifierValue  = action.Activity.ActivityTypeId.ToString();
                attribute.Name        = "DateTime Sent";
                attribute.Key         = AttrKey;
                attribute.FieldTypeId = FieldTypeCache.Read(Rock.SystemGuid.FieldType.TEXT.AsGuid()).Id;

                // Need to save the attribute now (using different context) so that an attribute id is returned.
                using (var newRockContext = new RockContext())
                {
                    new AttributeService(newRockContext).Add(attribute);
                    newRockContext.SaveChanges();
                    AttributeCache.FlushEntityAttributes();
                    WorkflowActivityTypeCache.Flush(action.Activity.ActivityTypeId);
                }

                action.Activity.Attributes.Add(AttrKey, AttributeCache.Read(attribute));
                var attributeValue = new AttributeValueCache();
                attributeValue.AttributeId = attribute.Id;
                attributeValue.Value       = RockDateTime.Now.ToString("o");
                action.Activity.AttributeValues.Add(AttrKey, attributeValue);
            }
            else
            {
                // Check to see if this action instance has a value for the 'Delay Activated' attrbute
                DateTime?dateSent = action.Activity.GetAttributeValue(AttrKey).AsDateTime();
                if (dateSent.HasValue)
                {
                    // If a value does exist, check to see if the number of minutes to delay has passed
                    // since the value was saved
                    return(RockDateTime.Now.Subtract(dateSent.Value).TotalHours);
                }
                else
                {
                    // If no value exists, set the value to the current time
                    action.Activity.SetAttributeValue(AttrKey, RockDateTime.Now.ToString("o"));
                }
            }

            return(0.0D);
        }
        private DateTime GetDateTimeActivated(WorkflowAction action)
        {
            var dateActivated = RockDateTime.Now;

            string AttrKey = action.ActionTypeCache.Guid.ToString();

            if (!action.Activity.Attributes.ContainsKey(AttrKey))
            {
                var attribute = new Rock.Model.Attribute
                {
                    EntityTypeId = action.Activity.TypeId,
                    EntityTypeQualifierColumn = "ActivityTypeId",
                    EntityTypeQualifierValue  = action.Activity.ActivityTypeId.ToString(),
                    Name        = "Process Signature Activated",
                    Key         = AttrKey,
                    FieldTypeId = FieldTypeCache.Get(Rock.SystemGuid.FieldType.TEXT.AsGuid()).Id
                };

                using (var newRockContext = new RockContext())
                {
                    new AttributeService(newRockContext).Add(attribute);
                    newRockContext.SaveChanges();
                }

                action.Activity.Attributes.Add(AttrKey, AttributeCache.Get(attribute));
                var attributeValue = new AttributeValueCache
                {
                    AttributeId = attribute.Id,
                    Value       = dateActivated.ToString("o")
                };
                action.Activity.AttributeValues.Add(AttrKey, attributeValue);

                action.AddLogEntry(string.Format("Process Signature Activated at {0}", dateActivated), true);
            }
            else
            {
                DateTime?activated = action.Activity.GetAttributeValue(AttrKey).AsDateTime();
                if (activated.HasValue)
                {
                    return(activated.Value);
                }
                else
                {
                    action.Activity.SetAttributeValue(AttrKey, dateActivated.ToString("o"));
                    action.AddLogEntry(string.Format("Process Signature Activated at {0}", dateActivated), true);
                }
            }

            return(dateActivated);
        }
        public void AddEntityItemListToAttributeValueCache(string entityName, Guid entityID, List<AttributeValue> entityItemList)
        {
            var foundEntity = AttributeValueCacheList.SingleOrDefault(obj => obj.Name.ToLower() == entityName.ToLower());

            if (foundEntity == null)
            {
                var attributeValueCache = new AttributeValueCache(entityName);
                attributeValueCache.AddAttributeValues(entityID, entityItemList);
                AttributeValueCacheList.Add(attributeValueCache);
            }
            else
            {
                foundEntity.AddAttributeValues(entityID, entityItemList);
            }
        }
示例#6
0
        /// <summary>
        /// Executes the specified workflow.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="action">The action.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="errorMessages">The error messages.</param>
        /// <returns></returns>
        public override bool Execute(RockContext rockContext, WorkflowAction action, Object entity, out List <string> errorMessages)
        {
            errorMessages = new List <string>();

            if (entity is Model.BinaryFile)
            {
                var binaryFile = (Model.BinaryFile)entity;
                if (binaryFile.BinaryFileType.Guid != new Guid(SystemGuid.BinaryFiletype.CHECKIN_LABEL))
                {
                    errorMessages.Add("Binary file is not a check-in label");
                    action.AddLogEntry("Binary file is not a check-in label", true);
                    return(false);
                }

                if (binaryFile.Attributes == null)
                {
                    binaryFile.LoadAttributes();
                }

                // Get the existing merge fields
                var existingMergeFields = new Dictionary <string, string>();
                foreach (var keyAndVal in binaryFile.GetAttributeValue("MergeCodes").Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    var keyVal = keyAndVal.Split(new char[] { '^' });
                    if (keyVal.Length == 2)
                    {
                        existingMergeFields.AddOrIgnore(keyVal[0], keyVal[1]);
                    }
                }

                // Build new merge fields
                var newMergeFields = new List <string>();
                foreach (Match match in Regex.Matches(binaryFile.ContentsToString(), @"(?<=\^FD)((?!\^FS).)*(?=\^FS)"))
                {
                    string value = existingMergeFields.ContainsKey(match.Value) ? existingMergeFields[match.Value] : "";
                    newMergeFields.Add(string.Format("{0}^{1}", match.Value, value));
                }

                // Save attribute value
                var attributeValue = new AttributeValueCache();
                attributeValue.Value = newMergeFields.AsDelimited("|");

                binaryFile.AttributeValues["MergeCodes"] = attributeValue;
                binaryFile.SaveAttributeValues(rockContext);
            }

            return(true);
        }
示例#7
0
        // looks up an attribute by it's handle, if none is found a new manaeged wrapper is created
        // The factory as a Func<> allows for the constructor to remain private so that the only
        // way to create an AttributeValue is via the containing context. This ensures that the
        // proper ownership is maintained. (LLVM has no method of retrieving the context that owns an attribute)
        internal AttributeValue GetAttributeFor(LLVMAttributeRef handle, Func <Context, LLVMAttributeRef, AttributeValue> factory)
        {
            if (handle.Pointer.IsNull( ))
            {
                return(default(AttributeValue));
            }

            if (AttributeValueCache.TryGetValue(handle.Pointer, out AttributeValue retVal))
            {
                return(retVal);
            }

            retVal = factory(this, handle);
            AttributeValueCache.Add(handle.Pointer, retVal);
            return(retVal);
        }
示例#8
0
        private static AttributeValueCache GetGroupEBEventId(Group group)
        {
            AttributeValueCache retVar = null;
            var ebFieldType            = FieldTypeCache.Get(EBGuid.FieldType.EVENTBRITE_EVENT.AsGuid());

            if (ebFieldType != null)
            {
                group.LoadAttributes();
                var attribute = group.Attributes.Select(a => a.Value).FirstOrDefault(a => a.FieldTypeId == ebFieldType.Id);
                if (attribute != null)
                {
                    retVar = group.AttributeValues.Select(av => av.Value).FirstOrDefault(av => av.AttributeId == attribute.Id && av.Value != "");
                }
            }

            return(retVar);
        }
示例#9
0
        private string EmailStatus(WorkflowAction action)
        {
            // Use the current action type' guid as the key for a 'Email Status' attribute
            string AttrKey = action.ActionTypeCache.Guid.ToString() + "_EmailStatus";

            // Check to see if the action's activity does not yet have the the 'Email Status' attribute.
            // The first time this action runs on any workflow instance using this action instance, the
            // attribute will not exist and need to be created
            if (!action.Activity.Attributes.ContainsKey(AttrKey))
            {
                var attribute = new Rock.Model.Attribute();
                attribute.EntityTypeId = action.Activity.TypeId;
                attribute.EntityTypeQualifierColumn = "ActivityTypeId";
                attribute.EntityTypeQualifierValue  = action.Activity.ActivityTypeId.ToString();
                attribute.Name        = "Email Status";
                attribute.Key         = AttrKey;
                attribute.FieldTypeId = FieldTypeCache.Read(Rock.SystemGuid.FieldType.TEXT.AsGuid()).Id;

                // Need to save the attribute now (using different context) so that an attribute id is returned.
                using (var newRockContext = new RockContext())
                {
                    new AttributeService(newRockContext).Add(attribute);
                    newRockContext.SaveChanges();
                    AttributeCache.FlushEntityAttributes();
                    WorkflowActivityTypeCache.Flush(action.Activity.ActivityTypeId);
                }

                action.Activity.Attributes.Add(AttrKey, AttributeCache.Read(attribute));
                var attributeValue = new AttributeValueCache();
                attributeValue.AttributeId = attribute.Id;
                attributeValue.Value       = string.Empty;
                action.Activity.AttributeValues.Add(AttrKey, attributeValue);
            }
            else
            {
                return(action.Activity.GetAttributeValue(AttrKey));
            }

            return(string.Empty);
        }
        /// <summary>
        /// Converts an Attribute Value to a view model that can be sent to the client.
        /// </summary>
        /// <param name="attributeValue">The attribute value.</param>
        /// <returns>A <see cref="ClientAttributeValueViewModel"/> instance.</returns>
        /// <remarks>Internal until this is moved to a permanent location.</remarks>
        internal static ClientAttributeValueViewModel ToClientAttributeValue(AttributeValueCache attributeValue)
        {
            var attribute = AttributeCache.Get(attributeValue.AttributeId);

            var fieldType = _fieldTypes.GetOrAdd(attribute.FieldType.Guid, GetFieldType);

            return(new ClientAttributeValueViewModel
            {
                FieldTypeGuid = attribute.FieldType.Guid,
                AttributeGuid = attribute.Guid,
                Name = attributeValue.AttributeName,
                Categories = attribute.Categories.Select(c => new ClientAttributeValueCategoryViewModel
                {
                    Guid = c.Guid,
                    Name = c.Name,
                    Order = c.Order
                }).ToList(),
                Order = attribute.Order,
                TextValue = fieldType.GetTextValue(attributeValue.Value, attribute.ConfigurationValues),
                Value = fieldType.GetClientValue(attributeValue.Value, attribute.ConfigurationValues)
            });
        }
示例#11
0
        /// <summary>
        /// Converts an Attribute Value to a view model that can be sent to a
        /// public device for the purpose of viewing the value.
        /// </summary>
        /// <param name="attributeValue">The attribute value.</param>
        /// <returns>A <see cref="PublicAttributeViewModel"/> instance that contains details about the attribute but not the value.</returns>
        internal static PublicAttributeViewModel GetPublicAttributeForView(AttributeValueCache attributeValue)
        {
            var attribute = AttributeCache.Get(attributeValue.AttributeId);

            return(GetPublicAttributeForView(attribute, attributeValue.Value));
        }
        /// <summary>
        /// Converts an Attribute Value to a view model that can be sent to the client.
        /// </summary>
        /// <param name="attributeValue">The attribute value.</param>
        /// <returns>A <see cref="ClientEditableAttributeValueViewModel"/> instance.</returns>
        /// <remarks>Internal until this is moved to a permanent location.</remarks>
        internal static ClientEditableAttributeValueViewModel ToClientEditableAttributeValue(AttributeValueCache attributeValue)
        {
            var attribute = AttributeCache.Get(attributeValue.AttributeId);

            return(ToClientEditableAttributeValue(attribute, attributeValue.Value));
        }
示例#13
0
        /// <summary>
        /// Executes the action.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="action">The action.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="errorMessages">The error messages.</param>
        /// <returns></returns>
        public override bool Execute(RockContext rockContext, WorkflowAction action, object entity, out List <string> errorMessages)
        {
            errorMessages = new List <string>();

            // Get the number of minutes to delay
            int?minutes = GetAttributeValue(action, "MinutesToDelay").AsIntegerOrNull();

            if (!minutes.HasValue || minutes.Value <= 0)
            {
                return(true);
            }

            // Use the current action type' guid as the key for a 'Delay Activated' attribute
            string AttrKey = action.ActionType.Guid.ToString();

            // Check to see if the action's activity does not yet have the the 'Delay Activated' attribute.
            // The first time this action runs on any workflow instance using this action instance, the
            // attribute will not exist and need to be created
            if (!action.Activity.Attributes.ContainsKey(AttrKey))
            {
                var attribute = new Rock.Model.Attribute();
                attribute.EntityTypeId = action.Activity.TypeId;
                attribute.EntityTypeQualifierColumn = "ActivityTypeId";
                attribute.EntityTypeQualifierValue  = action.Activity.ActivityTypeId.ToString();
                attribute.Name        = "Delay Activated";
                attribute.Key         = AttrKey;
                attribute.FieldTypeId = FieldTypeCache.Read(Rock.SystemGuid.FieldType.TEXT.AsGuid()).Id;

                // Need to save the attribute now (using different context) so that an attribute id is returned.
                var newRockContext = new RockContext();
                new AttributeService(newRockContext).Add(attribute);
                newRockContext.SaveChanges();

                action.Activity.Attributes.Add(AttrKey, AttributeCache.Read(attribute));
                var attributeValue = new AttributeValueCache();
                attributeValue.AttributeId = attribute.Id;
                attributeValue.Value       = RockDateTime.Now.ToString("o");
                action.Activity.AttributeValues.Add(AttrKey, attributeValue);

                action.AddLogEntry(string.Format("{0:N0} Minute Delay Activated.", minutes.Value), true);
            }
            else
            {
                // Check to see if this action instance has a value for the 'Delay Activated' attrbute
                DateTime?activated = action.Activity.GetAttributeValue(AttrKey).AsDateTime();
                if (!activated.HasValue)
                {
                    // If no value exists, set the value to the current time
                    action.Activity.SetAttributeValue(AttrKey, RockDateTime.Now.ToString("o"));
                    action.AddLogEntry(string.Format("{0:N0} Minute Delay Activated.", minutes.Value), true);
                }
                else
                {
                    // If a value does exist, check to see if the number of minutes to delay has passed
                    // since the value was saved
                    if (activated.Value.AddMinutes(minutes.Value).CompareTo(RockDateTime.Now) < 0)
                    {
                        // If delay has elapsed, return True ( so that processing of activity will continue )
                        action.AddLogEntry(string.Format("{0:N0} Minute Delay Completed.", minutes.Value), true);
                        return(true);
                    }
                }
            }

            // If delay has not elapsed, return false so that processing of activity stops
            return(false);
        }
示例#14
0
        /// <summary>
        /// Get the next person for the action and group.
        /// </summary>
        /// <param name="action">The action that needs the next round robin person picked.</param>
        /// <param name="groupId">The identifier of the group to load the next person from.</param>
        /// <returns>A person object that represents the next person in the round robin selection process.</returns>
        private Person GetNextPerson(WorkflowAction action, int groupId)
        {
            Person person = null;

            //
            // Lock so that only one thread can do this at a time. This is to ensure that
            // we don't have two workflows processing at the same time and trying to get
            // the next person in the round robin and overwriting each others changes.
            //
            lock ( _lockObject )
            {
                var attrKey = action.ActionType.Guid.ToString();

                //
                // Load attributes if we need to.
                //
                if (action.Activity.Workflow.WorkflowType.Attributes == null)
                {
                    action.Activity.Workflow.WorkflowType.LoadAttributes();
                }

                //
                // Check if we already have an attribute.
                //
                if (!action.Activity.Workflow.WorkflowType.Attributes.ContainsKey(attrKey))
                {
                    var attribute = new Rock.Model.Attribute
                    {
                        EntityTypeId = action.Activity.Workflow.WorkflowType.TypeId,
                        Name         = string.Format("Last Round Robin Person ({0})", action.ActionType.Name),
                        Key          = attrKey,
                        FieldTypeId  = FieldTypeCache.Get(Rock.SystemGuid.FieldType.TEXT.AsGuid()).Id
                    };

                    using (var newRockContext = new RockContext())
                    {
                        new AttributeService(newRockContext).Add(attribute);
                        newRockContext.SaveChanges();
                        AttributeCache.RemoveEntityAttributes();
                    }

                    action.Activity.Workflow.WorkflowType.Attributes.Add(attrKey, AttributeCache.Get(attribute));
                    var attributeValue = new AttributeValueCache
                    {
                        AttributeId = attribute.Id,
                        Value       = string.Empty
                    };
                    action.Activity.Workflow.WorkflowType.AttributeValues.Add(attrKey, attributeValue);
                }

                //
                // Get the last person selected.
                //
                var lastPersonId = action.Activity.Workflow.WorkflowType.GetAttributeValue(attrKey).AsIntegerOrNull();

                var rockContext = new RockContext();
                //
                // Get the list of group members to pick from.
                //
                var groupMemberService = new GroupMemberService(rockContext);
                var statuses           = this.GetAttributeValue(action, "GroupMemberStatus")
                                         .SplitDelimitedValues()
                                         .Select(s => ( GroupMemberStatus )Enum.Parse(typeof(GroupMemberStatus), s))
                                         .ToList();
                var groupMembers = groupMemberService.Queryable()
                                   .Where(m => m.GroupId == groupId && statuses.Contains(m.GroupMemberStatus))
                                   .DistinctBy(m => m.PersonId)
                                   .OrderBy(m => m.Person.LastName)
                                   .ThenBy(m => m.Person.FirstName)
                                   .ToList();

                //
                // Filter by the group role.
                //
                if (!string.IsNullOrWhiteSpace(GetAttributeValue(action, "GroupRole")))
                {
                    var groupRole = new GroupTypeRoleService(rockContext).Get(GetAttributeValue(action, "GroupRole").AsGuid());

                    groupMembers = groupMembers.Where(m => m.GroupRoleId == groupRole.Id).ToList();
                }

                //
                // Find the next person.
                //
                if (groupMembers.Count > 0)
                {
                    int lastMemberIndex = -1;

                    //
                    // Find the index of the last person picked.
                    //
                    if (lastPersonId.HasValue)
                    {
                        var lastMember = groupMembers
                                         .Where(m => !lastPersonId.HasValue || m.PersonId == lastPersonId)
                                         .FirstOrDefault();
                        if (lastMember != null)
                        {
                            lastMemberIndex = groupMembers.IndexOf(lastMember);
                        }
                    }

                    //
                    // Pick either the next or the first person.
                    //
                    if (lastMemberIndex < 0 || (lastMemberIndex + 1) >= groupMembers.Count)
                    {
                        person = groupMembers.First().Person;
                    }
                    else
                    {
                        person = groupMembers[lastMemberIndex + 1].Person;
                    }
                }

                //
                // Update the attribute value.
                //
                action.Activity.Workflow.WorkflowType.SetAttributeValue(attrKey, person != null ? person.Id.ToString() : string.Empty);
                action.Activity.Workflow.WorkflowType.SaveAttributeValues(rockContext);
            }

            return(person);
        }
        public void AddEntityItemToAttributeValueCache(string entityName, AttributeValue entityItem)
        {
            var foundEntity = AttributeValueCacheList.SingleOrDefault(obj => obj.Name.ToLower() == entityName.ToLower());

            if (foundEntity == null)
            {
                var attributeValueCache = new AttributeValueCache(entityName);
                var avList = new List<AttributeValue>();
                avList.Add(entityItem);
                attributeValueCache.AddAttributeValues(entityItem.EntityID, avList);
                //attributeValueCache.AddAttribute(entityItem);
                AttributeValueCacheList.Add(attributeValueCache);
            }
            else
            {
                var avList = new List<AttributeValue>();
                avList.Add(entityItem);
                foundEntity.AddAttributeValues(entityItem.EntityID, avList);
                //foundEntity.AddAttribute(entityItem);
            }
        }
        private void SetSpecialAttribute(SpecialAttribute special)
        {
            _specAttr = special;
            if (State.Attribute == _currentState)
                _currentState = State.SpecialAttr;
            else if (State.RootLevelAttr == _currentState)
                _currentState = State.RootLevelSpecAttr;
            else
                Debug.Assert(false, "State.Attribute == currentState || State.RootLevelAttr == currentState");

            if (_attrValueCache == null)
            {
                _attrValueCache = new AttributeValueCache();
            }
        }
 private void SetSpecialAttribute(SpecialAttribute special)
 {
     this.specAttr = special;
     if (State.Attribute == this.currentState)
     {
         this.currentState = State.SpecialAttr;
     }
     else if (State.RootLevelAttr == this.currentState)
     {
         this.currentState = State.RootLevelSpecAttr;
     }
     if (this.attrValueCache == null)
     {
         this.attrValueCache = new AttributeValueCache();
     }
 }