Exemple #1
0
        internal void RemoveAttributeSet(ReceivedAttributeMessage request)
        {
            var attributeSet = _repository.AttributeSetOf(request.AttributeSetName !);

            if (attributeSet.IsDefined)
            {
                attributeSet = AttributeSet.Named(request.AttributeSetName);
                _repository.Remove(request.AttributeSetName !);
            }
            _confirmingDistributor.ConfirmRemove(request.TrackingId, attributeSet, _configuration.NodeMatching(request.SourceNodeId));
        }
        internal void CreateAttributeSet(ReceivedAttributeMessage request)
        {
            var attributeSet = _repository.AttributeSetOf(request.AttributeSetName);

            if (attributeSet.IsNone)
            {
                attributeSet = AttributeSet.Named(request.AttributeSetName);
                _repository.Add(attributeSet);
            }
            _confirmingDistributor.ConfirmCreate(request.TrackingId, attributeSet, _configuration.NodeMatching(request.SourceNodeId));
        }
Exemple #3
0
        internal void AddAttribute(ReceivedAttributeMessage request)
        {
            var attributeSet = _repository.AttributeSetOf(request.AttributeSetName !);

            if (attributeSet.IsNone)
            {
                attributeSet = AttributeSet.Named(request.AttributeSetName);
                _repository.Add(attributeSet);
            }
            var tracked = attributeSet.AddIfAbsent(request.Attribute());

            _confirmingDistributor.Confirm(request.TrackingId, attributeSet, tracked, request.Type, _configuration.NodeMatching(request.SourceNodeId));
        }
Exemple #4
0
        //=========================================
        // AttributesAgent (core)
        //=========================================
        #region AttributesAgent (core)

        public void Add <T>(string attributeSetName, string attributeName, T value)
        {
            var set = _repository.AttributeSetOf(attributeSetName);

            if (set.IsNone)
            {
                var newSet = AttributeSet.Named(attributeSetName);
                newSet.AddIfAbsent(Attribute <T> .From(attributeName, value));
                _repository.Add(newSet);
                _client.SyncWith(newSet);
                _confirmingDistributor.DistributeCreate(newSet);
            }
            else
            {
                var newlyTracked = set.AddIfAbsent(Attribute <T> .From(attributeName, value));
                if (!newlyTracked.IsDistributed)
                {
                    _confirmingDistributor.Distribute(set, newlyTracked, ApplicationMessageType.AddAttribute);
                }
            }
        }