当前位置: 首页>>代码示例>>C#>>正文


C# Security.SecurityToken类代码示例

本文整理汇总了C#中sones.Library.Commons.Security.SecurityToken的典型用法代码示例。如果您正苦于以下问题:C# SecurityToken类的具体用法?C# SecurityToken怎么用?C# SecurityToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SecurityToken类属于sones.Library.Commons.Security命名空间,在下文中一共展示了SecurityToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetResult

        public override QueryResult GetResult(
            GQLPluginManager myPluginManager,
            IGraphDB myGraphDB,
            SecurityToken mySecurityToken,
            TransactionToken myTransactionToken)
        {
            var resultingVertices = new List<IVertexView>();
            ASonesException error = null;

            #region Specific index

            var request = new RequestDescribeIndex(_TypeName, _IndexName, _IndexEdition);

            var indices = myGraphDB.DescribeIndex<IEnumerable<IIndexDefinition>>(mySecurityToken, myTransactionToken, request, (stats, definitions) => definitions);

            if (indices == null)
            {
                error = new IndexTypeDoesNotExistException(_TypeName, _IndexName);
            }

            if (String.IsNullOrEmpty(_IndexEdition))
            {
                //_IndexEdition = DBConstants.DEFAULTINDEX;
            }

            resultingVertices = new List<IVertexView>() { GenerateOutput(indices, _IndexName) };

            #endregion

            if(error != null)
                return new QueryResult("", SonesGQLConstants.GQL, 0L, ResultType.Failed, resultingVertices, error);
            else
                return new QueryResult("", SonesGQLConstants.GQL, 0L, ResultType.Successful, resultingVertices);
        }
开发者ID:loubo,项目名称:sones,代码行数:34,代码来源:DescribeIndexDefinition.cs

示例2: Clear

 public List<Int64> Clear(SecurityToken mySecurityToken, Int64 myTransactionToken)
 {
     var Request = ServiceRequestFactory.MakeRequestClear();
     var Response = this.GraphDS.Clear(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConvertOnlyVertexTypeIDs);
     return Response.ToList();
 }
开发者ID:cosh,项目名称:sones,代码行数:7,代码来源:GraphDS_API.cs

示例3: Execute

        public override QueryResult Execute(IGraphDB myGraphDB, 
            IGraphQL myGraphQL,
            GQLPluginManager myPluginManager,
            String myQuery,
            SecurityToken mySecurityToken,
            Int64 myTransactionToken)
        {
            _queryString = myQuery;

            QueryResult result;

            try
            {
                result = myGraphDB.Insert<QueryResult>(
                        mySecurityToken,
                        myTransactionToken,
                        CreateRequest(myPluginManager,
                                        myGraphDB,
                                        mySecurityToken,
                                        myTransactionToken),
                        CreateQueryResult);
            }
            catch (ASonesException e)
            {
                result = new QueryResult(_queryString, SonesGQLConstants.GQL, 0, ResultType.Failed, null, e);
            }

            return result;
        }
开发者ID:ramz,项目名称:sones,代码行数:29,代码来源:InsertNode.cs

示例4: ExecFunc

        /// <summary>
        /// Executes the function on myCallingObject
        /// </summary>
        public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
        {
            var currentInnerEdgeType = ((IOutgoingEdgeDefinition)myAttributeDefinition).InnerEdgeType;

            if (myCallingObject is IHyperEdge && currentInnerEdgeType.HasProperty("Weight"))
            {
                var hyperEdge = myCallingObject as IHyperEdge;

                if (currentInnerEdgeType.HasProperty("Weight"))
                {
                    var weightProperty = currentInnerEdgeType.GetPropertyDefinition("Weight");

                    var maxWeight = hyperEdge.InvokeHyperEdgeFunc<Double>(singleEdges =>
                    {
                        return Convert.ToDouble(
                            weightProperty.GetValue(
                            singleEdges
                            .OrderByDescending(edge => weightProperty.GetValue(edge))
                            .First()));
                    });

                    return new FuncParameter(maxWeight);

                }
            }

            throw new InvalidTypeException(myCallingObject.GetType().ToString(), "Weighted IHyperEdge");
        }
开发者ID:loubo,项目名称:sones,代码行数:31,代码来源:MaxWeightFunc.cs

示例5: Execute

        public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
        {
            Query = myQuery;

            var indexDef = new IndexPredefinition(_IndexName);
            indexDef.SetIndexType(_IndexType);
            indexDef.SetVertexType(_DBType);
            indexDef.SetEdition(_IndexEdition);

            //to be indices attributes
            foreach (var aIndexedProperty in _AttributeList)
            {
                indexDef.AddProperty(aIndexedProperty.IndexAttribute.ContentString);
            }

            //options for the index
            if (_options != null)
            {
                foreach (var aKV in _options)
                {
                    indexDef.AddOption(aKV.Key, aKV.Value);
                }
            }

            return myGraphDB.CreateIndex<QueryResult>(mySecurityToken, myTransactionToken, new RequestCreateIndex(indexDef), GenerateResult);
        }
开发者ID:loubo,项目名称:sones,代码行数:26,代码来源:CreateIndexNode.cs

示例6: AddVertex

        public IVertex AddVertex(RequestInsertVertex myInsertDefinition, TransactionToken myTransaction, SecurityToken mySecurity)
        {
            IVertexType vertexType = GetVertexType(myInsertDefinition.VertexTypeName, myTransaction, mySecurity);

            if (vertexType.IsAbstract)
                throw new AbstractConstraintViolationException(myInsertDefinition.VertexTypeName);

            ConvertUnknownProperties(myInsertDefinition, vertexType);
            ConvertDefaultValues(myInsertDefinition, vertexType);

            if (myInsertDefinition.OutgoingEdges != null)
                CheckOutgoingEdges(myInsertDefinition.OutgoingEdges, vertexType);

            if (myInsertDefinition.StructuredProperties != null)
            {
                CheckAddStructuredProperties(myInsertDefinition.StructuredProperties, vertexType);
            }

            CheckMandatoryConstraint(myInsertDefinition, vertexType);

            if (myInsertDefinition.BinaryProperties != null)
                CheckAddBinaryProperties(myInsertDefinition, vertexType);

            return null;
        }
开发者ID:loubo,项目名称:sones,代码行数:25,代码来源:CheckVertexHandler.cs

示例7: ExecFunc

        public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
        {
            if (!(myCallingObject is String))
            {
                throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
            }

            var pos = Convert.ToInt32(myParams[0].Value);

            StringBuilder resString = new StringBuilder();
            bool dontInsert = false;

            if (pos > (myCallingObject as String).Length)
            {
                dontInsert = true;
                resString.Append((myCallingObject as String).ToString());
            }
            else
            {
                resString.Append((myCallingObject as String).ToString().Substring(0, pos));
            }

            foreach (FuncParameter fp in myParams.Skip(1))
            {
                resString.Append(fp.Value as String);
            }

            if(!dontInsert)
                resString.Append((myCallingObject as String).ToString().Substring(pos));

            return new FuncParameter(resString.ToString());
        }
开发者ID:loubo,项目名称:sones,代码行数:32,代码来源:InsertFunc.cs

示例8: Execute

        public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
        {
            _query = myQuery;

            var vertexType = myGraphDB.GetVertexType<IVertexType>(
                mySecurityToken,
                myTransactionToken,
                new RequestGetVertexType(_typeName),
                (stats, vType) => vType);

            _WhereExpression.Validate(myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, vertexType);

            var expressionGraph = _WhereExpression.Calculon(myPluginManager, myGraphDB, mySecurityToken,
                                                            myTransactionToken,
                                                            new CommonUsageGraph(myGraphDB, mySecurityToken,
                                                                                 myTransactionToken));

            var toBeDeletedVertices =
                expressionGraph.Select(
                    new LevelKey(vertexType.ID, myGraphDB, mySecurityToken, myTransactionToken),
                    null, true);

            //TODO: do sth that is better than that: ew RequestDelete(new RequestGetVertices(_typeName, toBeDeletedVertices.Select(_ => _.VertexID))).
            return myGraphDB.Delete<QueryResult>(
                mySecurityToken,
                myTransactionToken,
                new RequestDelete(new RequestGetVertices(_typeName, toBeDeletedVertices.Select(_ => _.VertexID))).AddAttributes(_toBeDeletedAttributes),
                CreateQueryResult);
        }
开发者ID:loubo,项目名称:sones,代码行数:29,代码来源:DeleteNode.cs

示例9: ExecFunc

 public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
 {
     if (myCallingObject is IHyperEdge)
     {
         return new FuncParameter((UInt64)((IHyperEdge)myCallingObject).GetAllEdges().Count());
     }
     else if (myCallingObject is ISingleEdge)
     {
         UInt64 count = 1;
         return new FuncParameter(count);
     }
     else if (myCallingObject is IncomingEdgeCollection)
     {
         return new FuncParameter((UInt64)(myCallingObject as IncomingEdgeCollection).LongCount());
     }
     else if (myCallingObject is IEnumerable<long>)
     {
         return new FuncParameter((UInt64)(myCallingObject as IEnumerable<long>).LongCount());
     }
     else if (myCallingObject is IEnumerable<IVertex>)
     {
         return new FuncParameter((UInt64)(myCallingObject as IEnumerable<IVertex>).LongCount());
     }
     else
     {
         throw new UnknownDBException("Unexpected input for COUNT aggregate.");
     }
 }
开发者ID:loubo,项目名称:sones,代码行数:28,代码来源:CountFunc.cs

示例10: CreateQueryPlan

        /// <summary>
        /// Creates a query plan using a logic expression
        /// </summary>
        /// <param name="myExpression">The logic expression</param>
        /// <param name="myIsLongRunning">Determines whether it is anticipated that the request could take longer</param>
        /// <param name="myTransaction">The current transaction token</param>
        /// <param name="mySecurity">The current security token</param>
        /// <returns>A query plan</returns>
        public IQueryPlan CreateQueryPlan(IExpression myExpression, 
                                            Boolean myIsLongRunning, 
                                            Int64 myTransaction, 
                                            SecurityToken mySecurity)
        {
            IQueryPlan result;

            switch (myExpression.TypeOfExpression)
            {
                case TypeOfExpression.Binary:

                    result = GenerateFromBinaryExpression((BinaryExpression) myExpression, myIsLongRunning, myTransaction, mySecurity);

                    break;
                
                case TypeOfExpression.Unary:
                    
                    result = GenerateFromUnaryExpression((UnaryExpression)myExpression, myTransaction, mySecurity);    

                    break;
               
                case TypeOfExpression.Property:

                    result = GenerateFromPropertyExpression((PropertyExpression)myExpression, myTransaction, mySecurity);

                    break;
                
                default:
                    throw new ArgumentOutOfRangeException();
            }

            return result;
        }
开发者ID:anukat2015,项目名称:sones,代码行数:41,代码来源:QueryPlanManager.cs

示例11: Execute

        public override QueryResult Execute(IGraphDB myGraphDB, IGraphQL myGraphQL, GQLPluginManager myPluginManager, String myQuery, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
        {
            var sw = Stopwatch.StartNew();

            QueryResult result = null;

            if (_DumpFormat.ToString().ToUpper().Equals("GQL"))
            {
                var plugin = myPluginManager.GetAndInitializePlugin<IGraphDBExport>("GQLEXPORT");

                if (plugin != null)
                {
                    result = plugin.Export(_DumpDestination, _DumpableGrammar, myGraphDB, myGraphQL, mySecurityToken, myTransactionToken, _TypesToDump, _DumpType);
                }
            }

            sw.Stop();

            if (result != null)
            {
                return new QueryResult(myQuery, _DumpFormat.ToString(), (ulong)sw.ElapsedMilliseconds, result.TypeOfResult, result.Vertices, result.Error);
            }
            else
                return null;
        }
开发者ID:loubo,项目名称:sones,代码行数:25,代码来源:DumpNode.cs

示例12: GetVertices

        public override IEnumerable<IVertex> GetVertices(RequestGetVertices _request, Int64 Int64, SecurityToken SecurityToken)
        {
            #region case 1 - Expression

            if (_request.Expression != null)
            {
                if (!_queryPlanManager.IsValidExpression(_request.Expression))
                {
                    throw new InvalidExpressionException(_request.Expression);
                }
            }
            
            #endregion

            #region case 2 - No Expression

            else if (_request.VertexTypeName != null)
            {
                //2.1 typeName as string
                _vertexTypeManager.CheckManager.GetType(_request.VertexTypeName, Int64, SecurityToken);
            }
            else
            {
                //2.2 type as id
                _vertexTypeManager.CheckManager.GetType(_request.VertexTypeID, Int64, SecurityToken);
            }

            #endregion

            return null;
        }
开发者ID:anukat2015,项目名称:sones,代码行数:31,代码来源:CheckVertexHandler.cs

示例13: AlterVertexType

 public ServiceVertexType AlterVertexType(SecurityToken mySecurityToken, Int64 myTransactionToken,
     ServiceVertexType myVertexType, ServiceAlterVertexChangeset myChangeset)
 {
     var Request = ServiceRequestFactory.MakeRequestAlterVertexType(myVertexType, myChangeset);
     var Response = this.GraphDS.AlterVertexType<IVertexType>(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConvertOnlyVertexType);
     return new ServiceVertexType(Response);
 }
开发者ID:cosh,项目名称:sones,代码行数:8,代码来源:GraphDS_API.cs

示例14: CommonUsageGraph

 /// <summary>
 /// Constructor
 /// </summary>
 public CommonUsageGraph(IGraphDB myIGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
     : this()
 {
     _iGraphDB = myIGraphDB;
     _securityToken = mySecurityToken;
     _transactionToken = myTransactionToken;
     _Levels = new Dictionary<int, IExpressionLevel>();
 }
开发者ID:loubo,项目名称:sones,代码行数:11,代码来源:CommonUsageGraph.cs

示例15: LevelKey

        public LevelKey(IEnumerable<EdgeKey> myEdgeKey, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
        {
            Edges = new List<EdgeKey>();

            foreach (var aEdgeKey in myEdgeKey)
            {
                if (aEdgeKey.IsAttributeSet)
                {
                    var vertexType = myGraphDB.GetVertexType<IVertexType>
                        (mySecurityToken,
                        myTransactionToken,
                        new RequestGetVertexType(aEdgeKey.VertexTypeID),
                        (stats, type) => type);

                    var attribute = vertexType.GetAttributeDefinition(aEdgeKey.AttributeID);

                    if (attribute != null && attribute.Kind != AttributeType.Property)
                    {
                        //so there is an edge
                        Edges.Add(aEdgeKey);
                        Level++;

                        AddHashCodeFromSingleEdge(ref _hashcode, aEdgeKey);
                    }
                    else
                    {
                        if (Level == 0)
                        {
                            var newEdgeKey = new EdgeKey(aEdgeKey.VertexTypeID);
                            Edges.Add(newEdgeKey);

                            AddHashCodeFromSingleEdge(ref _hashcode, newEdgeKey);

                            break;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    if (Level == 0)
                    {
                        Edges.Add(aEdgeKey);

                        AddHashCodeFromSingleEdge(ref _hashcode, aEdgeKey);

                        break;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:58,代码来源:LevelKey.cs


注:本文中的sones.Library.Commons.Security.SecurityToken类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。