Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ecc8703e

Přidáno uživatelem Jiri Trefil před téměř 2 roky(ů)

#10526 vytvoreni controlleru pro detekci.

Zobrazit rozdíly:

src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/DetectController.java
1
package cz.zcu.fav.kiv.antipatterndetectionapp.v2.controller;
2

  
3
import com.google.gson.Gson;
4
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern;
5
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Project;
6
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Query;
7
import cz.zcu.fav.kiv.antipatterndetectionapp.service.AntiPatternService;
8
import cz.zcu.fav.kiv.antipatterndetectionapp.service.ProjectService;
9
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.http.HttpStatus;
11
import org.springframework.http.ResponseEntity;
12
import org.springframework.web.bind.annotation.GetMapping;
13
import org.springframework.web.bind.annotation.RequestMapping;
14
import org.springframework.web.bind.annotation.RestController;
15

  
16
import java.util.List;
17

  
18
@RestController
19
@RequestMapping("v2/detect")
20
public class DetectController {
21
    @Autowired
22
    private ProjectService projectService;
23

  
24
    @Autowired
25
    private AntiPatternService antiPatternService;
26

  
27
    @GetMapping("/list")
28
    public ResponseEntity<String> getAntipatternsAndProjects(){
29
        //List<Project> projects = projectService.getAllProjects();
30
        //List<AntiPattern> antiPatterns = antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns());
31
        //List<AntiPattern> antiPatterns = antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns());
32
        return ResponseEntity.ok(new Gson().toJson( new Query(projectService.getAllProjects(), antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns()))));
33
    }
34

  
35
}

Také k dispozici: Unified diff