1 package org.apache.turbine.modules.navigations; 2 3 4 /* 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 */ 22 23 24 import org.apache.turbine.modules.Navigation; 25 import org.apache.turbine.pipeline.PipelineData; 26 27 /** 28 * Base Template Navigation. 29 * 30 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> 31 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 32 * @version $Id: TemplateNavigation.java 1709648 2015-10-20 17:08:10Z tv $ 33 */ 34 public abstract class TemplateNavigation 35 extends Navigation 36 { 37 /** 38 * WebMacro Navigations extending this class should override this 39 * method to perform any particular business logic and add 40 * information to the context. 41 * 42 * @param pipelineData Turbine information. 43 * @throws Exception a generic exception. 44 */ 45 protected abstract void doBuildTemplate(PipelineData pipelineData) throws Exception; 46 47 /** 48 * This Builds the WebMacro/FreeMarker/etc template. 49 * @param pipelineData Turbine information. 50 * @return the content of the navigation module 51 * @throws Exception a generic exception. 52 */ 53 public abstract String buildTemplate(PipelineData pipelineData) throws Exception; 54 55 /** 56 * Calls doBuildTemplate() and then buildTemplate(). 57 * 58 * @param pipelineData Turbine information. 59 * @return the content of the navigation module 60 * @throws Exception a generic exception. 61 */ 62 @Override 63 protected String doBuild(PipelineData pipelineData) 64 throws Exception 65 { 66 doBuildTemplate(pipelineData); 67 return buildTemplate(pipelineData); 68 } 69 }