1 package de.webman.content.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.queries.TKDBContentTreeGetParentInfo; 8 import de.webman.content.db.queries.*; 9 import com.teamkonzept.webman.mainint.events.*; 10 import com.teamkonzept.lib.*; 11 import com.teamkonzept.field.*; 12 import com.teamkonzept.field.db.*; 13 import com.teamkonzept.db.*; 14 import de.webman.content.workflow.*; 15 import java.sql.*; 16 import com.teamkonzept.international.LanguageManager; 17 import de.webman.util.legacy.Legacy; 18 19 25 public class CEContentInfoHandler extends DefaultEventHandler implements ParameterTypes, FrameConstants, DatabaseDefaults 26 { 27 private CEContentInfoHandler() 28 {} 29 30 31 private static CEContentInfoHandler instance = new CEContentInfoHandler(); 32 33 public static CEContentInfoHandler getInstance() 34 { 35 return instance; 36 } 37 38 public void handleEvent(TKEvent evt) throws TKException 39 { 40 try 41 { 42 CEUtils.checkEvent(evt); 43 Integer contentNodeId = new Integer (evt.getParameter(PARAMETER, "CONTENT_NODE_ID")); 44 String type = evt.getParameter(PARAMETER, "CONTENT_NODE_TYPE"); 45 String name = evt.getParameter(PARAMETER, "CONTENT_NODE_NAME"); 46 TKVector depends = new TKVector(); 47 boolean groupDepend = false; 48 TKQuery q; 50 ResultSet rs; 51 if (type.equals(SINGLE)) 52 { 53 q = TKDBManager.newQuery(TKDBContentTreeGetParentInfo.class); 54 q.setQueryParams("CONTENT_NODE_ID", contentNodeId); 55 q.execute(); 56 rs = q.fetchResultSet(); 57 rs.next(); 58 String parentType = rs.getString("CONTENT_NODE_TYPE"); 60 if (parentType.equals(GROUP)) 61 { 62 Integer groupId = new Integer (rs.getInt("CONTENT_NODE_ID")); 64 if (CEUtils.checkDependencies(groupId, depends, false)) 65 { 66 groupDepend = true; 67 } 69 } 70 } 71 CEUtils.checkDependencies(contentNodeId, depends, true); 72 TKHTMLTemplate t = evt.getPrepHTMLTemplate("dependency.tmpl"); 73 q = TKDBManager.newQuery(SelectContentTreeAndForm.class); 74 q.setQueryParams("CONTENT_NODE_ID", contentNodeId); 75 q.execute(); 76 rs = q.fetchResultSet(); 77 78 String text = null; 79 80 if (rs.next()) 81 { 82 Object [] arguments = new Object [2]; 83 arguments[0] = name; 84 arguments[1] = rs.getString("FORM_NAME"); 85 86 text = LanguageManager.getText("content", "CONTENT_DEPENDENCY", arguments); 87 } 88 else 89 { 90 text = LanguageManager.getText("content", "CONTENT_DIRECTORY_DEPENDENCY", new Object []{name}); 91 } 92 93 t.set("TITLE", text); 94 t.setListIterator( new TKStandardPluginIterator("REFERENCES", null, depends, false, t.getListIterator())); 95 96 evt.finishTemplate(t); 97 } 98 catch (Throwable e) 99 { 100 throw WebmanExceptionHandler.getException(e); 102 } 103 } 104 105 public boolean isHandler(TKEvent evt) 106 { 107 return evt.getName().equalsIgnoreCase("CE_INFO"); 108 } 109 } 110 | Popular Tags |