001 /** 002 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 013 */ 014 015 package com.liferay.portlet.wiki.engines; 016 017 import com.liferay.portlet.wiki.PageContentException; 018 import com.liferay.portlet.wiki.model.WikiPage; 019 020 import java.util.Map; 021 022 import javax.portlet.PortletURL; 023 024 /** 025 * @author Jorge Ferrer 026 */ 027 public interface WikiEngine { 028 029 /** 030 * Convert the content of the given page to HTML using the view and edit 031 * URLs to build links. 032 * 033 * @param page the wiki page 034 * @param viewPageURL the URL to view the page 035 * @param editPageURL the URL to edit the page 036 * @param attachmentURLPrefix the URL prefix to use for attachments to the 037 * page 038 * @return HTML string 039 * @throws PageContentException if a page content exception occurred 040 */ 041 public String convert( 042 WikiPage page, PortletURL viewPageURL, PortletURL editPageURL, 043 String attachmentURLPrefix) 044 throws PageContentException; 045 046 /** 047 * Get a map with the links included in the given page. The key of each map 048 * entry is the title of the linked page. The value is a Boolean object that 049 * indicates if the linked page exists or not. 050 * 051 * @param page the page 052 * @return a map of links 053 * @throws PageContentException if a page content exception occurred 054 */ 055 public Map<String, Boolean> getOutgoingLinks(WikiPage page) 056 throws PageContentException; 057 058 /** 059 * Set the configuraton to support quick links to other wikis. The format of 060 * the configuration is specific to the wiki engine. 061 */ 062 public void setInterWikiConfiguration(String interWikiConfiguration); 063 064 /** 065 * Set the main wiki configuraiton as a String. The format of the 066 * configuration is specific to the wiki engine. 067 */ 068 public void setMainConfiguration(String mainConfiguration); 069 070 /** 071 * Validate the content of a wiki page for this engine. 072 * 073 * @param nodeId the ID of the wiki page node 074 * @param content the page content 075 * @return <code>true</code> if the content is valid 076 */ 077 public boolean validate(long nodeId, String content); 078 079 }