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

import org.innovateuk.ifs.commons.rest.RestResult;
import org.innovateuk.ifs.threads.service.ThreadService;
import org.innovateuk.threads.resource.PostResource;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

public class CommonThreadController<R> {
    private final ThreadService<R, PostResource> service;

    public CommonThreadController(ThreadService<R, PostResource> service) {
        this.service = service;
    }

    @RequestMapping(value = "", method = GET)
    public RestResult<List<R>> allThreads(@PathVariable("contextClassId") final Long projectFinanceId) {
        return service.findAll(projectFinanceId).toGetResponse();
    }

    @RequestMapping(value = "", method = POST)
    public RestResult<Void> createThread(@RequestBody R query) {
        return service.create(query).toPostCreateResponse();
    }

    @RequestMapping(value = "/{threadId}/post", method = POST)
    public RestResult<Void> addPost(@RequestBody PostResource post, @PathVariable("queryId") Long queryId) {
        return service.addPost(post, queryId).toPostCreateResponse();
    }
}<commit_msg>Adding missing {contextClassId} path variable to allThreads method on CommonThreadController.<commit_after>package org.innovateuk.ifs.threads.controller;

import org.innovateuk.ifs.commons.rest.RestResult;
import org.innovateuk.ifs.threads.service.ThreadService;
import org.innovateuk.threads.resource.PostResource;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

public class CommonThreadController<R> {
    private final ThreadService<R, PostResource> service;

    public CommonThreadController(ThreadService<R, PostResource> service) {
        this.service = service;
    }

    @RequestMapping(value = "/{contextClassId}", method = GET)
    public RestResult<List<R>> allThreads(@PathVariable("contextClassId") final Long projectFinanceId) {
        return service.findAll(projectFinanceId).toGetResponse();
    }

    @RequestMapping(value = "", method = POST)
    public RestResult<Void> createThread(@RequestBody R query) {
        return service.create(query).toPostCreateResponse();
    }

    @RequestMapping(value = "/{threadId}/post", method = POST)
    public RestResult<Void> addPost(@RequestBody PostResource post, @PathVariable("queryId") Long queryId) {
        return service.addPost(post, queryId).toPostCreateResponse();
    }
}
{'fraction_non_alphanumeric': 0.1086452467704538, 'fraction_numerical': 0.0, 'mean_word_length': 5.291666666666667, 'pattern_counts': {'":': 0, '<': 17, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6546250', 'n_tokens_mistral': 836, 'n_tokens_neox': 825, 'n_words': 154}