package sg.ncl.service.realization.web;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
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.realization.data.jpa.RealizationEntity;
import sg.ncl.service.realization.logic.RealizationService;

import javax.inject.Inject;

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

    private final RealizationService realizationService;

    @Inject
    protected RealizationsController(final RealizationService realizationService) {
        this.realizationService = realizationService;
    }

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

    @RequestMapping(path = "/start/{experimentId}", method = RequestMethod.PUT)
    public void startExperiment(@PathVariable Long experimentId) {
        RealizationEntity realizationEntity = realizationService.getByExperimentId(experimentId);
        realizationService.startExperimentInDeter(realizationEntity.getTeamId(), realizationEntity.getExperimentName());
    }
}

@@ -982,23 +982,8 @@
 tart
-/%7BexperimentId%7D
 %22, m
@@ -1045,39 +1045,49 @@
 ent(
-@PathVariable Long experimentId
+final RealizationEntity realizationEntity
 ) %7B%0A
@@ -1129,16 +1129,18 @@
 onEntity
+Db
  = reali
@@ -1171,17 +1171,38 @@
 imentId(
-e
+realizationEntity.getE
 xperimen
@@ -1204,19 +1204,130 @@
 rimentId
+()
 );%0A
+%0A        if (realizationEntity == null) %7B%0A            realizationService.save(realizationEntity);%0A        %7D%0A%0A
         
@@ -1381,24 +1381,26 @@
 zationEntity
+Db
 .getTeamId()
@@ -1410,32 +1410,34 @@
 ealizationEntity
+Db
 .getExperimentNa

Add start method to controller