1 4 package com.teamkonzept.field.db.queries; 5 6 import com.teamkonzept.db.*; 7 import com.teamkonzept.lib.*; 8 9 import java.sql.*; 10 11 public class TKDBContentTreeDir extends TKPrepQuery { 12 13 public final static boolean isPrepared = 14 true; 15 16 public final static String [] paramOrder = 17 { }; 18 19 public final static Object [][] paramTypes = 20 null; 21 22 public final static boolean[] setRelevants = 23 { true }; 24 25 public final static String sqlString = 26 "SELECT * " + 27 "FROM CONTENT_TREE " + 28 "ORDER BY LEFT_NR"; 29 30 public void initQuery(Connection con) { 31 super.initQuery( 32 con, 33 isPrepared, 34 paramOrder, 35 paramTypes, 36 setRelevants, 37 sqlString ); 38 } 39 45 public static TKHashtable getContentPathes () throws Throwable 46 { 47 TKQuery q = TKDBManager.newQuery(TKDBContentTreeDir.class); 48 q.execute(); 49 ResultSet rs = q.fetchResultSet(); 50 51 TKHashtable pathes = new TKHashtable(); 52 53 while( rs.next() ) { 54 55 int leftNr = rs.getInt( "LEFT_NR" ); 56 int rightNr = rs.getInt( "RIGHT_NR" ); 57 58 int contentNodeId = rs.getInt( "CONTENT_NODE_ID" ); 59 int contentNodeParent = rs.getInt( "CONTENT_NODE_PARENT" ); 60 int formId = rs.getInt( "CONTENT_FORM" ); 61 int nodeType = rs.getInt( "CONTENT_NODE_TYPE" ); 62 63 String nodeName = rs.getString( "CONTENT_NODE_NAME" ); 64 String nodeShortName = rs.getString( "CONTENT_NODE_SHORTNAME" ); 65 66 if (nodeShortName == null) { 67 68 continue; 69 } 70 71 if (contentNodeParent <= 0) { 72 pathes.put (new Integer (contentNodeId),nodeShortName); 73 } else { 74 75 String pstr = (String ) pathes.get (new Integer (contentNodeParent)); 76 if (pstr == null) { 77 continue; 78 } 79 80 pathes.put (new Integer (contentNodeId),pstr+"/"+nodeShortName); 81 } 82 } 83 84 return pathes; 85 } 86 } 87 | Popular Tags |