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 17 import java.util.*; 18 import java.sql.*; 19 20 27 public class DTUpdatePresCompHandler extends DefaultEventHandler implements ParameterTypes, FrameConstants, DatabaseDefaults 28 { 29 30 private DTUpdatePresCompHandler() 31 {} 32 33 34 private static DTUpdatePresCompHandler instance = new DTUpdatePresCompHandler(); 35 36 public static DTUpdatePresCompHandler getInstance() 37 { 38 return instance; 39 } 40 41 public void handleEvent(TKEvent evt) throws TKException 42 { 43 try 44 { 45 WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), ContextConstants.PRESENTATIONS); 46 String compType = evt.getParameter( PARAMETER, "COMPONENT_TYPE" ); 47 String intType = evt.getParameter( PARAMETER, "INTEGRATION_TYPE" ); 48 String formId = evt.getNotNullParameter( PARAMETER, "THE_FORM_ID" ); 49 String update = evt.getNotNullParameter( PARAMETER, "UPDATE" ); 51 String oldCompType = evt.getNotNullParameter( PARAMETER, "OLD_COMPONENT_TYPE" ); 52 53 if( compType.equals( REFERENCE_FREE ) ) { if( !oldCompType.equals( "" ) && !oldCompType.equals( compType ) ) { 55 DTUtils.removeOldContext( evt, oldCompType ); 56 } 57 DTUtils.updatePresComp(evt); 58 } 59 else if( compType.equals( REFERENCE_TYPED ) ) { if( update.equals( "NO_SEL" ) ) { 61 if( !oldCompType.equals( "" ) && !oldCompType.equals( compType ) ) { 62 DTUtils.removeOldContext( evt, oldCompType ); 63 DTEditSubPresSelectionHandler.getInstance().handleEvent(evt); return; 65 } 66 else { 67 DTUtils.updatePresComp(evt); } 69 } 70 else { if( !oldCompType.equals( "" ) && !oldCompType.equals( compType ) ) { 73 DTUtils.removeOldContext( evt, oldCompType ); 74 } 75 DTUtils.updatePresComp(evt); 76 DTUtils.updatePresRef(evt); 77 } 78 } 79 else if( compType.equals( CONTENT ) ) { if( formId.equals( "" ) ) { DTUtils.subSelection( evt, TKDBFormGetAll69.class, false ); 82 return; 83 } 84 else { if( !oldCompType.equals( "" ) && !oldCompType.equals( compType ) ) { 86 DTUtils.removeOldContext( evt, oldCompType ); 87 DTUtils.updatePresComp(evt); 88 DTUtils.insertPresCont( evt, formId ); 89 } 90 else { 91 DTUtils.updatePresComp(evt); 92 DTUtils.updatePresCont( evt, formId ); 93 } 94 } 95 } 96 else if( compType.equals( STRUCTURE ) && intType.equals( SINGLE ) ) { if( formId.equals( "" ) ) { DTUtils.subSelection( evt, TKDBFormGetStruct.class, false ); 99 return; 100 } 101 else { if( !oldCompType.equals( "" ) && !oldCompType.equals( compType ) ) { 103 DTUtils.removeOldContext( evt, oldCompType ); 104 DTUtils.updatePresComp(evt); 105 DTUtils.insertPresCont( evt, formId ); 106 } 107 else { 108 DTUtils.updatePresComp(evt); 109 DTUtils.updatePresCont( evt, formId ); 110 } 111 } 112 } 113 DTEditHandler.getInstance().handleEvent(evt); 114 } 115 catch (Throwable e) 116 { 117 throw WebmanExceptionHandler.getException(e); 119 } 120 } 121 122 public boolean isHandler(TKEvent evt) 123 { 124 return evt.getName().equalsIgnoreCase("PR_UPDATE_PRES_COMP") ; 125 } 126 } 127 | Popular Tags |