Ejemplo n.º 1
0
        private void CheckRemoveOutgoingEdges(RequestAlterVertexType myAlterVertexTypeRequest, IVertexType myVertexType, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
        {
            if (myAlterVertexTypeRequest.ToBeRemovedOutgoingEdges == null)
                return;

            #region get the list of incoming edges that will be deleted too

            var toBeRemovedIncomingEdgeIDs = new List<long>();

            if (myAlterVertexTypeRequest.ToBeRemovedIncomingEdges != null)
                toBeRemovedIncomingEdgeIDs.AddRange(
                    myAlterVertexTypeRequest.ToBeRemovedIncomingEdges.Select(
                        _ => myVertexType.GetIncomingEdgeDefinition(_).ID));

            #endregion

            foreach (var aOutgoingEdge in myAlterVertexTypeRequest.ToBeRemovedOutgoingEdges)
            {
                var attrDef = myVertexType.GetOutgoingEdgeDefinition(aOutgoingEdge);

                var vertex = _vertexManager.ExecuteManager.GetVertex((long) BaseTypes.OutgoingEdge, attrDef.ID, null,
                                                                     null, myTransactionToken, mySecurityToken);

                var incomingEdges = vertex.GetIncomingVertices((long) BaseTypes.IncomingEdge,
                                                               (long)
                                                               AttributeDefinitions.IncomingEdgeDotRelatedEgde);

                foreach (var incomingEdge in incomingEdges)
                {
                    if (!toBeRemovedIncomingEdgeIDs.Contains(incomingEdge.VertexID))
                    {
                        //TODO a better exception here
                        throw new Exception(
                            "The outgoing edge can not be removed, because there are related incoming edges.");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessIncomingEdgeRemoval(IEnumerable<string> myToBeRemovedIncomingEdges, IVertexType vertexType, TransactionToken myTransactionToken, SecurityToken mySecurityToken)
        {
            foreach (var aIncomingEdge in myToBeRemovedIncomingEdges)
            {
                var incomingEdgeDefinition = vertexType.GetIncomingEdgeDefinition(aIncomingEdge);

                _vertexManager.ExecuteManager.VertexStore.RemoveVertex(mySecurityToken, myTransactionToken, incomingEdgeDefinition.ID, (long)BaseTypes.IncomingEdge);
            }
        }