private void cleanup(String configurationName) { securityService.asAdmin(() -> { propertyService.getPropertyTypes().stream() // Keeps only the types which are linked to configuration properties .filter(propertyType -> propertyType instanceof ConfigurationPropertyType) // Casting .map(propertyType -> (ConfigurationPropertyType) propertyType) // Cleanup for each type .forEach(propertyType -> cleanupType(propertyType, configurationName)); } ); }
@Override public List<GraphQLFieldDefinition> getFields(Class<? extends ProjectEntity> projectEntityClass, ProjectEntityType projectEntityType) { return propertyService.getPropertyTypes().stream() // Gets properties which supports this type of entity .filter(propertyType -> propertyType.getSupportedEntityTypes().contains(projectEntityType)) // Gets as a field definition .map(propertyType -> newFieldDefinition() .name(propertyFieldName(propertyType)) .description(propertyType.getDescription()) .type(property.getTypeRef()) .dataFetcher(projectEntityPropertyDataFetcher(propertyType, projectEntityClass)) .build()) // OK .collect(Collectors.toList()); }