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


001:        /*
002:         * Copyright 2006-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.gl.web.lookupable;
017:
018:        import java.util.Collection;
019:        import java.util.Collections;
020:        import java.util.Iterator;
021:        import java.util.List;
022:        import java.util.Map;
023:
024:        import org.apache.commons.lang.StringUtils;
025:        import org.kuali.core.bo.BusinessObject;
026:        import org.kuali.core.lookup.AbstractLookupableHelperServiceImpl;
027:        import org.kuali.core.lookup.CollectionIncomplete;
028:        import org.kuali.core.util.BeanPropertyComparator;
029:        import org.kuali.core.web.ui.Field;
030:        import org.kuali.core.web.ui.Row;
031:        import org.kuali.kfs.KFSConstants;
032:        import org.kuali.kfs.KFSPropertyConstants;
033:        import org.kuali.kfs.service.GeneralLedgerPendingEntryService;
034:        import org.kuali.module.gl.web.Constant;
035:
036:        /**
037:         * The abstract parent class for GL Lookupables, providing base implementations of methods
038:         * to make adding new lookupable reports easier
039:         */
040:        public abstract class AbstractGLLookupableHelperServiceImpl extends
041:                AbstractLookupableHelperServiceImpl {
042:
043:            private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
044:                    .getLogger(AbstractGLLookupableHelperServiceImpl.class);
045:
046:            private GeneralLedgerPendingEntryService generalLedgerPendingEntryService;
047:
048:            protected GeneralLedgerPendingEntryService getGeneralLedgerPendingEntryService() {
049:                return generalLedgerPendingEntryService;
050:            }
051:
052:            public void setGeneralLedgerPendingEntryService(
053:                    GeneralLedgerPendingEntryService generalLedgerPendingEntryService) {
054:                this .generalLedgerPendingEntryService = generalLedgerPendingEntryService;
055:            }
056:
057:            /**
058:             * This method overides that in parent class so that the maintainance actions are surpressed
059:             * 
060:             * @returns links to edit and copy maintenance action for the current maintenance record. For GL balance inquire, there are no
061:             *          maintenance links.
062:             */
063:            @Override
064:            public String getActionUrls(BusinessObject bo) {
065:                return KFSConstants.EMPTY_STRING;
066:            }
067:
068:            /**
069:             * This method tests if the user selects to see the general ledager pending entries
070:             * 
071:             * @param fieldValues the map containing the search fields and values
072:             * @return the value of pending entry option
073:             */
074:            protected String getSelectedPendingEntryOption(Map fieldValues) {
075:                // truncate the non-property filed
076:                String pendingEntryOption = (String) fieldValues
077:                        .get(Constant.PENDING_ENTRY_OPTION);
078:                fieldValues.remove(Constant.PENDING_ENTRY_OPTION);
079:
080:                return pendingEntryOption;
081:            }
082:
083:            /**
084:             * This method tests if the user selects to see the reports by monthly or accumulated
085:             * 
086:             * @param fieldValues the map containing the search fields and values
087:             * @return the value of amount view option
088:             */
089:            protected String getSelectedAmountViewOption(Map fieldValues) {
090:
091:                String amountViewOption = Constant.EMPTY_STRING;
092:                if (fieldValues.containsKey(Constant.AMOUNT_VIEW_OPTION)) {
093:                    amountViewOption = (String) fieldValues
094:                            .get(Constant.AMOUNT_VIEW_OPTION);
095:
096:                    // truncate the non-property filed
097:                    fieldValues.remove(Constant.AMOUNT_VIEW_OPTION);
098:                }
099:                return amountViewOption;
100:            }
101:
102:            /**
103:             * This method tests if the user selects to see the details or consolidated results
104:             * 
105:             * @param fieldValues the map containing the search fields and values
106:             * @return true if consolidation is selected and subaccount is not specified
107:             */
108:            protected boolean isConsolidationSelected(Map fieldValues) {
109:                // truncate the non-property filed
110:                String consolidationOption = (String) fieldValues
111:                        .get(Constant.CONSOLIDATION_OPTION);
112:                fieldValues.remove(Constant.CONSOLIDATION_OPTION);
113:
114:                // detail option would be used
115:                if (Constant.DETAIL.equals(consolidationOption)) {
116:                    return false;
117:                }
118:
119:                // if the subAccountNumber is specified, detail option could be used
120:                String subAccountNumber = (String) fieldValues
121:                        .get(KFSPropertyConstants.SUB_ACCOUNT_NUMBER);
122:                if (!StringUtils.isBlank(subAccountNumber)) {
123:                    this .changeFieldValue(Constant.CONSOLIDATION_OPTION,
124:                            Constant.DETAIL);
125:                    return false;
126:                }
127:
128:                // if the subObjectCode is specified, detail option could be used
129:                String subObjectCode = (String) fieldValues
130:                        .get(KFSPropertyConstants.SUB_OBJECT_CODE);
131:                if (!StringUtils.isBlank(subObjectCode)) {
132:                    this .changeFieldValue(Constant.CONSOLIDATION_OPTION,
133:                            Constant.DETAIL);
134:                    return false;
135:                }
136:
137:                // if the objectTypeCode is specified, detail option could be used
138:                String objectTypeCode = (String) fieldValues
139:                        .get(KFSPropertyConstants.OBJECT_TYPE_CODE);
140:                if (!StringUtils.isBlank(objectTypeCode)) {
141:                    this .changeFieldValue(Constant.CONSOLIDATION_OPTION,
142:                            Constant.DETAIL);
143:                    return false;
144:                }
145:                return true;
146:            }
147:
148:            /**
149:             * This method tests if the user selects to see the results with cost share subaccount
150:             * 
151:             * @param fieldValues the map containing the search fields and values
152:             * @return true if inclusive option is selected
153:             */
154:            protected boolean isCostShareInclusive(Map fieldValues) {
155:                // TODO: is this method being called?
156:                // truncate the non-property filed
157:                String costShareOption = (String) fieldValues
158:                        .get(Constant.COST_SHARE_OPTION);
159:                fieldValues.remove(Constant.COST_SHARE_OPTION);
160:
161:                if (costShareOption.equals(Constant.COST_SHARE_INCLUDE)) {
162:                    return true;
163:                }
164:                return false;
165:            }
166:
167:            /**
168:             * build the serach result list from the given collection and the number of all qualified search results
169:             * 
170:             * @param searchResultsCollection the given search results, which may be a subset of the qualified search results
171:             * @param actualSize the number of all qualified search results
172:             * @return the serach result list with the given results and actual size
173:             */
174:            protected List buildSearchResultList(
175:                    Collection searchResultsCollection, Long actualSize) {
176:                CollectionIncomplete results = new CollectionIncomplete(
177:                        searchResultsCollection, actualSize);
178:
179:                // sort list if default sort column given
180:                List searchResults = (List) results;
181:                List defaultSortColumns = getDefaultSortColumns();
182:                if (defaultSortColumns.size() > 0) {
183:                    Collections.sort(results, new BeanPropertyComparator(
184:                            defaultSortColumns, true));
185:                }
186:                return searchResults;
187:            }
188:
189:            /**
190:             * This method is used to update amounts of the given entries with the corresponding pending amounts. It is a factory that
191:             * executes the update methods of individual derived classes.
192:             * 
193:             * @param entryCollection a collection of balance entries
194:             * @param fieldValues the map containing the search fields and values
195:             * @param pendingEntryOption flag whether the approved entries or all entries will be processed
196:             * @param isCostShareInclusive flag whether the user selects to see the results with cost share subaccount
197:             * @param isConsolidated flag whether the results are consolidated or not
198:             */
199:            protected void updateByPendingLedgerEntry(
200:                    Collection entryCollection, Map fieldValues,
201:                    String pendingEntryOption, boolean isConsolidated,
202:                    boolean isCostShareInclusive) {
203:
204:                // determine if search results need to be updated by pending ledger entries
205:                if (Constant.ALL_PENDING_ENTRY.equals(pendingEntryOption)) {
206:                    updateEntryCollection(entryCollection, fieldValues, false,
207:                            isConsolidated, isCostShareInclusive);
208:                } else if (Constant.APPROVED_PENDING_ENTRY
209:                        .equals(pendingEntryOption)) {
210:                    updateEntryCollection(entryCollection, fieldValues, true,
211:                            isConsolidated, isCostShareInclusive);
212:                }
213:            }
214:
215:            /**
216:             * This method is an abstract method and implemented to update the given entry collection by the children classes. It is called
217:             * by updateByPendingLedgerEntry method.
218:             * 
219:             * @param entryCollection a collection of balance entries
220:             * @param fieldValues the map containing the search fields and values
221:             * @param isApproved flag whether the approved entries or all entries will be processed
222:             * @param isCostShareInclusive flag whether the user selects to see the results with cost share subaccount
223:             * @param isConsolidated flag whether the results are consolidated or not
224:             */
225:            protected abstract void updateEntryCollection(
226:                    Collection entryCollection, Map fieldValues,
227:                    boolean isApproved, boolean isConsolidated,
228:                    boolean isCostShareInclusive);
229:
230:            // change the value of the field with the given field name into the given field value
231:            private void changeFieldValue(String fieldName, String fieldValue) {
232:                for (Iterator rowIterator = getRows().iterator(); rowIterator
233:                        .hasNext();) {
234:                    Row row = (Row) rowIterator.next();
235:
236:                    for (Iterator fieldIterator = row.getFields().iterator(); fieldIterator
237:                            .hasNext();) {
238:                        Field field = (Field) fieldIterator.next();
239:
240:                        if (field.getPropertyName().equals(fieldName)) {
241:                            field.setPropertyValue(fieldValue);
242:                        }
243:                    }
244:                }
245:            }
246:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.