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.ade.contenteditor.shared.CmsContentDefinition;
032import org.opencms.ade.contenteditor.shared.CmsEditHandlerData;
033import org.opencms.ade.contenteditor.shared.CmsSaveResult;
034import org.opencms.gwt.CmsRpcException;
035import org.opencms.util.CmsUUID;
036
037import java.util.Collection;
038import java.util.List;
039import java.util.Map;
040
041/**
042 * The content editor service interface.<p>
043 */
044public interface I_CmsContentService extends org.opencms.acacia.shared.rpc.I_CmsContentService {
045
046    /** The content definition dictionary name. */
047    String DICT_CONTENT_DEFINITION = "com_alkacon_acacia_shared_ContentDefinition";
048
049    /** The back-link parameter. */
050    String PARAM_BACKLINK = "backlink";
051
052    /**
053     * Calls the editor change handlers.<p>
054     *
055     * @param entityId the edited entity id
056     * @param editedLocaleEntity the edited entity
057     * @param skipPaths the locale synchronization value paths to skip
058     * @param changedScopes the changed content value paths
059     *
060     * @return the changed content
061     *
062     * @throws CmsRpcException in case anything goes wrong
063     */
064    CmsContentDefinition callEditorChangeHandlers(
065        String entityId,
066        CmsEntity editedLocaleEntity,
067        Collection<String> skipPaths,
068        Collection<String> changedScopes)
069    throws CmsRpcException;
070
071    /**
072     * Copies the given source locale to the target locales.<p>
073     *
074     * @param locales the target locales
075     * @param sourceLocale the source locale
076     *
077     * @throws CmsRpcException if something goes wrong
078     */
079    void copyLocale(Collection<String> locales, CmsEntity sourceLocale) throws CmsRpcException;
080
081    /**
082     * Loads the content definition for a given entity.<p>
083     *
084     * @param entityId the entity id/URI
085     * @param clientId the container element client id if available
086     * @param editedLocaleEntity the edited locale entity
087     * @param skipPaths the paths to skip during locale synchronization
088     * @param settingPresets the presets for container element settings
089     *
090     * @return the content definition
091     *
092     * @throws Exception if something goes wrong processing the request
093     */
094    CmsContentDefinition loadDefinition(
095        String entityId,
096        String clientId,
097        CmsEntity editedLocaleEntity,
098        Collection<String> skipPaths,
099        Map<String, String> settingPresets)
100    throws Exception;
101
102    /**
103     * Loads the content definition for a given entity.<p>
104     *
105     * @param entityId the entity id/URI
106     * @param clientId the container element client id if available
107     * @param newLink the new link
108     * @param modelFileId  the optional model file id
109     * @param editContext the container page currently being edited (may be null)
110     * @param mainLocale the main language to copy in case the element language node does not exist yet
111     * @param mode the content creation mode
112     * @param postCreateHandler the post-create handler class name
113     * @param editHandlerData the edit handler data, if an edit handler is used for creating a new element; null otherwise
114     * @param settingPresets the presets for container element settings
115     * @param editorStylesheet the path of the editor style sheet (may be null)
116     *
117     * @return the content definition
118     *
119     * @throws CmsRpcException if something goes wrong processing the request
120     */
121    CmsContentDefinition loadInitialDefinition(
122        String entityId,
123        String clientId,
124        String newLink,
125        CmsUUID modelFileId,
126        String editContext,
127        String mainLocale,
128        String mode,
129        String postCreateHandler,
130        CmsEditHandlerData editHandlerData,
131        Map<String, String> settingPresets,
132        String editorStylesheet)
133    throws CmsRpcException;
134
135    /**
136     * Loads new entity definition.<p>
137     * This will load the entity representation of a new locale node.<p>
138     *
139     * @param entityId the entity id/URI
140     * @param clientId the container element client id if available
141     * @param editedLocaleEntity the edited locale entity
142     * @param skipPaths the paths to skip during locale synchronization
143     * @param settingPresets the presets for container element settings
144     *
145     * @return the content definition
146     *
147     * @throws CmsRpcException if something goes wrong processing the request
148     */
149    CmsContentDefinition loadNewDefinition(
150        String entityId,
151        String clientId,
152        CmsEntity editedLocaleEntity,
153        Collection<String> skipPaths,
154        Map<String, String> settingPresets)
155    throws CmsRpcException;
156
157    /**
158     * Returns the content definition of the resource requested through parameter 'resource'.<p>
159     *
160     * @return the content definition
161     *
162     * @throws CmsRpcException if something goes wrong
163     */
164    CmsContentDefinition prefetch() throws CmsRpcException;
165
166    /**
167     * Saves and deletes the given entities. Returns the editor save result information.<p>
168     *
169     * @param lastEditedEntity the last edited entity
170     * @param clientId the container element client id if available
171     * @param deletedEntities the entity id's to delete
172     * @param skipPaths the paths to skip during locale synchronization
173     * @param lastEditedLocale the last edited locale
174     * @param clearOnSuccess  <code>true</code> to unlock resource after saving
175     *
176     * @return the editor save result information
177     *
178     * @throws CmsRpcException if something goes wrong processing the request
179     */
180    CmsSaveResult saveAndDeleteEntities(
181        CmsEntity lastEditedEntity,
182        String clientId,
183        List<String> deletedEntities,
184        Collection<String> skipPaths,
185        String lastEditedLocale,
186        boolean clearOnSuccess)
187    throws CmsRpcException;
188
189    /**
190     * Saves a value in an existing XML content.<p>
191     *
192     * @param contentId the structure id of the content
193     * @param contentPath the xpath of the value to set
194     * @param locale the locale in which to set the value
195     * @param value the value to set
196     *
197     * @return not used
198     * @throws CmsRpcException if something goes wrong
199     */
200    String saveValue(String contentId, String contentPath, String locale, String value) throws CmsRpcException;
201}