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.RemoteService;
038
039/**
040 * The content service used to load and persist entity and type information.<p>
041 *
042 * Implement this on the server side.<p>
043 */
044public interface I_CmsContentService extends RemoteService {
045
046    /**
047     * Loads the content definition for a given entity.<p>
048     *
049     * @param entityId the entity id/URI
050     *
051     * @return the content type definition
052     *
053     * @throws Exception if something goes wrong processing the request
054     */
055    CmsContentDefinition loadContentDefinition(String entityId) throws Exception;
056
057    /**
058     * Saves the given entities and returns a validation result in case of invalid entities.<p>
059     * Invalid entities will not be saved.<p>
060     *
061     * @param entities the entities to save
062     *
063     * @return the validation result in case of invalid entities
064     *
065     * @throws Exception if something goes wrong processing the request
066     */
067    CmsValidationResult saveEntities(List<CmsEntity> entities) throws Exception;
068
069    /**
070     * Saves the given entity and returns a validation result in case of invalid entities.<p>
071     * Invalid entities will not be saved.<p>
072     *
073     * @param entity the entity to save
074     *
075     * @return the validation result in case of invalid entities
076     *
077     * @throws Exception if something goes wrong processing the request
078     */
079    CmsValidationResult saveEntity(CmsEntity entity) throws Exception;
080
081    /**
082     * Retrieves the updated entity HTML representation.<p>
083     * The entity data will be validated but not persisted on the server.<p>
084     *
085     * @param entity the entity
086     * @param contextUri the context URI
087     * @param htmlContextInfo information about the HTML context
088     *
089     * @return the HTML representation including the validation result
090     *
091     * @throws Exception if something goes wrong processing the request
092     */
093    CmsEntityHtml updateEntityHtml(CmsEntity entity, String contextUri, String htmlContextInfo) throws Exception;
094
095    /**
096     * Validates the given entity and returns maps of error and warning messages in case of invalid attributes.<p>
097     *
098     * @param changedEntity the entity to validate
099     *
100     * @return the validation result
101     *
102     * @throws Exception if something goes wrong processing the request
103     */
104    CmsValidationResult validateEntity(CmsEntity changedEntity) throws Exception;
105}