use of org.molgenis.data.util.EntityTypeUtils in project molgenis by molgenis.
the class SystemEntityTypePersister method removeNonExistingSystemEntityTypes.
/**
* Package-private for testability
*/
void removeNonExistingSystemEntityTypes() {
// get all system entities
List<String> removedSystemEntityIds = new ArrayList<>();
dataService.getRepository(ENTITY_TYPE_META_DATA, EntityType.class).forEachBatched(new Fetch().field(ID).field(PACKAGE), entityTypes -> entityTypes.stream().filter(EntityTypeUtils::isSystemEntity).filter(this::isNotExists).map(EntityType::getId).forEach(removedSystemEntityIds::add), 1000);
dataService.getMeta().deleteEntityTypes(removedSystemEntityIds);
removedSystemEntityIds.forEach(entityTypeId -> mutableAclClassService.deleteAclClass(EntityIdentityUtils.toType(entityTypeId)));
}
Aggregations