001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (C) Alkacon Software (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.acacia.shared.rpc;
029
030import org.opencms.acacia.shared.CmsContentDefinition;
031import org.opencms.acacia.shared.CmsEntity;
032import org.opencms.acacia.shared.CmsEntityHtml;
033import org.opencms.acacia.shared.CmsValidationResult;
034
035import java.util.List;
036
037import com.google.gwt.user.client.rpc.AsyncCallback;
038
039/**
040 * The content service used to load and persist entity and type information.<p>
041 *
042 * Use this asynchronous interface on the client side.<p>
043 */
044public interface I_CmsContentServiceAsync {
045
046    /**
047     * Loads the content definition for a given type.<p>
048     *
049     * @param entityId the entity id/URI
050     * @param callback the asynchronous callback
051     */
052    void loadContentDefinition(String entityId, AsyncCallback<CmsContentDefinition> callback);
053
054    /**
055     * Saves the given entities and returns a validation result in case of invalid entities.<p>
056     *
057     * @param entities the entities to save
058     * @param callback the asynchronous callback
059     */
060    void saveEntities(List<CmsEntity> entities, AsyncCallback<CmsValidationResult> callback);
061
062    /**
063     * Saves the given entity and returns a validation result in case of invalid entities.<p>
064     *
065     * @param entity the entity to save
066     * @param callback the asynchronous callback
067     */
068    void saveEntity(CmsEntity entity, AsyncCallback<CmsValidationResult> callback);
069
070    /**
071     * Retrieves the updated entity HTML representation.<p>
072     * The entity data will be validated but not persisted on the server.<p>
073     *
074     * @param entity the entity
075     * @param contextUri the context URI
076     * @param htmlContextInfo information about the HTML context
077     * @param callback the asynchronous callback
078     */
079    void updateEntityHtml(
080        CmsEntity entity,
081        String contextUri,
082        String htmlContextInfo,
083        AsyncCallback<CmsEntityHtml> callback);
084
085    /**
086     * Validates the given entity and returns maps of error and warning messages in case of invalid attributes.<p>
087     *
088     * @param changedEntity the entity to validate
089     * @param callback the asynchronous callback
090     */
091    void validateEntity(CmsEntity changedEntity, AsyncCallback<CmsValidationResult> callback);
092}