1 package de.webman.generator; 2 3 import com.teamkonzept.lib.*; 4 import java.sql.*; 5 import de.webman.content.Content; 6 import de.webman.content.workflow.*; 7 8 import org.apache.log4j.Category; 9 17 public class SiteContentNode 18 { 19 20 21 private static Category cat = Category.getInstance(SiteContentNode.class); 22 23 26 private GeneratorContext context; 27 28 public final static int NODE_TYPE_GROUP = 2; 29 public final static int NODE_TYPE_SINGLE = 3; 30 31 32 private int id; 33 34 35 private int type; 36 37 38 private String shortName; 39 40 41 private String name; 42 43 44 private int formId; 45 46 49 private TKVector contents; 50 51 57 public SiteContentNode( GeneratorContext context, ResultSet rs ) 58 throws SQLException 59 { 60 this.context = context != null ? context : GeneratorContext.setup (); 61 62 this.id = rs.getInt( "CONTENT_NODE_ID" ); 63 this.type = rs.getInt( "CONTENT_NODE_TYPE" ); 64 this.shortName = rs.getString( "CONTENT_NODE_SHORTNAME" ); 65 this.name = rs.getString( "CONTENT_NODE_NAME" ); 66 this.formId = rs.getInt( "CONTENT_FORM" ); 67 68 this.contents = new TKVector(); 69 } 70 71 public int getId() 72 { 73 return id; 74 } 75 76 public int getType() 77 { 78 return type; 79 } 80 81 public String getShortName() 82 { 83 return shortName; 84 } 85 86 public String getName() 87 { 88 return name; 89 } 90 91 public int getFormularId() 92 { 93 return formId; 94 } 95 96 public void addContent(SiteContent siteContent) 97 { 98 contents.addElement(siteContent); 99 } 100 101 public TKVector getContents() 102 { 103 if (GeneratorContext.isPreviewMode() && contents.size() == 0) 106 { 107 try 108 { 109 TKVector conts = VersionCache.getVersionInfo(new Integer (id), false); 110 for (int i = 0; i < conts.size(); i++) 111 { 112 Content c = (Content)conts.elementAt(i); 113 contents.addElement(new SiteContent(context, c.getFormularId().intValue(), c, false)); 114 } 115 } 116 catch (SQLException e) 117 { 118 cat.error("Couldn't make dynamic content lookup " , e); 119 } 120 } 121 return contents; 122 } 123 } 124 | Popular Tags |