1 package org.apache.turbine.services.template.mapper; 2 3 18 19 import org.apache.commons.lang.StringUtils; 20 21 import org.apache.turbine.services.template.TemplateEngineService; 22 import org.apache.turbine.services.template.TemplateService; 23 import org.apache.turbine.services.template.TurbineTemplate; 24 25 33 34 public class ScreenTemplateMapper 35 extends BaseTemplateMapper 36 implements Mapper 37 { 38 43 public ScreenTemplateMapper() 44 { 45 } 46 47 54 public String doMapping(String template) 55 { 56 String [] components = StringUtils.split(template, String.valueOf(TemplateService.TEMPLATE_PARTS_SEPARATOR)); 57 58 TemplateEngineService tes = 60 TurbineTemplate.getTemplateEngineService(components[components.length - 1]); 61 62 String templatePackage = StringUtils.join(components, String.valueOf(separator)); 63 64 StringBuffer testPath = new StringBuffer (); 66 if (StringUtils.isNotEmpty(prefix)) 67 { 68 testPath.append(prefix); 69 testPath.append(separator); 70 } 71 testPath.append(templatePackage); 72 73 return (tes != null && tes.templateExists(testPath.toString())) 74 ? templatePackage 75 : null; 76 } 77 } 78 79 80 81 82 | Popular Tags |