예제 #1
0
  @Override
  public void ImportWarningCategories() {
    List<WarningCategory> warningCategories = new ArrayList<WarningCategory>();
    try {
      Reader reader =
          new InputStreamReader(
              AdminServiceImpl.class
                  .getClassLoader()
                  .getResourceAsStream("mongo/warningCategories.json"));
      warningCategories =
          new Gson().fromJson(reader, new TypeToken<List<WarningCategory>>() {}.getType());

    } catch (JsonSyntaxException e) {
      log.error(e.getMessage(), e);
      throw new MedCheckerException(e.getMessage());
    } catch (JsonIOException e) {
      log.error(e.getMessage(), e);
      throw new MedCheckerException(e.getMessage());
    }

    warningRepo.insert(warningCategories);
  }
예제 #2
0
 @Override
 public List<WarningCategory> getWarningCategories() {
   return warningRepo.fetchValidWarnings();
 }