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.plugins.site;
017
018import java.util.List;
019
020
021/**
022 * Site's informations.
023 */
024public class Site
025{
026    private String _name;
027    private List<SiteUrl> _urls;
028    private List<String> _languages;
029    private List<String> _populationIds;
030    
031    /**
032     * Constructor.
033     * @param name the site name
034     * @param urls the front-office server URLs.
035     * @param languages the languages handle by the site
036     * @param populationIds the ids of populations attached to the site
037     */
038    public Site(String name, List<SiteUrl> urls, List<String> languages, List<String> populationIds)
039    {
040        _name = name;
041        _urls = urls;
042        _languages = languages;
043        _populationIds = populationIds;
044    }
045    
046    /**
047     * Returns the site name.
048     * @return the site name.
049     */
050    public String getName()
051    {
052        return _name;
053    }
054    
055    /**
056     * Get the URLs of the site
057     * @return A non null list of URLs of the site
058     */
059    public List<SiteUrl> getSiteUrls()
060    {
061        return _urls;
062    }
063    
064    /**
065     * Get the languages of the site
066     * @return A non null list of languages of the site
067     */
068    public List<String> getLanguages()
069    {
070        return _languages;
071    }
072    
073    /**
074     * Get the populations ids associated to the site
075     * @return The non null lists
076     */
077    public List<String> getPopulationIds()
078    {
079        return _populationIds;
080    }
081    
082    @Override
083    public String toString()
084    {
085        SiteUrl mainUrl = _urls.get(0); 
086            
087        return "Site " + _name + "[serverName=" + mainUrl.getServerName() + "; serverPort=" + mainUrl.getServerPort() + "; _serverPath=" + mainUrl.getServerPath() + "]";
088    }
089}