package sg.ncl;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;

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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import sg.ncl.testbed_interface.Team;

@RestController
public class TeamController {
    
    private List<Team> myTeamsList = new ArrayList<Team>();
    private final AtomicLong counter = new AtomicLong();
    
    @RequestMapping("/team")
    public Team addTeam(@RequestParam(value="name") String name) {
        Team myTeam = new Team(counter.incrementAndGet(), name, "this is a desc", "www.nus.edu.sg", "research", true);
        myTeamsList.add(myTeam);
        return myTeam;
    }
    
    @RequestMapping(value = "/team/{name}", method = RequestMethod.GET, headers="Accept=application/json")
    public String getTeamByName(@PathVariable String name)
    {
        for (Team currTeam:myTeamsList) {
            if (currTeam.getName().equalsIgnoreCase(name)) {
                return currTeam.toString();
            }
        }
        return "The team name not available";
    }
}

@@ -1309,10 +1309,770 @@
 ;%0A    %7D%0A
+    %0A    @RequestMapping(value = %22/team/all%22, method = RequestMethod.GET, headers=%22Accept=application/json%22)%0A    public List%3CTeam%3E getAllTeams() %7B%0A        return myTeamsList;%0A    %7D%0A    %0A    @RequestMapping(value = %22/seedTeam%22)%0A    public List%3CTeam%3E seedTeam() %7B%0A        Team team1 = new Team(counter.incrementAndGet(), %22hybridcloud%22, %22this is a desc%22, %22www.nus.edu.sg%22, %22research%22, true);%0A        Team team2 = new Team(counter.incrementAndGet(), %22demo%22, %22this is a desc%22, %22www.nus.edu.sg%22, %22research%22, true);%0A        Team team3 = new Team(counter.incrementAndGet(), %22demo2%22, %22this is a desc%22, %22www.nus.edu.sg%22, %22research%22, true);%0A        myTeamsList.add(team1);%0A        myTeamsList.add(team2);%0A        myTeamsList.add(team3);%0A        return myTeamsList;%0A    %7D%0A
 %7D%0A

add seed rest api to Team (#DEV-82)