Search in sources :

Example 1 with EntityTypeUtils

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)));
}
Also used : SystemEntityType(org.molgenis.data.meta.SystemEntityType) EntityType(org.molgenis.data.meta.model.EntityType) Fetch(org.molgenis.data.Fetch) ArrayList(java.util.ArrayList) EntityTypeUtils(org.molgenis.data.util.EntityTypeUtils)

Aggregations

ArrayList (java.util.ArrayList)1 Fetch (org.molgenis.data.Fetch)1 SystemEntityType (org.molgenis.data.meta.SystemEntityType)1 EntityType (org.molgenis.data.meta.model.EntityType)1 EntityTypeUtils (org.molgenis.data.util.EntityTypeUtils)1