private Dictionary <string, long> LookupProviders(IVocabularyService vocabularyService) { var providerKeys = new Dictionary <string, long>(StringComparer.OrdinalIgnoreCase); foreach (var pb in personBuilders.Values) { foreach (var providerKey in pb.Value.ProviderKeys.Keys) { if (!providerKeys.ContainsKey(providerKey)) { providerKeys.Add(providerKey, 0); } } } if (providerKeys.Count > 0) { var providerIds = vocabularyService.GetProviderIds(providerKeys.Keys.ToArray()); foreach (var keyValuePair in providerIds) { if (keyValuePair.Value != -1) { providerKeys[keyValuePair.Key] = keyValuePair.Value; } } } return(providerKeys); }
public ParseController(IScanWordParser parser, IVocabularyService vocabularyService, UserManager userManager) { _parser = parser; _userManager = userManager; _vocabularyService = vocabularyService; }
public MaterialAppService( IRepository <Material, long> materialsRepository, IVocabularyService vocabularyService) { _materialsRepository = materialsRepository; _vocabularyService = vocabularyService; }
public void Process() { try { var channelFactory = ServicesManager.GetChannelFactory <IVocabularyService>("net.pipe://localhost/VocabularyServiceEndpoint"); vocabularyService = channelFactory.CreateChannel(); var part = new ChunkPart(chunkId, createPersonBuilder, "0"); part.Load(); part.Build(vocabularyService); part.Save(); var dbChunk = new DbChunk(Settings.Current.Building.BuilderConnectionString); dbChunk.ChunkComplete(chunkId); channelFactory.Close(); } catch (Exception e) { Logger.WriteError(chunkId, e); throw; } }
public Importer(IMapping mapping, IFileSystem fileSystem, IRecordService recordService, IVocabularyService vocabularyService, UserInfo userInfo) { this.mapping = mapping; this.fileSystem = fileSystem; this.recordService = recordService; this.vocabularyService = vocabularyService; this.userInfo = userInfo; }
public BaseController(IWordService wordService, IVocabularyService vocabularyService, ITopicService topicService, IHostingEnvironment appEnvironment) { _wordService = wordService; _vocabularyService = vocabularyService; _topicService = topicService; _appEnvironment = appEnvironment; }
public void Build(IVocabularyService vocabularyService) { var providerKeys = LookupProviders(vocabularyService); Parallel.ForEach(personBuilders.Values, pb => pb.Value.Build(providerKeys)); personBuilders.Clear(); personBuilders = null; }
public VocabulariesController( IVocabularyService _VocabularyService, IWordClassService _WordClassService, IVocabularyTopicService _VocabularyTopicService) { this._VocabularyService = _VocabularyService; this._WordClassService = _WordClassService; this._VocabularyTopicService = _VocabularyTopicService; }
public RefreshVocabularyTask( IVocabularyService Vocabulary, IDiversityServiceClient Repository, INotificationService Notification ) { this.Vocabulary = Vocabulary; this.Repository = Repository; this.Notification = Notification; }
private Dictionary <string, long> LookupProviders(IVocabularyService vocabularyService) { var providerKeys = new Dictionary <string, long>(StringComparer.OrdinalIgnoreCase); foreach (var pb in personBuilders.Values) { foreach (var providerKey in pb.Value.ProviderKeys.Keys) { if (!providerKeys.ContainsKey(providerKey)) { providerKeys.Add(providerKey, 0); } } } if (providerKeys.Count <= 0) { return(providerKeys); } var attempt = 0; var done = false; while (!done) { try { attempt++; var providerIds = vocabularyService.GetProviderIds(providerKeys.Keys.ToArray()); foreach (var keyValuePair in providerIds) { if (keyValuePair.Value != -1) { providerKeys[keyValuePair.Key] = keyValuePair.Value; } } done = true; } catch (Exception ex) { if (attempt <= 11) { Logger.Write(chunkId, LogMessageTypes.Warning, "LookupProviders attempt=" + attempt + Logger.CreateExceptionString(ex)); } else { throw; } } } return(providerKeys); }
public ArchiveUserDataIntegrationService(IAnnotationItemIntegrationService annotationItemIntegrationService, IRepository <DbUser> usersRepository, IRepository <DbAnnotationItemAccessibleUsers> annotationUsersRepository, IRepository <DbAnnotationItemAccessibleGroups> annotationGroupsRepository, IRepository <DbAnnotationItem> annotationItemRepository, IRepository <DbVocabularyUserValue> usersVocabularyRepository, IRepository <DbUserFile> userFilesRepository, IVocabularyService vocabularyService, ISecurityService userFilesService) { _annotationItemIntegrationService = annotationItemIntegrationService; _usersRepository = usersRepository; _annotationUsersRepository = annotationUsersRepository; _annotationGroupsRepository = annotationGroupsRepository; _annotationItemRepository = annotationItemRepository; _usersVocabularyRepository = usersVocabularyRepository; _userFilesRepository = userFilesRepository; _vocabularyService = vocabularyService; _userFilesService = userFilesService; }
public void Process() { try { var channelFactory = ServicesManager.GetChannelFactory <IVocabularyService>("net.pipe://localhost/VocabularyServiceEndpoint"); vocabularyService = channelFactory.CreateChannel(); var dbChunk = new DbChunk(Settings.Current.Building.BuilderConnectionString); var part = new ChunkPart(chunkId, createPersonBuilder, "0"); var timer = new Stopwatch(); timer.Start(); part.Load(); dbChunk.ChunkLoaded(chunkId); Logger.Write(chunkId, LogMessageTypes.Info, string.Format("Loaded - {0} ms | {1} Mb", timer.ElapsedMilliseconds, (GC.GetTotalMemory(false) / 1024f) / 1024f)); part.Build(vocabularyService); part.Save(); if (Settings.Current.Building.DestinationEngine.Database == Database.Redshift) { ServicesManager.AddToSaveQueue(chunkId); Logger.Write(null, LogMessageTypes.Debug, "AddToSaveQueue " + chunkId); } else { dbChunk.ChunkComplete(chunkId); } channelFactory.Close(); } catch (Exception e) { Logger.WriteError(chunkId, e); throw; } }
public WordsController(IWordService wordService, IVocabularyService vocabularyService) { _wordService = wordService; _vocabularyService = vocabularyService; }
public DicVocaIndexModel(IVocabularyService _VocabularyService) { this._VocabularyService = _VocabularyService; }
public void Process() { try { var channelFactory = ServicesManager.GetChannelFactory <IVocabularyService>("net.pipe://localhost/VocabularyServiceEndpoint"); vocabularyService = channelFactory.CreateChannel(); var dbChunk = new DbChunk(Settings.Current.Building.BuilderConnectionString); var timer = new Stopwatch(); timer.Start(); var folder = string.Format("{0}/{1}/raw", Settings.Current.Building.Vendor, Settings.Current.Building.Id); Parallel.ForEach(Settings.Current.Building.SourceQueryDefinitions, qd => { if (qd.Providers != null) { return; } if (qd.Locations != null) { return; } if (qd.CareSites != null) { return; } var sql = qd.GetSql(Settings.Current.Building.SourceEngine.Database, Settings.Current.Building.Vendor, Settings.Current.Building.SourceSchemaName); if (string.IsNullOrEmpty(sql)) { return; } qd.FieldHeaders = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase); var metadataKey = string.Format("{0}/metadata/{1}", folder, qd.FileName + ".txt"); using (var client = new AmazonS3Client(Settings.Current.S3AwsAccessKeyId, Settings.Current.S3AwsSecretAccessKey, Amazon.RegionEndpoint.USEast1)) using (var stream = new MemoryStream()) using (var sr = new StreamReader(stream)) { var request = new GetObjectRequest { BucketName = Settings.Current.Bucket, Key = metadataKey }; using (var response = client.GetObject(request)) { response.ResponseStream.CopyTo(stream); } stream.Position = 0; var index = 0; foreach (var fieldName in sr.ReadLine().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { try { qd.FieldHeaders.Add(fieldName, index); index++; } catch (Exception) { throw new Exception("[RestoreMetadataFromS3] fieldName duplication: " + fieldName + " - " + qd.FileName); } } } }); Parallel.ForEach(GetParts(), new ParallelOptions { MaxDegreeOfParallelism = 2 }, p => //Parallel.ForEach(GetParts(), p => { Logger.Write(chunkId, LogMessageTypes.Info, "load part=" + p); var part = new ChunkPart(chunkId, createPersonBuilder, p); LoadPart(part, p); part.Build(vocabularyService); SavePart(part, p); }); dbChunk.ChunkLoaded(chunkId); Logger.Write(chunkId, LogMessageTypes.Info, string.Format("Loaded - {0} ms | {1} Mb", timer.ElapsedMilliseconds, (GC.GetTotalMemory(false) / 1024f) / 1024f)); if (Settings.Current.Building.DestinationEngine.Database == Database.Redshift) { ServicesManager.AddToSaveQueue(chunkId); Logger.Write(null, LogMessageTypes.Debug, "AddToSaveQueue " + chunkId); } else { dbChunk.ChunkComplete(chunkId); } channelFactory.Close(); } catch (Exception e) { Logger.WriteError(chunkId, e); throw; } }
public UserController(IUserService userService, IVocabularyService vocabularyService) { _userService = userService; _vocabularyService = vocabularyService; }
// TODO: use dependency injection public VocabularyController() { _vocabularyService = new VocabularyService(); }
public VocabularyApiController(IVocabularyService vocabularyService) { this._vocabularyService = vocabularyService; }
public VocabulariesController(IVocabularyService vocabularyService, IMapper mapper) { _vocabularyService = vocabularyService; _mapper = mapper; }
/// <summary>Initializes a new instance of the <see cref="VocabularyWordsController"/> class.</summary> /// <param name="vocabularyService">Vocabulary service.</param> public VocabularyWordsController(IVocabularyService vocabularyService) { _vocabularyService = vocabularyService; }
public VocabulariesController(IVocabularyService service, IDocumentSession db) { this.service = service; this.db = db; }
public DictionariesController(IWordService wordService, IVocabularyService vocabularyService, ITopicService topicService) { _wordService = wordService; _vocabularyService = vocabularyService; _topicService = topicService; }
public VocabularyAppService(IVocabularyService vocabularyService) { _vocabularyService = vocabularyService; }
public QuickTestController(IVocabularyService _VocabularyService) { this._VocabularyService = _VocabularyService; }
public PartialsController( IVocabularyService _VocabularyService) { this._VocabularyService = _VocabularyService; }
/// <summary>Initializes a new instance of the <see cref="MaterialsController"/> class.</summary> /// <param name="materialService">Material service.</param> /// <param name="vocabularyService">Vocabulary service.</param> public MaterialsController(IMaterialsService materialService, IVocabularyService vocabularyService) { _materialService = materialService; _vocabularyService = vocabularyService; }
/// <summary>Initializes a new instance of the <see cref="VocabularyController"/> class.</summary> /// <param name="vocabularyService">Vocabulary service.</param> /// <param name="translationService">Translation service.</param> public VocabularyController(IVocabularyService vocabularyService, ITranslationService translationService) { _vocabularyService = vocabularyService; }