1 package de.webman.template.eventhandler; 2 3 import com.teamkonzept.webman.mainint.events.*; 4 import com.teamkonzept.webman.mainint.*; 5 import com.teamkonzept.webman.*; 6 import com.teamkonzept.web.*; 7 import com.teamkonzept.lib.*; 8 9 15 public class TERenameHandler extends DefaultEventHandler implements ParameterTypes 16 { 17 private TERenameHandler() 18 {} 19 20 private static TERenameHandler instance = new TERenameHandler(); 21 22 public static TERenameHandler getInstance() 23 { 24 return instance; 25 } 26 public void handleEvent(TKEvent evt) throws TKException 27 { 28 try 29 { 30 TKHTMLTemplate t = evt.getPrepHTMLTemplate( "te_renameTmpl.tmpl" ); 31 String tmplName = evt.getParameter( PARAMETER, "TEMPLATE_NAME" ); 32 if (!TEUtils.isValidTemplateName(tmplName)) 33 { 34 throw new TKUserException("Ungueltiger Name", WRONG_TEMPLATE_NAME, USER_SEVERITY, false, null); 35 } 36 String tmplId = evt.getParameter( PARAMETER, "TEMPLATE_ID" ); 37 t.set( "TEMPLATE_NAME", tmplName ); 38 t.set( "TEMPLATE_ID", tmplId ); 39 WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t, ContextConstants.TEMPLATES); 40 evt.finishTemplate(t); 41 } 42 catch( Throwable e ) 43 { 44 throw WebmanExceptionHandler.getException(e); 45 } 46 } 47 public boolean isHandler(TKEvent evt) 48 { 49 return evt.getName().equalsIgnoreCase("TE_RENAME"); 50 } 51 } 52 | Popular Tags |