コード例 #1
0
  public static Result get() throws Exception {
    final String facebookUserId = session("facebookUserId");

    final User user = DBUtil.getUserByFacebookId(facebookUserId);
    final List<ShareableItem> borrowableItems = DBUtil.getAllBorrowAbleItemsForUser(user);

    response().setContentType("application/json");
    return ok(Global.objectMapper().writeValueAsString(borrowableItems));
  }
コード例 #2
0
  public static void analyzeStaff(SiteInformationOld siteInfo) throws IOException {
    fetchPagesConditionally(siteInfo);

    for (PageInformation pageInfo : siteInfo.getPages()) {
      File in =
          new File(
              Global.getCrawlStorageFolder()
                  + siteInfo.getCrawlStorageFolder()
                  + "/"
                  + pageInfo.getFileLocation());
      PageAnalyzer.analyzeStaff(pageInfo, in);
    }
  }
コード例 #3
0
  public static void analyzeMatches(SiteInformationOld siteInfo) throws IOException {
    fetchPagesConditionally(siteInfo);

    for (PageInformation pageInfo : siteInfo.getPages()) {
      File in =
          new File(
              Global.getCrawlStorageFolder()
                  + siteInfo.getCrawlStorageFolder()
                  + "/"
                  + pageInfo.getFileLocation());
      //			System.out.println(siteInfo.getId() + " : " + pageInfo.getPath());
      PageAnalyzer.analyzeMatches(pageInfo, in);
    }
  }
コード例 #4
0
  public static void fetchPages(SiteInformationOld siteInfo) throws IOException {

    File siteFolder = new File(Global.getCrawlStorageFolder() + siteInfo.getCrawlStorageFolder());
    if (!(siteFolder.exists() && siteFolder.isDirectory())) {
      System.out.println("But it doesn't exist : " + siteFolder.getAbsolutePath());
      throw new IOException("There is no site information at this location");
    }

    PageInformation pageInfo;
    String pagePath;
    for (File pageFile : siteFolder.listFiles()) {
      if (pageFile.isFile() && !FilenameUtils.getExtension(pageFile.getName()).equals("ser")) {
        pagePath = pageFile.getName().replaceAll("HTML-", "");
        pageInfo = new PageInformation(pagePath);
        pageInfo.setFileLocation(pagePath);
        siteInfo.addPageInformation(pageInfo);
      }
    }
    if (siteInfo.getPages().size() < 1) {
      siteInfo.setEmptySite(true);
    }
  }