Source Code Cross Referenced for VersionCache.java in  » Content-Management-System » webman » de » webman » content » workflow » 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.content.workflow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package de.webman.content.workflow;
002:
003:        import com.teamkonzept.lib.*;
004:        import com.teamkonzept.db.*;
005:
006:        import com.teamkonzept.web.*;
007:        import com.teamkonzept.field.*;
008:        import com.teamkonzept.webman.mainint.DatabaseDefaults;
009:        import de.webman.content.eventhandler.ContentContext;
010:        import de.webman.content.workflow.db.queries.*;
011:        import de.webman.content.db.queries.GetContentNodeFromContentInstance;
012:        import java.util.*;
013:        import java.sql.*;
014:        import com.teamkonzept.webman.mainint.db.queries.*;
015:        import de.webman.content.*;
016:        import com.teamkonzept.webman.mainint.db.SearchListIterator;
017:
018:        import org.apache.log4j.Category;
019:
020:        /**
021:         Cached die WorkflowDaten
022:         Key ist die InstanceID eines Contents
023:         * @author  $Author: sebastian $
024:         * @version $Revision: 1.27 $
025:         */
026:        public class VersionCache implements  DatabaseDefaults, VersionConstants {
027:            /** Logging Category */
028:            private static Category cat = Category
029:                    .getInstance(VersionCache.class);
030:
031:            /**
032:            	Invalidieren des Caches
033:             */
034:            public static void invalidInstance(Integer instanceID) {
035:                // not implemented yet
036:                instanceID = instanceID;
037:            }
038:
039:            public static TKVector getVersionInfo(Integer nodeId,
040:                    boolean subtree) throws SQLException {
041:                return getVersionInfo(nodeId, subtree, false, null);
042:            }
043:
044:            public static TKVector getVersionInfo(Integer nodeId,
045:                    boolean subtree, boolean kennung, String searchString)
046:                    throws SQLException {
047:                TKQuery q;
048:
049:                if (subtree)
050:                    q = (TKUnprepQuery) TKDBManager
051:                            .newQuery(TKDBGetAllTreeContentVersions.class);
052:                else
053:                    q = (TKUnprepQuery) TKDBManager
054:                            .newQuery(TKDBGetAllNodeContentVersions.class);
055:
056:                if ((searchString != null) && (searchString.length() != 0)) {
057:                    if (kennung)
058:                        q.setQueryParams("KENNUNG", new Integer(1));
059:                    else
060:                        q.setQueryParams("KENNUNG", new Integer(0));
061:                    ((TKUnprepQuery) q).setListIterator(new SearchListIterator(
062:                            searchString, "SEARCH_STRING", (TKUnprepQuery) q));
063:                }
064:                q.setQueryParams("CONTENT_NODE_ID", nodeId);
065:
066:                return doReadInstances(q);
067:            }
068:
069:            /**
070:            	Liefert zum angegebenen Context die Versionsdaten aller Instanzen
071:
072:            	@param WMContentContext
073:            	@param subtree ist der ganze Unterbaum mit ausgewählt
074:            	@param context
075:
076:             */
077:            public static TKVector getVersionInfo(ContentContext context,
078:                    boolean subtree) throws SQLException {
079:                boolean isGroup = context.conNodeType.intValue() == GROUP_INTEGER
080:                        .intValue();
081:                return getVersionInfo(isGroup ? context.groupConNodeId
082:                        : context.conNodeId, subtree);
083:            }
084:
085:            /**
086:            	Liefert zum angegebenen Context die Versionsdaten aller Instanzen
087:
088:            	@param WMContentContext
089:            	@param subtree
090:            	@kennung nach Kennung suchen (für Suche)
091:            	@searchString für Suche
092:             */
093:            public static TKVector getVersionInfo(ContentContext context,
094:                    boolean subtree, boolean kennung, String searchString)
095:                    throws SQLException {
096:                boolean isGroup = context.conNodeType.intValue() == GROUP_INTEGER
097:                        .intValue();
098:                return getVersionInfo(isGroup ? context.groupConNodeId
099:                        : context.conNodeId, subtree, kennung, searchString);
100:            }
101:
102:            /*
103:            	liefert Content mit durchgefuehrtem Workflow fuer eine Instanz ID zurueck
104:             */
105:            public static Content getInstanceInfo(Integer instanceId) {
106:                try {
107:                    TKQuery q = TKDBManager
108:                            .newQuery(GetContentNodeFromContentInstance.class);
109:                    q.setQueryParams("INSTANCE_ID", instanceId);
110:                    q.execute();
111:                    ResultSet rs = q.fetchResultSet();
112:                    rs.next();
113:                    Integer contentNodeId = new Integer(rs
114:                            .getInt("CONTENT_NODE_ID"));
115:                    return getContentInfo(contentNodeId);
116:                } catch (SQLException e) {
117:                    cat.error("Could not get content for instance : "
118:                            + instanceId, e);
119:                }
120:                return null;
121:            }
122:
123:            /*
124:            	liefert Content mit durchgefuehrtem Workflow fuer eine Content Node ID zurueck
125:             */
126:            public static Content getContentInfo(Integer contentNodeId) {
127:                try {
128:
129:                    TKVector result = getVersionInfo(contentNodeId, false);
130:                    if (result.size() > 0)
131:                        return (Content) result.elementAt(0);
132:                } catch (SQLException e) {
133:                    cat.error("Could not get content : " + contentNodeId, e);
134:                }
135:                return null;
136:            }
137:
138:            /**
139:             * Returns all instances readable by the given query.
140:             *
141:             * @param query the query to be executed.
142:             * @return all instances readable by the given query.
143:             * @throws SQLException if an error occurred while executing
144:             * the query.
145:             */
146:            public static TKVector doReadInstances (TKQuery query)
147:		throws SQLException
148:	{
149:		query.execute();
150:		ResultSet rs = query.fetchResultSet();
151:		// ordnet einer instanceId die Instanzdaten zu
152:		TKHashtable instances = new TKHashtable();
153:
154:		// das ResultSet einlesen
155:		instances = readResultSet(rs);
156:		TKVector allInstances = new TKVector();
157:		Enumeration enum = instances.elements();
158:		while (enum.hasMoreElements())
159:		{
160:			Content c = (Content)enum.nextElement();
161:			WorkflowEngine.getInterestingVersionsPerInstance(c);
162:			allInstances.addElement(c);
163:		}
164:
165:		return allInstances;
166:
167:	}
168:
169:            /**
170:             * Processes the given result set.
171:             *
172:             * @param rs the result set.
173:             * @return a hashtable containing the processed result set.
174:             * @throws SQLException if an error occurred while reading
175:             * the result set.
176:             */
177:            public static TKHashtable readResultSet(ResultSet rs)
178:                    throws SQLException {
179:                // statische Daten der Versionsverwaltung abrufen
180:                VersionStatics statics = VersionStatics.setup();
181:                TKHashtable allInstances = new TKHashtable();
182:                boolean hasRefNode = false;
183:                try {
184:                    int index = rs.findColumn("REF_NODE_ID");
185:                    hasRefNode = (index > 0);
186:                } catch (SQLException e) {
187:                    cat.debug("No GeneratorQuery");
188:                }
189:                while (rs.next()) {
190:                    // Versionsinformation auslesen
191:                    int versionId = rs.getInt("VERSION_ID");
192:                    // System.out.println(versionId);
193:                    Integer instanceId = new Integer(rs.getInt("INSTANCE_ID"));
194:                    Integer contentNodeId = new Integer(rs
195:                            .getInt("CONTENT_NODE_ID"));
196:                    // int contentNodeType = rs.getInt ("CONTENT_NODE_TYPE");
197:                    int parentType = rs.getInt("PARENT_TYPE");
198:
199:                    // abhaengig vom parenttype den Type des Content bestimmen (inGroup/single)
200:                    Integer contentId = new Integer(rs.getInt("CONTENT_ID"));
201:                    int statusId = rs.getInt("STATUS_ID");
202:                    Integer formId = new Integer(rs.getInt("CONTENT_FORM"));
203:                    VersionStatus statusDesc = (VersionStatus) statics
204:                            .getStatusPool().get(new Integer(statusId));
205:                    if (statusDesc.comment)
206:                        continue;
207:
208:                    // fuer die Generator Query
209:                    Integer refId = null;
210:                    if (hasRefNode) {
211:                        refId = new Integer(rs.getInt("REF_NODE_ID"));
212:                    }
213:                    java.util.Date date = rs.getTimestamp("VERSION_DATE");
214:                    // System.out.println("Datum : " + date);
215:                    String author = rs.getString("AUTHOR");
216:                    Integer parentId = new Integer(rs
217:                            .getInt("CONTENT_NODE_PARENT"));
218:                    String contentNodename = rs.getString("CONTENT_NODE_NAME");
219:                    String contentNodeShortName = rs
220:                            .getString("CONTENT_NODE_SHORTNAME");
221:
222:                    // String status = rs.getString ("STATUS");
223:                    ContentVersion version = new ContentVersion(new Integer(
224:                            versionId), contentId, contentNodeId, author, date,
225:                            statusDesc, parentType == DIRECTORY_NODE_INTEGER
226:                                    .intValue());
227:                    Content content = (Content) allInstances.get(contentNodeId);
228:                    if (content == null) {
229:                        content = new Content(
230:                                contentNodeId,
231:                                contentNodename,
232:                                contentNodeShortName,
233:                                instanceId,
234:                                formId,
235:                                parentType == DIRECTORY_NODE_INTEGER.intValue(),
236:                                parentId);
237:                        if (refId != null) {
238:                            content.setRefNodeId(refId);
239:                        }
240:                        allInstances.put(contentNodeId, content);
241:                    }
242:                    // hier noch auf die Sortierung achten !!!
243:                    content.addVersion(version);
244:                }
245:                return allInstances;
246:            }
247:
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.