/**
 * Copyright 2017 Goldman Sachs.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package resources;

// TODO - add your @Path here
public class StockResource {

    // TODO - Add a @GET resource to get stock data
    // Your service should return data based on 3 inputs
    // Stock ticker, start date and end date

}

@@ -634,71 +634,2492 @@
 s;%0D%0A
-%0D%0A// TODO - add your @Path here%0D%0Apublic class StockResource %7B%0D%0A
+import javax.ws.rs.*;%0D%0Aimport javax.ws.rs.GET;%0D%0Aimport javax.ws.rs.Path;%0D%0Aimport pojo.Stock;%0D%0Aimport java.text.SimpleDateFormat;%0D%0A%0D%0A@Path(%22services%22)%0D%0Apublic class StockResource %7B%0D%0A    @GET%0D%0A    @Path(%22stock%22)%0D%0A    @Produces(MediaType.APPLICATION_JSON)%0D%0A    public static Stock getDateRange(String startDate, String endDate)%0D%0A    %7B%0D%0A        List%3CStock%3E stocks;%0D%0A        stocks = readAllStocks(fileName);%0D%0A        SimpleDateFormat format = new SimpleDateFormat(%22dd-MM-yyyy%22);%0D%0A%0D%0A        Date start = format.parse(startDate);%0D%0A        Date end = format.parse(endDate);%0D%0A%0D%0A        for(Stock s: stocks)%0D%0A        %7B%0D%0A            Date curr = format.parse(s.getDate());%0D%0A            if (curr.compareTo(start) %3C 0) %7B%0D%0A                stocks.remove(s);%0D%0A            %7D%0D%0A            if(end.compareTo(curr) %3C 0) %7B%0D%0A                stocks.remove(s);%0D%0A            %7D%0D%0A        %7D%0D%0A        return stocks;%0D%0A    %7D%0D%0A    public static List%3CMap%3CDate, Double%3E%3E sort(Stock s)%0D%0A    %7B%0D%0A        List%3CMap%3CString,Double%3E%3E original;%0D%0A        original = s.getDailyClosePrice();%0D%0A        for (Entry e : original.getEntrySet())%0D%0A        Scanner scan = new Scanner(// key value of a map);%0D%0A        Date d = new GregorianCalendar(scan.next(), scan.next(), scan.next());%0D%0A    %7D%0D%0A    public static List%3CString%3E readAllStockTickers()%0D%0A    %7B   %0D%0A        List%3CString%3E stockTickers;%0D%0A        List%3CStock%3E stocks;%0D%0A        stocks = readAllStocks(%22historicalStockData.json%22);%0D%0A        for(Stock s: stocks)%0D%0A        %7B%0D%0A            stockTickers.add(s.getSymbol());%0D%0A        %7D%0D%0A        return stockTickers;%0D%0A%0D%0A    %7D%0D%0A      public static List%3CString%3E readAllDates()%0D%0A    %7B   %0D%0A        List%3CString%3E stockTickers;%0D%0A        List%3CStock%3E stocks;%0D%0A        stocks = readAllStocks(%22historicalStockData.json%22);%0D%0A        for(Stock s: stocks)%0D%0A        %7B%0D%0A            stockTickers.add(s.getSymbol());%0D%0A        %7D%0D%0A        return stockTickers;%0D%0A%0D%0A    %7D%0D%0A    public Response getStockResource(String stockTicker, String startDate, String endDate) %0D%0A    throws IOException%0D%0A    %7B%0D%0A        %0D%0A        String fileName = %22historicalStock.json%22;%0D%0A        List%3CStock%3E dateRange; //TODO instantiate using Company methods%0D%0A        dateRange = getDateRange(startDate, endDate);%0D%0A        for(Stock s: dateRange)%0D%0A        %7B%0D%0A            if(s.getName().equals(stockTicker) && dateRange.contains(s) %0D%0A            && dateRange.containsDate(s)) %0D%0A            %7B%0D%0A                return Response.ok().entity(s).build();%0D%0A            %7D%0D%0A            %0D%0A        %7D%0D%0A%0D%0A    %7D
 %0D%0A  

Update StockResource.java