1 package de.webman.generator; 2 3 import com.teamkonzept.db.*; 4 import com.teamkonzept.lib.*; 5 import de.webman.content.workflow.*; 6 import de.webman.content.Content; 7 import de.webman.generator.db.queries.*; 8 9 import java.util.Enumeration ; 10 import java.sql.*; 11 import org.apache.log4j.Category; 12 13 19 public class SiteContentNodeStatics 20 { 21 22 23 private static Category cat = Category.getInstance(SiteContentNodeStatics.class.getName()); 24 25 28 GeneratorContext context; 29 30 35 private TKHashtable contentNodeHash; 36 37 public SiteContentNodeStatics (GeneratorContext context) 38 { 39 this.context = context != null ? context : GeneratorContext.setup (); 40 this.contentNodeHash = null; 41 } 42 43 44 52 public void getFilteredInstances () throws Throwable  53 { 54 55 cat.debug("Getting Query 1"); 56 TKQuery q_1 = TKDBManager.newQuery(GenContNodeConts_Part_1.class); 57 TKQuery q_2 = TKDBManager.newQuery(GenContNodeConts_Part_2.class); 58 q_1.execute(); 59 cat.debug("Query 1 finished"); 60 ResultSet rs = q_1.fetchResultSet(); 61 contentNodeHash = new TKHashtable(); 63 while( rs.next() ) 64 { 65 SiteContentNode node = new SiteContentNode( context, rs ); 66 contentNodeHash.put( new Integer ( node.getId() ), node ); 67 } 68 q_1.close(); 69 71 TKVector allInstances = VersionCache.doReadInstances(q_2); 72 int instIndex = 0; 73 VersionStatics statics = VersionStatics.getStatics(); 75 TKHashtable statusPool = VersionStatus.selectSingles(statics, false); 76 TKHashtable filter = VersionSelection.initContentFilter(statusPool); 77 while (instIndex < allInstances.size()) 78 { 79 Content content = (Content) allInstances.elementAt(instIndex); 80 instIndex++; 81 if (content.filterTransitions(filter, "SRC")) 84 { 85 SiteContentNode node = ((SiteContentNode) contentNodeHash.get (content.getRefNodeId())); 86 87 if (node.getType() == SiteContentNode.NODE_TYPE_GROUP) 94 { 95 if (context.isWorkflowIgnored()== false && content.getGeneratableVersion() == null) 96 continue; 97 } 98 node.addContent( 99 new SiteContent( 100 context, node.getFormularId(), content, false)); 101 } 102 } 103 } 104 105 109 public void getContents() 110 { 111 try { 112 getFilteredInstances(); 113 } 114 catch (SQLException e) 115 { 116 cat.error("getContents failed", e); 117 e.printStackTrace(System.out); 118 throw new TKSQLError (e.getMessage(), e); 119 } 120 catch (Throwable t) 121 { 122 cat.error("getContents failed", t); 123 t.printStackTrace(System.out); 124 125 throw new Error (t.getMessage()); 126 } 127 } 128 129 133 public final SiteContentNode getContentNode( int nodeId ) 134 { 135 if( contentNodeHash == null ) return null; 136 return (SiteContentNode) contentNodeHash.get( new Integer ( nodeId ) ); 137 } 138 } 139 140 145 class VersionData 146 { 147 Integer statusID; 148 String author; 149 java.util.Date date; 150 }
| Popular Tags
|