package controllers;

import play.mvc.Controller;
import play.mvc.Result;
import models.Task;
import models.TestResult;
import models.UserStory;
import models.UserStoryHandler;
import play.libs.Json;
import play.mvc.BodyParser;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.util.*;

public class Application extends Controller {
    
	public static Result addDataPoint() {
        final Map<String, String[]> post = request().body().asFormUrlEncoded();
        
        String value=post.get("value")[0];
        String backend=post.get("backend")[0];
        String testName=post.get("testName")[0];

       TestResult tr=new TestResult();
        tr.setValue(value);
        tr.setTestName(testName);
        tr.setBackEnd(backend);
        tr.save();
       
        //System.out.println(post.get("value")[0]);
        
		return ok();
	}
	@BodyParser.Of(BodyParser.Json.class)
	public static Result index() {
		//JsonNode json = request().body().asJson();
		//ObjectNode result = Json.newObject();
    	//List<UserStory> userStories = UserStoryHandler.loadAllUserStories();
    	//for (UserStory userStory : userStorys) {
    //		System.out.println(userStory);
	//	}
    	return ok(views.html.index.render("Hello my framwork"));
    	//List<Task> tasks = Task.find.all();
     // 	return ok(views.html.index.render("Hello my framwork"));

    }
    public static Result getUserStories() {
    	String userStories = UserStoryHandler.loadAllUserStories();
    	return ok(userStories);
    }
    
    public static Result getTests(String userStoryName) {
    	//List<Task> tasks = Task.find.all();
    	//UserStory userStory = UserStoryHandler.getTests(userStoryName);
    	return ok();
    }
}

@@ -26,73 +26,24 @@
 ort 
-play.mvc.Controller;%0Aimport play.mvc.Result;%0Aimport models.Task
+java.util.Map
 ;%0A
+%0A
 impo
@@ -68,33 +68,8 @@
 lt;%0A
-import models.UserStory;%0A
 impo
@@ -100,31 +100,8 @@
 er;%0A
-import play.libs.Json;%0A
 impo
@@ -128,131 +128,58 @@
 er;%0A
-%0A
 import 
-com.fasterxml.jackson.databind.JsonNode;%0Aimport com.fasterxml.jackson.databind.node.ObjectNode;%0A%0Aimport java.util.*
+play.mvc.Controller;%0Aimport play.mvc.Result
 ;%0A%0Ap

fix imports on Application.java