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.ugc.shared.rpc;
029
030import org.opencms.ugc.shared.CmsUgcContent;
031import org.opencms.util.CmsUUID;
032
033import java.util.Map;
034import java.util.Set;
035
036import com.google.gwt.http.client.RequestBuilder;
037import com.google.gwt.user.client.rpc.AsyncCallback;
038import com.google.gwt.user.client.rpc.SynchronizedRpcRequest;
039
040/**
041 * The asynchronous form edit service interface.<p>
042 */
043public interface I_CmsUgcEditServiceAsync {
044
045    /**
046     * Destroys a session.<p>
047     *
048     * @param sessionId the id of the session to destroy
049     *
050     * @param callback if something goes wrong
051     */
052    @SynchronizedRpcRequest
053    void destroySession(CmsUUID sessionId, AsyncCallback<Void> callback);
054
055    /**
056     * Returns the form content for an existing session.<p>
057     *
058     * @param sessionId the id of the existing session
059     * @param callback the callback for the result
060     *
061     * @return the request builder for this RPC call
062     */
063    RequestBuilder getContent(CmsUUID sessionId, AsyncCallback<CmsUgcContent> callback);
064
065    /**
066     * Gets the link corresponding to a given site path.<p>
067     *
068     * @param path the site path
069     * @param resultCallback the callback for the result
070     *
071     * @return the request builder for the RPC call
072     */
073    RequestBuilder getLink(String path, AsyncCallback<String> resultCallback);
074
075    /**
076     * Saves the given content values to the edited content.<p>
077     *
078     * @param sessionId the session id
079     * @param contentValues the content values
080     * @param callback the callback
081     *
082     * @return the request builder for this  RPC call
083     */
084    RequestBuilder saveContent(
085        CmsUUID sessionId,
086        Map<String, String> contentValues,
087        AsyncCallback<Map<String, String>> callback);
088
089    /**
090     * Uploads submitted file form fields to the VFS.<p>
091     *
092     * @param sessionId the session id
093     * @param fieldNames the set of names of the form fields containing the uploads
094     * @param formDataId the form data id
095     * @param filenameCallback the callback to call with the resulting map from field names to file paths
096     *
097     * @return the request builder for this service method
098     */
099    RequestBuilder uploadFiles(
100        CmsUUID sessionId,
101        Set<String> fieldNames,
102        String formDataId,
103        AsyncCallback<Map<String, String>> filenameCallback);
104
105    /**
106     * Validates the new content values for a content loaded in the given session.<p>
107     *
108     * @param sessionId the id of the session containing the content
109     * @param values the values to validate
110     * @param resultCallback the callback to call with the result
111     *
112     * @return the request builder for the RPC call
113     */
114    RequestBuilder validateContent(
115        CmsUUID sessionId,
116        Map<String, String> values,
117        AsyncCallback<Map<String, String>> resultCallback);
118}