Esempio n. 1
0
 @CommitAfter
 void onActivate() throws Exception {
   Origin Japan = referenceService.findOriginByTitle("Japan");
   insertInDb(ROOT + "mvs.csv", Japan, referenceService.findPlatformByName("MVS"));
   // insertInDb(ROOT + "aes.csv", Japan, referenceService.findPlatformByName("AES"));
   // insertInDb(ROOT + "cd_jp.csv", Japan, referenceService.findPlatformByName("CD"));
   // insertInDb(ROOT + "cd_us.csv", referenceService.findOriginByTitle("US"),
   // referenceService.findPlatformByName("CD"));
 }
Esempio n. 2
0
  public void initializeWithUrlParameters(
      Request request, ReferenceService referenceService, Population population) {
    String originTitle = request.getParameter("origin");
    String platformName = request.getParameter("platform");
    String type = request.getParameter("type");
    String publisherName = request.getParameter("publisher");
    String userName = request.getParameter("user");

    if (originTitle != null || platformName != null || type != null || publisherName != null) {
      clear();
    }

    if (originTitle != null) {
      Origin origin = referenceService.findOriginByTitle(originTitle);
      if (origin != null) {
        filterByOrigin(origin);
      }
    }
    if (platformName != null) {
      Platform platform = referenceService.findPlatformByName(platformName);
      if (platform != null) {
        filterByPlatform(platform);
      }
    }
    if (publisherName != null) {
      Publisher publisher = referenceService.findPublisherByName(publisherName);
      if (publisher != null) {
        filterByPublisher(publisher);
      }
    }
    if (userName != null) {
      User user = population.findByLogin(userName);
      if (user != null) {
        filterByUser(user);
      }
    }
    if (type != null) {
      if ("hardwares".equals(type)) {
        filterByHardwares();
      } else if ("accessories".equals(type)) {
        filterByAccessories();
      } else {
        filterByGames();
      }
    }
  }
Esempio n. 3
0
  private void insertRow(Origin origin, Platform platform, String gameLine) throws ParseException {
    String[] splits = gameLine.split(",");
    String ngh = splits[0];
    String title = splits[1].replaceAll(" The", ", The");
    String publisher = splits[5];
    String megaCount = splits[6];
    String releaseDate = splits[7];

    Game game = new Game();
    game.setNgh(ngh);
    game.setTitle(title);
    game.setPlatform(platform);
    game.setOrigin(origin);
    game.setPublisher(referenceService.findPublisherByName(publisher));
    game.setMegaCount(Long.valueOf(megaCount));
    try {
      game.setReleaseDate(new SimpleDateFormat("DD/MM/yy").parse(releaseDate));
    } catch (Exception e) {

    }
    session.persist(game);
  }