Source Code Cross Referenced for HelpServiceImpl.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » help » 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 » ERP CRM Financial » Kuali Financial System » edu.iu.uis.eden.help 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package edu.iu.uis.eden.help;
018:
019:        import java.io.InputStream;
020:        import java.util.ArrayList;
021:        import java.util.List;
022:
023:        import org.jdom.Element;
024:
025:        import edu.iu.uis.eden.EdenConstants;
026:        import edu.iu.uis.eden.WorkflowServiceErrorException;
027:        import edu.iu.uis.eden.WorkflowServiceErrorImpl;
028:        import edu.iu.uis.eden.export.ExportDataSet;
029:        import edu.iu.uis.eden.help.dao.HelpDAO;
030:        import edu.iu.uis.eden.user.WorkflowUser;
031:        import edu.iu.uis.eden.xml.export.HelpEntryXmlExporter;
032:        import edu.iu.uis.eden.xml.help.HelpEntryXmlParser;
033:
034:        public class HelpServiceImpl implements  HelpService {
035:            private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
036:                    .getLogger(HelpServiceImpl.class);
037:            private HelpDAO helpDAO;
038:
039:            private static final String NAME_EMPTY = "helpentry.name.empty";
040:            private static final String TEXT_EMPTY = "helpentry.text.empty";
041:            private static final String ID_INVALID = "helpentry.id.invalid";
042:            private static final String KEY_EMPTY = "helpentry.key.empty";
043:            private static final String KEY_EXIST = "helpentry.key.exists";
044:            private static final String KEY_ILLEGAL = "helpentry.key.illegal";
045:
046:            public void save(HelpEntry helpEntry) {
047:                validateHelpEntry(helpEntry);
048:                getHelpDAO().save(helpEntry);
049:            }
050:
051:            public void saveXmlEntry(HelpEntry helpEntry) {
052:                HelpEntry entry = validateXmlHelpEntry(helpEntry);
053:                LOG.debug(entry.getHelpId() + ", " + entry.getHelpName() + ", "
054:                        + entry.getHelpText() + ", " + entry.getHelpKey());
055:                getHelpDAO().save(entry);
056:            }
057:
058:            public void delete(HelpEntry helpEntry) {
059:                getHelpDAO().deleteEntry(helpEntry);
060:            }
061:
062:            private HelpEntry validateXmlHelpEntry(HelpEntry helpEntry) {
063:                LOG.debug("Enter validateXMLHelpEntry(..)");
064:                List errors = new ArrayList();
065:
066:                if (helpEntry.getHelpName() == null
067:                        || "".equals(helpEntry.getHelpName().trim())) {
068:                    errors.add(new WorkflowServiceErrorImpl("Help Name empty.",
069:                            NAME_EMPTY));
070:                }
071:                if (helpEntry.getHelpText() == null
072:                        || "".equals(helpEntry.getHelpText().trim())) {
073:                    errors.add(new WorkflowServiceErrorImpl("Help Text empty.",
074:                            TEXT_EMPTY));
075:                } else {
076:                    helpEntry.setHelpText(helpEntry.getHelpText().trim());
077:                }
078:
079:                if (helpEntry.getHelpKey() == null
080:                        || "".equals(helpEntry.getHelpKey().trim())) {
081:                    errors.add(new WorkflowServiceErrorImpl("Help Key empty.",
082:                            KEY_EMPTY));
083:                } else if (helpEntry.getHelpKey().indexOf("'") >= 0) {
084:                    errors.add(new WorkflowServiceErrorImpl(
085:                            "Help Key illegal character.", KEY_ILLEGAL, "'"));
086:                } else {
087:                    helpEntry.setHelpKey(helpEntry.getHelpKey().trim());
088:                    HelpEntry entry1 = findByKey(helpEntry.getHelpKey());
089:                    if (helpEntry.getHelpId() == null && entry1 != null) {
090:                        Long id = entry1.getHelpId();
091:                        //LOG.debug("id of this help entry is: "+id.toString());
092:                        helpEntry.setHelpId(id);
093:                        helpEntry.setLockVerNbr(entry1.getLockVerNbr());
094:                        //LOG.debug(helpEntry.getHelpId()+", "+helpEntry.getHelpName()+", "+helpEntry.getHelpText()+", "+helpEntry.getHelpKey());
095:                    }
096:                }
097:
098:                LOG.debug("Exit validateXmlHelpEntry(..)");
099:                if (!errors.isEmpty()) {
100:                    throw new WorkflowServiceErrorException(
101:                            "Help Entry validation Error", errors);
102:                }
103:                return helpEntry;
104:            }
105:
106:            private void validateHelpEntry(HelpEntry helpEntry) {
107:                LOG.debug("Enter validateHelpEntry(..)");
108:                List errors = new ArrayList();
109:
110:                if (helpEntry.getHelpName() == null
111:                        || "".equals(helpEntry.getHelpName().trim())) {
112:                    errors.add(new WorkflowServiceErrorImpl("Help Name empty.",
113:                            NAME_EMPTY));
114:                }
115:                if (helpEntry.getHelpText() == null
116:                        || "".equals(helpEntry.getHelpText().trim())) {
117:                    errors.add(new WorkflowServiceErrorImpl("Help Text empty.",
118:                            TEXT_EMPTY));
119:                } else {
120:                    helpEntry.setHelpText(helpEntry.getHelpText().trim());
121:                }
122:
123:                if (helpEntry.getHelpKey() == null
124:                        || "".equals(helpEntry.getHelpKey().trim())) {
125:                    errors.add(new WorkflowServiceErrorImpl("Help Key empty.",
126:                            KEY_EMPTY));
127:                } else if (helpEntry.getHelpKey().indexOf("'") >= 0) {
128:                    errors.add(new WorkflowServiceErrorImpl(
129:                            "Help Key illegal character.", KEY_ILLEGAL, "'"));
130:                } else {
131:                    helpEntry.setHelpKey(helpEntry.getHelpKey().trim());
132:                    if (helpEntry.getHelpId() == null
133:                            && findByKey(helpEntry.getHelpKey()) != null) {
134:                        errors.add(new WorkflowServiceErrorImpl(
135:                                "Help Key exists.", KEY_EXIST, helpEntry
136:                                        .getHelpKey()));
137:                    }
138:                }
139:
140:                LOG.debug("Exit validateHelpEntry(..)");
141:                if (!errors.isEmpty()) {
142:                    throw new WorkflowServiceErrorException(
143:                            "Help Entry validation Error", errors);
144:                }
145:            }
146:
147:            public HelpEntry findByKey(String helpKey) {
148:                return getHelpDAO().findByKey(helpKey);
149:            }
150:
151:            public HelpDAO getHelpDAO() {
152:                return helpDAO;
153:            }
154:
155:            public void setHelpDAO(HelpDAO helpDAO) {
156:                this .helpDAO = helpDAO;
157:            }
158:
159:            public HelpEntry findById(Long helpId) {
160:                return getHelpDAO().findById(helpId);
161:            }
162:
163:            public List search(HelpEntry helpEntry) {
164:                List errors = new ArrayList();
165:                if (helpEntry.getHelpId() != null
166:                        && helpEntry.getHelpId().longValue() == 0) {
167:                    errors.add(new WorkflowServiceErrorImpl("Help Id invalid",
168:                            ID_INVALID));
169:                }
170:                if (!errors.isEmpty()) {
171:                    throw new WorkflowServiceErrorException(
172:                            "Help Entry search criteria error", errors);
173:                }
174:
175:                return getHelpDAO().search(helpEntry);
176:            }
177:
178:            public void loadXml(InputStream inputStream, WorkflowUser user) {
179:                HelpEntryXmlParser parser = new HelpEntryXmlParser();
180:                try {
181:                    parser.parseHelpEntries(inputStream);
182:                } catch (Exception e) {
183:                    throw new WorkflowServiceErrorException(
184:                            "Error parsing help  XML file",
185:                            new WorkflowServiceErrorImpl(
186:                                    "Error parsing xml file.",
187:                                    EdenConstants.XML_FILE_PARSE_ERROR));
188:                }
189:            }
190:
191:            public Element export(ExportDataSet dataSet) {
192:                HelpEntryXmlExporter exporter = new HelpEntryXmlExporter();
193:                return exporter.export(dataSet);
194:            }
195:
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.