Search in sources :

Example 1 with TaxonomiesUpdatedEvent

use of org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent 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 2 with TaxonomiesUpdatedEvent

use of org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent in project mica2 by obiba.

the class Mica320Upgrade method execute.

@Override
public void execute(Version version) {
    logger.info("Executing Mica upgrade to version 3.2.0");
    try {
        logger.info("Updating variable's variableType vocabulary terms.");
        mongoTemplate.execute(db -> db.eval(variableTypeVocabularyTermsUpdate()));
    } catch (Exception e) {
        logger.error("Failed to update variable's variableType vocabulary terms", e);
    }
    try {
        logger.info("Indexing Taxonomies");
        eventBus.post(new TaxonomiesUpdatedEvent());
    } catch (Exception e) {
        logger.error("Failed to index Taxonomies", e);
    }
    try {
        logger.info("Re-indexing studies");
        eventBus.post(new IndexStudiesEvent());
    } catch (Exception e) {
        logger.error("Failed to re-index studies", e);
    }
    try {
        logger.info("Re-indexing networks");
        eventBus.post(new IndexNetworksEvent());
    } catch (Exception e) {
        logger.error("Failed to re-index networks", e);
    }
}
Also used : TaxonomiesUpdatedEvent(org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent) IndexStudiesEvent(org.obiba.mica.study.event.IndexStudiesEvent) IndexNetworksEvent(org.obiba.mica.network.event.IndexNetworksEvent)

Example 3 with TaxonomiesUpdatedEvent

use of org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent in project mica2 by obiba.

the class Mica330Upgrade method execute.

@Override
public void execute(Version version) {
    logger.info("Executing Mica upgrade to version 3.3.0");
    try {
        logger.info("Checking presence of \"sets\" vocabulary in current Mica_variable taxonomy");
        mongoTemplate.execute(db -> db.eval(addSetsVocabularyToVariableTaxonomyIfMissing()));
    } catch (RuntimeException e) {
        logger.error("Error occurred when trying to addSetsVocabularyToVariableTaxonomyIfMissing.", e);
    }
    try {
        logger.info("Indexing Taxonomies");
        eventBus.post(new TaxonomiesUpdatedEvent());
    } catch (Exception e) {
        logger.error("Failed to index Taxonomies", e);
    }
}
Also used : TaxonomiesUpdatedEvent(org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent)

Example 4 with TaxonomiesUpdatedEvent

use of org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent 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 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) Path(javax.ws.rs.Path) JsonPath(com.jayway.jsonpath.JsonPath) Timed(com.codahale.metrics.annotation.Timed) RequiresRoles(org.apache.shiro.authz.annotation.RequiresRoles) PUT(javax.ws.rs.PUT)

Example 5 with TaxonomiesUpdatedEvent

use of org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent in project mica2 by obiba.

the class TaxonomyConfigService method update.

public void update(TaxonomyTarget target, Taxonomy taxonomy) {
    updateInternal(target, taxonomy);
    eventBus.post(new TaxonomiesUpdatedEvent(taxonomy.getName(), target));
}
Also used : TaxonomiesUpdatedEvent(org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent)

Aggregations

TaxonomiesUpdatedEvent (org.obiba.mica.micaConfig.event.TaxonomiesUpdatedEvent)6 Timed (com.codahale.metrics.annotation.Timed)2 PUT (javax.ws.rs.PUT)2 Path (javax.ws.rs.Path)2 RequiresRoles (org.apache.shiro.authz.annotation.RequiresRoles)2 IndexContactsEvent (org.obiba.mica.contact.event.IndexContactsEvent)2 IndexNetworksEvent (org.obiba.mica.network.event.IndexNetworksEvent)2 IndexStudiesEvent (org.obiba.mica.study.event.IndexStudiesEvent)2 JsonPath (com.jayway.jsonpath.JsonPath)1 IndexDatasetsEvent (org.obiba.mica.dataset.event.IndexDatasetsEvent)1 IndexFilesEvent (org.obiba.mica.file.event.IndexFilesEvent)1