private bool MongoProjectHasUserDataOrHasBeenSynced() { MongoProjectRecord record = _projectRecordFactory.Create(_currentProject); bool projectIsSRProject = record != null && !string.IsNullOrEmpty(record.SendReceiveProjectIdentifier); bool projectHasBeenSynced = record != null && record.LastSyncedDate != null && record.LastSyncedDate > MagicValues.UnixEpoch; long lexicalEntryCount = _connection.LexEntryCount(_currentProject); return((projectIsSRProject && projectHasBeenSynced) || lexicalEntryCount > 0); }
public bool SetLastSyncedDate(ILfProject project, DateTime?newSyncedDate) { _storedLastSyncDate[project.ProjectCode] = newSyncedDate; // Also update on the fake project record, since EnsureCloneAction looks at the project record to check its initial-clone logic if (_projectRecordFactory != null) { MongoProjectRecord projectRecord = _projectRecordFactory.Create(project); projectRecord.LastSyncedDate = newSyncedDate; } return(true); }
public override MongoProjectRecord Create(ILfProject project) { var sampleConfig = BsonSerializer.Deserialize <LfProjectConfig>(SampleData.jsonConfigData); // TODO: Could we use a Mock to do this instead? MongoProjectRecord record; if (_projectRecords.TryGetValue(project.ProjectCode, out record)) { return(record); } else { record = new MongoProjectRecord { Id = new ObjectId(), InputSystems = new Dictionary <string, LfInputSystemRecord>() { { "en", new LfInputSystemRecord { Abbreviation = "Eng", Tag = "en", LanguageName = "English", IsRightToLeft = false } }, { "fr", new LfInputSystemRecord { // this should probably be a three-letter abbreviation like Fre, // but since our test data has the two letter abbreviation for this ws // we have to stick with it so that we don't introduce an unwanted // change. Abbreviation = "fr", Tag = "fr", LanguageName = "French", IsRightToLeft = false } }, }, InterfaceLanguageCode = "en", LanguageCode = "fr", ProjectCode = project.ProjectCode, ProjectName = project.ProjectCode, SendReceiveProjectIdentifier = project.ProjectCode, Config = sampleConfig }; _projectRecords.Add(project.ProjectCode, record); return(record); } }
protected override void DoRun(ILfProject project) { _lfProject = project; _projectRecord = _projectRecordFactory.Create(_lfProject); if (_projectRecord == null) { Logger.Warning("No project named {0}", _lfProject.ProjectCode); Logger.Warning("If we are unit testing, this may not be an error"); return; } _lfProjectConfig = _projectRecord.Config; if (_lfProjectConfig == null) { return; } if (project.FieldWorksProject == null) { Logger.Error("Failed to find the corresponding FieldWorks project!"); return; } if (project.FieldWorksProject.IsDisposed) { Logger.Warning("Project {0} is already disposed; this shouldn't happen", project.ProjectCode); } _cache = project.FieldWorksProject.Cache; if (_cache == null) { Logger.Error("Failed to find the LCM cache!"); return; } _servLoc = _cache.ServiceLocator; if (_servLoc == null) { Logger.Error("Failed to find the service locator; giving up."); return; } var converter = new ConvertMongoToLcmLexicon(Settings, project, Logger, Progress, _connection, _projectRecord, EntryCounts); converter.RunConversion(); }
protected override void DoRun(ILfProject project) { // TODO: Some of these checks might be overkill; consider removing some of them Logger.Debug("MongoToFdo: starting"); _lfProject = project; _projectRecord = _projectRecordFactory.Create(_lfProject); if (_projectRecord == null) { Logger.Warning("No project named {0}", _lfProject.ProjectCode); Logger.Warning("If we are unit testing, this may not be an error"); return; } _lfProjectConfig = _projectRecord.Config; if (_lfProjectConfig == null) return; if (project.FieldWorksProject == null) { Logger.Error("Failed to find the corresponding FieldWorks project!"); return; } if (project.FieldWorksProject.IsDisposed) Logger.Warning("Project {0} is already disposed; this shouldn't happen", project.ProjectCode); _cache = project.FieldWorksProject.Cache; if (_cache == null) { Logger.Error("Failed to find the FDO cache!"); return; } _servLoc = _cache.ServiceLocator; if (_servLoc == null) { Logger.Error("Failed to find the service locator; giving up."); return; } var converter = new ConvertMongoToFdoLexicon(Settings, project, Logger, _connection, _projectRecord); converter.RunConversion(); }