Exemple #1
0
 public SQSListener(string dASAppointmentsQueueName, IAppointmentStorageService appointmentStorageService,
                    IAppointmentOpLogStorageService appointmentOpLogStorageService, IConflictsManager conflictsManager)
 {
     DASAppointmentsQueueName       = dASAppointmentsQueueName;
     AppointmentStorageService      = appointmentStorageService;
     AppointmentOpLogStorageService = appointmentOpLogStorageService;
     ConflictsManager = conflictsManager;
 }
        public void ResolveConflicts(IDataStore localDataStore, IConflictsManager conflictsManager)
        {
            if (Conflicts == null || Conflicts.Count == 0)
            {
                return;
            }

            foreach (var conflict in Conflicts)
            {
                var identityChange = conflict.Resolve(localDataStore);
                conflictsManager.AddNewIdentityChange(identityChange);
            }
        }
Exemple #3
0
        public RuleSetConflictsController(IHost host, IConflictsManager conflictsManager)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }
            if (conflictsManager == null)
            {
                throw new ArgumentNullException(nameof(conflictsManager));
            }

            this.host                = host;
            this.conflictsManager    = conflictsManager;
            this.FixConflictsCommand = new RelayCommand <IEnumerable <ProjectRuleSetConflict> >(this.OnFixConflicts, this.OnFixConflictsStatus);
        }
Exemple #4
0
        public void ApplyInsert(IEntityConflict entityConflict, IConflictsManager conflictsManager)
        {
            foreach (var row in Insert)
            {
                conflictsManager.ApplyForeignKeyChange(row);
                var existing = FindExisting(row);
                if (existing != null)
                {
                    entityConflict.OnApplyInsertAlreadyExisting(existing, row);
                    continue;
                }

                if (conflictsManager.HasForeignKeyDeleted(row))
                {
                    continue;
                }

                ApplyInsertWhenNoExistInLocal(entityConflict, row);
            }
        }
Exemple #5
0
        public void ApplyChanges(ISqlDataStore datastore, ISyncStatProvider statProvider, IConflictsManager conflictsManager)
        {
            if (EntityChangeset.Count == 0)
            {
                return;
            }

            var progression = new LinearProgression(EntityChangeset.Count * 3);

            statProvider.SetNewState(SyncStates.ApplyingRemoteChange, progression);

            var changeSets = new List <ChangeSet>();

            foreach (var entityChangeset in EntityChangeset)
            {
                entityChangeset.SetDatastore(datastore);
                var conflic = conflictsManager.CreateEntityConflict(entityChangeset, _syncSessionInfo);
                changeSets.Add(new ChangeSet(entityChangeset, conflic, conflictsManager));
            }

            // Update FK changes before delete
            foreach (var entityChange in changeSets)
            {
                entityChange.ApplyUpdate();
                progression.CurrentStepFinished();
            }

            // Delete FK before delete PK
            changeSets.Reverse();
            foreach (var entityChange in changeSets)
            {
                entityChange.ApplyDelete();
                progression.CurrentStepFinished();
            }

            // Insert PK before insert FK
            changeSets.Reverse();
            foreach (var entityChange in changeSets)
            {
                entityChange.ApplyInsert();
                entityChange.ApplyLastSync();
                entityChange.ResolveConflicts(datastore);
                progression.CurrentStepFinished();
            }
        }
Exemple #6
0
 public ChangeSet(EntityChangeset entityChangeset, IEntityConflict conflic, IConflictsManager conflictsManager)
 {
     _entityChangeset  = entityChangeset;
     _conflic          = conflic;
     _conflictsManager = conflictsManager;
 }
Exemple #7
0
 protected void ApplyRemoteChange(IConflictsManager conflictsManager)
 {
     RemoteChanges.ApplyChanges(DataStore as ISqlDataStore, StatProvider, conflictsManager);
     StatProvider.SetConflicts(conflictsManager);
 }
 public void ResolveConflicts(IDataStore localDataStore, IConflictsManager conflictsManager)
 {
 }
Exemple #9
0
 public void SetConflicts(IConflictsManager conflicts)
 {
     Conflicts = conflicts.Count;
     Info("{0} - Conflict detected:{1}", Source, Conflicts);
 }
Exemple #10
0
 private void ApplyChanges(EntitiesChangeset localChange, IConflictsManager conflictsManager)
 {
     SyncSession.HighBoundaryAnchor = SyncDateTimeProvider.UtcNow;
     localChange.ApplyChanges(Desktop.DataStore, new Mock <ISyncStatProvider>().Object, conflictsManager);
 }