KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > sitetree > eventhandler > TKContentSelectionIterator


1 /*
2  * $Header: /cvsroot/webman-cms/source/webman/de/webman/sitetree/eventhandler/TKContentSelectionIterator.java,v 1.2 2001/08/22 10:55:02 alex Exp $
3  *
4  */

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 /**
13     erweitert Anzeige der Contents um den vollen Pfad des Contents
14  * @author $Author: alex $
15  * @version $Revision: 1.2 $
16 */

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 JavaDoc listName )
23     {
24         super(result, oldIterator, listName);
25     }
26     
27     public boolean apply( TKTemplate template, int i, String JavaDoc 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 JavaDoc contentNodeID = (String JavaDoc)table.get("CONTENT_NODE_ID");
38                     String JavaDoc fullPath = CEUtils.getCurrentNamePath(new Integer JavaDoc(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