package sg.ncl.service.experiment.web;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import sg.ncl.service.experiment.data.jpa.ExperimentRepository;

import javax.inject.Inject;

/**
 * @author Christopher Zhong
 */
@RestController
@RequestMapping(path = "/experiments", produces = MediaType.APPLICATION_JSON_VALUE)
public class ExperimentsController {

    private final ExperimentRepository experimentRepository;

    @Inject
    protected ExperimentsController(final ExperimentRepository experimentRepository) {
        this.experimentRepository = experimentRepository;
    }

    @RequestMapping(method = RequestMethod.GET)
    public void get() { }

}

@@ -65,25 +65,26 @@
 rk.http.
-MediaType
+HttpStatus
 ;%0Aimport
@@ -108,42 +108,22 @@
 ork.
-web.bind.annotation.RequestMapping
+http.MediaType
 ;%0Aim
@@ -171,84 +171,133 @@
 ion.
-RequestMethod;%0Aimport org.springframework.web.bind.annotation.RestController
+*;%0Aimport sg.ncl.service.experiment.data.jpa.ExperimentEntity;%0Aimport sg.ncl.service.experiment.data.jpa.ExperimentRepository
 ;%0Aim
@@ -320,39 +320,37 @@
 ice.experiment.d
-ata.jpa
+omain
 .ExperimentRepos
@@ -348,82 +348,178 @@
 ment
-Repository;%0A%0Aimport javax.inject.Inject;%0A%0A/**%0A * @author Christopher Zhong
+;%0Aimport sg.ncl.service.experiment.logic.ExperimentService;%0A%0Aimport javax.inject.Inject;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * Created by Desmond Lim
 %0A */
@@ -681,34 +681,31 @@
 l Experiment
-Repository
+Service
  experimentR
@@ -703,26 +703,23 @@
 periment
-Repository
+Service
 ;%0A%0A    @
@@ -777,26 +777,23 @@
 periment
-Repository
+Service
  experim
@@ -795,26 +795,23 @@
 periment
-Repository
+Service
 ) %7B%0A    
@@ -833,41 +833,214 @@
 ment
-Repository = experimentRepository
+Service = experimentService;%0A    %7D%0A%0A    @RequestMapping(method = RequestMethod.GET)%0A    @ResponseStatus(code = HttpStatus.OK)%0A    public List%3CExperimentEntity%3E get() %7B%0A        return experimentService.get()
 ;%0A  
@@ -1056,32 +1056,53 @@
 @RequestMapping(
+path = %22/user/%7Bid%7D%22, 
 method = Request
@@ -1121,29 +1121,400 @@
     
-public void get() %7B %7D%0A
+@ResponseStatus(code = HttpStatus.OK)%0A    public List%3CExperimentInfo%3E getByUser(@PathVariable String id) %7B%0A        List%3CExperimentInfo%3E infoList = new ArrayList%3C%3E();%0A        List%3CExperimentEntity%3E entityList = experimentService.findByUser(id);%0A%0A        for (ExperimentEntity entity : entityList) %7B%0A            infoList.add(new ExperimentInfo(entity));%0A        %7D%0A%0A        return infoList;%0A    %7D
 %0A%7D%0A

Add controller methods