private Map<String, Boolean> _getLinks(WikiPage page) throws PageContentException {

    try {
      return _getEngine(page.getFormat()).getOutgoingLinks(page);
    } catch (WikiFormatException wfe) {
      return Collections.emptyMap();
    }
  }
  private String _convert(
      WikiPage page, PortletURL viewPageURL, PortletURL editPageURL, String attachmentURLPrefix)
      throws PageContentException, WikiFormatException {

    LiferayPortletURL liferayViewPageURL = (LiferayPortletURL) viewPageURL;
    LiferayPortletURL liferayEditPageURL = (LiferayPortletURL) editPageURL;

    WikiEngine engine = _getEngine(page.getFormat());

    String content = engine.convert(page, viewPageURL, editPageURL, attachmentURLPrefix);

    String editPageURLString = StringPool.BLANK;

    if (editPageURL != null) {
      liferayEditPageURL.setParameter("title", "__REPLACEMENT__", false);

      editPageURLString = editPageURL.toString();

      editPageURLString = StringUtil.replace(editPageURLString, "__REPLACEMENT__", "$1");
    }

    Matcher matcher = _editPageURLPattern.matcher(content);

    content = _convertURLs(editPageURLString, matcher);

    String viewPageURLString = StringPool.BLANK;

    if (viewPageURL != null) {
      liferayViewPageURL.setParameter("title", "__REPLACEMENT__", false);

      viewPageURLString = viewPageURL.toString();

      viewPageURLString = StringUtil.replace(viewPageURLString, "__REPLACEMENT__", "$1");
    }

    matcher = _viewPageURLPattern.matcher(content);

    content = _convertURLs(viewPageURLString, matcher);

    content = _replaceAttachments(content, page.getTitle(), attachmentURLPrefix);

    return content;
  }
  @Override
  protected BaseModel<?> updateBaseModel(long primaryKey, ServiceContext serviceContext)
      throws Exception {

    WikiPage page = WikiPageLocalServiceUtil.getPageByPageId(primaryKey);

    serviceContext = (ServiceContext) serviceContext.clone();

    return WikiPageLocalServiceUtil.updatePage(
        TestPropsValues.getUserId(),
        page.getNodeId(),
        page.getTitle(),
        page.getVersion(),
        RandomTestUtil.randomString(),
        RandomTestUtil.randomString(),
        false,
        page.getFormat(),
        page.getParentTitle(),
        page.getRedirectTitle(),
        serviceContext);
  }