コード例 #1
0
  protected void moveFrontPage(long userId, WikiNode node, Map<String, String[]> options) {

    String frontPageTitle = MapUtil.getString(options, WikiImporterKeys.OPTIONS_FRONT_PAGE);

    if (Validator.isNotNull(frontPageTitle)) {
      frontPageTitle = normalizeTitle(frontPageTitle);

      try {
        if (WikiPageLocalServiceUtil.getPagesCount(node.getNodeId(), frontPageTitle, true) > 0) {

          ServiceContext serviceContext = new ServiceContext();

          serviceContext.setAddGroupPermissions(true);
          serviceContext.setAddGuestPermissions(true);

          WikiPageLocalServiceUtil.movePage(
              userId,
              node.getNodeId(),
              frontPageTitle,
              WikiPageConstants.FRONT_PAGE,
              false,
              serviceContext);
        }
      } catch (Exception e) {
        if (_log.isWarnEnabled()) {
          StringBundler sb = new StringBundler(4);

          sb.append("Could not move ");
          sb.append(WikiPageConstants.FRONT_PAGE);
          sb.append(" to the title provided: ");
          sb.append(frontPageTitle);

          _log.warn(sb.toString(), e);
        }
      }
    }
  }
コード例 #2
0
  @Override
  protected int getNotInTrashBaseModelsCount(BaseModel<?> parentBaseModel) throws Exception {

    return WikiPageLocalServiceUtil.getPagesCount(
        (Long) parentBaseModel.getPrimaryKeyObj(), true, WorkflowConstants.STATUS_ANY);
  }