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.ecs.ConcreteElement; 25 26 import org.apache.turbine.modules.Navigation; 27 import org.apache.turbine.pipeline.PipelineData; 28 29 import org.apache.turbine.util.RunData; 30 31 /** 32 * Base Template Navigation. 33 * 34 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> 35 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 36 * @version $Id: TemplateNavigation.java 1066561 2011-02-02 18:15:37Z ludwig $ 37 */ 38 public abstract class TemplateNavigation 39 extends Navigation 40 { 41 /** 42 * WebMacro Navigations extending this class should overide this 43 * method to perform any particular business logic and add 44 * information to the context. 45 * 46 * @deprecated Use PipelineData version instead. 47 * @param data Turbine information. 48 * @throws Exception a generic exception. 49 */ 50 @Deprecated 51 protected abstract void doBuildTemplate(RunData data) 52 throws Exception; 53 54 /** 55 * WebMacro Navigations extending this class should overide this 56 * method to perform any particular business logic and add 57 * information to the context. 58 * 59 * @param data Turbine information. 60 * @throws Exception a generic exception. 61 */ 62 protected void doBuildTemplate(PipelineData pipelineData) 63 throws Exception 64 { 65 RunData data = getRunData(pipelineData); 66 doBuildTemplate(data); 67 } 68 69 70 /** 71 * This Builds the WebMacro/FreeMarker/etc template. 72 * @deprecated Use PipelineData version 73 * @param data Turbine information. 74 * @return A ConcreteElement. 75 * @throws Exception a generic exception. 76 */ 77 @Deprecated 78 public abstract ConcreteElement buildTemplate(RunData data) 79 throws Exception; 80 81 /** 82 * This Builds the WebMacro/FreeMarker/etc template. 83 * Should revert to abstract when RunData goes. 84 * @param pipelineData Turbine information. 85 * @return A ConcreteElement. 86 * @throws Exception a generic exception. 87 */ 88 public ConcreteElement buildTemplate(PipelineData pipelineData) 89 throws Exception 90 { 91 RunData data = getRunData(pipelineData); 92 return buildTemplate(data); 93 } 94 95 /** 96 * Calls doBuildTemplate() and then buildTemplate(). 97 * 98 * @param data Turbine information. 99 * @return A ConcreteElement. 100 * @throws Exception a generic exception. 101 */ 102 @Override 103 protected ConcreteElement doBuild(RunData data) 104 throws Exception 105 { 106 doBuildTemplate(data); 107 return buildTemplate(data); 108 } 109 110 /** 111 * Calls doBuildTemplate() and then buildTemplate(). 112 * 113 * @param data Turbine information. 114 * @return A ConcreteElement. 115 * @throws Exception a generic exception. 116 */ 117 @Override 118 protected ConcreteElement doBuild(PipelineData pipelineData) 119 throws Exception 120 { 121 RunData data = getRunData(pipelineData); 122 return doBuild(data); 123 } 124 125 }