    001package org.apache.turbine.modules.navigations;
    002
    003
    004/*
    005 * Licensed to the Apache Software Foundation (ASF) under one
    006 * or more contributor license agreements.  See the NOTICE file
    007 * distributed with this work for additional information
    008 * regarding copyright ownership.  The ASF licenses this file
    009 * to you under the Apache License, Version 2.0 (the
    010 * "License"); you may not use this file except in compliance
    011 * with the License.  You may obtain a copy of the License at
    012 *
    013 *   http://www.apache.org/licenses/LICENSE-2.0
    014 *
    015 * Unless required by applicable law or agreed to in writing,
    016 * software distributed under the License is distributed on an
    017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    018 * KIND, either express or implied.  See the License for the
    019 * specific language governing permissions and limitations
    020 * under the License.
    021 */
    022
    023
    024import org.apache.turbine.modules.Navigation;
    025import org.apache.turbine.pipeline.PipelineData;
    026
    027/**
    028 * Base Template Navigation.
    029 *
    030 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
    031 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
    032 * @version $Id: TemplateNavigation.java 1709648 2015-10-20 17:08:10Z tv $
    033 */
    034public abstract class TemplateNavigation
    035        extends Navigation
    036{
    037    /**
    038     * WebMacro Navigations extending this class should override this
    039     * method to perform any particular business logic and add
    040     * information to the context.
    041     *
    042     * @param pipelineData Turbine information.
    043     * @throws Exception a generic exception.
    044     */
    045    protected abstract void doBuildTemplate(PipelineData pipelineData) throws Exception;
    046
    047    /**
    048     * This Builds the WebMacro/FreeMarker/etc template.
    049     * @param pipelineData Turbine information.
    050     * @return the content of the navigation module
    051     * @throws Exception a generic exception.
    052     */
    053    public abstract String buildTemplate(PipelineData pipelineData) throws Exception;
    054
    055    /**
    056     * Calls doBuildTemplate() and then buildTemplate().
    057     *
    058     * @param pipelineData Turbine information.
    059     * @return the content of the navigation module
    060     * @throws Exception a generic exception.
    061     */
    062    @Override
    063    protected String doBuild(PipelineData pipelineData)
    064            throws Exception
    065    {
    066        doBuildTemplate(pipelineData);
    067        return buildTemplate(pipelineData);
    068    }
    069}