com.eldar.models.Page.java Source code

Java tutorial

Introduction

Here is the source code for com.eldar.models.Page.java

Source

/*******************************************************************************
 * This file is part of Eldar Works.
 *
 * Eldar Works is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Eldar Works is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Eldar Works.  If not, see <http://www.gnu.org/licenses/>.
 * Copyright (c) 2012. Phillip Sanderson
 ******************************************************************************/

package com.eldar.models;

import com.eldar.models.elements.PageElement;
import com.eldar.models.templates.Template;
import org.apache.commons.collections.collection.CompositeCollection;
import org.apache.commons.lang3.SerializationUtils;

import java.util.HashMap;
import java.util.List;

/**
 * A virtual page on the site.
 * Essentially represents a group of elements that are
 * displayed together.
 * @author Phillip Sanderson
 *         Date: 12/05/12
 *         Time: 11:03 PM
 */
public class Page extends Base implements Versionable<PageVersion> {

    public Page() {

    }

    private String name;

    private String description;

    private HashMap<String, PageElement> pageElements;

    private PageVersion currentVersion;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public HashMap<String, PageElement> getPageElements() {
        return pageElements;
    }

    public void setPageElements(HashMap<String, PageElement> pageElements) {
        this.pageElements = pageElements;
    }

    @Override
    public void setVersion(PageVersion pageVersion) {
        currentVersion = pageVersion;
    }

    public PageVersion getVersion() {
        return this.currentVersion;
    }

    @Override
    public PageVersion cloneCurrentVersion() {
        PageVersion clone = SerializationUtils.clone(currentVersion);
        clone.setId(0);
        clone.setKey("");
        return null; //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public int getVersionNumber() {
        return currentVersion.getVersion();
    }
}