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 */
016package org.ametys.web.repository.page;
017
018import java.util.Set;
019
020import org.ametys.plugins.explorer.resources.ResourceCollection;
021import org.ametys.plugins.repository.AmetysObject;
022import org.ametys.plugins.repository.AmetysRepositoryException;
023import org.ametys.plugins.repository.tag.TagAwareAmetysObject;
024
025/**
026 * {@link AmetysObject} for reading page informations.<p>
027 */
028public interface Page extends MetadataAwareSitemapElement, TagAwareAmetysObject
029{
030    /** Type of a page. */
031    public enum PageType
032    {
033        /** Empty page (no zone, nor link) */
034        NODE,
035        /** Link page. */
036        LINK,
037        /** Multiple zone (content, service) page. */
038        CONTAINER
039    }
040
041    /** Type of a link page. */
042    public enum LinkType
043    {
044        /** External page */
045        WEB,
046        /** Internal page */
047        PAGE
048    }
049
050    /**
051     * Retrieves the long title.
052     * @return the title.
053     * @throws AmetysRepositoryException if an error occurs.
054     */
055    String getLongTitle() throws AmetysRepositoryException;
056
057    /**
058     * Retrieves the type.<br>
059     * @return the type.
060     * @throws AmetysRepositoryException if an error occurs.
061     * @see PageType
062     */
063    PageType getType() throws AmetysRepositoryException;
064
065    /**
066     * Retrieves the linked URL.
067     * @return the linked URL.
068     * @throws AmetysRepositoryException if an error occurs.
069     */
070    String getURL() throws AmetysRepositoryException;
071
072    /**
073     * Retrieves the linked URL type.
074     * @return the linked URL type.
075     * @throws AmetysRepositoryException if an error occurs.
076     */
077    LinkType getURLType() throws AmetysRepositoryException;
078
079    /**
080     * Get the page depth
081     * @return the page depth
082     * @throws AmetysRepositoryException if an error occurs.
083     */
084    int getDepth () throws AmetysRepositoryException;
085
086    /**
087     * Retrieves the attachments root node
088     * @return The the attachments root node
089     * @throws AmetysRepositoryException if an error occurs.
090     */
091    ResourceCollection getRootAttachments()  throws AmetysRepositoryException;
092    
093    /**
094     * Retrieves all {@link AmetysObject} ids referencing this page.
095     * @return the {@link AmetysObject} ids referencing this page.
096     * @throws AmetysRepositoryException if an error occurs.
097     */
098    Set<String> getReferers() throws AmetysRepositoryException;
099    
100    /**
101     * Determine if the page is visible into navigation elements
102     * @return true if the page is visible.
103     * @throws AmetysRepositoryException if an error occurs.
104     */
105    boolean isVisible() throws AmetysRepositoryException;
106
107}