Source Code Cross Referenced for DelegateGlobalMaintainableImpl.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » chart » maintenance » 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 » org.kuali.module.chart.maintenance 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.module.chart.maintenance;
017:
018:        import java.util.ArrayList;
019:        import java.util.HashMap;
020:        import java.util.HashSet;
021:        import java.util.List;
022:        import java.util.Map;
023:        import java.util.Set;
024:
025:        import org.apache.commons.lang.StringUtils;
026:        import org.kuali.core.document.MaintenanceLock;
027:        import org.kuali.core.maintenance.KualiGlobalMaintainableImpl;
028:        import org.kuali.core.service.BusinessObjectService;
029:        import org.kuali.kfs.KFSConstants;
030:        import org.kuali.kfs.context.SpringContext;
031:        import org.kuali.module.chart.bo.AccountGlobalDetail;
032:        import org.kuali.module.chart.bo.Delegate;
033:        import org.kuali.module.chart.bo.DelegateGlobal;
034:        import org.kuali.module.chart.bo.DelegateGlobalDetail;
035:        import org.kuali.module.chart.bo.OrganizationRoutingModel;
036:        import org.kuali.module.chart.bo.OrganizationRoutingModelName;
037:
038:        /**
039:         * This class overrides the base {@link KualiGlobalMaintainableImpl} to generate the specific maintenance locks for Global delegates
040:         * and to help with using delegate models
041:         * 
042:         * @see OrganizationRoutingModelName
043:         */
044:        public class DelegateGlobalMaintainableImpl extends
045:                KualiGlobalMaintainableImpl {
046:
047:            /**
048:             * This method is used for the creation of a delegate from a {@link OrganizationRoutingModelName}
049:             * 
050:             * @see org.kuali.core.maintenance.KualiMaintainableImpl#setupNewFromExisting()
051:             */
052:            @Override
053:            public void setupNewFromExisting() {
054:                super .setupNewFromExisting();
055:
056:                DelegateGlobal globalDelegate = (DelegateGlobal) this 
057:                        .getBusinessObject();
058:                // 1. if model name, chart of accounts, and org code are all present
059:                // then let's see if we've actually got a model record
060:                if (!StringUtils.isBlank(globalDelegate.getModelName())
061:                        && !StringUtils.isBlank(globalDelegate
062:                                .getModelChartOfAccountsCode())
063:                        && !StringUtils.isBlank(globalDelegate
064:                                .getModelOrganizationCode())) {
065:                    Map pkMap = new HashMap();
066:                    pkMap.put("organizationRoutingModelName", globalDelegate
067:                            .getModelName());
068:                    pkMap.put("chartOfAccountsCode", globalDelegate
069:                            .getModelChartOfAccountsCode());
070:                    pkMap.put("organizationCode", globalDelegate
071:                            .getModelOrganizationCode());
072:
073:                    OrganizationRoutingModelName globalDelegateTemplate = (OrganizationRoutingModelName) SpringContext
074:                            .getBean(BusinessObjectService.class)
075:                            .findByPrimaryKey(
076:                                    OrganizationRoutingModelName.class, pkMap);
077:                    if (globalDelegateTemplate != null) {
078:                        // 2. if there is a model record, then let's populate the global delegate
079:                        // based on that
080:                        for (OrganizationRoutingModel model : globalDelegateTemplate
081:                                .getOrganizationRoutingModel()) {
082:                            if (model.isActive()) { // only populate with active models
083:                                DelegateGlobalDetail newDelegate = new DelegateGlobalDetail(
084:                                        model);
085:                                // allow deletion of the new delegate from the global delegate
086:                                newDelegate.setNewCollectionRecord(true);
087:                                globalDelegate.getDelegateGlobals().add(
088:                                        newDelegate);
089:                            }
090:                        }
091:                    }
092:                }
093:            }
094:
095:            /**
096:             * This creates the particular locking representation for this global document.
097:             * 
098:             * @see org.kuali.core.maintenance.Maintainable#generateMaintenanceLocks()
099:             */
100:            @Override
101:            public List<MaintenanceLock> generateMaintenanceLocks() {
102:                // create locking rep for each combination of account and object code
103:                List<MaintenanceLock> maintenanceLocks = new ArrayList();
104:                DelegateGlobal delegateGlobal = (DelegateGlobal) getBusinessObject();
105:
106:                // hold all the locking representations in a set to make sure we don't get any duplicates
107:                Set<String> lockingRepresentations = new HashSet<String>();
108:
109:                MaintenanceLock maintenanceLock;
110:                for (AccountGlobalDetail accountGlobalDetail : delegateGlobal
111:                        .getAccountGlobalDetails()) {
112:                    for (DelegateGlobalDetail delegateGlobalDetail : delegateGlobal
113:                            .getDelegateGlobals()) {
114:                        StringBuilder lockRep = new StringBuilder();
115:                        lockRep.append(Delegate.class.getName());
116:                        lockRep
117:                                .append(KFSConstants.Maintenance.AFTER_CLASS_DELIM);
118:                        lockRep.append("chartOfAccountsCode");
119:                        lockRep
120:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
121:                        lockRep.append(accountGlobalDetail
122:                                .getChartOfAccountsCode());
123:                        lockRep
124:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
125:                        lockRep.append("accountNumber");
126:                        lockRep
127:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
128:                        lockRep.append(accountGlobalDetail.getAccountNumber());
129:                        lockRep
130:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
131:                        lockRep.append("financialDocumentTypeCode");
132:                        lockRep
133:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
134:                        lockRep.append(delegateGlobalDetail
135:                                .getFinancialDocumentTypeCode());
136:                        lockRep
137:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
138:                        lockRep.append("accountDelegateSystemId");
139:                        lockRep
140:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
141:                        lockRep.append(delegateGlobalDetail
142:                                .getAccountDelegateUniversalId());
143:                        // FIXME above is a bit dangerous b/c it hard codes the attribute names, which could change (particularly
144:                        // accountDelegateSystemId) - guess they should either be constants or obtained by looping through Delegate keys;
145:                        // however, I copied this from elsewhere which had them hard-coded, so I'm leaving it for now
146:
147:                        if (!lockingRepresentations
148:                                .contains(lockRep.toString())) {
149:                            maintenanceLock = new MaintenanceLock();
150:                            maintenanceLock.setDocumentNumber(delegateGlobal
151:                                    .getDocumentNumber());
152:                            maintenanceLock.setLockingRepresentation(lockRep
153:                                    .toString());
154:                            maintenanceLocks.add(maintenanceLock);
155:                            lockingRepresentations.add(lockRep.toString());
156:                        }
157:
158:                        lockRep = new StringBuilder();
159:                        lockRep.append(Delegate.class.getName());
160:                        lockRep
161:                                .append(KFSConstants.Maintenance.AFTER_CLASS_DELIM);
162:                        lockRep.append("chartOfAccountsCode");
163:                        lockRep
164:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
165:                        lockRep.append(accountGlobalDetail
166:                                .getChartOfAccountsCode());
167:                        lockRep
168:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
169:                        lockRep.append("accountNumber");
170:                        lockRep
171:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
172:                        lockRep.append(accountGlobalDetail.getAccountNumber());
173:                        lockRep
174:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
175:                        lockRep.append("financialDocumentTypeCode");
176:                        lockRep
177:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
178:                        lockRep.append(delegateGlobalDetail
179:                                .getFinancialDocumentTypeCode());
180:                        lockRep
181:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
182:                        lockRep.append("accountsDelegatePrmrtIndicator");
183:                        lockRep
184:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
185:                        lockRep.append("true");
186:
187:                        if (!lockingRepresentations
188:                                .contains(lockRep.toString())) {
189:                            maintenanceLock = new MaintenanceLock();
190:                            maintenanceLock.setDocumentNumber(delegateGlobal
191:                                    .getDocumentNumber());
192:                            maintenanceLock.setLockingRepresentation(lockRep
193:                                    .toString());
194:                            maintenanceLocks.add(maintenanceLock);
195:                            lockingRepresentations.add(lockRep.toString());
196:                        }
197:                    }
198:                }
199:                return maintenanceLocks;
200:            }
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.