<commit_before>package org.innovateuk.ifs.threads.controller;

import org.innovateuk.ifs.commons.rest.RestResult;
import org.innovateuk.ifs.threads.resource.PostResource;
import org.innovateuk.ifs.threads.service.MessageThreadService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

public class CommonMessageThreadController<R, S extends MessageThreadService<R, PostResource>> {
    protected final S service;

    public CommonMessageThreadController(S service) {
        this.service = service;
    }

    @GetMapping("/all/{contextClassId}")
    public RestResult<List<R>> findAll(@PathVariable("contextClassId") final Long contextClassId) {
        return service.findAll(contextClassId).toGetResponse();
    }

    @GetMapping("/{threadId}")
    public RestResult<R> findOne(@PathVariable("threadId") final Long threadId) {
        return service.findOne(threadId).toGetResponse();
    }

    @PostMapping
    public RestResult<Long> create(@RequestBody R thread) {
        return service.create(thread).toPostCreateResponse();
    }

    @PostMapping("/thread/{threadId}/close")
    public RestResult<Void> close(@PathVariable("threadId") final Long threadId) {
        return service.close(threadId).toPostResponse();
    }

}<commit_msg>IFS-5941 fixed.<commit_after>package org.innovateuk.ifs.threads.controller;

import org.innovateuk.ifs.commons.rest.RestResult;
import org.innovateuk.ifs.threads.resource.PostResource;
import org.innovateuk.ifs.threads.service.MessageThreadService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

public class CommonMessageThreadController<R, S extends MessageThreadService<R, PostResource>> {
    protected final S service;

    public CommonMessageThreadController(S service) {
        this.service = service;
    }

    @GetMapping("/all/{contextClassId}")
    public RestResult<List<R>> findAll(@PathVariable("contextClassId") final Long contextClassId) {
        return service.findAll(contextClassId).toGetResponse();
    }

    @GetMapping("/{threadId}")
    public RestResult<R> findOne(@PathVariable("threadId") final Long threadId) {
        return service.findOne(threadId).toGetResponse();
    }

    @PostMapping
    public RestResult<Long> create(@RequestBody R thread) {
        return service.create(thread).toPostCreateResponse();
    }

    @PostMapping("/thread/{threadId}/close")
    public RestResult<Void> close(@PathVariable("threadId") final Long threadId) {
        return service.close(threadId).toPostResponse();
    }

    @PostMapping("/{threadId}/post")
    public RestResult<Void> addPost(@RequestBody PostResource post, @PathVariable("threadId") Long threadId) {
        return service.addPost(post, threadId).toPostCreateResponse();
    }
}
{'fraction_non_alphanumeric': 0.11607992388201713, 'fraction_numerical': 0.0012686330478908975, 'mean_word_length': 4.906367041198502, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '6278528', 'n_tokens_mistral': 884, 'n_tokens_neox': 876, 'n_words': 151}