Source Code Cross Referenced for WikiTextEditController.java in  » Project-Management » EmForce » ru » emdev » EmForge » wiki » web » bean » 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 » Project Management » EmForce » ru.emdev.EmForge.wiki.web.bean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package ru.emdev.EmForge.wiki.web.bean;
002:
003:        import java.util.Date;
004:
005:        import org.apache.commons.lang.StringUtils;
006:        import org.apache.commons.logging.Log;
007:        import org.apache.commons.logging.LogFactory;
008:        import org.emforge.jbpm.web.bean.TaskController;
009:        import org.emforge.projectmanager.base.MilestoneDO;
010:        import org.emforge.projectmanager.web.bean.MilestoneController;
011:        import org.emforge.projectmanager.web.bean.ProjectController;
012:        import org.emforge.report.web.bean.ReportViewBean;
013:
014:        import ru.emdev.EmForge.util.Helper;
015:        import ru.emdev.EmForge.web.bean.EditTextController;
016:        import ru.emdev.EmForge.web.bean.MainMenuController.MainMenuItem;
017:
018:        import com.ecyrd.jspwiki.WikiContext;
019:        import com.ecyrd.jspwiki.WikiPage;
020:
021:        /**
022:         * Controller for Edit page. It can be used for description editing too
023:         * 
024:         * @author spopov
025:         */
026:        public class WikiTextEditController extends BaseWikiControllerImpl {
027:
028:            protected final Log logger = LogFactory.getLog(getClass());
029:            public static final String EDIT_PAGE_NAME = "edit.faces";
030:
031:            private EditTextController m_editTextController;
032:
033:            /*
034:             * @see ru.emdev.EmForge.web.bean.BaseControllerImpl#init()
035:             */
036:            @Override
037:            protected void init() {
038:
039:                setPageName(getPageParam());
040:
041:                String version = getParam("version");
042:                if (Helper.isNumber(version)) {
043:                    setVersion(Integer.valueOf(version));
044:                }
045:
046:                if (m_pageName != null) {
047:                    try {
048:                        // get wiki text without conversions
049:                        String content = m_wikiEngine.getPureText(m_pageName,
050:                                m_version);
051:                        if (content != null) {
052:                            m_editTextController.setWikiText(content);
053:                        }
054:                    } catch (Exception e) {
055:                        logger.error(e.getMessage());
056:                    }
057:                }
058:            }
059:
060:            /**
061:             * @param editTextController
062:             */
063:            public void setEditTextController(
064:                    EditTextController editTextController) {
065:
066:                m_editTextController = editTextController;
067:            }
068:
069:            /*
070:             * @see ru.emdev.EmForge.web.bean.BaseControllerImpl#getSelectionItemOnMainMenu()
071:             */
072:            @Override
073:            public MainMenuItem getSelectionItemOnMainMenu() {
074:
075:                return null;
076:            }
077:
078:            /*
079:             * @see ru.emdev.EmForge.web.bean.BaseControllerImpl#getTitleImpl()
080:             */
081:            @Override
082:            public String getTitleImpl() {
083:
084:                if (isEditProject()) {
085:                    return "Edit Project \"" + getPageName() + "\" Description";
086:                } else if (isEditMilestone()) {
087:                    return "Edit Milestone \"" + getPageName()
088:                            + "\" Description";
089:                } else if (isEditTask()) {
090:                    return "Edit Task #" + getPageName() + " Description";
091:                } else {
092:                    return "Edit Page \"" + getPageName() + "\"";
093:                }
094:            }
095:
096:            /*
097:             * @see ru.emdev.EmForge.web.bean.BaseControllerImpl#getTrailCrumbInfo()
098:             */
099:            @Override
100:            public Crumb getTrailCrumbInfo() {
101:
102:                return new Crumb(getTitleImpl(), m_urlConstructor.makeURL(
103:                        WikiContext.EDIT, getPageName(), false, null));
104:            }
105:
106:            /**
107:             * @return
108:             */
109:            public String submit() {
110:
111:                if (m_appContext != null && m_pageName != null) {
112:
113:                    if (StringUtils.isEmpty(m_pageName)) {
114:                        logger.info("page name is not specified as param");
115:                        return null;
116:                    }
117:                    try {
118:                        WikiPage wikiPage = m_wikiEngine.getPage(m_pageName,
119:                                m_version);
120:
121:                        if (wikiPage == null) {
122:                            wikiPage = new WikiPage(m_wikiEngine, m_pageName);
123:                        }
124:                        WikiContext wikiContext = new WikiContext(m_wikiEngine,
125:                                wikiPage);
126:                        String user = getCurrentUser().getUsername();
127:
128:                        wikiContext.getPage().setAuthor(user);
129:                        wikiContext.getPage().setLastModified(new Date());
130:                        m_wikiEngine.saveText(wikiContext,
131:                                getTextInWikiFormat());
132:
133:                        /*
134:                         * else { String comment = getTextInWikiFormat(); if (StringUtils.isNotEmpty(comment)) { String content =
135:                         * m_wikiEngine.getPureText(wikiPage); StringBuffer strbuf = new StringBuffer(content);
136:                         * strbuf.append("\n----"); strbuf.append(comment); strbuf.append("\n\n--[" +
137:                         * getCurrentUser().getUsername() + "|mailto:" + getCurrentUser().getEmail() + "], " + new Date() +
138:                         * "\n\n"); WikiContext wikiContext = new WikiContext(m_wikiEngine, wikiPage);
139:                         * m_wikiEngine.saveText(wikiContext, strbuf.toString()); } }
140:                         */
141:
142:                        if (isEditProject()) {
143:                            // if we edited project descriptoion - we should back to project page
144:                            redirect(ProjectController.PROJECT_PAGE_NAME + "/"
145:                                    + getPageName());
146:
147:                        } else if (isEditMilestone()) {
148:                            MilestoneDO milestone = m_projectService
149:                                    .getMilestone(getPageName());
150:                            redirect(ProjectController.PROJECT_PAGE_NAME + "/"
151:                                    + milestone.getProject().getName() + "/"
152:                                    + MilestoneController.MILESTONE_PAGE_NAME
153:                                    + "/" + milestone.getName());
154:
155:                        } else if (isEditTask()) {
156:                            redirect(TaskController.TASK_PAGE_NAME + "/"
157:                                    + getPageName());
158:
159:                        } else if (isEditReport()) {
160:                            redirect(ReportViewBean.PAGE_FOLDER + "/"
161:                                    + getPageName());
162:
163:                        } else {
164:                            // redirect to previous view page after submit action
165:                            m_trail.backToPreviousUrl();
166:                        }
167:
168:                    } catch (Exception e) {
169:                        logger.error(e.getMessage(), e);
170:                        return null;
171:                    }
172:                }
173:                return null;
174:            }
175:
176:            /**
177:             * @return
178:             */
179:            public String cancel() {
180:
181:                m_trail.backToPreviousUrl();
182:                return null;
183:            }
184:
185:            /**
186:             * @return
187:             */
188:            public String getTextInWikiFormat() {
189:
190:                return m_editTextController.getWikiText();
191:            }
192:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.