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


001:        package de.webman.content.eventhandler;
002:
003:        import com.teamkonzept.lib.*;
004:        import com.teamkonzept.web.*;
005:        import com.teamkonzept.field.*;
006:        import com.teamkonzept.field.db.*;
007:        import de.webman.content.workflow.*;
008:        import org.apache.log4j.Category;
009:        import java.util.*;
010:
011:        /**
012:         haelt den aktuellen Zustand beim Browsen durch Templates
013:         * @author  $Author: sebastian $
014:         * @version $Revision: 1.9 $
015:         */
016:        public class ContentContext {
017:            /** Logging Category */
018:            private static Category cat = Category
019:                    .getInstance(ContentContext.class);
020:
021:            private final static String DIVIDER = "$";
022:
023:            private TKParams params;
024:            private String event;
025:
026:            public String groupConNodeName;
027:            public String groupConNodeShortName;
028:            public String conNodeName;
029:            public String conNodeShortName;
030:            public String mode;
031:            public String upbase;
032:            public String filterMode;
033:            public String instanceStatus;
034:            public String sort_by;
035:            /** searchstring */
036:            public String searchString;
037:            public String sortUpDown;
038:            /** searchoption kennung */
039:            public String searchKennung;
040:            public String conlist_start;
041:            public String conlist_count;
042:
043:            private String navigationContext;
044:
045:            public Integer groupConNodeId;
046:            public Integer conNodeId;
047:            public Integer conNodeType;
048:            public Integer formId;
049:            public Integer instanceId;
050:            public Integer versionId;
051:            public Integer fromStatusId;
052:            public Integer toStatusId;
053:            public Integer filterId;
054:
055:            public boolean subtree;
056:
057:            public TKHashtable fieldLookup;
058:            public TKContentDBData cdata;
059:
060:            public TKVector diagnostics;
061:
062:            public ContentContext(TKParams _params, String _event) {
063:                event = _event;
064:                params = _params;
065:                diagnostics = new TKVector();
066:
067:                navigationContext = getParam("NAVIGATION_CONTEXT");
068:                groupConNodeName = getParam("GROUP_CONTENT_NODE_NAME");
069:                groupConNodeShortName = getParam("GROUP_CONTENT_NODE_SHORTNAME");
070:                conNodeName = getParam("CONTENT_NODE_NAME");
071:                conNodeShortName = getParam("CONTENT_NODE_SHORTNAME");
072:                filterMode = getParam("FILTER_MODE");
073:                mode = getParam("MODE");
074:                upbase = getParam("UPBASE");
075:                instanceStatus = getParam("INSTANCE_STATUS");
076:
077:                groupConNodeId = string2Int(getParam("GROUP_CONTENT_NODE_ID"));
078:                conNodeId = string2Int(getParam("CONTENT_NODE_ID"));
079:                conNodeType = string2Int(getParam("CONTENT_NODE_TYPE"));
080:                formId = string2Int(getParam("CONTENT_FORM"));
081:                instanceId = string2Int(getParam("INSTANCE_ID"));
082:                versionId = string2Int(getParam("VERSION_ID"));
083:                fromStatusId = string2Int(getParam("FROM_STATUS_ID"));
084:                toStatusId = string2Int(getParam("TO_STATUS_ID"));
085:                filterId = string2Int(getParam("FILTER_ID"));
086:
087:                sort_by = getParam("SORT_BY");
088:                searchString = getParam("SEARCHSTRING");
089:                sortUpDown = getParam("SORT_UP_DOWN");
090:                searchKennung = getParam("S_KENNUNG");
091:                conlist_start = getParam("CONLIST_START");
092:                conlist_count = getParam("CONLIST_COUNT");
093:                subtree = getParam("SUBTREE") != null;
094:            }
095:
096:            public ContentContext(TKParams params) {
097:
098:                this (params, null);
099:            }
100:
101:            public String getNavigationContext() {
102:                return navigationContext;
103:            }
104:
105:            public ContentContext(String navContext) {
106:                this .navigationContext = navContext;
107:                String newString = navContext.replace(DIVIDER.charAt(0), '\n');
108:                java.io.StringBufferInputStream stream = new java.io.StringBufferInputStream(
109:                        newString);
110:                Properties prop = new Properties();
111:                try {
112:                    prop.load(stream);
113:                } catch (Exception e) {
114:                    cat.error("", e);
115:                    // kann nicht passieren
116:                }
117:                conNodeName = decode(prop.getProperty("CONTENT_NODE_NAME"));
118:                conNodeShortName = decode(prop
119:                        .getProperty("CONTENT_NODE_SHORTNAME"));
120:                groupConNodeName = decode(prop
121:                        .getProperty("GROUP_CONTENT_NODE_NAME"));
122:                groupConNodeShortName = decode(prop
123:                        .getProperty("GROUP_CONTENT_NODE_SHORTNAME"));
124:
125:                conNodeId = string2Int(decode(prop
126:                        .getProperty("CONTENT_NODE_ID")));
127:                conNodeType = string2Int(decode(prop
128:                        .getProperty("CONTENT_NODE_TYPE")));
129:                filterId = string2Int(decode(prop.getProperty("FILTER_ID")));
130:                groupConNodeId = string2Int(decode(prop
131:                        .getProperty("GROUP_CONTENT_NODE_ID")));
132:                formId = string2Int(decode(prop.getProperty("CONTENT_FORM")));
133:
134:                sort_by = decode(prop.getProperty("SORT_BY"));
135:                searchString = decode(prop.getProperty("SEARCHSTRING"));
136:                sortUpDown = decode(prop.getProperty("SORT_UP_DOWN"));
137:                searchKennung = decode(prop.getProperty("S_KENNUNG"));
138:                conlist_start = decode(prop.getProperty("CONLIST_START"));
139:                conlist_count = decode(prop.getProperty("CONLIST_COUNT"));
140:                subtree = decode(prop.getProperty("SUBTREE")) != null;
141:
142:                toStatusId = new Integer(-1);
143:                instanceId = new Integer(-1);
144:                versionId = new Integer(-1);
145:            }
146:
147:            /**
148:            	ermittelt den NavContext
149:            	Wertpaare werden nicht durch & sondern durch % getrennt
150:             */
151:            public String calculateNavContext() {
152:                navigationContext = "";
153:                if (conNodeId.intValue() != -1)
154:                    navigationContext += "CONTENT_NODE_ID=" + encode(conNodeId)
155:                            + DIVIDER;
156:                if (conNodeType.intValue() != -1)
157:                    navigationContext += "CONTENT_NODE_TYPE="
158:                            + encode(conNodeType) + DIVIDER;
159:                if (conNodeName != null)
160:                    navigationContext += "CONTENT_NODE_NAME="
161:                            + encode(conNodeName) + DIVIDER;
162:                if (conNodeShortName != null)
163:                    navigationContext += "CONTENT_NODE_SHORTNAME="
164:                            + encode(conNodeShortName) + DIVIDER;
165:                if (groupConNodeId.intValue() != -1)
166:                    navigationContext += "GROUP_CONTENT_NODE_ID="
167:                            + encode(groupConNodeId) + DIVIDER;
168:                if (groupConNodeName != null)
169:                    navigationContext += "GROUP_CONTENT_NODE_NAME="
170:                            + encode(groupConNodeName) + DIVIDER;
171:                if (groupConNodeShortName != null)
172:                    navigationContext += "GROUP_CONTENT_NODE_SHORTNAME="
173:                            + encode(groupConNodeShortName) + DIVIDER;
174:                if (formId.intValue() != -1)
175:                    navigationContext += "CONTENT_FORM=" + encode(formId)
176:                            + DIVIDER;
177:                if (filterId.intValue() != -1)
178:                    navigationContext += "FILTER_ID=" + encode(filterId)
179:                            + DIVIDER;
180:                if (subtree)
181:                    navigationContext += "SUBTREE=1" + DIVIDER;
182:                if (searchString != null)
183:                    navigationContext += "SEARCHSTRING=" + encode(searchString)
184:                            + DIVIDER;
185:                if (sort_by != null)
186:                    navigationContext += "SORT_BY=" + encode(sort_by) + DIVIDER;
187:                if (sortUpDown != null)
188:                    navigationContext += "SORT_UP_DOWN=" + encode(sortUpDown)
189:                            + DIVIDER;
190:                if (conlist_start != null)
191:                    navigationContext += "CONLIST_START="
192:                            + encode(conlist_start) + DIVIDER;
193:                if (conlist_count != null)
194:                    navigationContext += "CONLIST_COUNT="
195:                            + encode(conlist_count) + DIVIDER;
196:
197:                if (searchKennung != null)
198:                    navigationContext += "S_KENNUNG=" + encode(searchKennung);
199:
200:                return navigationContext;
201:            }
202:
203:            public static ContentContext reCalculateContext(String navContext) {
204:                return new ContentContext(navContext);
205:            }
206:
207:            public String empty2Null(String str) {
208:
209:                return str != null && str.length() == 0 ? null : str;
210:            }
211:
212:            public Integer string2Int(String str) {
213:
214:                return str == null || str.length() == 0 ? new Integer(-1)
215:                        : new Integer(str);
216:            }
217:
218:            public String int2String(int val) {
219:
220:                return Integer.toString(val);
221:            }
222:
223:            public String getParam(String name) {
224:
225:                return empty2Null(params.hasMultiple("PAR", name) ? params.get(
226:                        "PAR", name, 0) : params.get("PAR", name));
227:            }
228:
229:            public void fillIntoTemplate(TemplateBasic t) throws Throwable {
230:                if (groupConNodeId.intValue() != -1)
231:                    t.set("GROUP_CONTENT_NODE_ID", groupConNodeId);
232:                if (conNodeId.intValue() != -1)
233:                    t.set("CONTENT_NODE_ID", conNodeId);
234:                if (conNodeType.intValue() != -1)
235:                    t.set("CONTENT_NODE_TYPE", conNodeType);
236:                if (formId.intValue() != -1)
237:                    t.set("CONTENT_FORM", formId);
238:                if (instanceId.intValue() != -1)
239:                    t.set("INSTANCE_ID", instanceId);
240:                if (versionId.intValue() != -1)
241:                    t.set("VERSION_ID", versionId);
242:                if (filterId.intValue() != -1)
243:                    t.set("FILTER_ID", filterId);
244:                if (navigationContext != null)
245:                    t.set("NAVIGATION_CONTEXT", navigationContext);
246:                if (groupConNodeName != null)
247:                    t.set("GROUP_CONTENT_NODE_NAME", groupConNodeName);
248:                if (groupConNodeShortName != null)
249:                    t
250:                            .set("GROUP_CONTENT_NODE_SHORTNAME",
251:                                    groupConNodeShortName);
252:                if (conNodeName != null)
253:                    t.set("CONTENT_NODE_NAME", conNodeName);
254:                if (conNodeShortName != null)
255:                    t.set("CONTENT_NODE_SHORTNAME", conNodeShortName);
256:                if (mode != null)
257:                    t.set("MODE", mode);
258:                if (filterMode != null)
259:                    t.set("FILTER_MODE", filterMode);
260:                if (upbase != null)
261:                    t.set("UPBASE", upbase);
262:                if (instanceStatus != null)
263:                    t.set("INSTANCE_STATUS", instanceStatus);
264:
265:                if (toStatusId.intValue() >= 0) {
266:                    // statische Daten der Versionsverwaltung abrufen
267:                    VersionStatics statics = VersionStatics.setup();
268:                    VersionStatus statusDesc = (VersionStatus) statics
269:                            .getStatusPool().get(toStatusId);
270:                    if (statusDesc != null) {
271:                        t.set("TO_STATUS_ID", toStatusId);
272:                        t.set("TO_STATUS", statusDesc.getName());
273:                    }
274:                }
275:                if (searchString != null)
276:                    t.set("SEARCHSTRING", searchString);
277:                if (searchKennung != null)
278:                    t.set("S_KENNUNG", searchKennung);
279:                else
280:                    t.set("S_KENNUNG", "");
281:                if (sort_by != null)
282:                    t.set("SORT_BY", sort_by);
283:                if (sortUpDown != null)
284:                    t.set("SORT_UP_DOWN", sortUpDown);
285:                if (conlist_start != null)
286:                    t.set("CONLIST_START", conlist_start);
287:                if (conlist_count != null)
288:                    t.set("CONLIST_COUNT", conlist_count);
289:                if (subtree)
290:                    t.set("SUBTREE", "1");
291:            }
292:
293:            public String toString() {
294:
295:                StringBuffer buf = new StringBuffer();
296:
297:                if (groupConNodeId != null)
298:                    buf.append(" GROUP_CONTENT_NODE_ID=" + groupConNodeId);
299:                if (conNodeId != null)
300:                    buf.append(" CONTENT_NODE_ID=" + conNodeId);
301:                if (conNodeType != null)
302:                    buf.append(" CONTENT_NODE_TYPE=" + conNodeType);
303:                if (formId != null)
304:                    buf.append(" CONTENT_FORM=" + formId);
305:                if (instanceId != null)
306:                    buf.append(" INSTANCE_ID=" + instanceId);
307:                if (filterId != null)
308:                    buf.append(" FILTER_ID=" + filterId);
309:
310:                if (groupConNodeName != null)
311:                    buf.append(" GROUP_CONTENT_NODE_NAME=" + groupConNodeName);
312:                if (groupConNodeShortName != null)
313:                    buf.append(" GROUP_CONTENT_NODE_SHORTNAME="
314:                            + groupConNodeShortName);
315:                if (conNodeName != null)
316:                    buf.append(" CONTENT_NODE_NAME=" + conNodeName);
317:                if (conNodeShortName != null)
318:                    buf.append(" CONTENT_NODE_SHORTNAME=" + conNodeShortName);
319:                if (upbase != null)
320:                    buf.append(" UPBASE=" + upbase);
321:                if (instanceStatus != null)
322:                    buf.append(" INSTANCE_STATUS=" + instanceStatus);
323:                if (navigationContext != null)
324:                    buf.append("NAVIGATION_CONTEXT=" + navigationContext);
325:                return buf.toString();
326:            }
327:
328:            /*
329:            private void scanAttributes ()
330:            {
331:            	String action = event == null ? null : params.get("ACTION",event);
332:            	String indexStr = event == null ? null : params.get("INDEX",event);
333:            	
334:            	TKHashtable subFieldLookup = (TKHashtable) fieldLookup.get("ATTRIBUTES");
335:            	TKHashtable attributes = new TKHashtable ();
336:            	boolean selectionMissing = false;		
337:            	
338:            	Enumeration subFields = subFieldLookup != null ? subFieldLookup.keys() : null;
339:            	while ((subFields != null) && subFields.hasMoreElements())
340:            	{
341:            	
342:            		String sub = (String) subFields.nextElement();
343:            		if (sub == null) continue;
344:            		
345:            		if ((action != null) && (action.trim().equalsIgnoreCase("DELETE_ATTRIBUTE")) &&
346:            		    (indexStr != null) && (indexStr.trim().equals(sub.trim()))) continue;
347:            		
348:            		String attrFieldName = (String) subFieldLookup.get(sub);
349:            		if (attrFieldName == null) continue;
350:
351:            		TKHashtable attrFieldLookup = (TKHashtable) fieldLookup.get(attrFieldName);
352:            		if (attrFieldLookup == null) continue;
353:            	
354:            		String sAttributeId = null;
355:            		String sAttributeNewId = null;
356:            		String value = null;
357:
358:            		String fullPath = (String) attrFieldLookup.get("ATTRIBUTE_ID");
359:            		if (fullPath != null) sAttributeId = getParam(fullPath);
360:
361:            		fullPath = (String) attrFieldLookup.get("NEW_ATTRIBUTE_ID");
362:            		if (fullPath != null) sAttributeNewId = getParam(fullPath);
363:            		
364:            		fullPath = (String) attrFieldLookup.get("ATTRIBUTE_VALUE");
365:            		if (fullPath != null) value = getParam(fullPath);
366:            		
367:            		Integer attributeId = string2Int (sAttributeId);
368:            		Integer attributeNewId = string2Int (sAttributeNewId);
369:
370:            		if (attributeNewId.intValue() >= 0) 
371:            		{
372:            			TKContentAttributeOption option = TKContentAttributeOption.getOptionById (attributeNewId);
373:            			if (attributes.get (new Integer (attributeNewId)) != null) {
374:            				diagnostics.addElement ("Neues Attribut '"+option.name+"' doppelt");
375:            				attributeId = attributeNewId;
376:            			} else {
377:            				attributeId = attributeNewId;
378:            				attributes.put (new Integer (attributeNewId),option);
379:            			}
380:
381:            		} else if (attributeId >= 0) 
382:            		{
383:            			TKContentAttributeOption option = TKContentAttributeOption.getOptionById (attributeId);
384:            			if (attributes.get (new Integer (attributeId)) != null) {
385:            				diagnostics.addElement ("Attribut '"+option.name+"' doppelt");
386:            			} else {
387:            				attributes.put (new Integer (attributeId),option);
388:            			}
389:            		}
390:            		
391:            		TKContentAttributeOption option = TKContentAttributeOption.getOptionById (attributeId);
392:            		String scannedValue = null;
393:            		
394:            		if (option == null) selectionMissing = true;
395:            		else 
396:            		{
397:            			try 
398:            			{
399:            				scannedValue = TKContentAttributeTableData.scanValue (value,attributeId);
400:            				value = scannedValue;
401:            			
402:            			} catch (Exception ex) 
403:            			{
404:            				String msg = ex.getMessage();
405:            				diagnostics.addElement ("Attribut '"+option.name+"' syntaktisch falsch"+(msg == null ? "" : ": "+msg));	
406:            			}
407:            		}
408:            		
409:            		cdata.content_attribute.addElement 
410:            			(new TKContentAttributeTableData (cdata.content_id,attributeId,value));
411:            	}
412:            	
413:            	if (action.trim().equalsIgnoreCase("NEW_ATTR"))
414:            	{
415:            		cdata.content_attribute.addElement 
416:            			(new TKContentAttributeTableData (cdata.content_id));
417:            		diagnostics.addElement ("Bitte Attribut auswählen");
418:
419:            	} else if (selectionMissing) diagnostics.addElement ("Bitte Attribut auswählen");
420:
421:            }
422:             */
423:            public void scanFields() {
424:                fieldLookup = new TKHashtable();
425:                if (cdata == null)
426:                    cdata = new TKContentDBData();
427:
428:                scanFields(fieldLookup, params.getClass("PAR"));
429:                // scanAttributes ();
430:            }
431:
432:            public static void scanFields(TKHashtable fieldLookup,
433:                    TKHashtable lookup) {
434:                if (lookup == null)
435:                    return;
436:
437:                Enumeration e = lookup.keys();
438:                while ((e != null) && e.hasMoreElements()) {
439:                    String name = (String) e.nextElement();
440:                    if (name == null)
441:                        continue;
442:
443:                    StringTokenizer tokenizer = new StringTokenizer(name, ".");
444:                    String path = "";
445:
446:                    while (tokenizer.hasMoreTokens()) {
447:                        String fieldName = tokenizer.nextToken();
448:                        if (fieldName == null)
449:                            continue;
450:
451:                        if (path.length() > 0) {
452:                            String fullPath = path + "." + fieldName;
453:                            TKHashtable subFields = (TKHashtable) fieldLookup
454:                                    .get(path);
455:
456:                            if (subFields == null) {
457:                                subFields = new TKHashtable();
458:                                fieldLookup.put(path, subFields);
459:                            }
460:
461:                            subFields.put(fieldName, fullPath);
462:                            path = fullPath;
463:
464:                        } else
465:                            path = fieldName;
466:                    }
467:                }
468:            }
469:
470:            public static String encode(Object in) {
471:                return java.net.URLEncoder.encode(in.toString());
472:            }
473:
474:            public static String decode(String in) {
475:                try {
476:                    if (in == null)
477:                        return null;
478:                    else
479:                        return java.net.URLDecoder.decode(in);
480:                } catch (Exception e) {
481:                    // Wozu das hier steht weiss ich nicht, der Siegfried Compiler zwingt mich dazu
482:                    return null;
483:                }
484:            }
485:
486:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.