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.gwt.CmsRpcException;
031import org.opencms.ugc.shared.CmsUgcContent;
032import org.opencms.ugc.shared.CmsUgcException;
033import org.opencms.util.CmsUUID;
034
035import java.util.Map;
036import java.util.Set;
037
038import com.google.gwt.user.client.rpc.RemoteService;
039
040/**
041 * The form edit service interface.<p>
042 */
043public interface I_CmsUgcEditService extends RemoteService {
044
045    /**
046     * Destroys the given session.<p>
047     *
048     * @param sessionId the id of the session to destroy
049     *
050     * @throws CmsRpcException if something goes wrong
051     */
052    void destroySession(CmsUUID sessionId) throws CmsRpcException;
053
054    /**
055     * Loads the form content for an existing session.<p>
056     *
057     * @param sessionId the id of the existing session
058     *
059     * @return the form content information
060     *
061     * @throws CmsRpcException if something goes wrong
062     */
063    CmsUgcContent getContent(CmsUUID sessionId) throws CmsRpcException;
064
065    /**
066     * Gets the link corresponding to a given site path.<p>
067     *
068     * @param path the site path
069     *
070     * @return the link for the path
071     */
072    String getLink(String path);
073
074    /**
075     * Saves the given content values to the edited content.<p>
076     *
077     * @param sessionId the session id
078     * @param contentValues the content values
079     *
080     * @return the validation errors, if there are any
081     *
082     * @throws CmsRpcException if something goes wrong
083     */
084    Map<String, String> saveContent(CmsUUID sessionId, Map<String, String> contentValues) throws CmsRpcException;
085
086    /**
087     * Uploads multiple files.<p>
088     *
089     * @param sessionId the session id
090     * @param fieldNames the set of field names of the form fields containing the uploaded files
091     * @param formDataId the form data id of the form submit in which the form fields were posted
092     *
093     * @return the map from field names to the VFS paths of uploaded files
094     * @throws CmsRpcException if something goes wrong
095     */
096    Map<String, String> uploadFiles(CmsUUID sessionId, Set<String> fieldNames, String formDataId)
097    throws CmsRpcException;
098
099    /**
100     * Validates the new content values for a content loaded in the given session.<p>
101     *
102     * @param sessionId the id of the session containing the content
103     * @param contentValues the values to validate
104     *
105     * @return the map of validation results
106     *
107     * @throws CmsUgcException if something goes wrong
108     */
109    Map<String, String> validateContent(CmsUUID sessionId, Map<String, String> contentValues) throws CmsUgcException;
110
111}