Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions caseStudy/services/src/main/java/pojo/Company.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ public class Company {
private int numEmployees;
private String sector;
private String industry;
private Stock stockHistory;

public Company(String symbol, String name, String hqCity, String hqStateOrCountry, int numEmployees, String sector, String industry) {
this.symbol = symbol;
this.name = symbol;
this.hqCity = symbol;
this.hqStateOrCountry = hqStateOrCountry;
this.numEmployees = numEmployees;
this.sector = sector;
this.industry = industry;
}

public String getSymbol() {
return symbol;
Expand Down Expand Up @@ -86,6 +97,14 @@ public void setIndustry(String industry) {
this.industry = industry;
}

public Stock getStockHistory() {
return this.stockHistory;
}

public void setStockHistory(Stock stockHistory) {
this.stockHistory = stockHistory;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
1 change: 1 addition & 0 deletions caseStudy/services/src/main/java/pojo/Stock.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* This class will define a company's end-of-day stock price
* Look at resources/data/historicalStockData.json
*/

public class Stock {

public String name;
Expand Down
29 changes: 26 additions & 3 deletions caseStudy/services/src/main/java/resources/CompanyResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,33 @@

package resources;

// TODO - add your @Path here
public class CompanyResource {
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import java.io.IOException;
import pojo.Company;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import resources.FileHelper;

import jdk.nashorn.internal.objects.annotations.Getter;

// TODO - Add a @GET resource to get company data
// Your service should return data for a given stock ticker

@Path("companies")
public class CompanyResource {

private static final ObjectMapper mapper = new ObjectMapper();

@GET
public Response getCompanyForTicker(String ticker) throws IOException {

List<Company> companies = FileHelper.readAllCompanies("companyInfo.json");

// Need to get .json object
//Company company; //get the company for ticker
//return Response.ok().entity(company).build();
return Response.ok().entity(companies).build();
}

}
Empty file modified caseStudy/services/target/classes/data/companyInfo.json
100755 → 100644
Empty file.
Empty file modified caseStudy/services/target/classes/data/historicalStockData.json
100755 → 100644
Empty file.
Empty file modified caseStudy/services/target/classes/data/readme.txt
100755 → 100644
Empty file.
Binary file modified caseStudy/services/target/classes/pojo/Company.class
100755 → 100644
Binary file not shown.
Binary file modified caseStudy/services/target/classes/pojo/Stock.class
100755 → 100644
Binary file not shown.
Binary file modified caseStudy/services/target/classes/resources/CompanyResource.class
100755 → 100644
Binary file not shown.
Empty file modified caseStudy/services/target/classes/resources/StockResource.class
100755 → 100644
Empty file.
Empty file modified caseStudy/services/target/classes/utility/InputValidator.class
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.