コード例 #1
0
ファイル: Tdb.java プロジェクト: Mvrooman/lockss-daemon
  /**
   * Get the TdbTitle name from the properties. Fall back to a name derived from the TdbAU name if
   * not specified.
   *
   * @param props a group of properties
   * @param au the TdbAu
   * @return a TdbTitle name
   */
  private String getTdbTitleName(Properties props, TdbAu au) {
    // use "journalTitle" prop if specified, or synthesize it
    // from auName and one of several properties
    String titleName = getTdbTitleName(props);
    if (titleName == null) {
      String year = au.getYear();
      String volume = au.getVolume();
      String issue = au.getIssue();

      String auName = au.getName();
      String auNameLC = auName.toLowerCase();
      if ((volume != null) && auNameLC.endsWith(" vol " + volume)) {
        titleName = auName.substring(0, auName.length() - " vol ".length() - volume.length());
      } else if ((volume != null) && auNameLC.endsWith(" volume " + volume)) {
        titleName = auName.substring(0, auName.length() - " volume ".length() - volume.length());
      } else if ((issue != null) && auNameLC.endsWith(" issue " + issue)) {
        titleName = auName.substring(0, auName.length() - " issue ".length() - issue.length());
      } else if ((year != null) && auNameLC.endsWith(" " + year)) {
        titleName = auName.substring(0, auName.length() - " ".length() - year.length());
      } else {
        titleName = UNKNOWN_TITLE_PREFIX + "[" + auName + "]";
      }
    }
    return titleName;
  }