Skip to content

Commit

Permalink
DAO, reqHandler: delete debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
Amarygdala committed Oct 28, 2022
1 parent 3447b12 commit 1280ed1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
13 changes: 0 additions & 13 deletions src/main/java/ca/utoronto/utm/mcs/Neo4jDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public int addActor(String Name, String id) {
query = String.format(query, id);
Result result = this.session.run(query);
if(result.hasNext()){
System.out.println("Actor Found: " + id);
return 400;
}
query = "CREATE (a:actor {Name: \"%s\", id: \"%s\"})";
Expand All @@ -44,7 +43,6 @@ public int addMovie(String Name, String id) {
query = String.format(query, id);
Result result = this.session.run(query);
if(result.hasNext()){
System.out.println("Movie Found: " + id);
return 400;
}
query = "CREATE (m:movie {Name: \"%s\", id: \"%s\"})";
Expand All @@ -59,23 +57,20 @@ public int addRelationship(String actorId, String movieId) {
query = String.format(query, actorId);
Result result = this.session.run(query);
if(!result.hasNext()){
System.out.println("Actor not found: " + actorId);
return 404;
}

query = "MATCH (m:movie { id: \"%s\"}) RETURN m.id";
query = String.format(query, movieId);
result = this.session.run(query);
if(!result.hasNext()){
System.out.println("Movie not found: " + movieId);
return 404;
}

query = "MATCH (a:actor {id: \"%s\"})-[:ACTED_IN]->(m:movie {id: \"%s\"}) RETURN a.id";
query = String.format(query, actorId, movieId);
result = this.session.run(query);
if(result.hasNext()){
System.out.println("Relationship Found: " + actorId +"->"+ movieId);
return 400;
}

Expand All @@ -93,7 +88,6 @@ public String getActor(String id) throws JSONException {

Result result = this.session.run(query);
if(!result.hasNext()){
System.out.println("No actor with this ID");
return "404";
}
List<Record> resultValues = result.list();
Expand All @@ -118,9 +112,7 @@ public String getMovie(String movieId) throws JSONException {
query = String.format(query, movieId);

Result result = this.session.run(query);
System.out.println(result.hasNext());
if(!result.hasNext()){
System.out.println("No movie with this ID");
return "404";
}
List<Record> resultValues = result.list();
Expand All @@ -144,15 +136,13 @@ public String hasRelationship(String actorId, String movieId) throws JSONExcepti
query = String.format(query, movieId);
Result result = this.session.run(query);
if(!result.hasNext()){
System.out.println("No movie with this ID");
return "404";
}

query = "MATCH (a:actor { id: \"%s\"}) RETURN a.Name";
query = String.format(query, actorId);
result = this.session.run(query);
if(!result.hasNext()){
System.out.println("No actor with this ID");
return "404";
}

Expand Down Expand Up @@ -184,7 +174,6 @@ public String computeBaconNumber(String actorId) throws JSONException{

Result result = this.session.run(query);
if(!result.hasNext()){
System.out.println("No path");
return "404";
}
Record record = result.next();
Expand All @@ -211,9 +200,7 @@ public String computeBaconPath(String actorId) throws JSONException {
query = String.format(query, actorId, kevinBid);

Result result = this.session.run(query);
System.out.println(result);
if(!result.hasNext()){
System.out.println("No path");
return "404";
}
Record record = result.next();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/ca/utoronto/utm/mcs/ReqHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public void handle(HttpExchange exchange) throws IOException {

URI requestURI = exchange.getRequestURI();
String request = requestURI.toString().split("/")[3];
System.out.println(request);
try {
switch (exchange.getRequestMethod()) {
case "GET":
Expand Down

0 comments on commit 1280ed1

Please sign in to comment.