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.client.entity; 029 030import org.opencms.acacia.shared.CmsEntity; 031import org.opencms.acacia.shared.CmsType; 032 033import java.util.List; 034import java.util.Map; 035 036import com.google.gwt.dom.client.Element; 037 038/** 039 * The interface for VIE implementations.<p> 040 */ 041public interface I_CmsEntityBackend { 042 043 /** 044 * Changes the original entities content to the given new content.<p> 045 * 046 * @param original the original entity to change 047 * @param newContent the new content entity 048 */ 049 void changeEntityContentValues(CmsEntity original, CmsEntity newContent); 050 051 /** 052 * Clears all entities from VIE.<p> 053 */ 054 void clearEntities(); 055 056 /** 057 * Creates a new entity registering it within VIE.<p> 058 * 059 * @param entityId the entity id 060 * @param entityType the entity type 061 * 062 * @return the new entity 063 */ 064 CmsEntity createEntity(String entityId, String entityType); 065 066 /** 067 * Creates a new type.<p> 068 * 069 * @param id the type id/name 070 * 071 * @return the new type 072 */ 073 CmsType createType(String id); 074 075 /** 076 * Returns DOM elements displaying the given attribute's value.<p> 077 * 078 * @param entity the entity 079 * @param attributeName the attribute name 080 * @param context the context to search within 081 * 082 * @return the elements 083 */ 084 List<Element> getAttributeElements(CmsEntity entity, String attributeName, Element context); 085 086 /** 087 * Returns DOM elements displaying the given attribute's value.<p> 088 * 089 * @param entityId the entity id/subject 090 * @param attributeName the attribute name 091 * @param context the context to search within 092 * 093 * @return the elements 094 */ 095 List<Element> getAttributeElements(String entityId, String attributeName, Element context); 096 097 /** 098 * Returns the entity with the given id.<p> 099 * 100 * @param entityId the entity id 101 * 102 * @return the entity 103 */ 104 CmsEntity getEntity(String entityId); 105 106 /** 107 * Returns the type with the given id/name.<p> 108 * 109 * @param id the type id/name 110 * 111 * @return the type 112 */ 113 CmsType getType(String id); 114 115 /** 116 * Registers the given entity within the VIE model.<p> 117 * 118 * @param entity the entity to register 119 * 120 * @return the new registered entity object 121 */ 122 CmsEntity registerEntity(CmsEntity entity); 123 124 /** 125 * Registers the given entity within the VIE model.<p> 126 * 127 * @param entity the entity to register 128 * @param discardIds <code>true</code> to discard the entity ids and generate ids 129 * 130 * @return the new registered entity object 131 */ 132 CmsEntity registerEntity(CmsEntity entity, boolean discardIds); 133 134 /** 135 * Registers the type and it's sub-types.<p> 136 * 137 * @param type the type to register 138 * @param types the available types 139 */ 140 void registerTypes(CmsType type, Map<String, CmsType> types); 141 142 /** 143 * Removes the given entity from VIE.<p> 144 * 145 * @param entityId the entity id 146 */ 147 void removeEntity(String entityId); 148}