1 /* 2 * Copyright (C) 2003-2010 eXo Platform SAS. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Affero General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, see<http://www.gnu.org/licenses/>. 16 */ 17 package org.exoplatform.wiki.service.wysiwyg; 18 19 import org.xwiki.component.annotation.Role; 20 import org.xwiki.gwt.wysiwyg.client.wiki.EntityConfig; 21 import org.xwiki.gwt.wysiwyg.client.wiki.EntityReference; 22 import org.xwiki.gwt.wysiwyg.client.wiki.ResourceReference; 23 24 /** 25 * Manages 2 different link types: EntityConfig and EntityReference. 26 * 27 * @LevelAPI Experimental 28 */ 29 @Role 30 public interface LinkService { 31 32 /** 33 * Creates an EntityConfig (URL and reference) for a link with the specified origin and 34 * destination. The link reference in the returned EntityConfig is relative to the link origin. 35 * 36 * @param origin Origin of the link. 37 * @param destination Destination of the link. 38 * @return The entity link that can be used to insert the link in the origin. 39 */ 40 EntityConfig getEntityConfig(EntityReference origin, ResourceReference destination); 41 42 /** 43 * Parses a given link reference and extracts a reference to the linked entity. The returned entity reference is 44 * resolved that is relative to the given base entity reference. 45 * 46 * @param linkReference The link reference pointing to the entity. 47 * @param baseReference The entity reference which is used for resolving the linked entity reference. 48 * @return The link reference to the entity. 49 */ 50 ResourceReference parseLinkReference(String linkReference, EntityReference baseReference); 51 52 }