001/*
002 *  Copyright 2010 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016
017package org.ametys.web.repository.page;
018
019import org.ametys.cms.repository.TaggableAmetysObject;
020import org.ametys.plugins.repository.AmetysObject;
021import org.ametys.plugins.repository.AmetysObjectIterable;
022import org.ametys.plugins.repository.AmetysRepositoryException;
023import org.ametys.plugins.repository.ModifiableTraversableAmetysObject;
024import org.ametys.plugins.repository.RemovableAmetysObject;
025import org.ametys.plugins.repository.data.ametysobject.ModifiableModelLessDataAwareAmetysObject;
026import org.ametys.plugins.repository.data.holder.ModifiableModelAwareDataHolder;
027
028/**
029 * {@link AmetysObject} for storing page informations. <p>
030 */
031public interface ModifiablePage extends Page, ModifiableModelLessDataAwareAmetysObject, ModifiableTraversableAmetysObject, RemovableAmetysObject, TaggableAmetysObject
032{
033    /**
034     * Set the title.
035     * @param title the title.
036     * @throws AmetysRepositoryException if an error occurs.
037     */
038    void setTitle(String title) throws AmetysRepositoryException;
039    
040    /**
041     * Set the long title.
042     * @param title the title.
043     * @throws AmetysRepositoryException if an error occurs.
044     */
045    void setLongTitle(String title) throws AmetysRepositoryException;
046    
047    /**
048     * Set the sitemap name.
049     * @param sitemapName the sitemap name.
050     * @throws AmetysRepositoryException if an error occurs.
051     */
052    public void setSitemapName(String sitemapName) throws AmetysRepositoryException;
053
054    /**
055     * Set the site name.
056     * @param siteName the site name.
057     * @throws AmetysRepositoryException if an error occurs.
058     */
059    public void setSiteName(String siteName) throws AmetysRepositoryException;
060    
061    /**
062     * Set the type.<br>
063     * @param type the type.
064     * @throws AmetysRepositoryException if an error occurs.
065     * @see Page.PageType
066     */
067    void setType(PageType type) throws AmetysRepositoryException;
068
069    /**
070     * Set the linked URL.
071     * @param type the type of link
072     * @param url the linked URL (depending on the type)
073     * @throws AmetysRepositoryException if an error occurs.
074     */
075    void setURL(LinkType type, String url) throws AmetysRepositoryException;
076
077    /**
078     * Set the template name.
079     * @param template the template name.
080     * @throws AmetysRepositoryException if an error occurs.
081     */
082    void setTemplate(String template) throws AmetysRepositoryException;
083
084    /**
085     * Retrieves the zones.
086     * @return the zones.
087     * @throws AmetysRepositoryException if an error occurs.
088     */
089    @Override
090    AmetysObjectIterable<ModifiableZone> getZones() throws AmetysRepositoryException;
091
092    /**
093     * Retrieves a given zone.
094     * @param name the name of the zone.
095     * @return the given zone.
096     * @throws UnknownZoneException if there is no zone for the given name.
097     * @throws AmetysRepositoryException if an error occurs.
098     */
099    @Override
100    ModifiableZone getZone(String name) throws UnknownZoneException, AmetysRepositoryException;
101
102    /**
103     * Creates a given zone.<br> 
104     * @param name the name of the zone.
105     * @return the given zone.
106     * @throws AmetysRepositoryException if an error occurs.
107     */
108    ModifiableZone createZone(String name) throws AmetysRepositoryException;
109    
110    /**
111     * Add a new {@link AmetysObject} referencing this page.
112     * @param ametysObjectId the {@link AmetysObject} ids referencing this page.
113     * @throws AmetysRepositoryException if an error occurs.
114     */
115    void addReferer(String ametysObjectId) throws AmetysRepositoryException;
116
117    /**
118     * Removes an {@link AmetysObject} referencing this page.
119     * @param ametysObjectId the {@link AmetysObject} ids referencing this page.
120     * @throws AmetysRepositoryException if an error occurs.
121     */
122    void removeReferer(String ametysObjectId) throws AmetysRepositoryException;
123    
124    /**
125     * Set the visibility of the page
126     * @param isVisible the page visibility.
127     * @throws AmetysRepositoryException if an error occurs.
128     */
129    void setVisible(boolean isVisible) throws AmetysRepositoryException;
130    
131    /**
132     * Get the view parameters
133     * @return the view parameters
134     * @throws AmetysRepositoryException if an error occurs.
135     */
136    @Override
137    public ModifiableModelAwareDataHolder getTemplateParametersHolder() throws AmetysRepositoryException;
138}