Ejemplo n.º 1
1
 public Set<Sport> getSports() {
   Set<Sport> sports = new HashSet<Sport>();
   for (SeasonalTeam st : getSeasonalTeams()) {
     Sport sport = Sport.getInstance(st);
     if (!ObjectUtils.isBlank(sport)) {
       sports.add(sport);
     }
   }
   return sports;
 }
Ejemplo n.º 2
1
  public Long getEventsPlayedCount(Sport sport) {

    if (ObjectUtils.isBlank(sport)) {
      return null;
    }

    ObjectType seasonalAthleteType = ObjectType.getInstance(sport.getSeasonalAthleteClass());

    Query<SeasonalAthlete> seasonalAthleteQuery =
        Query.from(SeasonalAthlete.class)
            .where("typeId = ? && athlete = ?", seasonalAthleteType, this);
    return Query.from(Event.class).where("seasonalAthletes = ?", seasonalAthleteQuery).count();
  }
Ejemplo n.º 3
0
  public List<SeasonalAthlete> findSeasonalAthletes(Sport sport) {

    if (ObjectUtils.isBlank(sport)) {
      return null;
    }

    ObjectType seasonalAthleteType = ObjectType.getInstance(sport.getSeasonalAthleteClass());

    return Query.from(SeasonalAthlete.class)
        .where("typeId = ? && athlete = ?", seasonalAthleteType, this)
        .selectAll();
  }
Ejemplo n.º 4
0
  @Override
  public void doFilter(
      ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
      throws IOException, ServletException {
    boolean doFilterChain = true;
    Content content = null;

    if (servletRequest instanceof HttpServletRequest) {
      HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
      HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
      String servletPath = httpServletRequest.getServletPath();
      Page page = PageFilter.getPage(httpServletRequest);
      UrlKeyPageModification.AppPageKeys appPageKey = null;
      HandlerResult handlerResult = null;
      PageInfo pageInfo = new PageInfo();

      if (null == servletPath) {
      } else if (servletPath.startsWith("/school/")) {
        // use regular processing if the request yields a page
        // otherwise, if no page would be returned, use this code
        if (null == page) {
          String[] pathParts = servletPath.split("/");
          String keyInPath = pathParts.length > 2 ? pathParts[2] : null;
          String action = pathParts.length > 3 ? pathParts[3] : null;
          School school = null;

          if (!isBlank(keyInPath)) {
            if (!isBlank(keyInPath)) {
              Query<School> schoolQuery = School.findSchoolByKeyQuery(keyInPath.toLowerCase());
              school = getDisplayQuery(schoolQuery).first();
            }

            content = school;

            if (!isBlank(content)) {
              /*-- get the appPageKey based on the action --*/
              if (isBlank(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.School;
              } else if (FOLLOWERS_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.SchoolFollowers;
              } else if (NEWS_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.SchoolNews;
              } else if (MEDIA_PATH.equals(action)) {
                appPageKey = AppPageKeys.SchoolMedia;
                UrlKeyPageModification.AppPageKeys videoPageKey = AppPageKeys.SchoolVideo;
                UrlKeyPageModification.AppPageKeys galleryPageKey = AppPageKeys.SchoolGallery;

                String assetId = null;
                String galleryId = null;

                if (pathParts.length > 4) {
                  galleryId = pathParts[4];
                  servletRequest.setAttribute(DynamicMediaGallery.GALLERY_ID_ATTRIBUTE, galleryId);
                  appPageKey = galleryPageKey;

                  DynamicMediaGallery gallery =
                      Query.findUnique(DynamicMediaGallery.class, "id", galleryId);
                  if (!(gallery instanceof DateRangeGallery || gallery instanceof EventGallery)) {
                    page = null;
                    appPageKey = null;
                  }

                  if (null != gallery) {
                    servletRequest.setAttribute(GALLERY_ATTRIBUTE, gallery);
                  }

                  if (gallery instanceof VideoGallery) {
                    appPageKey = videoPageKey;
                  }

                  if (pathParts.length > 5) {
                    assetId = pathParts[5];

                    servletRequest.setAttribute(
                        DynamicMediaGallery.GALLERY_ASSET_ID_ATTRIBUTE, assetId);
                  }
                }
              } else if (SCORES_SCHEDULES_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.SchoolScoresSchedules;
              } else {
                // possible a team request
                String sportName = action;
                String levelName = pathParts.length > 4 ? pathParts[4] : null;
                String genderName = pathParts.length > 5 ? pathParts[5] : null;
                page = AppPageKeys.School.getPage();

                if ("All".equals(action) && "All".equals(levelName) && "All".equals(genderName)) {
                  page = AppPageKeys.School.getPage();
                } else if (!isBlank(sportName) && !isBlank(levelName) && !isBlank(genderName)) {
                  try {
                    Sport sport = Sport.valueOf(sportName.toUpperCase());
                    SportLevel level = SportLevel.valueOf(levelName.toUpperCase());
                    SportGender gender = SportGender.valueOf(genderName.toUpperCase());

                    Query<Team> teamQuery =
                        Query.from(Team.class)
                            .where(
                                "sport = ? && gender = ? && level = ? && school = ?",
                                sport,
                                gender,
                                level,
                                school);
                    getDisplayQuery(teamQuery);

                    Team team = teamQuery.first();

                    if (null != team) {
                      content = team;
                      page = AppPageKeys.Team.getPage();
                    }
                  } catch (Exception e) {
                    logger.debug("failed to get team from school request: " + servletPath, e);
                  }
                }
              }
            }
          }
        }
      } else if (servletPath.startsWith("/team/")) {
        // use regular processing if the request yields a page
        // otherwise, if no page would be returned, use this code
        if (null == page) {
          String[] pathParts = servletPath.split("/");
          String schoolNaturalKey = pathParts.length > 2 ? pathParts[2] : null;
          String teamDiscriminator = pathParts.length > 3 ? pathParts[3] : null;
          String action = pathParts.length > 4 ? pathParts[4] : null;
          Team team = null;
          String teamUrlNaturalKey = null;

          if (!isBlank(schoolNaturalKey) && !isBlank(teamDiscriminator)) {
            teamUrlNaturalKey = schoolNaturalKey + "/" + teamDiscriminator;

            Query<Team> teamQuery =
                Query.from(Team.class).where("naturalKey = ?", teamUrlNaturalKey.toLowerCase());

            getDisplayQuery(teamQuery);

            content = team = teamQuery.first();

            if (!isBlank(content)) {
              /*-- get the appPageKey based on the action --*/
              if (isBlank(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.Team;
              } else if (FOLLOWERS_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.TeamFollowers;
              } else if (NEWS_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.TeamNews;
              } else if (MEDIA_PATH.equals(action)) {
                appPageKey = AppPageKeys.TeamMedia;
                UrlKeyPageModification.AppPageKeys videoPageKey = AppPageKeys.TeamVideo;
                UrlKeyPageModification.AppPageKeys galleryPageKey = AppPageKeys.TeamGallery;

                String assetId = null;
                String galleryId = null;

                if (pathParts.length > 5) {
                  galleryId = pathParts[5];
                  servletRequest.setAttribute(DynamicMediaGallery.GALLERY_ID_ATTRIBUTE, galleryId);
                  appPageKey = galleryPageKey;

                  DynamicMediaGallery gallery =
                      Query.findUnique(DynamicMediaGallery.class, "id", galleryId);
                  if (!(gallery instanceof DateRangeGallery || gallery instanceof EventGallery)) {
                    page = null;
                    appPageKey = null;
                  }

                  if (null != gallery) {
                    servletRequest.setAttribute(GALLERY_ATTRIBUTE, gallery);
                  }

                  if (gallery instanceof VideoGallery) {
                    appPageKey = videoPageKey;
                  }

                  if (pathParts.length > 6) {
                    assetId = pathParts[6];

                    servletRequest.setAttribute(
                        DynamicMediaGallery.GALLERY_ASSET_ID_ATTRIBUTE, assetId);
                  }
                }
              } else if (SCORES_SCHEDULES_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.TeamScoresSchedules;
              } else if (STATS_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.TeamStats;
              } else if ("roster".equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.TeamRoster;
              }
            }
          }
        }
      } else if (servletPath.startsWith("/athlete/")) {
        // use regular processing if the request yields a page
        // otherwise, if no page would be returned, use this code
        if (null == page) {
          String[] pathParts = servletPath.split("/");
          String schoolNaturalKey = pathParts.length > 2 ? pathParts[2] : null;
          String fullName = pathParts.length > 3 ? pathParts[3] : null;
          String id = pathParts.length > 4 ? pathParts[4] : null;
          String action = pathParts.length > 5 ? pathParts[5] : null;
          Athlete athlete = null;
          String athleteUrlNaturalKey = null;

          if (!isBlank(schoolNaturalKey) && !isBlank(fullName)) {
            athleteUrlNaturalKey = schoolNaturalKey + "/" + fullName;

            Query<Athlete> athleteQuery = Query.from(Athlete.class).where("id = ?", id);

            getDisplayQuery(athleteQuery);

            content = athlete = athleteQuery.first();
            if (!isBlank(content)) {
              /*-- get the appPageKey based on the action --*/
              if (isBlank(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.Athlete;
              } else if (FOLLOWERS_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.AthleteFollowers;
              } else if (NEWS_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.AthleteNews;
              } else if (MEDIA_PATH.equals(action)) {
                appPageKey = AppPageKeys.AthleteMedia;
                UrlKeyPageModification.AppPageKeys videoPageKey = AppPageKeys.AthleteVideo;
                UrlKeyPageModification.AppPageKeys galleryPageKey = AppPageKeys.AthleteGallery;

                String assetId = null;
                String galleryId = null;

                if (pathParts.length > 6) {
                  galleryId = pathParts[6];
                  servletRequest.setAttribute(DynamicMediaGallery.GALLERY_ID_ATTRIBUTE, galleryId);
                  appPageKey = galleryPageKey;

                  DynamicMediaGallery gallery =
                      Query.findUnique(DynamicMediaGallery.class, "id", galleryId);
                  if (!(gallery instanceof DateRangeGallery || gallery instanceof EventGallery)) {
                    page = null;
                    appPageKey = null;
                  }

                  if (null != gallery) {
                    servletRequest.setAttribute(GALLERY_ATTRIBUTE, gallery);
                  }

                  if (gallery instanceof VideoGallery) {
                    appPageKey = videoPageKey;
                  }

                  if (pathParts.length > 7) {
                    assetId = pathParts[7];

                    servletRequest.setAttribute(
                        DynamicMediaGallery.GALLERY_ASSET_ID_ATTRIBUTE, assetId);
                  }
                }
              } else if (SCORES_SCHEDULES_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.AthleteScoresSchedules;
              } else if (STATS_PATH.equals(action)) {
                appPageKey = UrlKeyPageModification.AppPageKeys.AthleteStats;
              }
            }
          }
        }
      } else if (servletPath.startsWith("/user/")) {
        // use regular processing if the request yields a page
        // otherwise, if no page would be returned, use this code
        if (null == page) {
          String[] pathParts = servletPath.split("/");
          String id = pathParts.length > 2 ? pathParts[2] : null;
          String action = pathParts.length > 3 ? pathParts[3] : null;
          User user = null;

          if (!isBlank(id)) {
            content = user = User.findUserByKey(id);

            /*-- get the appPageKey based on the action --*/
            if (isBlank(action) && content != null) {
              appPageKey = UrlKeyPageModification.AppPageKeys.User;
            } else if (FOLLOWERS_PATH.equals(action)) {
              appPageKey = UrlKeyPageModification.AppPageKeys.UserFollowers;
            } else if (NEWS_PATH.equals(action)) {
              appPageKey = UrlKeyPageModification.AppPageKeys.UserNews;
            } else if (SCORES_SCHEDULES_PATH.equals(action)) {
              appPageKey = AppPageKeys.UserScoresSchedules;
            } else if (STATS_PATH.equals(action)) {
              appPageKey = AppPageKeys.UserStats;
            } else if (MEDIA_PATH.equals(action)) {
              appPageKey = AppPageKeys.UserMedia;
              UrlKeyPageModification.AppPageKeys videoPageKey = AppPageKeys.UserVideo;
              UrlKeyPageModification.AppPageKeys galleryPageKey = AppPageKeys.UserGallery;

              String assetId = null;
              String galleryId = null;

              if (pathParts.length > 4) {
                galleryId = pathParts[4];
                servletRequest.setAttribute(DynamicMediaGallery.GALLERY_ID_ATTRIBUTE, galleryId);
                appPageKey = galleryPageKey;

                DynamicMediaGallery gallery =
                    Query.findUnique(DynamicMediaGallery.class, "id", galleryId);
                if (!(gallery instanceof DateRangeGallery || gallery instanceof EventGallery)) {
                  page = null;
                  appPageKey = null;
                }

                if (null != gallery) {
                  servletRequest.setAttribute(GALLERY_ATTRIBUTE, gallery);
                }

                if (gallery instanceof VideoGallery) {
                  appPageKey = videoPageKey;
                }

                if (pathParts.length > 5) {
                  assetId = pathParts[5];

                  servletRequest.setAttribute(
                      DynamicMediaGallery.GALLERY_ASSET_ID_ATTRIBUTE, assetId);
                }
              }
            } else if ("following".equals(action)) {
              appPageKey = UrlKeyPageModification.AppPageKeys.UserFollowing;
            } else if ("highlights".equals(action)) {
              appPageKey = UrlKeyPageModification.AppPageKeys.UserHighlights;
            }
          }
        }
      } else if (servletPath.startsWith("/game/")
          || servletPath.startsWith("/meet/")
          || servletPath.startsWith("/event/")) {
        // use regular processing if the request yields a page
        // otherwise, if no page would be returned, use this code
        if (null == page) {
          String[] pathParts = servletPath.split("/");
          String schoolNaturalKey = pathParts.length > 2 ? pathParts[2] : null;
          String teamDiscriminator = pathParts.length > 3 ? pathParts[3] : null;
          String eventKey = pathParts.length > 4 ? pathParts[4] : null;
          String action = pathParts.length > 5 ? pathParts[5] : null;
          Event event = null;

          if (!isBlank(eventKey)) {
            content = event = getDisplayQuery(Event.findEventByKeyQuery(eventKey)).first();

            String teamUrlNaturalKey = schoolNaturalKey + "/" + teamDiscriminator;
            Query<Team> teamQuery =
                Query.from(Team.class).where("naturalKey = ?", teamUrlNaturalKey.toLowerCase());

            getDisplayQuery(teamQuery);
            Team team = teamQuery.first();

            Query<School> schoolQuery =
                Query.from(School.class).where("naturalKey = ?", schoolNaturalKey.toLowerCase());

            getDisplayQuery(schoolQuery);
            School contextSchool = schoolQuery.first();

            httpServletRequest.setAttribute(HssUtils.SCHOOL_CONTEXT_ATTRIBUTE, contextSchool);

            if (content != null) {
              /*-- get the appPageKey based on the action --*/
              if (isBlank(action)) {

                if (event instanceof Game) {
                  appPageKey = UrlKeyPageModification.AppPageKeys.Game;

                } else if (event instanceof Meet) {
                  appPageKey = UrlKeyPageModification.AppPageKeys.Meet;
                }

                if (null != appPageKey) page = appPageKey.getPage();

                if (isBlank(page)) {
                  appPageKey = UrlKeyPageModification.AppPageKeys.Event;
                }
              } else if (MEDIA_PATH.equals(action)) {
                appPageKey = AppPageKeys.EventMedia;
                UrlKeyPageModification.AppPageKeys videoPageKey = AppPageKeys.EventVideo;
                UrlKeyPageModification.AppPageKeys galleryPageKey = AppPageKeys.EventGallery;

                String assetId = null;
                String galleryId = null;
                if (event instanceof Game) {
                  appPageKey = AppPageKeys.GameMedia;
                  galleryPageKey = UrlKeyPageModification.AppPageKeys.GameGallery;
                  videoPageKey = UrlKeyPageModification.AppPageKeys.GameVideo;
                } else if (event instanceof Meet) {
                  appPageKey = AppPageKeys.MeetMedia;
                  galleryPageKey = UrlKeyPageModification.AppPageKeys.MeetGallery;
                  videoPageKey = UrlKeyPageModification.AppPageKeys.MeetVideo;
                }

                if (pathParts.length > 6) {
                  galleryId = pathParts[6];
                  servletRequest.setAttribute(DynamicMediaGallery.GALLERY_ID_ATTRIBUTE, galleryId);
                  appPageKey = galleryPageKey;

                  if (null != appPageKey) {
                    page = appPageKey.getPage();
                  }

                  if (isBlank(page)) {
                    appPageKey = UrlKeyPageModification.AppPageKeys.EventGallery;
                  }

                  DynamicMediaGallery gallery =
                      Query.findUnique(DynamicMediaGallery.class, "id", galleryId);
                  if (!(gallery instanceof DateRangeGallery || gallery instanceof EventGallery)) {
                    page = null;
                    appPageKey = null;
                  }

                  if (null != gallery) {
                    servletRequest.setAttribute(GALLERY_ATTRIBUTE, gallery);
                  }

                  if (gallery instanceof VideoGallery) {
                    appPageKey = videoPageKey;
                  }

                  if (pathParts.length > 7) {
                    assetId = pathParts[7];

                    servletRequest.setAttribute(
                        DynamicMediaGallery.GALLERY_ASSET_ID_ATTRIBUTE, assetId);
                  }
                }
              }
            }
          }
        }
      }

      if (null == page) { // use a handler
        try {
          for (Handler handler : handlers) {
            if (null == handler) continue;

            if (handler.matches(httpServletRequest)) {
              handlerResult = handler.findHandlerResult(httpServletRequest, httpServletResponse);

              if (null == handlerResult) continue;

              if (null == page || null != handlerResult.page) page = handlerResult.page;

              content = handlerResult.content;

              if (null != handlerResult.pageInfo) pageInfo = handlerResult.pageInfo;

              if (handlerResult.stopHandlerChain) {
                doFilterChain = !handlerResult.stopFilterChain;
                break;
              }
            }
          }
        } catch (Exception e) {
          logger.debug("failed in Handler", e);
        }
      }

      if (null != appPageKey && page == null) {
        page = appPageKey.getPage();
      }

      if (null != page) {
        PageFilter.setPage(httpServletRequest, page);
        servletRequest.setAttribute(HssUtils.PAGE_ATTRIBUTE, page);

        if (null != content) {
          servletRequest.setAttribute(
              UrlKeyPageModification.ID_FROM_NATURAL_KEY_ATTR, content.getId().toString());
          PageFilter.setMainObject(httpServletRequest, content);
        }
      }

      if (true) {
        httpServletRequest.setAttribute(
            PAGE_INFO_ATTRIBUTE, pageInfo.updateFromRequest(httpServletRequest));
      }
    }

    if (doFilterChain) {
      filterChain.doFilter(servletRequest, servletResponse);
      return;
    }
  }
Ejemplo n.º 5
0
          public HandlerResult findHandlerResult(
              HttpServletRequest request, HttpServletResponse response) {
            String servletPath = request.getServletPath();
            String[] pathParts = servletPath.split("/");
            String UsStateOrSportName = pathParts.length > 2 ? pathParts[2] : null;

            int sportPathIndex = 2;
            String sportName = pathParts.length > sportPathIndex ? pathParts[sportPathIndex] : null;
            int pathIndex = 2;

            String action = null;
            String usState = null;
            if ("state".equals(sportName)) {
              action = sportName;
              sportPathIndex++;
              usState = pathParts.length > sportPathIndex ? pathParts[sportPathIndex] : null;

              USState stateKey = null;
              if (!isBlank(usState)) {
                USState usStateEnum = null;
                try {
                  usStateEnum = USState.valueOf(usState.replaceAll(" ", "_").toUpperCase());
                } catch (Exception e) {
                  logger.debug("failed to get USState for " + usState, e);
                }
                if (isBlank(usStateEnum)) usStateEnum = USState.getEnumValueByString(usState);

                if (isBlank(usStateEnum)) usStateEnum = USState.getEnumValueByAbbreviation(usState);

                if (!isBlank(usStateEnum)) {
                  request.setAttribute(US_STATE_REQUEST_ATTRIBUTE, usStateEnum.getAbbreviation());
                }
              }

              sportPathIndex++;
              sportName = pathParts.length > sportPathIndex ? pathParts[sportPathIndex] : null;
            } else if ("playoffs".equals(sportName)) {
              action = sportName;
              sportPathIndex++;

              sportName = pathParts.length > sportPathIndex ? pathParts[sportPathIndex] : null;
            } else if ("ratings".equals(sportName)) {
              action = sportName;
              sportPathIndex++;

              sportName = pathParts.length > sportPathIndex ? pathParts[sportPathIndex] : null;
            }

            Sport sport = Sport.FOOTBALL;

            try {
              if (!isBlank(sportName)) sport = Sport.valueOf(sportName.toUpperCase());
            } catch (Exception e) {
              logger.debug("failed to get sport", e);
            }

            String levelName =
                pathParts.length > (sportPathIndex + 1) ? pathParts[(sportPathIndex + 1)] : null;
            String genderName =
                pathParts.length > (sportPathIndex + 2) ? pathParts[(sportPathIndex + 2)] : null;
            String seasonNumber =
                pathParts.length > (sportPathIndex + 3) ? pathParts[(sportPathIndex + 3)] : null;
            String schoolName =
                pathParts.length > (sportPathIndex + 4) ? pathParts[(sportPathIndex + 4)] : null;

            HandlerResult result = new HandlerResult();

            String sportAttribute = null;

            SportGender gender = SportGender.BOYS;
            if (!isBlank(genderName)) {
              gender = SportGender.valueOf(genderName.toUpperCase());
              sportAttribute = sportName.toUpperCase() + "-" + genderName.toUpperCase();
            }

            Content content = null;
            Page page = null;

            if (!isBlank(schoolName)) {
              School school = School.findSchoolByKey(schoolName);
              if (null != school) {

                Query<Team> teamQuery =
                    Query.from(Team.class)
                        .where(
                            "sport = ? && gender = ? && level = ? && school = ?",
                            sport,
                            gender,
                            SportLevel.VARSITY,
                            school);
                getDisplayQuery(teamQuery);

                Team team = teamQuery.first();
                if (null == team) {
                  content = school;
                  page = AppPageKeys.School.getPage();
                } else {
                  content = team;
                  page = AppPageKeys.Team.getPage();
                }
              }

            } else {
              Ranking ranking =
                  Query.from(Ranking.class).where("sport = ? && gender = ?", sport, gender).first();
              if (null == ranking) {
                ranking = Query.from(Ranking.class).first();
              }

              Template template = Query.from(Template.class).where("name ~= ?", "Ranking").first();

              content = ranking;
              page = template;
            }

            result.page = page;
            result.content = content;
            request.setAttribute(MASSEY_SPORT_REQUEST_ATTRIBUTE, sportAttribute);

            result.stopHandlerChain = true;

            return result;
          }
Ejemplo n.º 6
0
          public HandlerResult findHandlerResult(
              HttpServletRequest request, HttpServletResponse response) {
            String servletPath = request.getServletPath();
            String[] pathParts = servletPath.split("/");
            String schoolKey = pathParts.length > 2 ? pathParts[2] : null;
            String athleteKey = pathParts.length > 3 ? pathParts[3] : null;
            String unknownMarker = pathParts.length > 4 ? pathParts[4] : null;
            String sportName = pathParts.length > 5 ? pathParts[5] : null;
            String levelName = pathParts.length > 6 ? pathParts[6] : null;
            String genderName = pathParts.length > 7 ? pathParts[7] : null;
            HandlerResult result = new HandlerResult();
            School school = null;
            if (!isBlank(schoolKey)) {
              school = School.findSchoolByKey(schoolKey.toLowerCase());
            }

            if (isBlank(school)) {
              result.content = null;
              result.page = null;
              result.stopHandlerChain = false;
              result.stopFilterChain = false;

              return result;
            } else if (isBlank(athleteKey)) {
              result.content = school;
              result.page = AppPageKeys.School.getPage();
              result.stopHandlerChain = true;
              result.stopFilterChain = false;

              try {
                Sport sport = Sport.valueOf(sportName.toUpperCase());
                SportLevel level = SportLevel.valueOf(levelName.toUpperCase());
                SportGender gender = SportGender.valueOf(genderName.toUpperCase());

                Query<Team> teamQuery =
                    Query.from(Team.class)
                        .where(
                            "sport = ? && gender = ? && level = ? && school = ?",
                            sport,
                            gender,
                            level,
                            school);
                getDisplayQuery(teamQuery);

                Team team = teamQuery.first();

                if (null != team) {
                  result.content = team;
                  result.page = AppPageKeys.Team.getPage();
                }
              } catch (Exception e) {
                logger.debug("failed to get team from request: " + servletPath, e);
              }

              return result;

            } else {

              try {
                Athlete athlete = Athlete.findAthleteByKey(athleteKey);

                if (null != athlete) {
                  setSchool(request, school);
                  result.content = athlete;
                  result.page = AppPageKeys.Athlete.getPage();
                  result.stopHandlerChain = true;
                  result.stopFilterChain = false;
                }

                return result;
              } catch (Exception e) {
                logger.debug("failed to get athlete from school request: " + servletPath, e);
              }
            }

            return result;
          }