package sagan.questions.support;

import sagan.projects.support.ProjectMetadataService;

import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
class QuestionsController {

    private ProjectMetadataService service;

    @Autowired
    public QuestionsController(ProjectMetadataService service) {
        this.service = service;
    }

    @RequestMapping("/questions")
    public String show(Model model) {

        model.addAttribute("projects", service.getProjects().stream()
                .filter(project -> !project.getCategory().equals("attic"))
                .filter(project -> !project.getStackOverflowTagList().isEmpty())
                .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName()))
                .collect(Collectors.toList()));
        return "questions/index";
    }

}

@@ -386,16 +386,22 @@
 private 
+final 
 ProjectM
@@ -415,23 +415,31 @@
 Service 
-service
+projectMetadata
 ;%0A%0A    @
@@ -502,23 +502,31 @@
 Service 
-service
+projectMetadata
 ) %7B%0A    
@@ -538,25 +538,41 @@
 his.
-service = service
+projectMetadata = projectMetadata
 ;%0A  
@@ -692,15 +692,23 @@
 s%22, 
-service
+projectMetadata
 .get

Rename ProjectMetadataService.{service => projectMetadata}