コード例 #1
0
ファイル: GrouperDocument.cs プロジェクト: Kungsbacka/Grouper
#pragma warning disable IDE0051 // "Remove unused private members" - Used when deserializing from JSON
        private GrouperDocument(Guid id, int interval, Guid groupId, string groupName, GroupStores store, GroupOwnerActions owner, List <GrouperDocumentMember> members)
#pragma warning restore IDE0051 // "Remove unused private members"
        {
            Id = id;
            ProcessingInterval = interval;
            GroupId            = groupId;
            GroupName          = groupName;
            Store    = store;
            Owner    = owner;
            _members = members;
        }
コード例 #2
0
 public GroupInfo(string id, string displayName, GroupStores store)
 {
     if (Guid.TryParse(id, out Guid guid))
     {
         Id = guid;
     }
     else
     {
         throw new ArgumentException(nameof(id), "Argument is not a valid GUID");
     }
     DisplayName = displayName;
     Store       = store;
 }
コード例 #3
0
        public void Run(ILFunction function, ILTransformContext context)
        {
            var groupStores = new GroupStores(function, context.CancellationToken);

            function.Body.AcceptVisitor(groupStores);
            // Replace analyzed variables with their split versions:
            foreach (var inst in function.Descendants.OfType <IInstructionWithVariableOperand>())
            {
                if (groupStores.IsAnalyzedVariable(inst.Variable))
                {
                    inst.Variable = groupStores.GetNewVariable(inst);
                }
            }
            function.Variables.RemoveDead();
        }
コード例 #4
0
        private static void InternalValidateMembers(IList <GrouperDocumentMember> documentMembers, GroupStores groupStore, ResourceLocation groupLocation, List <ValidationError> validationErrors)
        {
            if (documentMembers == null || documentMembers.Count == 0)
            {
                validationErrors.Add(new ValidationError(nameof(GrouperDocument.Members), ResourceString.ValidationErrorNoMemberObjects));
            }
            foreach (GrouperDocumentMember member in documentMembers)
            {
                if (memberSources.TryGetValue(member.Source, out DocumentMemberValidationRules memberSourceInfo))
                {
                    if (memberSourceInfo.Location != ResourceLocation.Independent && memberSourceInfo.Location != groupLocation)
                    {
                        validationErrors.Add(new ValidationError(nameof(GrouperDocumentMember.Source), ResourceString.ValidationErrorInvalidCombinationOfGroupStoreAndMemberSource, groupStore, member.Source));
                    }
                }
                else
                {
                    validationErrors.Add(new ValidationError(nameof(GrouperDocumentMember.Source), ResourceString.ValidationErrorInvalidMemberSource, member.Source));
                }
            }
            if (validationErrors.Count > 0)
            {
                return;
            }
            HashSet <GrouperDocumentMember> members = new HashSet <GrouperDocumentMember>();

            foreach (GrouperDocumentMember member in documentMembers)
            {
                if (members.Add(member))
                {
                    InternalValidateRules(member.Rules, member.Source, validationErrors);
                }
                else
                {
                    validationErrors.Add(new ValidationError(nameof(GrouperDocumentMember.Action), ResourceString.ValidationErrorDuplicateMemberObject, member.Source, member.Action, member.Rules?.Count));
                }
            }
        }
コード例 #5
0
 public GroupInfo(Guid id, string displayName, GroupStores store)
 {
     Id          = id;
     DisplayName = displayName;
     Store       = store;
 }