1 5 package de.webman.sitetree.eventhandler; 6 7 import java.sql.*; 8 import com.teamkonzept.lib.*; 9 import de.webman.content.eventhandler.CEUtils; 10 import org.apache.log4j.Category; 11 12 17 public class TKContentSelectionIterator extends TKDBResultIterator 18 { 19 20 private static Category cat = Category.getInstance(TKContentSelectionIterator.class); 21 22 public TKContentSelectionIterator( TKDBResult result, TKListIterator oldIterator, String listName ) 23 { 24 super(result, oldIterator, listName); 25 } 26 27 public boolean apply( TKTemplate template, int i, String currListName ) 28 { 29 try 30 { 31 if( currListName.equalsIgnoreCase( listName ) ) 32 { 33 if( i >= result.size() ) return false; 34 TKHashtable table = TKDBTemplate.getHashFromResult((TKDBResultRow) result.get(i)); 35 if (table != null) 36 { 37 String contentNodeID = (String )table.get("CONTENT_NODE_ID"); 38 String fullPath = CEUtils.getCurrentNamePath(new Integer (contentNodeID)); 39 if (fullPath.endsWith("/")) 40 fullPath = fullPath.substring(0, fullPath.length()-1); 41 table.put("CONTENT_NAME_PATH", fullPath); 42 template.set(table); 43 return true; 44 } 45 return false; 46 } 47 else if( oldIterator != null ) { 48 return oldIterator.apply( template, i, currListName ); 49 } 50 else { 51 return false; 52 } 53 } 54 catch (SQLException e) 55 { 56 cat.error("apply", e); 57 return false; 58 } 59 } 60 61 } 62 63 | Popular Tags |