001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.contenteditor.shared.rpc; 029 030import org.opencms.acacia.shared.CmsEntity; 031import org.opencms.acacia.shared.CmsValidationResult; 032import org.opencms.ade.contenteditor.shared.CmsContentDefinition; 033import org.opencms.ade.contenteditor.shared.CmsEditHandlerData; 034import org.opencms.ade.contenteditor.shared.CmsSaveResult; 035import org.opencms.gwt.CmsRpcException; 036import org.opencms.util.CmsUUID; 037 038import java.util.Collection; 039import java.util.List; 040import java.util.Map; 041 042/** 043 * The content editor service interface.<p> 044 */ 045public interface I_CmsContentService extends org.opencms.acacia.shared.rpc.I_CmsContentService { 046 047 /** The content definition dictionary name. */ 048 String DICT_CONTENT_DEFINITION = "com_alkacon_acacia_shared_ContentDefinition"; 049 050 /** The back-link parameter. */ 051 String PARAM_BACKLINK = "backlink"; 052 053 /** 054 * Calls the editor change handlers.<p> 055 * 056 * @param entityId the edited entity id 057 * @param editedLocaleEntity the edited entity 058 * @param skipPaths the locale synchronization value paths to skip 059 * @param changedScopes the changed content value paths 060 * 061 * @return the changed content 062 * 063 * @throws CmsRpcException in case anything goes wrong 064 */ 065 CmsContentDefinition callEditorChangeHandlers( 066 String entityId, 067 CmsEntity editedLocaleEntity, 068 Collection<String> skipPaths, 069 Collection<String> changedScopes) 070 throws CmsRpcException; 071 072 /** 073 * Copies the given source locale to the target locales.<p> 074 * 075 * @param locales the target locales 076 * @param sourceLocale the source locale 077 * 078 * @throws CmsRpcException if something goes wrong 079 */ 080 void copyLocale(Collection<String> locales, CmsEntity sourceLocale) throws CmsRpcException; 081 082 /** 083 * Loads the content definition for a given entity.<p> 084 * 085 * @param entityId the entity id/URI 086 * @param clientId the container element client id if available 087 * @param editedLocaleEntity the edited locale entity 088 * @param skipPaths the paths to skip during locale synchronization 089 * @param settingPresets the presets for container element settings 090 * 091 * @return the content definition 092 * 093 * @throws Exception if something goes wrong processing the request 094 */ 095 CmsContentDefinition loadDefinition( 096 String entityId, 097 String clientId, 098 CmsEntity editedLocaleEntity, 099 Collection<String> skipPaths, 100 Map<String, String> settingPresets) 101 throws Exception; 102 103 /** 104 * Loads the content definition for a given entity.<p> 105 * 106 * @param entityId the entity id/URI 107 * @param clientId the container element client id if available 108 * @param newLink the new link 109 * @param modelFileId the optional model file id 110 * @param editContext the container page currently being edited (may be null) 111 * @param mainLocale the main language to copy in case the element language node does not exist yet 112 * @param mode the content creation mode 113 * @param postCreateHandler the post-create handler class name 114 * @param editHandlerData the edit handler data, if an edit handler is used for creating a new element; null otherwise 115 * @param settingPresets the presets for container element settings 116 * @param editorStylesheet the path of the editor style sheet (may be null) 117 * 118 * @return the content definition 119 * 120 * @throws CmsRpcException if something goes wrong processing the request 121 */ 122 CmsContentDefinition loadInitialDefinition( 123 String entityId, 124 String clientId, 125 String newLink, 126 CmsUUID modelFileId, 127 String editContext, 128 String mainLocale, 129 String mode, 130 String postCreateHandler, 131 CmsEditHandlerData editHandlerData, 132 Map<String, String> settingPresets, 133 String editorStylesheet) 134 throws CmsRpcException; 135 136 /** 137 * Loads new entity definition.<p> 138 * This will load the entity representation of a new locale node.<p> 139 * 140 * @param entityId the entity id/URI 141 * @param clientId the container element client id if available 142 * @param editedLocaleEntity the edited locale entity 143 * @param skipPaths the paths to skip during locale synchronization 144 * @param settingPresets the presets for container element settings 145 * 146 * @return the content definition 147 * 148 * @throws CmsRpcException if something goes wrong processing the request 149 */ 150 CmsContentDefinition loadNewDefinition( 151 String entityId, 152 String clientId, 153 CmsEntity editedLocaleEntity, 154 Collection<String> skipPaths, 155 Map<String, String> settingPresets) 156 throws CmsRpcException; 157 158 /** 159 * Returns the content definition of the resource requested through parameter 'resource'.<p> 160 * 161 * @return the content definition 162 * 163 * @throws CmsRpcException if something goes wrong 164 */ 165 CmsContentDefinition prefetch() throws CmsRpcException; 166 167 /** 168 * Saves and deletes the given entities. Returns the editor save result information.<p> 169 * 170 * @param lastEditedEntity the last edited entity 171 * @param clientId the container element client id if available 172 * @param deletedEntities the entity id's to delete 173 * @param skipPaths the paths to skip during locale synchronization 174 * @param lastEditedLocale the last edited locale 175 * @param clearOnSuccess <code>true</code> to unlock resource after saving 176 * @param failOnWarnings <code>true</code> to prevent saving when there are validation warnings 177 * 178 * @return the editor save result information 179 * 180 * @throws CmsRpcException if something goes wrong processing the request 181 */ 182 CmsSaveResult saveAndDeleteEntities( 183 CmsEntity lastEditedEntity, 184 String clientId, 185 List<String> deletedEntities, 186 Collection<String> skipPaths, 187 String lastEditedLocale, 188 boolean clearOnSuccess, 189 boolean failOnWarnings) 190 throws CmsRpcException; 191 192 /** 193 * Saves a value in an existing XML content.<p> 194 * 195 * @param contentId the structure id of the content 196 * @param contentPath the xpath of the value to set 197 * @param locale the locale in which to set the value 198 * @param value the value to set 199 * 200 * @return not used 201 * @throws CmsRpcException if something goes wrong 202 */ 203 String saveValue(String contentId, String contentPath, String locale, String value) throws CmsRpcException; 204 205 /** 206 * Validates the edited XML content, taking all current changes into account. Returns the validation result.<p> 207 * 208 * @param lastEditedEntity the last edited entity 209 * @param clientId the container element client id if available 210 * @param deletedEntities the entity id's to delete 211 * @param skipPaths the paths to skip during locale synchronization 212 * @param lastEditedLocale the last edited locale 213 * 214 * @return the validatoin result 215 * 216 * @throws CmsRpcException if something goes wrong processing the request 217 */ 218 CmsValidationResult validateEntities( 219 CmsEntity lastEditedEntity, 220 String clientId, 221 List<String> deletedEntities, 222 Collection<String> skipPaths, 223 String lastEditedLocale) 224 throws CmsRpcException; 225}