Exemplo n.º 1
0
        private bool saveFieldSchema(WSMemberSchema field, bool replace, ref WSFieldFilters filters)
        {
            if (field != null)
            {
                Func <WSMemberSchema, bool> func = x => x is WSFieldSchema && ((WSFieldSchema)x).param.Match(field.Name);
                if (!filters.Any(func))
                {
                    filters.Add(field);
                }
                else
                {
                    if (replace)
                    {
                        /*  TODO@ANDVO : 2016-03-08 : combine redundant field's options somehow,... (when field used more than once in schema)
                         *   fx.: 'userid:{less:10}&schema={user:[*,{userid:{more:1}}]}'
                         *   note: ofcourse we can combine them like: 'schema={user:[*,{userid:{less:10,more:1}}]}',
                         *   but what if there will be need for option's separation as : AND <-> OR?
                         */

                        filters[filters.IndexOf(filters.FirstOrDefault(func))] = field;
                    }
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        private void proceedFieldFilter(WSJValue jField, ref WSFieldFilters filters)
        {
            bool replace = true;
            List <WSMemberSchema> schemas = readFieldSchema(jField, out replace);

            if (schemas != null && schemas.Any())
            {
                foreach (WSMemberSchema schema in schemas)
                {
                    saveFieldSchema(schema, replace, ref filters);
                }
            }
            else
            {
                IOBaseOptions.Save(jField);
            }
        }
Exemplo n.º 3
0
        private void proceedFieldFilter(WSJProperty jField, ref WSFieldFilters filters)
        {
            bool replace = true;
            List <WSMemberSchema> schemas = readFieldSchema(jField, out replace);

            if (schemas.Any())
            {
                foreach (WSMemberSchema schema in schemas)
                {
                    saveFieldSchema(schema, replace, ref filters);
                }
            }
            else
            {
                IOBaseOptions.Save(new WSJObject(new List <WSJProperty> {
                    jField
                }));
            }
        }
Exemplo n.º 4
0
 private void proceedFieldFilter(WSJson json, ref WSFieldFilters filters)
 {
     if (json is WSJValue)
     {
         proceedFieldFilter((WSJValue)json, ref filters);
     }
     else if (json is WSJProperty)
     {
         proceedFieldFilter((WSJProperty)json, ref filters);
     }
     else if (json is WSJObject)
     {
         proceedFieldFilter((WSJObject)json, ref filters);
     }
     else if (json is WSJArray)
     {
         proceedFieldFilter((WSJArray)json, ref filters);
     }
 }
Exemplo n.º 5
0
        internal WSFieldFilters Clone(WSTableSource src)
        {
            WSFieldFilters filters = new WSFieldFilters()
            {
                CombineMode = CombineMode
            };

            foreach (WSMemberSchema i in this)
            {
                if (i is WSPrimitiveFieldSchema)
                {
                    filters.Add(((WSPrimitiveFieldSchema)i).Clone(src));
                }
                else if (i is WSEntityFieldSchema)
                {
                    filters.Add(((WSEntityFieldSchema)i).Clone(src));
                }
            }
            return(filters);
        }
Exemplo n.º 6
0
 private void proceedFieldFilter(WSJArray jArr, ref WSFieldFilters filters)
 {
     proceedFieldFilter(jArr.Value[0], ref filters);
 }
Exemplo n.º 7
0
 private void proceedFieldFilter(WSJObject jObj, ref WSFieldFilters filters)
 {
     //TODO@ANDVO : make it possible to add all comming properties!!!
     proceedFieldFilter(jObj.Value[0], ref filters);
 }