Search in sources :

Example 1 with IndexContactsEvent

use of org.obiba.mica.contact.event.IndexContactsEvent in project mica2 by obiba.

the class ElasticsearchUpgrade method execute.

@Override
public void execute(Version version) {
    log.info("Rebuild elasticsearch indices.");
    cacheService.clearOpalTaxonomiesCache();
    eventBus.post(new IndexStudiesEvent());
    eventBus.post(new IndexFilesEvent());
    eventBus.post(new IndexContactsEvent());
    eventBus.post(new IndexNetworksEvent());
    eventBus.post(new IndexDatasetsEvent());
}
Also used : IndexStudiesEvent(org.obiba.mica.study.event.IndexStudiesEvent) IndexFilesEvent(org.obiba.mica.file.event.IndexFilesEvent) IndexContactsEvent(org.obiba.mica.contact.event.IndexContactsEvent) IndexNetworksEvent(org.obiba.mica.network.event.IndexNetworksEvent) IndexDatasetsEvent(org.obiba.mica.dataset.event.IndexDatasetsEvent)

Example 2 with IndexContactsEvent

use of org.obiba.mica.contact.event.IndexContactsEvent in project mica2 by obiba.

the class Mica2Upgrade method reindexRequiredData.

private void reindexRequiredData() {
    logger.debug("Indexing all networks in the repository.");
    networkService.indexAll();
    logger.debug("Indexing all studies in the repository.");
    individualStudyService.indexAll();
    logger.debug("Indexing all study datasets in the repository.");
    collectedDatasetService.indexAll(false);
    logger.debug("Indexing all harmonization datasets in the repository.");
    harmonizedDatasetService.indexAll(false);
    logger.debug("Indexing all contacts.");
    eventBus.post(new IndexContactsEvent());
    logger.debug("Indexing all taxonomies.");
    eventBus.post(new TaxonomiesUpdatedEvent());
}
Also used : TaxonomiesUpdatedEvent(org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent) IndexContactsEvent(org.obiba.mica.contact.event.IndexContactsEvent)

Example 3 with IndexContactsEvent

use of org.obiba.mica.contact.event.IndexContactsEvent in project mica2 by obiba.

the class Mica380Upgrade method execute.

@Override
public void execute(Version version) {
    logger.info("Executing Mica upgrade to version 3.8.0");
    cacheService.clearAllCaches();
    eventBus.post(new DeleteTaxonomiesEvent());
    try {
        logger.info("Ensure Study taxonomy's investigator and contact vocabulary are of type `text`");
        ensureVocabularyType(TaxonomyTarget.STUDY, "investigator", "contact");
    } catch (RuntimeException e) {
        logger.error("Error occurred when ensuring Study taxonomy's investigator and contact vocabulary are of type `text`.", e);
    }
    try {
        logger.info("Ensure Network taxonomy's investigator and contact vocabulary are of type `text`");
        ensureVocabularyType(TaxonomyTarget.NETWORK, "investigator", "contact");
    } catch (RuntimeException e) {
        logger.error("Error occurred when ensuring Network taxonomy's investigator and contact vocabulary are of type `text`.", e);
    }
    logger.info("Update all indices, this may take a long while...");
    // TODO implement a queue so that indexing is done in order
    eventBus.post(new IndexStudiesEvent());
    eventBus.post(new IndexFilesEvent());
    eventBus.post(new IndexContactsEvent());
    eventBus.post(new IndexNetworksEvent());
    eventBus.post(new IndexDatasetsEvent());
    eventBus.post(new TaxonomiesUpdatedEvent());
}
Also used : TaxonomiesUpdatedEvent(org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent) IndexStudiesEvent(org.obiba.mica.study.event.IndexStudiesEvent) IndexFilesEvent(org.obiba.mica.file.event.IndexFilesEvent) IndexContactsEvent(org.obiba.mica.contact.event.IndexContactsEvent) DeleteTaxonomiesEvent(org.obiba.mica.micaConfig.event.DeleteTaxonomiesEvent) IndexNetworksEvent(org.obiba.mica.network.event.IndexNetworksEvent) IndexDatasetsEvent(org.obiba.mica.dataset.event.IndexDatasetsEvent)

Example 4 with IndexContactsEvent

use of org.obiba.mica.contact.event.IndexContactsEvent in project mica2 by obiba.

the class MicaConfigResource method updateIndices.

@PUT
@Path("/_index")
@Timed
@RequiresRoles(Roles.MICA_ADMIN)
public Response updateIndices() {
    eventBus.post(new IndexStudiesEvent());
    eventBus.post(new IndexFilesEvent());
    eventBus.post(new IndexContactsEvent());
    eventBus.post(new IndexNetworksEvent());
    eventBus.post(new IndexDatasetsEvent());
    eventBus.post(new IndexProjectsEvent());
    eventBus.post(new TaxonomiesUpdatedEvent());
    return Response.noContent().build();
}
Also used : TaxonomiesUpdatedEvent(org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent) IndexStudiesEvent(org.obiba.mica.study.event.IndexStudiesEvent) IndexFilesEvent(org.obiba.mica.file.event.IndexFilesEvent) IndexContactsEvent(org.obiba.mica.contact.event.IndexContactsEvent) IndexNetworksEvent(org.obiba.mica.network.event.IndexNetworksEvent) IndexDatasetsEvent(org.obiba.mica.dataset.event.IndexDatasetsEvent) IndexProjectsEvent(org.obiba.mica.project.event.IndexProjectsEvent) JsonPath(com.jayway.jsonpath.JsonPath) Timed(com.codahale.metrics.annotation.Timed) RequiresRoles(org.apache.shiro.authz.annotation.RequiresRoles)

Aggregations

IndexContactsEvent (org.obiba.mica.contact.event.IndexContactsEvent)4 IndexDatasetsEvent (org.obiba.mica.dataset.event.IndexDatasetsEvent)3 IndexFilesEvent (org.obiba.mica.file.event.IndexFilesEvent)3 TaxonomiesUpdatedEvent (org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent)3 IndexNetworksEvent (org.obiba.mica.network.event.IndexNetworksEvent)3 IndexStudiesEvent (org.obiba.mica.study.event.IndexStudiesEvent)3 Timed (com.codahale.metrics.annotation.Timed)1 JsonPath (com.jayway.jsonpath.JsonPath)1 RequiresRoles (org.apache.shiro.authz.annotation.RequiresRoles)1 DeleteTaxonomiesEvent (org.obiba.mica.micaConfig.event.DeleteTaxonomiesEvent)1 IndexProjectsEvent (org.obiba.mica.project.event.IndexProjectsEvent)1