Пример #1
0
  protected String getOriginalTitle(String title, String prefix) {
    if (!title.startsWith(prefix)) {
      return title;
    }

    title = title.substring(prefix.length());

    long trashEntryId = GetterUtil.getLong(title);

    if (trashEntryId <= 0) {
      return title;
    }

    try {
      TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(trashEntryId);

      if (trashEntry == null) {
        TrashVersion trashVersion = TrashVersionLocalServiceUtil.getTrashVersion(trashEntryId);

        title = trashVersion.getTypeSettingsProperty("title");
      } else {
        title = trashEntry.getTypeSettingsProperty("title");
      }
    } catch (Exception e) {
      if (_log.isDebugEnabled()) {
        _log.debug("No trash entry or trash version exists with ID " + trashEntryId);
      }
    }

    return title;
  }