1 package de.webman.documenttype.eventhandler; 2 3 import com.teamkonzept.web.*; 4 import com.teamkonzept.webman.*; 5 import com.teamkonzept.webman.db.TKWebmanDBManager; 6 import com.teamkonzept.webman.mainint.*; 7 import com.teamkonzept.webman.mainint.db.*; 8 9 10 import com.teamkonzept.webman.mainint.db.queries.*; 11 import com.teamkonzept.webman.mainint.events.*; 12 import com.teamkonzept.lib.*; 13 import com.teamkonzept.field.*; 14 import com.teamkonzept.field.db.*; 15 import com.teamkonzept.db.*; 16 import java.util.*; 17 import java.sql.*; 18 19 27 public class DTNewPresCompHandler extends DefaultEventHandler implements ParameterTypes, FrameConstants, DatabaseDefaults 28 { 29 30 private DTNewPresCompHandler() 31 {} 32 33 34 private static DTNewPresCompHandler instance = new DTNewPresCompHandler(); 35 36 39 public static DTNewPresCompHandler getInstance() 40 { 41 return instance; 42 } 43 44 public void handleEvent(TKEvent evt) throws TKException 45 { 46 try 47 { 48 WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), ContextConstants.PRESENTATIONS); 49 String compType = evt.getParameter( PARAMETER, "COMPONENT_TYPE" ); 50 String intType = evt.getParameter( PARAMETER, "INTEGRATION_TYPE" ); 51 String formId = evt.getNotNullParameter( PARAMETER, "THE_FORM_ID" ); 52 String neu = evt.getNotNullParameter( PARAMETER, "NEU" ); 53 if( compType.equals( REFERENCE_FREE ) ) 54 { 55 DTUtils.savePresComp(evt.getParameter(PARAMETER,"PRESENTATION_ID"),compType, 57 intType,evt.getNotNullParameter(PARAMETER,"INTEGRATION_NAME").trim(), 58 evt.getNotNullParameter( PARAMETER, "INTEGRATION_SHORTNAME" )); 59 } 60 else if( compType.equals( REFERENCE_TYPED ) ) 61 { if( neu.equals( "NO_SEL" ) ) 63 { DTUtils.subSelection( evt, TKDBPresentationGet.class, false ); 65 return; 66 } 67 else 68 { DTUtils.savePresRef(evt); 70 } 71 } 72 else if( compType.equals( CONTENT ) ) 73 { if( formId.equals( "" ) ) 75 { DTUtils.subSelection(evt, TKDBFormGetAll69.class, false ); 77 return; 78 } 79 else 80 { DTUtils.savePresComp(TKDBPresContInsert.class, evt.getParameter(PARAMETER,"PRESENTATION_ID"),formId,"FORM_ID",compType,intType,evt.getParameter(PARAMETER,"INTEGRATION_NAME"),evt.getParameter(PARAMETER,"INTEGRATION_SHORTNAME") ); 82 } 83 } 84 else if( compType.equals( STRUCTURE ) ) 85 { boolean hint = !intType.equals(SINGLE); 87 intType = SINGLE; evt.getParams().put( PARAMETER, "INTEGRATION_TYPE", SINGLE ); 89 if( formId.equals( "" ) ) 90 { DTUtils.subSelection( evt, TKDBFormGetStruct.class, hint ); 92 return; 93 } 94 else 95 { DTUtils.savePresComp(TKDBPresContInsert.class, evt.getParameter(PARAMETER,"PRESENTATION_ID"),formId,"FORM_ID",compType,intType,evt.getParameter(PARAMETER,"INTEGRATION_NAME"),evt.getParameter(PARAMETER,"INTEGRATION_SHORTNAME") ); 97 } 98 } 99 DTEditHandler.getInstance().handleEvent(evt); 100 } 101 catch (Throwable e) 102 { 103 throw WebmanExceptionHandler.getException(e); 105 } 106 } 107 108 public boolean isHandler(TKEvent evt) 109 { 110 return evt.getName().equalsIgnoreCase("PR_NEW_PRES_COMP") ; 111 } 112 } 113 | Popular Tags |