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