@Override
  public Paper getByDoi(String doi) {
    log.debug("getByDoi: {}", doi);

    Paper paper = new Paper();
    paper.setDOI(doi);
    Set<Paper> result = getByExample(paper, "isPublic");
    if (result.size() == 0) {
      throw new IllegalStateException(MessageFormat.format("no paper with DOI: \"{0}\"", doi));
    } else if (result.size() > 1) {
      throw new IllegalStateException(
          MessageFormat.format("more than one paper with DOI: \"{0}\"", doi));
    }
    return result.iterator().next();
  }
  @Override
  public Paper getByTitle(String title) {
    log.debug("getByTitle: {}", title);

    Paper paper = new Paper();
    paper.setTitle(title);
    Set<Paper> result = getByExample(paper, "isPublic");
    if (result.size() > 1) {
      // should never happen because title is a unique key
      throw new IllegalStateException(
          MessageFormat.format("more than one paper with title: \"{0}\"", title));
    } else if (result.size() == 0) {
      return null;
    }
    return result.iterator().next();
  }