public Sprint findSprintinProject(
     String username, String projectName, String projectType, String sprintName)
     throws NullMongoTemplateException {
   Sprint sprint = null;
   MongoOperations mongoOperations = getMongoOperationInstance();
   if (mongoOperations == null) {
     throw new NullMongoTemplateException();
   }
   ProjectScrum project =
       mongoOperations.findOne(
           query(
               where("projectname")
                   .is(projectName)
                   .and("ownername")
                   .is(username)
                   .and("projecttype")
                   .is(projectType)),
           ProjectScrum.class);
   if (project != null) {
     List<Sprint> sprints = project.getSprints();
     if (sprints.size() == 0) {
       return null;
     }
     for (Sprint sprint1 : sprints) {
       if (sprint1.getSprintName().equals(sprintName)) {
         sprint = sprint1;
         break;
       }
     }
   }
   return sprint;
 }
 public List<Sprint> getSprints(String projectid) throws NullMongoTemplateException {
   MongoOperations mongoOperations = getMongoOperationInstance();
   if (mongoOperations == null) {
     throw new NullMongoTemplateException();
   }
   ProjectScrum project =
       mongoOperations.findOne(query(where("_id").is(projectid)), ProjectScrum.class, "project");
   List<Sprint> sprints = project.getSprints();
   return sprints;
 }
 public int getHoursRemaining(String projectid, String projecttype)
     throws NullMongoTemplateException {
   MongoOperations mongoOperations = getMongoOperationInstance();
   if (mongoOperations == null) {
     throw new NullMongoTemplateException();
   }
   ProjectScrum project =
       mongoOperations.findOne(query(where("_id").is(projectid)), ProjectScrum.class, "project");
   int totalHours = 0;
   int hoursCompleted = 0;
   List<Sprint> sprints = project.getSprints();
   for (Sprint sprint : sprints) {
     List<TaskScrum> tasks = sprint.getTasks();
     for (TaskScrum task : tasks) {
       totalHours = totalHours + task.getHoursAllotted();
       hoursCompleted = hoursCompleted + task.getHoursCompleted();
     }
   }
   int hoursRemaining = totalHours - hoursCompleted;
   return hoursRemaining;
 }