@@ -0,0 +1,1721 @@
+package com.google.sps.servlets;%0A%0Aimport com.google.appengine.api.datastore.DatastoreService;%0Aimport com.google.appengine.api.datastore.DatastoreServiceFactory;%0Aimport com.google.appengine.api.datastore.Entity;%0Aimport com.google.firebase.auth.FirebaseAuth;%0Aimport com.google.firebase.auth.FirebaseAuthException;%0Aimport com.google.firebase.auth.UserRecord;%0Aimport com.google.sps.firebase.FirebaseAppManager;%0Aimport java.io.IOException;%0Aimport javax.servlet.ServletConfig;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.annotation.WebServlet;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0A// Retrieve the number of visits per class from Visit entity and send to chart%0A@WebServlet(%22/visits%22)%0Apublic class Visits extends HttpServlet %7B%0A  @Override%0A  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException %7B%0A%0A    ArrayList%3CString%3E listOfClassNames = new ArrayList%3CString%3E();%0A    ArrayList%3CInteger%3E visitsPerClass = new ArrayList%3CInteger%3E();%0A%0A    // Obtain visits from datastore and filter them into results query%0A    Query query = new Query(%22Visit%22);%0A    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();%0A    PreparedQuery results = datastore.prepare(query);%0A%0A    // Store the class name and number of visits into two separate lists%0A    for (Entity entity : results.asIterable()) %7B%0A      String className = entity.getProperty(%22???%22);%0A      Integer classVisits = entity.getProperty(%22numVisits%22);%0A%0A      listOfClassNames.add(className);%0A      visitsPerClass.add(classVisits);%0A    %7D%0A  %7D%0A%7D

Create visits servlet and obtain visits queries from datastore.