use of org.obiba.mica.core.event.DocumentSetDeletedEvent in project mica2 by obiba.
the class StudyIndexer method documentSetDeleted.
@Async
@Subscribe
public synchronized void documentSetDeleted(DocumentSetDeletedEvent event) {
if (!studySetService.isForType(event.getPersistable()))
return;
DocumentSet documentSet = event.getPersistable();
List<BaseStudy> toIndex = Lists.newArrayList();
{
List<BaseStudy> toRemove = studySetService.getPublishedStudies(event.getPersistable(), false);
toRemove.forEach(std -> std.removeSet(documentSet.getId()));
toIndex.addAll(toRemove);
}
indexer.indexAllIndexables(Indexer.PUBLISHED_STUDY_INDEX, toIndex);
}
use of org.obiba.mica.core.event.DocumentSetDeletedEvent in project mica2 by obiba.
the class VariableIndexer method documentSetDeleted.
@Async
@Subscribe
public synchronized void documentSetDeleted(DocumentSetDeletedEvent event) {
if (!variableSetService.isForType(event.getPersistable()))
return;
DocumentSet documentSet = event.getPersistable();
List<DatasetVariable> toIndex = Lists.newArrayList();
{
List<DatasetVariable> toRemove = variableSetService.getVariables(event.getPersistable(), false);
toRemove.forEach(var -> var.removeSet(documentSet.getId()));
toIndex.addAll(toRemove);
}
indexer.indexAllIndexables(Indexer.PUBLISHED_VARIABLE_INDEX, toIndex);
}
use of org.obiba.mica.core.event.DocumentSetDeletedEvent in project mica2 by obiba.
the class NetworkIndexer method documentSetDeleted.
@Async
@Subscribe
public synchronized void documentSetDeleted(DocumentSetDeletedEvent event) {
if (!networkSetService.isForType(event.getPersistable()))
return;
DocumentSet documentSet = event.getPersistable();
List<Network> toIndex = Lists.newArrayList();
{
List<Network> toRemove = networkSetService.getPublishedNetworks(event.getPersistable(), false);
toRemove.forEach(ntw -> ntw.removeSet(documentSet.getId()));
toIndex.addAll(toRemove);
}
indexer.indexAll(Indexer.PUBLISHED_NETWORK_INDEX, toIndex);
}
use of org.obiba.mica.core.event.DocumentSetDeletedEvent in project mica2 by obiba.
the class DocumentSetService method delete.
/**
* Delete definitely a document set.
*
* @param documentSet
*/
public void delete(DocumentSet documentSet) {
ensureType(documentSet);
if (!documentSet.isNew()) {
documentSetRepository.delete(documentSet);
eventBus.post(new DocumentSetDeletedEvent(documentSet));
}
}
Aggregations