/// <summary> /// Updates test data inside a storage. /// Overwrite existing entries /// </summary> /// <param name="sourceClient"> /// The source client. /// </param> /// <param name="targetClient"> /// The target client. /// </param> /// <param name="baseliClient"> /// The baseline client. /// </param> /// <param name="sourceStorePath"> /// The source storage path. /// </param> /// <param name="targetStorePath"> /// The target storage path. /// </param> /// <param name="baselineStorePath"> /// The baseline storage path. /// </param> /// <param name="commandParameter"> /// The command parameter. /// </param> /// <returns> /// True if the response from the <see cref="SyncComponent.UiProvider"/> is "continue" /// </returns> public bool ExecuteCommand( IClientBase sourceClient, IClientBase targetClient, IClientBase baseliClient, string sourceStorePath, string targetStorePath, string baselineStorePath, string commandParameter) { if (targetClient == null) { throw new InvalidOperationException("item.targetClient is null"); } if (sourceClient == null) { throw new InvalidOperationException("item.sourceClient is null"); } // delete existing elements targetClient.DeleteElements(targetClient.GetAll(targetStorePath), targetStorePath); var contacts = Contacts.GetStandardContactList(true); contacts.AddRange(Contacts.VariableContactList); targetClient.AddRange(contacts.ToStdElements(), targetStorePath); return(true); }
/// <summary> /// This command does lookup contact ralations for a List of <see cref="StdContact"/>. The connector that does read the /// data need to be specified inside the <paramref name="commandParameter"/> and must implement the interface <see cref="IExtendedReader"/>. /// Only contacts that can be mapped to internal Ids using the <paramref name="baseliClient"/> will be collected - no additional /// data is collected (there's no profile lookup for the unknown contacts). /// </summary> /// <param name="sourceClient"> The source client provides a set of <see cref="StdContact"/> entries for that the contact relations should be read. </param> /// <param name="targetClient"> The target client will write the processed list of <see cref="StdContact"/> that now does contain the contact relations. </param> /// <param name="baseliClient"> The baseline client provides lookup data for determine valid translations for the relation ids read from the connector specified in the <paramref name="commandParameter"/>. </param> /// <param name="sourceStorePath"> The source storage path. </param> /// <param name="targetStorePath"> The target storage path. </param> /// <param name="baselineStorePath"> The baseline storage path. </param> /// <param name="commandParameter"> The connector to the contact relations (must support <see cref="IExtendedReader"/>). </param> /// <returns> True if the response from the <see cref="SyncComponent.UiProvider"/> is "continue" </returns> public bool ExecuteCommand( IClientBase sourceClient, IClientBase targetClient, IClientBase baseliClient, string sourceStorePath, string targetStorePath, string baselineStorePath, string commandParameter) { if (targetClient == null) { throw new InvalidOperationException("item.targetClient is null"); } if (sourceClient == null) { throw new InvalidOperationException("item.sourceClient is null"); } if (baseliClient == null) { throw new InvalidOperationException("item.baseliClient is null"); } var extendedClient = sourceClient as IExtendedReader; if (extendedClient == null) { throw new InvalidOperationException("sourceClient is null or not an IExtendedReader"); } ((SyncComponent)extendedClient).ProcessingEvent += this.LogProcessingEvent; // get the baseline var baseline = baseliClient.GetAll(baselineStorePath); // get all source elements var elements = targetClient.GetAll(targetStorePath); // add the matching profile ids from the baseline as StdContact - // .ToContacts().ToStdElement() will convert each MatchingEntry // of the list into a StdContact elements.MergeHighEvidence(baseline.ToStdContacts().ToStdElements()); // fill the extended contact information var matchEntities = baseline.ToMatchingEntries(); extendedClient.FillAllContacts(elements, matchEntities); elements.ForEach(e => extendedClient.FillContacts(e, matchEntities)); // copy to the target connector targetClient.AddRange(elements, targetStorePath); baseliClient.WriteRange(baseline, baselineStorePath); ((SyncComponent)extendedClient).ProcessingEvent -= this.LogProcessingEvent; return(true); }
/// <summary> /// Copy all entries from the source client to the destination client; /// Overwrite existing entries /// </summary> /// <param name="sourceClient"> The source client instance that is the source of data for the copy operation. </param> /// <param name="targetClient"> The source client instance that is the target for the data of the copy operation. </param> /// <param name="baseliClient"> The baseline client is not utilized in this command. </param> /// <param name="sourceStorePath"> The storage path for the source connector. </param> /// <param name="targetStorePath"> The storage path for the target connector </param> /// <param name="baselineStorePath"> The baseline client (and so the storage path) is not utilized in this command. </param> /// <param name="commandParameter"> In this command there is no need for a parameter. </param> /// <returns> Always true. </returns> public bool ExecuteCommand( IClientBase sourceClient, IClientBase targetClient, IClientBase baseliClient, string sourceStorePath, string targetStorePath, string baselineStorePath, string commandParameter) { Bouncer.ForCheckData(() => sourceClient).Assert(new IsNotNullRule <IClientBase>()); Bouncer.ForCheckData(() => targetClient).Assert(new IsNotNullRule <IClientBase>()); targetClient.AddRange(sourceClient.GetAll(sourceStorePath), targetStorePath); return(true); }
/// <summary> /// Updates test data inside a storage. /// Overwrite existing entries /// </summary> /// <param name="sourceClient"> /// The source client. /// </param> /// <param name="targetClient"> /// The target client. /// </param> /// <param name="baseliClient"> /// The baseline client. /// </param> /// <param name="sourceStorePath"> /// The source storage path. /// </param> /// <param name="targetStorePath"> /// The target storage path. /// </param> /// <param name="baselineStorePath"> /// The baseline storage path. /// </param> /// <param name="commandParameter"> /// The command parameter. /// </param> /// <returns> /// True if the response from the <see cref="SyncComponent.UiProvider"/> is "continue" /// </returns> public bool ExecuteCommand( IClientBase sourceClient, IClientBase targetClient, IClientBase baseliClient, string sourceStorePath, string targetStorePath, string baselineStorePath, string commandParameter) { if (targetClient == null) { throw new InvalidOperationException("item.targetClient is null"); } if (sourceClient == null) { throw new InvalidOperationException("item.sourceClient is null"); } targetClient.AddRange(sourceClient.GetAll(sourceStorePath), targetStorePath); return(true); }