コード例 #1
0
  /**
   * Strip long params in publication object to prevent SQL errors on columns
   *
   * @param p publication to check
   */
  protected void stripLongParams(Publication p) {

    if (p.getTitle() != null && p.getTitle().length() > 1024) {
      p.setTitle(p.getTitle().substring(0, 1024));
    }
    if (p.getMain() != null && p.getMain().length() > 4000) {
      p.setMain(p.getMain().substring(0, 4000));
    }
    if (p.getIsbn() != null && p.getIsbn().length() > 32) {
      p.setIsbn(p.getIsbn().substring(0, 32));
    }
    if (p.getDoi() != null && p.getDoi().length() > 256) {
      p.setDoi(p.getDoi().substring(0, 256));
    }
  }