internal ServiceAlterEdgeChangeset(RequestAlterEdgeType myRequestAlterEdgeType) { this.NewTypeName = myRequestAlterEdgeType.AlteredTypeName; this.Comment = myRequestAlterEdgeType.AlteredComment; this.ToBeAddedProperties = myRequestAlterEdgeType.ToBeAddedProperties.Select(x => new ServicePropertyPredefinition(x)).ToList(); this.ToBeRemovedProperties = myRequestAlterEdgeType.ToBeRemovedProperties.ToList(); this.ToBeRenamedProperties = myRequestAlterEdgeType.ToBeRenamedProperties; }
public static RequestAlterEdgeType MakeRequestAlterEdgeType(ServiceEdgeType myEdgeType, ServiceAlterEdgeChangeset myChangeset) { var Request = new RequestAlterEdgeType(myEdgeType.Name); #region Add Attributes if (myChangeset.ToBeAddedProperties != null) { foreach (var toAdd in myChangeset.ToBeAddedProperties) { Request.AddProperty(toAdd.ToPropertyPredefinition()); } } #endregion #region Remove Attributes if (myChangeset.ToBeRemovedProperties != null) { foreach (var toDel in myChangeset.ToBeRemovedProperties) { Request.RemoveProperty(toDel); } } #endregion #region Rename Task if (myChangeset.ToBeRenamedProperties != null) { foreach(var item in myChangeset.ToBeRenamedProperties) { Request.RenameAttribute(item.Key, item.Value); } } #endregion if (myChangeset.Comment != null) Request.SetComment(myChangeset.Comment); if (myChangeset.NewTypeName != null) Request.RenameType(myChangeset.NewTypeName); //todo add unknown attribute return Request; }
private void ProcessAddAttribute(AAlterTypeCommand myAlterCommand, ref RequestAlterEdgeType result) { var command = (AlterEdgeType_AddAttributes)myAlterCommand; if (command.ListOfAttributes != null && command.ListOfAttributes.Count > 0) foreach (var aAttribute in command.ListOfAttributes) { result.AddUnknownAttribute(GenerateUnknownAttribute(aAttribute)); } }
private void ProcessDropAttribute(AAlterTypeCommand myAlterCommand, ref RequestAlterEdgeType result) { var command = (AlterType_DropAttributes)myAlterCommand; foreach (var aAttribute in command.ListOfAttributes) { result.RemoveUnknownAttribute(aAttribute); } }
private void ProcessRenameAttribute(AAlterTypeCommand myAlterCommand, ref RequestAlterEdgeType result) { var command = (AlterType_RenameAttribute)myAlterCommand; result.RenameAttribute(command.OldName, command.NewName); }
private void ProcessChangeComment(AAlterTypeCommand myAlterCommand, ref RequestAlterEdgeType result) { var command = (AlterType_ChangeComment)myAlterCommand; result.SetComment(command.NewComment); }
private void ProcessAlterCommand(AAlterTypeCommand myAlterCommand, ref RequestAlterEdgeType result) { switch (myAlterCommand.AlterType) { case TypesOfAlterCmd.AddAttribute: ProcessAddAttribute(myAlterCommand, ref result); break; case TypesOfAlterCmd.DropAttribute: ProcessDropAttribute(myAlterCommand, ref result); break; case TypesOfAlterCmd.RenameAttribute: ProcessRenameAttribute(myAlterCommand, ref result); break; case TypesOfAlterCmd.RenameType: ProcessRenameType(myAlterCommand, ref result); break; case TypesOfAlterCmd.ChangeComment: ProcessChangeComment(myAlterCommand, ref result); break; default: break; } }
private RequestAlterEdgeType CreateNewRequest(IGraphDB myGraphDB, GQLPluginManager myPluginManager, SecurityToken mySecurityToken, Int64 myTransactionToken) { RequestAlterEdgeType result = new RequestAlterEdgeType(_TypeName); foreach (var aAlterCommand in _AlterTypeCommand) { ProcessAlterCommand(aAlterCommand, ref result); } return result; }
public TResult AlterEdgeType <TResult>(sones.Library.Commons.Security.SecurityToken mySecurityToken, long myTransactionID, sones.GraphDB.Request.RequestAlterEdgeType myRequestAlterEdgeType, sones.GraphDB.Request.Converter.AlterEdgeTypeResultConverter <TResult> myOutputconverter) { Stopwatch RunningTime = Stopwatch.StartNew(); var svcEdgeType = _GraphDSService.AlterEdgeType(mySecurityToken, myTransactionID, new ServiceEdgeType(myRequestAlterEdgeType.TypeName), new ServiceAlterEdgeChangeset(myRequestAlterEdgeType)); var edgeType = new RemoteEdgeType(svcEdgeType, this); RunningTime.Stop(); return(myOutputconverter(new RequestStatistics(new TimeSpan(RunningTime.ElapsedTicks)), edgeType)); }