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;
026
027/**
028 * {@link AmetysObject} for storing page informations. <p>
029 */
030public interface ModifiablePage extends Page, ModifiableModelLessDataAwareAmetysObject, ModifiableTraversableAmetysObject, RemovableAmetysObject, TaggableAmetysObject
031{
032    /**
033     * Set the title.
034     * @param title the title.
035     * @throws AmetysRepositoryException if an error occurs.
036     */
037    void setTitle(String title) throws AmetysRepositoryException;
038    
039    /**
040     * Set the long title.
041     * @param title the title.
042     * @throws AmetysRepositoryException if an error occurs.
043     */
044    void setLongTitle(String title) throws AmetysRepositoryException;
045    
046    /**
047     * Set the sitemap name.
048     * @param sitemapName the sitemap name.
049     * @throws AmetysRepositoryException if an error occurs.
050     */
051    public void setSitemapName(String sitemapName) throws AmetysRepositoryException;
052
053    /**
054     * Set the site name.
055     * @param siteName the site name.
056     * @throws AmetysRepositoryException if an error occurs.
057     */
058    public void setSiteName(String siteName) throws AmetysRepositoryException;
059    
060    /**
061     * Set the type.<br>
062     * @param type the type.
063     * @throws AmetysRepositoryException if an error occurs.
064     * @see Page.PageType
065     */
066    void setType(PageType type) throws AmetysRepositoryException;
067
068    /**
069     * Set the linked URL.
070     * @param type the type of link
071     * @param url the linked URL (depending on the type)
072     * @throws AmetysRepositoryException if an error occurs.
073     */
074    void setURL(LinkType type, String url) throws AmetysRepositoryException;
075
076    /**
077     * Set the template name.
078     * @param template the template name.
079     * @throws AmetysRepositoryException if an error occurs.
080     */
081    void setTemplate(String template) throws AmetysRepositoryException;
082
083    /**
084     * Retrieves the zones.
085     * @return the zones.
086     * @throws AmetysRepositoryException if an error occurs.
087     */
088    @Override
089    AmetysObjectIterable<ModifiableZone> getZones() throws AmetysRepositoryException;
090
091    /**
092     * Retrieves a given zone.
093     * @param name the name of the zone.
094     * @return the given zone.
095     * @throws UnknownZoneException if there is no zone for the given name.
096     * @throws AmetysRepositoryException if an error occurs.
097     */
098    @Override
099    ModifiableZone getZone(String name) throws UnknownZoneException, AmetysRepositoryException;
100
101    /**
102     * Creates a given zone.<br> 
103     * @param name the name of the zone.
104     * @return the given zone.
105     * @throws AmetysRepositoryException if an error occurs.
106     */
107    ModifiableZone createZone(String name) throws AmetysRepositoryException;
108    
109    /**
110     * Add a new {@link AmetysObject} referencing this page.
111     * @param ametysObjectId the {@link AmetysObject} ids referencing this page.
112     * @throws AmetysRepositoryException if an error occurs.
113     */
114    void addReferer(String ametysObjectId) throws AmetysRepositoryException;
115
116    /**
117     * Removes an {@link AmetysObject} referencing this page.
118     * @param ametysObjectId the {@link AmetysObject} ids referencing this page.
119     * @throws AmetysRepositoryException if an error occurs.
120     */
121    void removeReferer(String ametysObjectId) throws AmetysRepositoryException;
122    
123    /**
124     * Set the visibility of the page
125     * @param isVisible the page visibility.
126     * @throws AmetysRepositoryException if an error occurs.
127     */
128    void setVisible(boolean isVisible) throws AmetysRepositoryException;
129}