diff --git a/docs/Credits.odt b/docs/Credits.odt new file mode 100644 index 0000000..7d99a35 Binary files /dev/null and b/docs/Credits.odt differ diff --git a/nbactions.xml b/nbactions.xml new file mode 100644 index 0000000..5f657da --- /dev/null +++ b/nbactions.xml @@ -0,0 +1,17 @@ + + + + run + + jar + + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -classpath %classpath com.rohitawate.restaurant.main.Main + java + + + diff --git a/pom.xml b/pom.xml index f86c9f3..e81771f 100644 --- a/pom.xml +++ b/pom.xml @@ -34,6 +34,17 @@ jersey-hk2 2.26 - + + + com.fasterxml.jackson.core + jackson-core + 2.9.3 + + + + com.fasterxml.jackson.core + jackson-databind + 2.9.3 + \ No newline at end of file diff --git a/src/main/java/com/rohitawate/restaurant/dashboard/DashboardController.java b/src/main/java/com/rohitawate/restaurant/dashboard/DashboardController.java index d4cc0ef..f6b80a8 100644 --- a/src/main/java/com/rohitawate/restaurant/dashboard/DashboardController.java +++ b/src/main/java/com/rohitawate/restaurant/dashboard/DashboardController.java @@ -76,10 +76,8 @@ public class DashboardController implements Initializable { } responseArea.setText(response); } catch (MalformedURLException ex) { - Logger.getLogger(DashboardController.class.getName()).log(Level.SEVERE, null, ex); - snackBar.show("Server did not respond", 7000); + snackBar.show("Invalid URL. Please verify and try again.", 7000); } catch (IOException ex) { - Logger.getLogger(DashboardController.class.getName()).log(Level.SEVERE, null, ex); snackBar.show("Server did not respond", 7000); } diff --git a/src/main/java/com/rohitawate/restaurant/requests/RequestManager.java b/src/main/java/com/rohitawate/restaurant/requests/RequestManager.java index 64c9cd6..fde40f3 100644 --- a/src/main/java/com/rohitawate/restaurant/requests/RequestManager.java +++ b/src/main/java/com/rohitawate/restaurant/requests/RequestManager.java @@ -15,6 +15,9 @@ */ package com.rohitawate.restaurant.requests; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -28,19 +31,35 @@ import javax.ws.rs.core.Response; * @author Rohit Awate */ public class RequestManager { + private final Client client; public RequestManager() { client = ClientBuilder.newClient(); } - + public String get(URL url) throws MalformedURLException, IOException { String responseBody; WebTarget target = client.target(url.toString()); - + Response response = target.request().get(); + String type = (String) response.getHeaders().getFirst("Content-type"); + System.out.println(type); responseBody = response.readEntity(String.class); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.INDENT_OUTPUT, true); + switch (type) { + case "application/json": + JsonNode node = mapper.readTree(responseBody); + responseBody = mapper.writeValueAsString(node); + break; + case "application/xml": + responseBody = mapper.writeValueAsString(responseBody); + break; + } + return responseBody; } } diff --git a/src/main/resources/assets/LogoWithName.png b/src/main/resources/assets/LogoWithName.png new file mode 100644 index 0000000..beb4ed6 Binary files /dev/null and b/src/main/resources/assets/LogoWithName.png differ diff --git a/src/main/resources/assets/RoundLogo_Black.png b/src/main/resources/assets/RoundLogo_Black.png new file mode 100644 index 0000000..81f359e Binary files /dev/null and b/src/main/resources/assets/RoundLogo_Black.png differ diff --git a/src/main/resources/assets/RoundLogo_White.png b/src/main/resources/assets/RoundLogo_White.png new file mode 100644 index 0000000..65fba0f Binary files /dev/null and b/src/main/resources/assets/RoundLogo_White.png differ diff --git a/src/main/resources/assets/editables/LogoWithName.xcf b/src/main/resources/assets/editables/LogoWithName.xcf new file mode 100644 index 0000000..dcc2668 Binary files /dev/null and b/src/main/resources/assets/editables/LogoWithName.xcf differ diff --git a/src/main/resources/assets/editables/RoundLogo.svg b/src/main/resources/assets/editables/RoundLogo.svg new file mode 100644 index 0000000..dd1d0a0 --- /dev/null +++ b/src/main/resources/assets/editables/RoundLogo.svg @@ -0,0 +1 @@ +Created by Aldric Rodríguezfrom the Noun Project \ No newline at end of file diff --git a/src/main/resources/fxml/Dashboard.fxml b/src/main/resources/fxml/Dashboard.fxml index bc0465d..028d373 100644 --- a/src/main/resources/fxml/Dashboard.fxml +++ b/src/main/resources/fxml/Dashboard.fxml @@ -5,34 +5,54 @@ + + + - +
- + + + + + + + + + + + + - + - + - + + + + + + + - +