////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public PropertyMapping(DomainProperty pDom, ApiProperty pApi,
                        CustomDir pCustom = CustomDir.Neither)
 {
     Domain = pDom;
     Api    = pApi;
     Custom = pCustom;
 }
Exemple #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public ClassSchema()
        {
            Names        = new NameProvider("Class", "Classes", "c");
            GetAccess    = Access.All;
            CreateAccess = Access.All;
            DeleteAccess = Access.CreatorUserAndApp;
            IsAbstract   = false;
            CustomCreate = true;

            ////

            Name           = new DomainProperty <string>("Name", "c_na");
            Name.IsElastic = true;

            NameKey             = new DomainProperty <string>("NameKey", "c_nk");
            NameKey.ToLowerCase = true;
            NameKey.IsIndexed   = true;
            Name.ExactIndexVia  = NameKey;

            Disamb            = new DomainProperty <string>("Disamb", "c_di");
            Disamb.IsNullable = true;
            Disamb.IsElastic  = true;

            Note            = new DomainProperty <string>("Note", "c_no");
            Note.IsNullable = true;

            ////

            FabName = new ApiProperty <string>("Name");
            FabName.SetOpenAccess();
            FabName.LenMin       = 1;
            FabName.LenMax       = 128;
            FabName.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabName.TraversalHas = Matching.None;

            FabDisamb = new ApiProperty <string>("Disamb");
            FabDisamb.SetOpenAccess();
            FabDisamb.IsNullable   = true;
            FabDisamb.LenMin       = 1;
            FabDisamb.LenMax       = 128;
            FabDisamb.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabDisamb.TraversalHas = Matching.None;

            FabNote = new ApiProperty <string>("Note");
            FabNote.SetOpenAccess();
            FabNote.IsNullable   = true;
            FabNote.LenMin       = 1;
            FabNote.LenMax       = 256;
            FabNote.TraversalHas = Matching.None;

            ////

            FabNameMap = new PropertyMapping <string, string>(Name, FabName, CustomDir.ApiToDomain);
            FabNameMap.ApiToDomainNote = "Set Domain.NameKey = Api.Name.ToLower()";

            FabDisambMap = new PropertyMapping <string, string>(Disamb, FabDisamb);
            FabNoteMap   = new PropertyMapping <string, string>(Note, FabNote);
        }
Exemple #3
0
        public static string GetMessageFromMesasgesPostRequest(ResourceDocument document)
        {
            ApiProperty des = null;

            document.Data.Attributes.TryGetApiProperty("message", out des);
            var str   = des.ToString();
            var sects = str.Split(':');

            return(sects[1]);
        }
Exemple #4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public InstanceSchema()
        {
            Names        = new NameProvider("Instance", "Instances", "i");
            GetAccess    = Access.All;
            CreateAccess = Access.All;
            DeleteAccess = Access.CreatorUserAndApp;
            IsAbstract   = false;
            CustomCreate = true;

            ////

            Name            = new DomainProperty <string>("Name", "i_na");
            Name.IsNullable = true;
            Name.IsElastic  = true;

            Disamb            = new DomainProperty <string>("Disamb", "i_di");
            Disamb.IsNullable = true;
            Disamb.IsElastic  = true;

            Note            = new DomainProperty <string>("Note", "i_no");
            Note.IsNullable = true;

            ////

            FabName = new ApiProperty <string>("Name");
            FabName.SetOpenAccess();
            FabName.IsNullable   = true;
            FabName.LenMin       = 1;
            FabName.LenMax       = 128;
            FabName.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabName.TraversalHas = Matching.None;

            FabDisamb = new ApiProperty <string>("Disamb");
            FabDisamb.SetOpenAccess();
            FabDisamb.IsNullable   = true;
            FabDisamb.LenMin       = 1;
            FabDisamb.LenMax       = 128;
            FabDisamb.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabDisamb.TraversalHas = Matching.None;

            FabNote = new ApiProperty <string>("Note");
            FabNote.SetOpenAccess();
            FabNote.IsNullable   = true;
            FabNote.LenMin       = 1;
            FabNote.LenMax       = 256;
            FabNote.TraversalHas = Matching.None;

            ////

            FabNameMap   = new PropertyMapping <string, string>(Name, FabName);
            FabDisambMap = new PropertyMapping <string, string>(Disamb, FabDisamb);
            FabNoteMap   = new PropertyMapping <string, string>(Note, FabNote);
        }
Exemple #5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public AppSchema()
        {
            Names        = new NameProvider("App", "Apps", "p");
            GetAccess    = Access.All;
            CreateAccess = Access.Internal;
            DeleteAccess = Access.Internal;
            IsAbstract   = false;

            ////

            Name           = new DomainProperty <string>("Name", "p_na");
            Name.IsUnique  = true;
            Name.IsElastic = true;

            NameKey = new DomainProperty <string>("NameKey", "p_nk");
            NameKey.EnforceUnique = true;
            NameKey.ToLowerCase   = true;
            NameKey.IsIndexed     = true;
            Name.ExactIndexVia    = NameKey;

            Secret = new DomainProperty <string>("Secret", "p_se");

            OauthDomains            = new DomainProperty <string>("OauthDomains", "p_od");
            OauthDomains.IsNullable = true;

            ////

            FabName              = new ApiProperty <string>("Name");
            FabName.GetAccess    = Access.All;
            FabName.IsUnique     = true;
            FabName.LenMin       = 3;
            FabName.LenMax       = 64;
            FabName.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabName.TraversalHas = Matching.None;

            FabSecret            = new ApiProperty <string>("Secret");
            FabSecret.LenMin     = 32;
            FabSecret.LenMax     = 32;
            FabSecret.ValidRegex = ApiProperty.ValidCodeRegex;

            FabOauthDomains                  = new ApiProperty <string>("OauthDomains");
            FabOauthDomains.IsNullable       = true;
            FabOauthDomains.CustomValidation = true;

            ////

            FabNameMap = new PropertyMapping <string, string>(Name, FabName, CustomDir.ApiToDomain);
            FabNameMap.ApiToDomainNote = "Set Domain.NameKey = Api.Name.ToLower()";

            FabSecretMap = new PropertyMapping <string, string>(Secret, FabSecret);

            FabOauthDomainsMap = new PropertyMapping <string, string>(OauthDomains, FabOauthDomains);
        }
Exemple #6
0
        public static void Equal(ApiProperty expected, ApiProperty actual)
        {
            if (expected == null)
            {
                Assert.Null(actual);
                return;
            }
            Assert.NotNull(actual);

            Assert.Equal(expected.Name, actual.Name);
            ClrObjectAssert.Equal(expected.ValueAsObject(), actual.ValueAsObject());
        }
Exemple #7
0
        private static ApiProperty CreateApiPropertyFromDomAttribute(DomAttribute domAttribute)
        {
            Contract.Requires(domAttribute != null);

            var apiPropertyName        = domAttribute.ApiPropertyName;
            var domAttributeCollection = domAttribute.Nodes()
                                         .Cast <DomAttribute>()
                                         .ToList();
            var apiObject   = CreateApiObjectFromDomAttributeCollection(domAttributeCollection);
            var apiProperty = ApiProperty.Create(apiPropertyName, apiObject);

            return(apiProperty);
        }
Exemple #8
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public VertexSchema()
        {
            Names        = new NameProvider("Vertex", "Vertices", "v");
            GetAccess    = Access.All;
            CreateAccess = Access.Custom;
            DeleteAccess = Access.Custom;
            IsAbstract   = true;

            ////

            VertexId           = new DomainProperty <long>("VertexId", "v_id");
            VertexId.IsUnique  = true;
            VertexId.IsIndexed = true;

            Timestamp           = new DomainProperty <long>("Timestamp", "v_ts");
            Timestamp.IsElastic = true;

            VertexType = new DomainProperty <byte>("VertexType", "v_t");

            ////

            FabId              = new ApiProperty <long>("Id");
            FabId.GetAccess    = Access.All;
            FabId.CreateAccess = Access.None;
            FabId.ModifyAccess = Access.None;
            FabId.IsUnique     = true;
            FabId.TraversalHas = Matching.Exact;

            FabTimestamp              = new ApiProperty <long>("Timestamp");
            FabTimestamp.GetAccess    = Access.All;
            FabTimestamp.CreateAccess = Access.None;
            FabTimestamp.ModifyAccess = Access.None;
            FabTimestamp.TraversalHas = Matching.Custom;

            FabVertexType              = new ApiProperty <byte>("VertexType");
            FabVertexType.GetAccess    = Access.All;
            FabVertexType.CreateAccess = Access.None;
            FabVertexType.ModifyAccess = Access.None;
            FabVertexType.TraversalHas = Matching.Exact;
            FabVertexType.FromEnum     = "VertexType";

            ////

            FabIdMap = new PropertyMapping <long, long>(VertexId, FabId);

            FabTimestampMap = new PropertyMapping <long, long>(Timestamp, FabTimestamp, CustomDir.Both);
            FabTimestampMap.ApiToDomainNote = "Convert Api.Timestamp from Unix-based seconds.";
            FabTimestampMap.DomainToApiNote = "Convert Domain.Timestamp to Unix-based seconds.";

            FabVertexTypeMap = new PropertyMapping <byte, byte>(VertexType, FabVertexType);
        }
Exemple #9
0
        // PRIVATE METHODS //////////////////////////////////////////////////
        #region Methods
        private static DomAttribute CreateFromClrAttribute(IAttributeInfo attributeInfo, object clrAttribute)
        {
            Contract.Requires(attributeInfo != null);

            var apiPropertyName = attributeInfo.ApiPropertyName;
            var clrPropertyName = attributeInfo.ClrPropertyName;
            var clrPropertyType = attributeInfo.ClrPropertyType;

            var apiAttribute = ApiProperty.Create(apiPropertyName, clrPropertyType, clrAttribute);

            var domAttribute = new DomAttribute(apiAttribute, apiPropertyName, clrAttribute, clrPropertyName, clrPropertyType);

            return(domAttribute);
        }
Exemple #10
0
        // PRIVATE CONSTRUCTORS /////////////////////////////////////////////
        #region Constructors
        private DomAttribute(ApiProperty apiAttribute, string apiPropertyName, object clrAttribute, string clrPropertyName, Type clrPropertyType)
        {
            Contract.Requires(apiAttribute != null);
            Contract.Requires(String.IsNullOrWhiteSpace(apiPropertyName) == false);
            Contract.Requires(clrAttribute != null);
            Contract.Requires(String.IsNullOrWhiteSpace(clrPropertyName) == false);
            Contract.Requires(clrPropertyType != null);

            this.ApiAttribute    = apiAttribute;
            this.ApiPropertyName = apiPropertyName;

            this.ClrAttribute    = clrAttribute;
            this.ClrPropertyName = clrPropertyName;
            this.ClrPropertyType = clrPropertyType;
        }
Exemple #11
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        protected EdgeSchema(Type pOutVertexType, Type pInVertexType, EdgeQuantity pQuantity)
        {
            FromVertexType = pOutVertexType;
            ToVertexType   = pInVertexType;
            Quantity       = pQuantity;
            Sort           = SortType.None;

            ToVertexId          = new DomainProperty <long>("VertexId", "N/A");
            ToVertexId.IsUnique = true;

            FabToVertexId              = new ApiProperty <long>("VertexId");
            FabToVertexId.IsUnique     = true;
            FabToVertexId.CreateAccess = Access.Internal;
            FabToVertexId.TraversalHas = Matching.Exact;
        }
        public ApiPropertyDto GetApiProperty(int?id)
        {
            ApiPropertyDto apiPropertyDto = new ApiPropertyDto();

            if (!id.HasValue && id.GetValueOrDefault() <= 0)
            {
                return(apiPropertyDto);
            }
            ApiProperty apiProperty = this.Session.Get <ApiProperty>(id.Value);

            if (apiProperty == null)
            {
                return(apiPropertyDto);
            }
            return(apiProperty.ToModel());
        }
Exemple #13
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public UserSchema()
        {
            Names        = new NameProvider("User", "Users", "u");
            GetAccess    = Access.All;
            CreateAccess = Access.Internal;
            DeleteAccess = Access.Internal;
            IsAbstract   = false;

            ////

            Name           = new DomainProperty <string>("Name", "u_na");
            Name.IsUnique  = true;
            Name.IsElastic = true;

            NameKey = new DomainProperty <string>("NameKey", "u_nk");
            NameKey.EnforceUnique = true;
            NameKey.ToLowerCase   = true;
            NameKey.IsIndexed     = true;
            Name.ExactIndexVia    = NameKey;

            Password = new DomainProperty <string>("Password", "u_pa");

            ////

            FabName              = new ApiProperty <string>("Name");
            FabName.GetAccess    = Access.All;
            FabName.IsUnique     = true;
            FabName.LenMin       = 3;
            FabName.LenMax       = 64;
            FabName.ValidRegex   = ApiProperty.ValidUserRegex;
            FabName.TraversalHas = Matching.None;

            FabPassword            = new ApiProperty <string>("Password");
            FabPassword.LenMin     = 8;
            FabPassword.LenMax     = 128;
            FabPassword.ValidRegex = ApiProperty.ValidCodeRegex;

            ////

            FabNameMap = new PropertyMapping <string, string>(Name, FabName, CustomDir.ApiToDomain);
            FabNameMap.ApiToDomainNote = "Set Domain.NameKey = Api.Name.ToLower()";
            FabNameMap.DomainToApiNote = "Direct mapping.";

            FabPasswordMap = new PropertyMapping <string, string>(Password, FabPassword, CustomDir.Both);
            FabPasswordMap.ApiToDomainNote = "Encrypt Api.Password.";
            FabPasswordMap.DomainToApiNote = "Direct mapping.";
        }
Exemple #14
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public OauthAccessSchema()
        {
            Names        = new NameProvider("OauthAccess", "OauthAccesses", "oa");
            GetAccess    = Access.Internal;
            CreateAccess = Access.Internal;
            DeleteAccess = Access.Internal;
            IsAbstract   = false;

            ////

            Token            = new DomainProperty <string>("Token", "oa_to");
            Token.IsUnique   = true;
            Token.IsNullable = true;
            Token.IsIndexed  = true;

            Refresh            = new DomainProperty <string>("Refresh", "oa_re");
            Refresh.IsUnique   = true;
            Refresh.IsNullable = true;
            Refresh.IsIndexed  = true;

            Expires = new DomainProperty <long>("Expires", "oa_ex");

            ////

            FabToken            = new ApiProperty <string>("Token");
            FabToken.IsNullable = true;
            FabToken.IsUnique   = true;
            FabToken.LenMin     = 32;
            FabToken.LenMax     = 32;
            FabToken.ValidRegex = ApiProperty.ValidCodeRegex;

            FabRefresh            = new ApiProperty <string>("Refresh");
            FabRefresh.IsNullable = true;
            FabRefresh.IsUnique   = true;
            FabRefresh.LenMin     = 32;
            FabRefresh.LenMax     = 32;
            FabRefresh.ValidRegex = ApiProperty.ValidCodeRegex;

            FabExpires = new ApiProperty <long>("Expires");

            ////

            FabTokenMap   = new PropertyMapping <string, string>(Token, FabToken);
            FabRefreshMap = new PropertyMapping <string, string>(Refresh, FabRefresh);
            FabExpiresMap = new PropertyMapping <long, long>(Expires, FabExpires);
        }
        // PUBLIC METHODS ///////////////////////////////////////////////////
        #region Assert Methods
        public static void Equal(ApiProperty expected, DomNode actual)
        {
            if (expected == null)
            {
                Assert.Null(actual);
                return;
            }

            Assert.NotNull(actual);

            Assert.Equal(DomNodeType.Attribute, actual.NodeType);

            var actualDomAttribute = (DomAttribute)actual;
            var actualApiAttribute = actualDomAttribute.ApiAttribute;

            ClrObjectAssert.Equal(expected, actualApiAttribute);
        }
        public void UpdateApiProperty(int id, ApiPropertyDto apiPropertyDto)
        {
            var transaction = this.Session.BeginTransaction();

            try
            {
                ApiProperty apiProperty = this.Session.Get <ApiProperty>(id);
                apiProperty = apiPropertyDto.ToEntity(apiProperty);
                this.Session.Update(apiProperty);

                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                throw ex;
            }
        }
Exemple #17
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public UrlSchema()
        {
            Names        = new NameProvider("Url", "Urls", "r");
            GetAccess    = Access.All;
            CreateAccess = Access.All;
            DeleteAccess = Access.CreatorUserAndApp;
            IsAbstract   = false;

            ////

            Name            = new DomainProperty <string>("Name", "r_na");
            Name.IsNullable = true;
            Name.IsElastic  = true;

            FullPath = new DomainProperty <string>("FullPath", "r_fp");
            FullPath.EnforceUnique = true;
            FullPath.ToLowerCase   = true;
            FullPath.IsIndexed     = true;

            ////

            FabName = new ApiProperty <string>("Name");
            FabName.SetOpenAccess();
            FabName.IsNullable   = true;
            FabName.LenMin       = 1;
            FabName.LenMax       = 128;
            FabName.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabName.TraversalHas = Matching.None;

            FabFullPath = new ApiProperty <string>("FullPath");
            FabFullPath.SetOpenAccess();
            FabFullPath.IsUnique     = true;
            FabFullPath.ToLowerCase  = true;
            FabFullPath.LenMin       = 1;
            FabFullPath.LenMax       = 2048;
            FabFullPath.TraversalHas = Matching.None;

            ////

            FabNameMap     = new PropertyMapping <string, string>(Name, FabName);
            FabFullPathMap = new PropertyMapping <string, string>(FullPath, FabFullPath);
        }
Exemple #18
0
        // PUBLIC METHODS ///////////////////////////////////////////////////
        #region Assert Methods
        public static void Equal(ApiProperty expected, JToken actualJToken)
        {
            // Handle when 'expected' is null.
            if (expected == null)
            {
                ClrObjectAssert.IsNull(actualJToken);
                return;
            }

            // Handle when 'expected' is not null.
            Assert.NotNull(actualJToken);

            var actualJTokenType = actualJToken.Type;

            Assert.Equal(JTokenType.Property, actualJTokenType);

            var actualJProperty = (JProperty)actualJToken;

            Assert.Equal(expected.Name, actualJProperty.Name);
            ClrObjectAssert.Equal(expected.ValueAsObject(), actualJProperty.Value);
        }
Exemple #19
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public EmailSchema()
        {
            Names        = new NameProvider("Email", "Emails", "e");
            GetAccess    = Access.Internal;
            CreateAccess = Access.Internal;
            DeleteAccess = Access.Internal;
            IsAbstract   = false;

            ////

            Address             = new DomainProperty <string>("Address", "e_ad");
            Address.ToLowerCase = true;
            Address.IsIndexed   = true;

            Code = new DomainProperty <string>("Code", "e_co");

            Verified = new DomainProperty <bool>("Verified", "e_ve");

            ////

            FabAddress             = new ApiProperty <string>("Address");
            FabAddress.LenMin      = 1;
            FabAddress.LenMax      = 256;
            FabAddress.ToLowerCase = true;
            FabAddress.ValidRegex  = ApiProperty.ValidEmailRegex;

            FabCode            = new ApiProperty <string>("Code");
            FabCode.LenMin     = 32;
            FabCode.LenMax     = 32;
            FabCode.ValidRegex = ApiProperty.ValidCodeRegex;

            FabVerified = new ApiProperty <bool>("Verified");

            ////

            FabAddressMap  = new PropertyMapping <string, string>(Address, FabAddress);
            FabCodeMap     = new PropertyMapping <string, string>(Code, FabCode);
            FabVerifiedMap = new PropertyMapping <bool, bool>(Verified, FabVerified);
        }
Exemple #20
0
        private static ApiObject CreateApiObjectFromDomAttributeCollection(IEnumerable <DomAttribute> domAttributeCollection)
        {
            Contract.Requires(domAttributeCollection != null);

            var apiProperties = domAttributeCollection
                                .Select(domAttribute =>
            {
                if (!domAttribute.HasNodes())
                {
                    // Simple attribute, has no children.
                    return(domAttribute.ApiAttribute);
                }

                // Complex attribute or collection of Complex attribute
                var isCollection = domAttribute.FirstNode.NodeType == DomNodeType.Index;
                if (isCollection)
                {
                    // Collection of Complex attributes, has children of DomIndex.
                    var domIndexCollection = domAttribute.Nodes()
                                             .Cast <DomIndex>()
                                             .ToList();

                    var apiObjectArray = domIndexCollection.Select(CreateApiObjectFromDomIndex)
                                         .ToArray();

                    var apiPropertyName = domAttribute.ApiPropertyName;
                    var apiProperty     = ApiProperty.Create(apiPropertyName, apiObjectArray);
                    return(apiProperty);
                }

                // Complex attribute, children are DomAttribute nodes.
                return(CreateApiPropertyFromDomAttribute(domAttribute));
            })
                                .ToList();

            var apiObject = new ApiObject(apiProperties);

            return(apiObject);
        }
        private void SaveProperty(ApiProperty property, ApiPropertyEntity apiPropertyEntity)
        {
            using (DatabaseContext context = CreateDatabaseContext())
            {
                VApiProperty existingProperty = context.ApiProperty.Find(property.PropertyId);

                if (existingProperty == null)
                {
                    context.ApiProperty.Add(new VApiProperty
                    {
                        ApiPropertyId   = property.PropertyId,
                        PropertyId      = apiPropertyEntity.PropertyId.Value,
                        LastChangedDate = property.DateLastModified
                    });
                }
                else
                {
                    existingProperty.LastChangedDate = property.DateLastModified;
                }

                context.SaveChanges();
            }
        }
 public static ApiPropertyDto ToModel(this ApiProperty apiProperty)
 {
     return(Mapper.Map <ApiProperty, ApiPropertyDto>(apiProperty));
 }
Exemple #23
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public MemberSchema()
        {
            Names        = new NameProvider("Member", "Members", "m");
            GetAccess    = Access.All;
            CreateAccess = Access.All;
            DeleteAccess = Access.CreatorApp;
            IsAbstract   = false;
            CustomCreate = true;

            ////

            MemberType = new DomainProperty <byte>("MemberType", "m_mt");

            OauthScopeAllow            = new DomainProperty <bool>("OauthScopeAllow", "m_osa");
            OauthScopeAllow.IsNullable = true;

            OauthGrantRedirectUri             = new DomainProperty <string>("OauthGrantRedirectUri", "m_ogr");
            OauthGrantRedirectUri.IsNullable  = true;
            OauthGrantRedirectUri.ToLowerCase = true;

            OauthGrantCode            = new DomainProperty <string>("OauthGrantCode", "m_ogc");
            OauthGrantCode.IsNullable = true;
            OauthGrantCode.IsUnique   = true;
            OauthGrantCode.IsIndexed  = true;

            OauthGrantExpires            = new DomainProperty <long>("OauthGrantExpires", "m_oge");
            OauthGrantExpires.IsNullable = true;

            ////

            FabMemberType = new ApiProperty <byte>("Type");
            FabMemberType.SetOpenAccess();
            FabMemberType.FromEnum = "MemberType";

            FabOauthScopeAllow            = new ApiProperty <bool>("OauthScopeAllow");
            FabOauthScopeAllow.IsNullable = true;

            FabOauthGrantRedirectUri             = new ApiProperty <string>("OauthGrantRedirectUri");
            FabOauthGrantRedirectUri.LenMin      = 1;
            FabOauthGrantRedirectUri.LenMax      = 1024;
            FabOauthGrantRedirectUri.ToLowerCase = true;
            FabOauthGrantRedirectUri.IsNullable  = true;

            FabOauthGrantCode            = new ApiProperty <string>("OauthGrantCode");
            FabOauthGrantCode.LenMin     = 32;
            FabOauthGrantCode.LenMax     = 32;
            FabOauthGrantCode.ValidRegex = ApiProperty.ValidCodeRegex;
            FabOauthGrantCode.IsNullable = true;

            FabOauthGrantExpires            = new ApiProperty <long>("OauthGrantExpires");
            FabOauthGrantExpires.IsNullable = true;

            ////

            FabMemberTypeMap      = new PropertyMapping <byte, byte>(MemberType, FabMemberType);
            FabOauthScopeAllowMap = new PropertyMapping <bool, bool>(
                OauthScopeAllow, FabOauthScopeAllow);
            FabOauthGrantRedirectUriMap = new PropertyMapping <string, string>(
                OauthGrantRedirectUri, FabOauthGrantRedirectUri);
            FabOauthGrantCodeMap = new PropertyMapping <string, string>(
                OauthGrantCode, FabOauthGrantCode);
            FabOauthGrantExpiresMap = new PropertyMapping <long, long>(
                OauthGrantExpires, FabOauthGrantExpires);
        }
 public void Save(ApiProperty property, ApiPropertyEntity apiPropertyEntity)
 {
     SaveBranch(apiPropertyEntity.Branch);
     _propertyDataProvider.Save(apiPropertyEntity);
     SaveProperty(property, apiPropertyEntity);
 }
 public static ApiProperty ToEntity(this ApiPropertyDto apiPropertyDto, ApiProperty apiProperty = null)
 {
     return(Mapper.Map <ApiPropertyDto, ApiProperty>(apiPropertyDto, apiProperty));
 }
Exemple #26
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public FactorSchema()
        {
            Names        = new NameProvider("Factor", "Factors", "f");
            GetAccess    = Access.All;
            CreateAccess = Access.All;
            DeleteAccess = Access.CreatorUserAndApp;
            IsAbstract   = false;
            CustomCreate = true;

            ////

            AssertionType = new DomainProperty <byte>("AssertionType", "f_at");

            IsDefining = new DomainProperty <bool>("IsDefining", "f_de");

            Note            = new DomainProperty <string>("Note", "f_no");
            Note.IsNullable = true;

            DescriptorType = new DomainProperty <byte>("DescriptorType", "f_det");

            DirectorType            = new DomainProperty <byte>("DirectorType", "f_dit");
            DirectorType.IsNullable = true;

            DirectorPrimaryAction            = new DomainProperty <byte>("DirectorPrimaryAction", "f_dip");
            DirectorPrimaryAction.IsNullable = true;

            DirectorRelatedAction            = new DomainProperty <byte>("DirectorRelatedAction", "f_dir");
            DirectorRelatedAction.IsNullable = true;

            EventorType            = new DomainProperty <byte>("EventorType", "f_evt");
            EventorType.IsNullable = true;

            EventorDateTime            = new DomainProperty <long>("EventorDateTime", "f_evd");
            EventorDateTime.IsNullable = true;

            IdentorType            = new DomainProperty <byte>("IdentorType", "f_idt");
            IdentorType.IsNullable = true;

            IdentorValue            = new DomainProperty <string>("IdentorValue", "f_idv");
            IdentorValue.IsNullable = true;
            IdentorValue.IsIndexed  = true;
            IdentorValue.IsElastic  = true;

            LocatorType            = new DomainProperty <byte>("LocatorType", "f_lot");
            LocatorType.IsNullable = true;

            LocatorValueX            = new DomainProperty <double>("LocatorValueX", "f_lox");
            LocatorValueX.IsNullable = true;

            LocatorValueY            = new DomainProperty <double>("LocatorValueY", "f_loy");
            LocatorValueY.IsNullable = true;

            LocatorValueZ            = new DomainProperty <double>("LocatorValueZ", "f_loz");
            LocatorValueZ.IsNullable = true;

            VectorType            = new DomainProperty <byte>("VectorType", "f_vet");
            VectorType.IsNullable = true;

            VectorUnit            = new DomainProperty <byte>("VectorUnit", "f_veu");
            VectorUnit.IsNullable = true;

            VectorUnitPrefix            = new DomainProperty <byte>("VectorUnitPrefix", "f_vep");
            VectorUnitPrefix.IsNullable = true;

            VectorValue            = new DomainProperty <long>("VectorValue", "f_vev");
            VectorValue.IsNullable = true;

            ////

            FabAssertionType = new ApiProperty <byte>("AssertionType");
            FabAssertionType.SetOpenUnmodAccess();
            FabAssertionType.FromEnum = "FactorAssertion";

            FabIsDefining = new ApiProperty <bool>("IsDefining");
            FabIsDefining.SetOpenUnmodAccess();

            FabNote = new ApiProperty <string>("Note");
            FabNote.SetOpenUnmodAccess();
            FabNote.IsNullable   = true;
            FabNote.LenMin       = 1;
            FabNote.LenMax       = 256;
            FabNote.TraversalHas = Matching.None;

            FabDescriptorType = new ApiProperty <byte>("Type");
            FabDescriptorType.SetOpenUnmodAccess();
            FabDescriptorType.SubObjectOf = "FabDescriptor";
            FabDescriptorType.FromEnum    = "DescriptorType";

            FabDirectorType = new ApiProperty <byte>("Type");
            FabDirectorType.SetOpenUnmodAccess();
            FabDirectorType.SubObjectOf = "FabDirector";
            FabDirectorType.FromEnum    = "DirectorType";

            FabDirectorPrimaryAction = new ApiProperty <byte>("PrimaryAction");
            FabDirectorPrimaryAction.SetOpenUnmodAccess();
            FabDirectorPrimaryAction.SubObjectOf = "FabDirector";
            FabDirectorPrimaryAction.FromEnum    = "DirectorAction";

            FabDirectorRelatedAction = new ApiProperty <byte>("RelatedAction");
            FabDirectorRelatedAction.SetOpenUnmodAccess();
            FabDirectorRelatedAction.SubObjectOf = "FabDirector";
            FabDirectorRelatedAction.FromEnum    = "DirectorAction";

            FabEventorType = new ApiProperty <byte>("Type");
            FabEventorType.SetOpenUnmodAccess();
            FabEventorType.SubObjectOf = "FabEventor";
            FabEventorType.FromEnum    = "EventorType";

            FabEventorYear = new ApiProperty <long>("Year");
            FabEventorYear.SetOpenUnmodAccess();
            FabEventorYear.SubObjectOf      = "FabEventor";
            FabEventorYear.Min              = -100000000000;
            FabEventorYear.Max              = 100000000000;
            FabEventorYear.CustomValidation = true;
            FabEventorYear.TraversalHas     = Matching.Custom;

            FabEventorMonth = new ApiProperty <byte>("Month");
            FabEventorMonth.SetOpenUnmodAccess();
            FabEventorMonth.SubObjectOf  = "FabEventor";
            FabEventorMonth.IsNullable   = true;
            FabEventorMonth.Min          = 1;
            FabEventorMonth.Max          = 12;
            FabEventorMonth.TraversalHas = Matching.Custom;

            FabEventorDay = new ApiProperty <byte>("Day");
            FabEventorDay.SetOpenUnmodAccess();
            FabEventorDay.SubObjectOf  = "FabEventor";
            FabEventorDay.IsNullable   = true;
            FabEventorDay.Min          = 0;
            FabEventorDay.Max          = 31;
            FabEventorDay.TraversalHas = Matching.Custom;

            FabEventorHour = new ApiProperty <byte>("Hour");
            FabEventorHour.SetOpenUnmodAccess();
            FabEventorHour.SubObjectOf  = "FabEventor";
            FabEventorHour.IsNullable   = true;
            FabEventorHour.Min          = 0;
            FabEventorHour.Max          = 23;
            FabEventorHour.TraversalHas = Matching.Custom;

            FabEventorMinute = new ApiProperty <byte>("Minute");
            FabEventorMinute.SetOpenUnmodAccess();
            FabEventorMinute.SubObjectOf  = "FabEventor";
            FabEventorMinute.IsNullable   = true;
            FabEventorMinute.Min          = 0;
            FabEventorMinute.Max          = 59;
            FabEventorMinute.TraversalHas = Matching.Custom;

            FabEventorSecond = new ApiProperty <byte>("Second");
            FabEventorSecond.SetOpenUnmodAccess();
            FabEventorSecond.SubObjectOf  = "FabEventor";
            FabEventorSecond.IsNullable   = true;
            FabEventorSecond.Min          = 0;
            FabEventorSecond.Max          = 59;
            FabEventorSecond.TraversalHas = Matching.Custom;

            FabIdentorType = new ApiProperty <byte>("Type");
            FabIdentorType.SetOpenUnmodAccess();
            FabIdentorType.SubObjectOf = "FabIdentor";
            FabIdentorType.FromEnum    = "IdentorType";

            FabIdentorValue = new ApiProperty <string>("Value");
            FabIdentorValue.SetOpenUnmodAccess();
            FabIdentorValue.SubObjectOf = "FabIdentor";
            FabIdentorValue.IsNullable  = true;
            FabIdentorValue.LenMin      = 1;
            FabIdentorValue.LenMax      = 256;

            FabLocatorType = new ApiProperty <byte>("Type");
            FabLocatorType.SetOpenUnmodAccess();
            FabLocatorType.SubObjectOf = "FabLocator";
            FabLocatorType.FromEnum    = "LocatorType";

            FabLocatorValueX = new ApiProperty <double>("ValueX");
            FabLocatorValueX.SetOpenUnmodAccess();
            FabLocatorValueX.SubObjectOf      = "FabLocator";
            FabLocatorValueX.CustomValidation = true;

            FabLocatorValueY = new ApiProperty <double>("ValueY");
            FabLocatorValueY.SetOpenUnmodAccess();
            FabLocatorValueY.SubObjectOf      = "FabLocator";
            FabLocatorValueY.CustomValidation = true;

            FabLocatorValueZ = new ApiProperty <double>("ValueZ");
            FabLocatorValueZ.SetOpenUnmodAccess();
            FabLocatorValueZ.SubObjectOf      = "FabLocator";
            FabLocatorValueZ.CustomValidation = true;

            FabVectorType = new ApiProperty <byte>("Type");
            FabVectorType.SetOpenUnmodAccess();
            FabVectorType.SubObjectOf = "FabVector";
            FabVectorType.FromEnum    = "VectorType";

            FabVectorUnit = new ApiProperty <byte>("Unit");
            FabVectorUnit.SetOpenUnmodAccess();
            FabVectorUnit.SubObjectOf = "FabVector";
            FabVectorUnit.FromEnum    = "VectorUnit";

            FabVectorUnitPrefix = new ApiProperty <byte>("UnitPrefix");
            FabVectorUnitPrefix.SetOpenUnmodAccess();
            FabVectorUnitPrefix.SubObjectOf = "FabVector";
            FabVectorUnitPrefix.FromEnum    = "VectorUnitPrefix";

            FabVectorValue = new ApiProperty <long>("Value");
            FabVectorValue.SetOpenUnmodAccess();
            FabVectorValue.SubObjectOf      = "FabVector";
            FabVectorValue.CustomValidation = true;

            ////

            FabAssertionTypeMap         = new PropertyMapping <byte, byte>(AssertionType, FabAssertionType);
            FabIsDefiningMap            = new PropertyMapping <bool, bool>(IsDefining, FabIsDefining);
            FabNoteMap                  = new PropertyMapping <string, string>(Note, FabNote);
            FabDescriptorTypeMap        = new PropertyMapping <byte, byte>(DescriptorType, FabDescriptorType);
            FabDirectorTypeMap          = new PropertyMapping <byte, byte>(DirectorType, FabDirectorType);
            FabDirectorPrimaryActionMap = new PropertyMapping <byte, byte>(
                DirectorPrimaryAction, FabDirectorPrimaryAction);
            FabDirectorRelatedActionMap = new PropertyMapping <byte, byte>(
                DirectorRelatedAction, FabDirectorRelatedAction);
            FabEventorTypeMap = new PropertyMapping <byte, byte>(EventorType, FabEventorType);
            FabEventorYearMap = new PropertyMapping <long, long>(EventorDateTime, FabEventorYear,
                                                                 CustomDir.Both);
            FabEventorYearMap.ApiToDomainNote = "Set Domain.EventorDateTime using Api.Year/Month/etc.";
            FabEventorYearMap.DomainToApiNote = "Set Api.Year/Momth/etc. using Domain.EventorDateTime.";
            FabEventorMonthMap = new PropertyMapping <long, byte>(
                EventorDateTime, FabEventorMonth, CustomDir.Both);
            FabEventorDayMap = new PropertyMapping <long, byte>(
                EventorDateTime, FabEventorDay, CustomDir.Both);
            FabEventorHourMap = new PropertyMapping <long, byte>(
                EventorDateTime, FabEventorHour, CustomDir.Both);
            FabEventorMinuteMap = new PropertyMapping <long, byte>(
                EventorDateTime, FabEventorMinute, CustomDir.Both);
            FabEventorSecondMap = new PropertyMapping <long, byte>(
                EventorDateTime, FabEventorSecond, CustomDir.Both);
            FabIdentorTypeMap      = new PropertyMapping <byte, byte>(IdentorType, FabIdentorType);
            FabIdentorValueMap     = new PropertyMapping <string, string>(IdentorValue, FabIdentorValue);
            FabLocatorTypeMap      = new PropertyMapping <byte, byte>(LocatorType, FabLocatorType);
            FabLocatorValueXMap    = new PropertyMapping <double, double>(LocatorValueX, FabLocatorValueX);
            FabLocatorValueYMap    = new PropertyMapping <double, double>(LocatorValueY, FabLocatorValueY);
            FabLocatorValueZMap    = new PropertyMapping <double, double>(LocatorValueZ, FabLocatorValueZ);
            FabVectorTypeMap       = new PropertyMapping <byte, byte>(VectorType, FabVectorType);
            FabVectorUnitMap       = new PropertyMapping <byte, byte>(VectorUnit, FabVectorUnit);
            FabVectorUnitPrefixMap = new PropertyMapping <byte, byte>(
                VectorUnitPrefix, FabVectorUnitPrefix);
            FabVectorValueMap = new PropertyMapping <long, long>(VectorValue, FabVectorValue);
        }