Source Code Cross Referenced for SiteNodeStatics.java in  » Content-Management-System » webman » de » webman » generator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » webman » de.webman.generator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package de.webman.generator;
002:
003:        import com.teamkonzept.db.*;
004:        import com.teamkonzept.lib.*;
005:        import com.teamkonzept.webman.db.*;
006:        import de.webman.generator.db.queries.*;
007:
008:        import java.sql.*;
009:        import java.util.*;
010:        import org.apache.log4j.Category;
011:
012:        /**
013:         * Diese Klasse baut den Tree aus SiteNodes auf und ruft alle weiteren Informationen
014:         * ab
015:         * @author  $Author: alex $
016:         * @version $Revision: 1.5 $
017:         */
018:        public class SiteNodeStatics {
019:
020:            /**
021:            	Verweis zurück auf den aktuellen statischen Kontext des laufenden Threads
022:             */
023:            GeneratorContext context;
024:
025:            /** alle SiteNodes */
026:            private TKHashtable nodeHash;
027:
028:            /** Wurzel des Sitetrees */
029:            private SiteNode root;
030:
031:            /** Log4J Kategory */
032:            private static Category cat = Category
033:                    .getInstance(SiteNodeStatics.class.getName());
034:
035:            // singh 1 1999.04.08
036:            // Bedeutung dieser Variablen ???
037:            private boolean reducedBuild;
038:            private boolean indexBuild;
039:
040:            // Argumente fuer partielles Generieren
041:            private int subtreeId;
042:            private String subtreePath;
043:            private String includeSubtreePath;
044:            private SiteNode subtreeNode;
045:
046:            public SiteNodeStatics(GeneratorContext context) {
047:
048:                this .context = context != null ? context : GeneratorContext
049:                        .setup();
050:
051:                this .nodeHash = null;
052:                this .root = null;
053:                this .reducedBuild = false;
054:                this .indexBuild = false;
055:
056:                this .subtreeId = -1;
057:                this .subtreePath = null;
058:                this .includeSubtreePath = null;
059:                this .subtreeNode = null;
060:            }
061:
062:            public boolean isReducedBuild() {
063:                return reducedBuild;
064:            }
065:
066:            public boolean isIndexBuild() {
067:                return indexBuild;
068:            }
069:
070:            public void setReducedBuild(boolean isReduced) {
071:                reducedBuild = isReduced;
072:            }
073:
074:            public void setIndexBuild(boolean isIndex) {
075:                indexBuild = isIndex;
076:            }
077:
078:            public String getIncludeSubtreePath() {
079:                return includeSubtreePath;
080:            }
081:
082:            public void setIncludeSubtreePath(String subPath) {
083:                includeSubtreePath = subPath;
084:            }
085:
086:            public String getSubtreePath() {
087:                return subtreePath;
088:            }
089:
090:            public void setSubtreePath(String path) {
091:                subtreePath = path;
092:            }
093:
094:            public SiteNode getSubtreeNode() {
095:                return subtreeNode;
096:            }
097:
098:            public void setSubtreeNode(SiteNode node) {
099:                subtreeNode = node;
100:            }
101:
102:            public int getSubtreeId() {
103:                return subtreeId;
104:            }
105:
106:            public void setSubtreeId(int id) {
107:                subtreeId = id;
108:            }
109:
110:            /**
111:            Checks - in case of subtree generation - if the the corresponding SiteNode 'subtreeNode' 
112:            was found.
113:            @return subtree node was found, else false.
114:             */
115:            public boolean subTreeUnmatched() {
116:
117:                return ((subtreePath != null) || (subtreeId >= 0))
118:                        && (subtreeNode == null);
119:            }
120:
121:            /**
122:            	zentrale Methode, sucht alle Informationen zusammen, die
123:            	zur Generierung gebraucht werden 
124:             */
125:            public SiteNode buildSiteTree() {
126:                SiteNode root;
127:                cat.info("start build Site-Structure");
128:
129:                // alle verwendeten Contents einlesen
130:                context.contentNodes.getContents();
131:                cat.debug("got Contents");
132:
133:                context.integrations.initSelection();
134:
135:                // alle Dokumenttypen lesen
136:                context.referenceTypes.getTypes();
137:
138:                // Sitetree einlesen und als Baum von SiteNodes speichern
139:                // noch in eine Methode auslagern
140:                try {
141:                    TKQuery q = TKWebmanDBManager.newQuery(GenSiteTree.class);
142:                    q.execute();
143:                    ResultSet rs = q.fetchResultSet();
144:                    if (!rs.next())
145:                        return null;
146:
147:                    nodeHash = new TKHashtable();
148:
149:                    root = new SiteNode(context, rs, null);
150:                    SiteNode last = root;
151:                    nodeHash.put(new Integer(root.getId()), root);
152:                    while (rs.next()) {
153:                        last = new SiteNode(context, rs, last);
154:
155:                        // singh + 1999.06.25
156:                        if ((subtreeNode != null)
157:                                && (last.getParent().getId() == subtreeNode
158:                                        .getParent().getId())
159:                                && (last.getId() != subtreeNode.getId()))
160:                            break;
161:
162:                        if (!subTreeUnmatched())
163:                            nodeHash.put(new Integer(last.getId()), last);
164:                    }
165:                    if (subTreeUnmatched())
166:                        return null;
167:
168:                    // singh + 1999.06.25
169:                    // Aufraeumen ...
170:                    SiteNode node = subtreeNode;
171:                    while (node != null) {
172:
173:                        SiteNode parent = node.getParent();
174:                        if (parent == null)
175:                            break;
176:
177:                        parent.getChilds().removeAllElements();
178:                        parent.getChilds().addElement(node);
179:                        nodeHash.put(new Integer(parent.getId()), parent);
180:
181:                        node = parent;
182:                    }
183:
184:                    // rekursives Erzeugen aller SiteDocuments
185:                    root.readDocuments();
186:                    cat.debug("got documents");
187:
188:                    if (indexBuild) {
189:                        // fuer preview
190:                        root.getContentIntegrations();
191:                        cat.debug("got integrations");
192:                        root.doContentSelections();
193:                        cat.debug("did selections");
194:                        return root;
195:                    }
196:                    //  rekursives Erzeugen aller SiteReferences
197:                    root.readReferences();
198:                    cat.debug("got refs");
199:
200:                    // Auslesen aller Sitestrukturparameter
201:                    root.readStructureContents();
202:                    cat.debug("got structure contents");
203:
204:                    // Auslesen aller Contentzuordnungen in den Dokumenten
205:                    root.getContentIntegrations();
206:
207:                    cat.debug("got integrations");
208:
209:                    // vererbte Dokumente erzeugen
210:                    root.assignInheritableDocuments();
211:
212:                    cat.debug("got inheritance");
213:                    cat.debug("Reduced Build : " + reducedBuild);
214:                    if (reducedBuild)
215:                        return root;
216:
217:                    // Auswerten der Referenzen
218:                    root.expandReferences();
219:                    cat.debug("refs expanded");
220:
221:                    // Aufloesen der Referenzen mit Contentzugriff
222:                    root.findReferenceContentDocuments();
223:                    cat.debug("got referenced contents");
224:
225:                    // loest die Content Selektoren auf ???
226:                    root.doContentSelections();
227:                    cat.debug("Site-Structure finished");
228:                } catch (SQLException e) {
229:                    throw new TKSQLError(e.getMessage(), e);
230:                } finally {
231:                    try {
232:                        if (TKDBManager.getDBVendor() == QueryConstants.ORACLE)
233:                            TKDBManager.closeConnection();
234:                    } catch (Exception e) {
235:                        cat.error("Oracle spezial", e);
236:                    }
237:                }
238:                return root;
239:            }
240:
241:            /**
242:            	Baut im Falle eines indexBuild den SiteTree so aus
243:            	wie es einem reducedBuild entspricht, falls dieser
244:            	gewünscht ist, ansonsten kompletter Ausbau.
245:
246:            	Diese Funktion wird z.B. beim Aufruf eines Previews
247:            	(setzt u.U. reducedBuild auf true) aus	der Index-Funktion
248:            	(setzt u.U. indexBuild auf true) vor dem Preview gebraucht.
249:
250:            	Ist indexBuild nicht gesetzt ist der SiteTree bereits so
251:            	aufgebaut, wie es der Preview braucht ...
252:
253:             */
254:            public void completeSiteTree(SiteNode root) {
255:                try {
256:                    if (!indexBuild)
257:                        return;
258:
259:                    root.readReferences();
260:                    root.readStructureContents();
261:                    root.assignInheritableDocuments();
262:
263:                    if (reducedBuild)
264:                        return;
265:
266:                    root.expandReferences();
267:                    root.findReferenceContentDocuments();
268:                    root.doContentSelections();
269:                } catch (SQLException e) {
270:                    throw new TKSQLError(e.getMessage(), e);
271:                }
272:
273:            }
274:
275:            public SiteNode getRoot() {
276:                return root;
277:            }
278:
279:            public void setRoot(SiteNode node) {
280:                root = node;
281:            }
282:
283:            public Enumeration getAllNodes() {
284:                return nodeHash.keys();
285:            }
286:
287:            public SiteNode getNode(int nodeId) {
288:                return (SiteNode) nodeHash.get(new Integer(nodeId));
289:            }
290:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.