<commit_before>package com.unidev.polycms.hateoas.controller;

import com.unidev.polycms.hateoas.vo.HateoasPolyIndex;
import com.unidev.polyembeddedcms.PolyCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.ResourceSupport;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;

/**
 * Controller for handling storage requests
 */
@RestController
public class StorageIndexController {

    private static Logger LOG = LoggerFactory.getLogger(StorageIndexController.class);

    @Autowired
    private PolyCore polyCore;

    @GetMapping(value = "/storage/{storage}", produces= MediaType.APPLICATION_JSON_VALUE)
    public ResourceSupport index(@PathVariable("storage") String storage) {
        if (!polyCore.existTenant(storage)) {
            LOG.warn("Not found storage {}", storage);
            throw new StorageNotFoundException("Storage " + storage + " not found");
        }
        HateoasPolyIndex hateoasPolyIndex = new HateoasPolyIndex();

        hateoasPolyIndex.add(
                linkTo(StorageIndexController.class).slash("categories").withRel("categories"),
                linkTo(StorageIndexController.class).slash("tags").withRel("tags")
        );

        return hateoasPolyIndex;
        //PolyQuery polyQuery = PolyQuery.query();

//        Long totalPolys = sqLitePolyService.countPoly(polyQuery, storage);
//
//        Long pages = totalPolys / PolyQuery.DEFAULT_ITEM_PER_PAGE;
//
//        HateoasPolyIndex index = hateoasPolyIndex();
//
//        LongStream.range(1, pages+1).forEach( page -> {
//            BasicPoly pageRecord  = new BasicPoly()._id(page + "");
//            HateoasPoly hateoasPoly = hateoasPoly(pageRecord);
//            Link link = linkTo(StoragePageController.class).slash("storage").slash(storage).slash("page").slash(page).withSelfRel();
//            hateoasPoly.add(link);
//            index.add(hateoasPoly);
//        });

        //return null;
    }

}<commit_msg>Hataeos paths for index<commit_after>package com.unidev.polycms.hateoas.controller;

import com.unidev.polycms.hateoas.vo.HateoasPolyIndex;
import com.unidev.polyembeddedcms.PolyCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.ResourceSupport;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;

/**
 * Controller for handling storage requests
 */
@RestController
public class StorageIndexController {

    private static Logger LOG = LoggerFactory.getLogger(StorageIndexController.class);

    @Autowired
    private PolyCore polyCore;

    @GetMapping(value = "/storage/{storage}", produces= MediaType.APPLICATION_JSON_VALUE)
    public ResourceSupport index(@PathVariable("storage") String storage) {
        if (!polyCore.existTenant(storage)) {
            LOG.warn("Not found storage {}", storage);
            throw new StorageNotFoundException("Storage " + storage + " not found");
        }
        HateoasPolyIndex hateoasPolyIndex = new HateoasPolyIndex();

        hateoasPolyIndex.add(
                linkTo(StorageIndexController.class).slash(storage).slash("categories").withRel("categories"),
                linkTo(StorageIndexController.class).slash(storage).slash("tags").withRel("tags")
        );

        return hateoasPolyIndex;
    }

}
{'fraction_non_alphanumeric': 0.11270125223613596, 'fraction_numerical': 0.001533350370559673, 'mean_word_length': 3.880299251870324, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2021348', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1090, 'n_words': 180}