Exemple #1
0
        internal StepHeaderSectionSyntax GetHeaderSyntax()
        {
            var macros = new List <StepHeaderMacroSyntax>()
            {
                new StepHeaderMacroSyntax(
                    FileDescriptionText,
                    new StepSyntaxList(
                        new StepSyntaxList(StepWriter.SplitStringIntoParts(Description).Select(s => new StepStringSyntax(s))),
                        new StepStringSyntax(ImplementationLevel))),
                new StepHeaderMacroSyntax(
                    FileNameText,
                    new StepSyntaxList(
                        new StepStringSyntax(Name),
                        new StepStringSyntax(Timestamp.ToString("O")),
                        new StepSyntaxList(StepWriter.SplitStringIntoParts(Author).Select(s => new StepStringSyntax(s))),
                        new StepSyntaxList(StepWriter.SplitStringIntoParts(Organization).Select(s => new StepStringSyntax(s))),
                        new StepStringSyntax(PreprocessorVersion),
                        new StepStringSyntax(OriginatingSystem),
                        new StepStringSyntax(Authorization))),
                new StepHeaderMacroSyntax(
                    FileSchemaText,
                    new StepSyntaxList(
                        new StepSyntaxList(
                            Schemas
                            .Select(s => s.ToSchemaName())
                            .Concat(UnsupportedSchemas)
                            .Select(s => new StepStringSyntax(s)))))
            };

            return(new StepHeaderSectionSyntax(-1, -1, macros));
        }
Exemple #2
0
        public override RuleTrigger ToTrigger()
        {
            var schemas = Schemas.Select(x => SimpleMapper.Map(x, new ContentChangedTriggerSchema())).ToImmutableList();

            return(new ContentChangedTrigger {
                HandleAll = HandleAll, Schemas = schemas
            });
        }
        public override RuleTrigger ToTrigger()
        {
            var schemas = Schemas?.Select(x => x.ToTrigger()).ToReadonlyList();

            return(new ContentChangedTriggerV2 {
                HandleAll = HandleAll, Schemas = schemas
            });
        }
        public RuleTrigger Migrate()
        {
            var schemas = new ReadOnlyCollection <ContentChangedTriggerSchemaV2>(Schemas.Select(x => x.Migrate()).ToList());

            return(new ContentChangedTriggerV2 {
                HandleAll = HandleAll, Schemas = schemas
            });
        }
Exemple #5
0
        public override RuleTrigger ToTrigger()
        {
            var schemas = Schemas.Select(x => SimpleMapper.Map(x, new ContentChangedTriggerSchemaV2())).ToReadOnlyCollection();

            return(new ContentChangedTriggerV2 {
                HandleAll = HandleAll, Schemas = schemas
            });
        }
 public object Clone()
 {
     return(new SCIMRepresentation
     {
         Id = Id,
         ExternalId = ExternalId,
         ResourceType = ResourceType,
         Version = Version,
         Created = Created,
         LastModified = LastModified,
         DisplayName = DisplayName,
         FlatAttributes = FlatAttributes.Select(a => (SCIMRepresentationAttribute)a.Clone()).ToList(),
         Schemas = Schemas.Select(a => (SCIMSchema)a.Clone()).ToList()
     });
 }
Exemple #7
0
        public Result GetResult()
        {
            Schemas schems = GetSchemas();
            Tables  tables = new Tables();

            var oTables = schems.Select(p => new { p.表格名稱 }).GroupBy(p => p);

            foreach (var oTable in oTables)
            {
                tables.Add(new Table()
                {
                    表格名稱    = oTable.Key.表格名稱,
                    Schemas = schems.Where(p => p.表格名稱 == oTable.Key.表格名稱).ToList <Schema>()
                });
            }

            return(new Result()
            {
                Schems = schems,
                Tables = tables
            });
        }
        public void AddStandardAttributes(string location, IEnumerable <string> attributes, bool isIncluded = true, bool ignore = true)
        {
            var metadata      = new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StandardSchemas.StandardResponseSchemas.GetAttribute(StandardSCIMRepresentationAttributes.Meta), StandardSchemas.ResourceTypeSchema.Id);
            var startWithMeta = attributes.Any(a => a.StartsWith(StandardSCIMRepresentationAttributes.Meta) && a.Split('.').Count() > 1);
            var containsMeta  = attributes.Contains(StandardSCIMRepresentationAttributes.Meta);

            if (startWithMeta || ignore || !(containsMeta && !isIncluded))
            {
                AddAttribute(metadata);
                var includeAll           = containsMeta && isIncluded;
                var containsResourceType = attributes.Contains($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.ResourceType}");
                var containsCreated      = attributes.Contains($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.Created}");
                var containsLastModified = attributes.Contains($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.LastModified}");
                var containsVersion      = attributes.Contains($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.Version}");
                var containsLocation     = attributes.Contains($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMRepresentationAttributes.Location}");
                if (containsResourceType && isIncluded || !containsResourceType && !isIncluded || ignore || includeAll)
                {
                    AddAttribute(metadata, new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StandardSchemas.StandardResponseSchemas.GetAttribute($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.ResourceType}"), StandardSchemas.ResourceTypeSchema.Id)
                    {
                        ValueString = ResourceType
                    });
                }

                if (containsCreated && isIncluded || !containsCreated && !isIncluded || ignore || includeAll)
                {
                    AddAttribute(metadata, new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StandardSchemas.StandardResponseSchemas.GetAttribute($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.Created}"), StandardSchemas.ResourceTypeSchema.Id)
                    {
                        ValueDateTime = Created
                    });
                }

                if (containsLastModified && isIncluded || !containsLastModified && !isIncluded || ignore || includeAll)
                {
                    AddAttribute(metadata, new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StandardSchemas.StandardResponseSchemas.GetAttribute($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.LastModified}"), StandardSchemas.ResourceTypeSchema.Id)
                    {
                        ValueDateTime = LastModified
                    });
                }

                if (containsVersion && isIncluded || !containsVersion && !isIncluded || ignore || includeAll)
                {
                    AddAttribute(metadata, new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StandardSchemas.StandardResponseSchemas.GetAttribute($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.Version}"), StandardSchemas.ResourceTypeSchema.Id)
                    {
                        ValueInteger = Version
                    });
                }

                if ((containsLocation && isIncluded || !containsLocation && !isIncluded || ignore || includeAll) && !string.IsNullOrWhiteSpace(location))
                {
                    AddAttribute(metadata, new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StandardSchemas.StandardResponseSchemas.GetAttribute($"{StandardSCIMRepresentationAttributes.Meta}.{StandardSCIMMetaAttributes.Location}"), StandardSchemas.ResourceTypeSchema.Id)
                    {
                        ValueString = location
                    });
                }
            }

            var containsExternalId = attributes.Contains(StandardSCIMRepresentationAttributes.ExternalId);
            var containsSchemas    = attributes.Contains(StandardSCIMRepresentationAttributes.Schemas);

            if (containsExternalId && isIncluded || !containsExternalId && !isIncluded || ignore)
            {
                if (!string.IsNullOrWhiteSpace(ExternalId))
                {
                    AddAttribute(new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StandardSchemas.StandardResponseSchemas.GetAttribute(StandardSCIMRepresentationAttributes.ExternalId), StandardSchemas.ResourceTypeSchema.Id)
                    {
                        ValueString = ExternalId
                    });
                }
            }

            if (containsSchemas && isIncluded || !containsSchemas && !isIncluded || ignore)
            {
                foreach (var schemaId in Schemas.Select(s => s.Id))
                {
                    AddAttribute(new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StandardSchemas.StandardResponseSchemas.GetAttribute(StandardSCIMRepresentationAttributes.Schemas), StandardSchemas.ResourceTypeSchema.Id)
                    {
                        ValueString = schemaId
                    });
                }
            }
        }