Source Code Cross Referenced for RuleAttributeServiceImpl.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » routetemplate » 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.routetemplate 
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.routetemplate;
018:
019:        import java.io.FileNotFoundException;
020:        import java.io.InputStream;
021:        import java.util.ArrayList;
022:        import java.util.Collection;
023:        import java.util.List;
024:
025:        import org.jdom.Element;
026:
027:        import edu.iu.uis.eden.KEWServiceLocator;
028:        import edu.iu.uis.eden.WorkflowServiceErrorException;
029:        import edu.iu.uis.eden.WorkflowServiceErrorImpl;
030:        import edu.iu.uis.eden.export.ExportDataSet;
031:        import edu.iu.uis.eden.routetemplate.dao.RuleAttributeDAO;
032:        import edu.iu.uis.eden.user.WorkflowUser;
033:        import edu.iu.uis.eden.xml.RuleAttributeXmlParser;
034:        import edu.iu.uis.eden.xml.export.RuleAttributeXmlExporter;
035:
036:        public class RuleAttributeServiceImpl implements  RuleAttributeService {
037:            private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
038:                    .getLogger(RuleAttributeServiceImpl.class);
039:
040:            private static final String RULE_ATTRIBUTE_NAME_REQUIRED = "rule.attribute.name.required";
041:            private static final String RULE_ATTRIBUTE_CLASS_REQUIRED = "rule.attribute.className.required";
042:
043:            private static final String XML_FILE_NOT_FOUND = "general.error.filenotfound";
044:            private static final String XML_PARSE_ERROR = "general.error.parsexml";
045:
046:            private RuleAttributeDAO ruleAttributeDAO;
047:
048:            public void save(RuleAttribute ruleAttribute) {
049:                validate(ruleAttribute);
050:                KEWServiceLocator.getDocumentTypeService()
051:                        .clearCacheForAttributeUpdate(ruleAttribute);
052:                getRuleAttributeDAO().save(ruleAttribute);
053:            }
054:
055:            public void delete(Long ruleAttributeId) {
056:                getRuleAttributeDAO().delete(ruleAttributeId);
057:            }
058:
059:            public List findByRuleAttribute(RuleAttribute ruleAttribute) {
060:                return getRuleAttributeDAO().findByRuleAttribute(ruleAttribute);
061:            }
062:
063:            public RuleAttribute findByRuleAttributeId(Long ruleAttributeId) {
064:                return getRuleAttributeDAO().findByRuleAttributeId(
065:                        ruleAttributeId);
066:            }
067:
068:            public List findAll() {
069:                return getRuleAttributeDAO().getAllRuleAttributes();
070:            }
071:
072:            public RuleAttribute findByName(String name) {
073:                return getRuleAttributeDAO().findByName(name);
074:            }
075:
076:            public RuleAttributeDAO getRuleAttributeDAO() {
077:                return ruleAttributeDAO;
078:            }
079:
080:            public void setRuleAttributeDAO(RuleAttributeDAO ruleAttributeDAO) {
081:                this .ruleAttributeDAO = ruleAttributeDAO;
082:            }
083:
084:            private void validate(RuleAttribute ruleAttribute) {
085:                LOG.debug("validating ruleAttribute");
086:                Collection errors = new ArrayList();
087:                if (ruleAttribute.getName() == null
088:                        || ruleAttribute.getName().trim().equals("")) {
089:                    errors.add(new WorkflowServiceErrorImpl(
090:                            "Please enter a rule attribute name.",
091:                            RULE_ATTRIBUTE_NAME_REQUIRED));
092:                    LOG.error("Rule attribute name is missing");
093:                } else {
094:                    ruleAttribute.setName(ruleAttribute.getName().trim());
095:                    if (ruleAttribute.getRuleAttributeId() == null) {
096:                        RuleAttribute nameInUse = findByName(ruleAttribute
097:                                .getName());
098:                        if (nameInUse != null) {
099:                            errors
100:                                    .add(new WorkflowServiceErrorImpl(
101:                                            "Rule attribute name already in use",
102:                                            "routetemplate.ruleattribute.name.duplicate"));
103:                            LOG.error("Rule attribute name already in use");
104:                        }
105:                    }
106:                }
107:                if (ruleAttribute.getClassName() == null
108:                        || ruleAttribute.getClassName().trim().equals("")) {
109:                    errors.add(new WorkflowServiceErrorImpl(
110:                            "Please enter a rule attribute class name.",
111:                            RULE_ATTRIBUTE_CLASS_REQUIRED));
112:                    LOG.error("Rule attribute class name is missing");
113:                } else {
114:                    ruleAttribute.setClassName(ruleAttribute.getClassName()
115:                            .trim());
116:                }
117:
118:                LOG.debug("end validating ruleAttribute");
119:                if (!errors.isEmpty()) {
120:                    throw new WorkflowServiceErrorException(
121:                            "RuleAttribute Validation Error", errors);
122:                }
123:            }
124:
125:            public void loadXml(InputStream inputStream, WorkflowUser user) {
126:                RuleAttributeXmlParser parser = new RuleAttributeXmlParser();
127:                try {
128:                    parser.parseRuleAttributes(inputStream);
129:                } catch (FileNotFoundException e) {
130:                    throw new WorkflowServiceErrorException(
131:                            "XML file not found", new WorkflowServiceErrorImpl(
132:                                    "Rule Attribute XML file not found",
133:                                    XML_FILE_NOT_FOUND));
134:                } catch (Exception e) { //any other exception
135:                    LOG.error("Error loading xml file", e);
136:                    throw new WorkflowServiceErrorException(
137:                            "Error loading xml file",
138:                            new WorkflowServiceErrorImpl(
139:                                    "Error loading xml file", XML_PARSE_ERROR));
140:                }
141:            }
142:
143:            public Element export(ExportDataSet dataSet) {
144:                RuleAttributeXmlExporter exporter = new RuleAttributeXmlExporter();
145:                return exporter.export(dataSet);
146:            }
147:
148:            public RuleAttribute findByClassName(String className) {
149:                return this.ruleAttributeDAO.findByClassName(className);
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.