package com.parrot.vraptor.controller;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.client.ClientProtocolException;
import org.json.JSONException;


import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.parrot.github.model.Payload;
import br.com.parrot.github.repository.PushEvents;

@Resource
@SuppressWarnings("unused")
public class TesteController {
	
	private final Result result; 
	private final PushEvents pushevent;
	
	public TesteController(Result result, PushEvents pushevents){
		super();
		this.pushevent = pushevents;
		this.result = result;
	}
	
	@Get
	@Path("/home/parrot")
	public void showSearchPage(){
		
	}
	
	@Get
	@Path("/home/parrot/search/apresentation")
	public List<Payload> showSearchPage(List<Payload> payloadList){
		return payloadList;
	}
	
	@Post
	@Path("/home/parrot/search")
	public void showSearchResults(String userName) throws ClientProtocolException, JSONException, IOException, URISyntaxException{
		result.redirectTo(this).showSearchPage(pushevent.getListOfPushEventsUrl(pushevent.getPublicEventsAsString(pushevent.buildPublicEventsUri(userName))));
	}
	
}

@@ -564,19 +564,22 @@
  class T
-est
+imeLin
 eControl
@@ -669,11 +669,14 @@
 ic T
-est
+imeLin
 eCon
@@ -804,29 +804,24 @@
 et%0A%09@Path(%22/
-home/
 parrot%22)%0A%09pu
@@ -821,97 +821,8 @@
 t%22)%0A
-%09public void showSearchPage()%7B%0A%09%09%0A%09%7D%0A%09%0A%09@Get%0A%09@Path(%22/home/parrot/search/apresentation%22)%0A
 %09pub
@@ -843,25 +843,23 @@
 ad%3E show
-SearchPag
+TimeLin
 e(List%3CP
@@ -927,13 +927,8 @@
 h(%22/
-home/
 parr
@@ -936,16 +936,21 @@
 t/search
+.user
 %22)%0A%09publ
@@ -1085,16 +1085,15 @@
 ult.
-redirect
+forward
 To(t
@@ -1105,17 +1105,15 @@
 show
-SearchPag
+TimeLin
 e(pu

update do time line controller