1 package de.webman.generator; 2 3 import com.teamkonzept.lib.*; 4 import java.util.*; 5 6 11 public class PrimContentsIterator implements TKListIterator 12 { 13 14 private TKListIterator oldIterator; 15 private String listName; 16 private TKVector list; 17 private Enumeration loop; 18 19 public PrimContentsIterator( TKVector list, TKListIterator oldIterator, String listName) 20 { 21 this.oldIterator = oldIterator; 22 this.listName = listName; 23 this.list = list; 24 this.loop = list.elements(); 25 } 26 27 public boolean apply( TKTemplate template, int i, String currListName ) 28 { 29 if( currListName.equalsIgnoreCase( listName ) ) { 30 31 SiteContent sc = null; 32 33 while ((sc == null) && loop.hasMoreElements()) 34 sc = (SiteContent) loop.nextElement(); 35 36 if (sc == null) { loop = list.elements(); return false; } 37 38 try { 39 template.set( "INSTANCE_ID", new Integer (sc.getInstanceId()) ); 40 template.set( "VERSION_ID", new Integer (sc.getVersionId()) ); 41 template.set( "CONTENT_ID", new Integer (sc.getContentId()) ); 42 template.set( "CONTENT_NODE_NAME",sc.getName()); 43 template.set( "CONTENT_NODE_SHORTNAME",sc.getShortName()); 44 } 45 catch ( Throwable th ) { 46 throw new Error ( th.getMessage() ); 47 } 48 return true; 49 } 50 else if( oldIterator != null ) { 51 return oldIterator.apply( template, i, currListName ); 52 } 53 else { 54 return false; 55 } 56 } 57 } 58 | Popular Tags |