<commit_before>package org.folio.rest.impl;

import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Handler;
import org.folio.cataloging.business.codetable.Avp;
import org.folio.cataloging.log.Log;
import org.folio.cataloging.log.MessageCatalog;

import org.folio.rest.jaxrs.model.MaterialType;
import org.folio.rest.jaxrs.model.MaterialTypeCollection;
import org.folio.rest.jaxrs.resource.MaterialTypesResource;

import javax.ws.rs.core.Response;
import java.util.Map;
import java.util.function.Function;

import static java.util.stream.Collectors.toList;
import static org.folio.cataloging.integration.CatalogingHelper.doGet;

/**
 * ShelfList type RESTful APIs.
 *
 * @author natasciab
 * @since 1.0
 */

public class MaterialTypesAPI implements MaterialTypesResource {

    protected final Log logger = new Log(MaterialTypesAPI.class);

    private Function<Avp<String>, MaterialType> toMaterialType = source -> {
        final MaterialType materialType = new MaterialType();
        materialType.setCode(source.getValue());
        materialType.setDescription(source.getLabel());
        return materialType;
    };

    @Override
    public void getMaterialTypes(final String lang,
                                  final Map<String, String> okapiHeaders,
                                  final Handler<AsyncResult<Response>> asyncResultHandler,
                                  final Context vertxContext) throws Exception {
        doGet((storageService, future) -> {
            try {
                final MaterialTypeCollection container = new MaterialTypeCollection();
                container.setMaterialTypes(<commit_msg>MODCAT-18:Add Material Type<commit_after>package org.folio.rest.impl;

import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Handler;
import org.folio.cataloging.business.codetable.Avp;
import org.folio.cataloging.log.Log;
import org.folio.cataloging.log.MessageCatalog;

import org.folio.rest.jaxrs.model.MaterialType;
import org.folio.rest.jaxrs.model.MaterialTypeCollection;
import org.folio.rest.jaxrs.resource.MaterialTypesResource;

import javax.ws.rs.core.Response;
import java.util.Map;
import java.util.function.Function;

import static java.util.stream.Collectors.toList;
import static org.folio.cataloging.integration.CatalogingHelper.doGet;

/**
 * Material type RESTful APIs.
 *
 * @author carment
 * @since 1.0
 */

public class MaterialTypesAPI implements MaterialTypesResource {

    protected final Log logger = new Log(MaterialTypesAPI.class);

    private Function<Avp<String>, MaterialType> toMaterialType = source -> {
        final MaterialType materialType = new MaterialType();
        materialType.setCode(source.getValue());
        materialType.setDescription(source.getLabel());
        return materialType;
    };

    @Override
    public void getMaterialTypes(final String lang,
                                  final Map<String, String> okapiHeaders,
                                  final Handler<AsyncResult<Response>> asyncResultHandler,
                                  final Context vertxContext) throws Exception {
        doGet((storageService, future) -> {
            try {
                final MaterialTypeCollection container = new MaterialTypeCollection();
                container.setMaterialTypes(
{'fraction_non_alphanumeric': 0.09202270690170301, 'fraction_numerical': 0.00179265013444876, 'mean_word_length': 3.174563591022444, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3311318', 'n_tokens_mistral': 899, 'n_tokens_neox': 871, 'n_words': 185}