Source Code Cross Referenced for OrganizationReversionGlobalMaintainableImpl.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.Collection;
020:        import java.util.Collections;
021:        import java.util.Comparator;
022:        import java.util.List;
023:
024:        import org.kuali.core.bo.PersistableBusinessObject;
025:        import org.kuali.core.document.MaintenanceLock;
026:        import org.kuali.core.maintenance.KualiGlobalMaintainableImpl;
027:        import org.kuali.core.util.TypedArrayList;
028:        import org.kuali.kfs.KFSConstants;
029:        import org.kuali.kfs.context.SpringContext;
030:        import org.kuali.module.chart.bo.OrganizationReversion;
031:        import org.kuali.module.chart.bo.OrganizationReversionCategory;
032:        import org.kuali.module.chart.bo.OrganizationReversionGlobal;
033:        import org.kuali.module.chart.bo.OrganizationReversionGlobalDetail;
034:        import org.kuali.module.chart.bo.OrganizationReversionGlobalOrganization;
035:        import org.kuali.module.chart.service.OrganizationReversionService;
036:
037:        /**
038:         * This class provides some specific functionality for the {@link OrganizationReversionGlobal} maintenance document inner class for
039:         * doing comparisons on {@link OrganizationReversionCategory} generateMaintenanceLocks - generates the appropriate maintenance locks
040:         * on {@link OrganizationReversion} setBusinessObject - populates the {@link OrganizationReversionGlobalDetail}s
041:         * isRelationshipRefreshable - makes sure that {@code organizationReversionGlobalDetails} isn't wiped out accidentally
042:         * processGlobalsAfterRetrieve - provides special handling for the details (which aren't a true collection)
043:         */
044:        public class OrganizationReversionGlobalMaintainableImpl extends
045:                KualiGlobalMaintainableImpl {
046:            protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
047:                    .getLogger(OrganizationReversionGlobalMaintainableImpl.class);
048:
049:            /**
050:             * This class is an inner class for comparing two {@link OrganizationReversionCategory}s
051:             */
052:            private class CategoryComparator implements 
053:                    Comparator<OrganizationReversionGlobalDetail> {
054:                public int compare(OrganizationReversionGlobalDetail detailA,
055:                        OrganizationReversionGlobalDetail detailB) {
056:                    OrganizationReversionCategory categoryA = detailA
057:                            .getOrganizationReversionCategory();
058:                    OrganizationReversionCategory categoryB = detailB
059:                            .getOrganizationReversionCategory();
060:
061:                    String code0 = categoryA
062:                            .getOrganizationReversionCategoryCode();
063:                    String code1 = categoryB
064:                            .getOrganizationReversionCategoryCode();
065:
066:                    return code0.compareTo(code1);
067:                }
068:            }
069:
070:            /**
071:             * This implementation locks all organization reversions that would be accessed by this global organization reversion. It does
072:             * not lock any OrganizationReversionDetail objects, as we expect that those will be inaccessible
073:             * 
074:             * @see org.kuali.core.maintenance.KualiGlobalMaintainableImpl#generateMaintenaceLocks()
075:             */
076:            @Override
077:            public List<MaintenanceLock> generateMaintenanceLocks() {
078:                List<MaintenanceLock> locks = new ArrayList<MaintenanceLock>();
079:                OrganizationReversionGlobal globalOrgRev = (OrganizationReversionGlobal) this 
080:                        .getBusinessObject();
081:                if (globalOrgRev.getUniversityFiscalYear() != null
082:                        && globalOrgRev
083:                                .getOrganizationReversionGlobalOrganizations() != null
084:                        && globalOrgRev
085:                                .getOrganizationReversionGlobalOrganizations()
086:                                .size() > 0) { // only
087:                    // generate
088:                    // locks
089:                    // if
090:                    // we're
091:                    // going
092:                    // to
093:                    // have
094:                    // primary
095:                    // keys
096:                    for (OrganizationReversionGlobalOrganization orgRevOrg : globalOrgRev
097:                            .getOrganizationReversionGlobalOrganizations()) {
098:                        MaintenanceLock maintenanceLock = new MaintenanceLock();
099:                        maintenanceLock.setDocumentNumber(globalOrgRev
100:                                .getDocumentNumber());
101:
102:                        StringBuffer lockRep = new StringBuffer();
103:                        lockRep.append(OrganizationReversion.class.getName());
104:                        lockRep
105:                                .append(KFSConstants.Maintenance.AFTER_CLASS_DELIM);
106:                        lockRep.append("chartOfAccountsCode");
107:                        lockRep
108:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
109:                        lockRep.append(orgRevOrg.getChartOfAccountsCode());
110:                        lockRep
111:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
112:                        lockRep.append("universityFiscalYear");
113:                        lockRep
114:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
115:                        lockRep.append(globalOrgRev.getUniversityFiscalYear()
116:                                .toString());
117:                        lockRep
118:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
119:                        lockRep.append("organizationCode");
120:                        lockRep
121:                                .append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
122:                        lockRep.append(orgRevOrg.getOrganizationCode());
123:                        lockRep
124:                                .append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
125:
126:                        maintenanceLock.setLockingRepresentation(lockRep
127:                                .toString());
128:                        locks.add(maintenanceLock);
129:                    }
130:                }
131:
132:                return locks;
133:            }
134:
135:            /**
136:             * Just like OrganizationReversionMaintainableImpl's setBusinessObject method populates the list of details so there is one
137:             * detail per active Organization Reversion Category, this method populates a list of Organization Reversion Change details.
138:             * 
139:             * @see org.kuali.core.maintenance.KualiMaintainableImpl#setBusinessObject(org.kuali.core.bo.PersistableBusinessObject)
140:             */
141:            @Override
142:            public void setBusinessObject(
143:                    PersistableBusinessObject businessObject) {
144:                super .setBusinessObject(businessObject);
145:                OrganizationReversionService organizationReversionService = SpringContext
146:                        .getBean(OrganizationReversionService.class);
147:                OrganizationReversionGlobal globalOrgRev = (OrganizationReversionGlobal) businessObject;
148:                List<OrganizationReversionGlobalDetail> details = globalOrgRev
149:                        .getOrganizationReversionGlobalDetails();
150:                LOG.debug("Details size before adding categories = "
151:                        + details.size());
152:
153:                if (details == null) {
154:                    details = new TypedArrayList(
155:                            OrganizationReversionGlobalDetail.class);
156:                    globalOrgRev.setOrganizationReversionGlobalDetails(details);
157:                }
158:
159:                if (details.size() == 0) {
160:
161:                    Collection<OrganizationReversionCategory> categories = organizationReversionService
162:                            .getCategoryList();
163:                    for (OrganizationReversionCategory category : categories) {
164:                        if (category
165:                                .isOrganizationReversionCategoryActiveIndicator()) {
166:                            OrganizationReversionGlobalDetail detail = new OrganizationReversionGlobalDetail();
167:                            detail
168:                                    .setOrganizationReversionCategoryCode(category
169:                                            .getOrganizationReversionCategoryCode());
170:                            detail.setOrganizationReversionCategory(category);
171:                            detail
172:                                    .setParentGlobalOrganizationReversion(globalOrgRev);
173:                            details.add(detail);
174:                        }
175:                    }
176:                    LOG.debug("Details size after adding categories = "
177:                            + details.size());
178:                    Collections.sort(details, new CategoryComparator());
179:                }
180:                super .setBusinessObject(businessObject);
181:            }
182:
183:            /**
184:             * Prevents Organization Reversion Change Details from being refreshed by a look up (because doing that refresh before a save
185:             * would wipe out the list of organization reversion change details).
186:             * 
187:             * @see org.kuali.core.maintenance.KualiMaintainableImpl#isRelationshipRefreshable(java.lang.Class, java.lang.String)
188:             */
189:            @Override
190:            protected boolean isRelationshipRefreshable(Class boClass,
191:                    String relationshipName) {
192:                if (relationshipName
193:                        .equals("organizationReversionGlobalDetails")) {
194:                    return false;
195:                } else {
196:                    return super .isRelationshipRefreshable(boClass,
197:                            relationshipName);
198:                }
199:            }
200:
201:            /**
202:             * The org reversion detail collection does not behave like a true collection (no add lines). The records on the collection
203:             * should not have the delete option.
204:             * 
205:             * @see org.kuali.core.maintenance.KualiGlobalMaintainableImpl#processGlobalsAfterRetrieve()
206:             */
207:            @Override
208:            protected void processGlobalsAfterRetrieve() {
209:                super .processGlobalsAfterRetrieve();
210:                for (OrganizationReversionGlobalDetail changeDetail : ((OrganizationReversionGlobal) businessObject)
211:                        .getOrganizationReversionGlobalDetails()) {
212:                    changeDetail.setNewCollectionRecord(false);
213:                }
214:            }
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.