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     *
116     * @return the content definition
117     *
118     * @throws CmsRpcException if something goes wrong processing the request
119     */
120    CmsContentDefinition loadInitialDefinition(
121        String entityId,
122        String clientId,
123        String newLink,
124        CmsUUID modelFileId,
125        String editContext,
126        String mainLocale,
127        String mode,
128        String postCreateHandler,
129        CmsEditHandlerData editHandlerData,
130        Map<String, String> settingPresets)
131    throws CmsRpcException;
132
133    /**
134     * Loads new entity definition.<p>
135     * This will load the entity representation of a new locale node.<p>
136     *
137     * @param entityId the entity id/URI
138     * @param clientId the container element client id if available
139     * @param editedLocaleEntity the edited locale entity
140     * @param skipPaths the paths to skip during locale synchronization
141     * @param settingPresets the presets for container element settings
142     *
143     * @return the content definition
144     *
145     * @throws CmsRpcException if something goes wrong processing the request
146     */
147    CmsContentDefinition loadNewDefinition(
148        String entityId,
149        String clientId,
150        CmsEntity editedLocaleEntity,
151        Collection<String> skipPaths,
152        Map<String, String> settingPresets)
153    throws CmsRpcException;
154
155    /**
156     * Returns the content definition of the resource requested through parameter 'resource'.<p>
157     *
158     * @return the content definition
159     *
160     * @throws CmsRpcException if something goes wrong
161     */
162    CmsContentDefinition prefetch() throws CmsRpcException;
163
164    /**
165     * Saves and deletes the given entities. Returns the editor save result information.<p>
166     *
167     * @param lastEditedEntity the last edited entity
168     * @param clientId the container element client id if available
169     * @param deletedEntities the entity id's to delete
170     * @param skipPaths the paths to skip during locale synchronization
171     * @param lastEditedLocale the last edited locale
172     * @param clearOnSuccess  <code>true</code> to unlock resource after saving
173     *
174     * @return the editor save result information
175     *
176     * @throws CmsRpcException if something goes wrong processing the request
177     */
178    CmsSaveResult saveAndDeleteEntities(
179        CmsEntity lastEditedEntity,
180        String clientId,
181        List<String> deletedEntities,
182        Collection<String> skipPaths,
183        String lastEditedLocale,
184        boolean clearOnSuccess)
185    throws CmsRpcException;
186
187    /**
188     * Saves a value in an existing XML content.<p>
189     *
190     * @param contentId the structure id of the content
191     * @param contentPath the xpath of the value to set
192     * @param locale the locale in which to set the value
193     * @param value the value to set
194     *
195     * @return not used
196     * @throws CmsRpcException if something goes wrong
197     */
198    String saveValue(String contentId, String contentPath, String locale, String value) throws CmsRpcException;
199}