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


001:        /*
002:         * Copyright 2005-2006 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.web;
018:
019:        import java.util.ArrayList;
020:        import java.util.Iterator;
021:        import java.util.List;
022:
023:        import org.apache.commons.beanutils.PropertyUtils;
024:
025:        import edu.iu.uis.eden.routetemplate.RuleDelegation;
026:        import edu.iu.uis.eden.routetemplate.RuleResponsibility;
027:
028:        /**
029:         * Some utilities which are utilized by the {@link Rule2Action}.
030:         *
031:         * @author ewestfal
032:         */
033:        public class WebRuleUtils {
034:
035:            /**
036:             * Copies the existing rule onto the current document.  This is used within the web-based rule GUI to make a
037:             * copy of a rule on the existing document.  Essentially, this method makes a copy of the rule and all
038:             * delegates but preserves the document ID of the original rule.
039:             */
040:            public static WebRuleBaseValues copyRuleOntoExistingDocument(
041:                    WebRuleBaseValues rule) throws Exception {
042:                WebRuleBaseValues ruleCopy = new WebRuleBaseValues();
043:                PropertyUtils.copyProperties(ruleCopy, rule);
044:                ruleCopy.setPreviousVersionId(null);
045:                ruleCopy.setCurrentInd(null);
046:                ruleCopy.setVersionNbr(null);
047:
048:                List responsibilities = new ArrayList();
049:                for (Iterator iter = ruleCopy.getResponsibilities().iterator(); iter
050:                        .hasNext();) {
051:                    WebRuleResponsibility responsibility = (WebRuleResponsibility) iter
052:                            .next();
053:                    WebRuleResponsibility responsibilityCopy = new WebRuleResponsibility();
054:                    PropertyUtils.copyProperties(responsibilityCopy,
055:                            responsibility);
056:
057:                    responsibilityCopy.setResponsibilityId(null);
058:                    responsibilityCopy.setRuleResponsibilityKey(null);
059:
060:                    List delegations = new ArrayList();
061:                    for (Iterator iterator = responsibilityCopy
062:                            .getDelegationRules().iterator(); iterator
063:                            .hasNext();) {
064:                        RuleDelegation delegation = (RuleDelegation) iterator
065:                                .next();
066:                        RuleDelegation delegationCopy = new RuleDelegation();
067:                        PropertyUtils
068:                                .copyProperties(delegationCopy, delegation);
069:
070:                        delegationCopy.setDelegateRuleId(null);
071:                        delegationCopy.setLockVerNbr(null);
072:                        delegationCopy.setRuleDelegationId(null);
073:                        delegationCopy.setRuleResponsibilityId(null);
074:
075:                        WebRuleBaseValues delegationRule = ((WebRuleBaseValues) delegation
076:                                .getDelegationRuleBaseValues());
077:                        WebRuleBaseValues ruleDelegateCopy = new WebRuleBaseValues();
078:                        PropertyUtils.copyProperties(ruleDelegateCopy,
079:                                delegationRule);
080:
081:                        ruleDelegateCopy.setPreviousVersionId(null);
082:                        ruleDelegateCopy.setCurrentInd(null);
083:                        ruleDelegateCopy.setVersionNbr(null);
084:
085:                        List delegateResps = new ArrayList();
086:                        for (Iterator iterator1 = ruleDelegateCopy
087:                                .getResponsibilities().iterator(); iterator1
088:                                .hasNext();) {
089:                            WebRuleResponsibility delegateResp = (WebRuleResponsibility) iterator1
090:                                    .next();
091:                            WebRuleResponsibility delegateRespCopy = new WebRuleResponsibility();
092:                            PropertyUtils.copyProperties(delegateRespCopy,
093:                                    delegateResp);
094:
095:                            delegateRespCopy.setResponsibilityId(null);
096:                            delegateRespCopy.setRuleResponsibilityKey(null);
097:                            delegateResps.add(delegateRespCopy);
098:                        }
099:                        ruleDelegateCopy.setResponsibilities(delegateResps);
100:                        delegationCopy
101:                                .setDelegationRuleBaseValues(ruleDelegateCopy);
102:                        delegations.add(delegationCopy);
103:                    }
104:                    responsibilityCopy.setDelegationRules(delegations);
105:                    responsibilities.add(responsibilityCopy);
106:                }
107:                ruleCopy.setResponsibilities(responsibilities);
108:                return ruleCopy;
109:            }
110:
111:            /**
112:             * Makes a copy of the rule and clears the document id on the rule and any of its delegates.
113:             * This method is used for making a copy of a rule for a new document.  It essentially calls
114:             * the copyRuleOntoExistingDocument method and then clears out the document IDs.
115:             * 
116:             * @param webRuleBaseValues
117:             */
118:            public static WebRuleBaseValues copyToNewRule(
119:                    WebRuleBaseValues webRuleBaseValues) throws Exception {
120:                WebRuleBaseValues newRule = copyRuleOntoExistingDocument(webRuleBaseValues);
121:                // clear out all document IDs on the rule and it's delegates
122:                newRule.setRouteHeaderId(null);
123:                for (Iterator iterator = newRule.getResponsibilities()
124:                        .iterator(); iterator.hasNext();) {
125:                    RuleResponsibility responsibility = (RuleResponsibility) iterator
126:                            .next();
127:                    for (Iterator iterator2 = responsibility
128:                            .getDelegationRules().iterator(); iterator2
129:                            .hasNext();) {
130:                        RuleDelegation delegation = (RuleDelegation) iterator2
131:                                .next();
132:                        delegation.getDelegationRuleBaseValues()
133:                                .setRouteHeaderId(null);
134:                    }
135:                }
136:                return newRule;
137:            }
138:
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.