Beispiel #1
0
        public ITypeToken Get(IOrientObject object_)
        {
            ITypeToken token_ = null;

            types.TryGetValue(object_.GetType(), out token_);

            return(token_);
        }
Beispiel #2
0
        public ITypeToken GetBase(IOrientObject object_)
        {
            ITypeToken    token_ = null;
            Type          tp     = object_.GetType().BaseType;
            IOrientObject t2     = (IOrientObject)object_;

            types.TryGetValue(object_.GetType().BaseType, out token_);


            return(token_);
        }
Beispiel #3
0
        //property add
        public List <ITypeToken> Command(ITypeToken command_, IOrientObject orientObject, IOrientObject orientClass_, ITypeToken orientTypeClass_, bool mandatory = false, bool notNull = false)
        {
            List <ITypeToken> result = new List <ITypeToken>();

            if (command_ is OrientCreateToken && orientObject is OrientProperty && orientClass_ is OrientClass)
            {
                result.Add(command_);
                result.Add(new OrientPropertyToken());
                result.Add(typeConverter.Get(orientObject));
                result.Add(new OrientDotToken());
                result.Add(typeConverter.Get(orientClass_));
            }
            if (mandatory)
            {
                //add itypetokens
            }
            return(result);
        }
Beispiel #4
0
        //for create (Class,Vertex) command
        public List <ITypeToken> Command(ITypeToken command_, IOrientObject orientObject, ITypeToken orientContext = null)
        {
            List <ITypeToken> result = new List <ITypeToken>();

            if (command_ is OrientCreateToken)
            {
                result.Add(command_);
                result.Add(typeConverter.GetBase(orientObject));
                result.Add(typeConverter.Get(orientObject));

                if (orientContext != null)
                {
                    if (orientObject is OrientClass)
                    {
                        result.Add(new OrientExtendsToken());
                    }
                    if (orientObject is OrientVertex)
                    {
                        result.Add(new OrientContentToken());
                        result.Add(orientContext);
                    }
                }
            }
            if (command_ is OrientDeleteToken)
            {
                result.Add(command_);
                if (orientObject is OrientClass)
                {
                    result.Add(new OrientClassToken());
                    result.Add(typeConverter.Get(orientObject));
                }
                if (orientObject is OrientVertex || orientObject is OrientEdge)
                {
                    result.Add(typeConverter.GetBase(orientObject));
                    result.Add(typeConverter.Get(orientObject));
                    if (orientContext != null)
                    {
                        result.Add(new OrientWhereToken());
                        result.Add(orientContext);
                    }
                }
            }
            return(result);
        }
Beispiel #5
0
        public string Add(IOrientObject obj_)
        {
            string            content   = jm.SerializeObject(obj_);
            List <ITypeToken> commandTk = tb.Command(new OrientCreateToken(), obj_, obj_, new TextToken()
            {
                Text = content
            });
            string command = txb.Build(commandTk, new OrientCreateVertexCluaseFormat());

            queryUrl = CommandUrl + "/" + command;

            owm.Authenticate(AuthUrl,
                             new NetworkCredential(ConfigurationManager.AppSettings["ParentLogin"], ConfigurationManager.AppSettings["ParentPassword"]));

            string resp =
                ir.ReadResponse(
                    owm.GetResponse(queryUrl, new POST().Text)
                    );

            return(resp);
        }
Beispiel #6
0
        //add edge with IDs
        public List <ITypeToken> Command(ITypeToken command_, IOrientObject orientObject, ITypeToken from, ITypeToken to, ITypeToken orientContext = null)
        {
            List <ITypeToken> result = new List <ITypeToken>();

            if (command_ is OrientCreateToken)
            {
                result.Add(command_);
                if (orientObject is OrientEdge)
                {
                    result.Add(typeConverter.GetBase(orientObject));
                    result.Add(typeConverter.Get(orientObject));
                    result.Add(new OrientFromToken());
                    result.Add(from);
                    result.Add(new OrientToToken());
                    result.Add(to);
                    if (orientContext != null)
                    {
                        result.Add(new OrientContentToken());
                        result.Add(orientContext);
                    }
                }
            }
            return(result);
        }