Source Code Cross Referenced for LaborOriginEntryFieldFinder.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » labor » web » optionfinder » 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.labor.web.optionfinder 
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.labor.web.optionfinder;
017:
018:        import java.text.ParseException;
019:        import java.text.SimpleDateFormat;
020:        import java.util.ArrayList;
021:        import java.util.Date;
022:        import java.util.Iterator;
023:        import java.util.List;
024:
025:        import org.apache.commons.lang.StringUtils;
026:        import org.kuali.core.lookup.keyvalues.KeyValuesBase;
027:        import org.kuali.core.util.KualiDecimal;
028:        import org.kuali.core.web.ui.KeyLabelPair;
029:        import org.kuali.kfs.KFSPropertyConstants;
030:
031:        /**
032:         * Field Finder for Labor Origin Entry.
033:         */
034:        public class LaborOriginEntryFieldFinder extends KeyValuesBase {
035:
036:            /**
037:             * @see org.kuali.core.lookup.keyvalues.KeyValuesFinder#getKeyValues()
038:             */
039:            public List getKeyValues() {
040:                List activeLabels = new ArrayList();
041:                activeLabels.add(new KeyLabelPair("universityFiscalYear",
042:                        "Fiscal Year"));
043:                activeLabels.add(new KeyLabelPair("chartOfAccountsCode",
044:                        "Chart Code"));
045:                activeLabels.add(new KeyLabelPair("accountNumber",
046:                        "Account Number"));
047:                activeLabels.add(new KeyLabelPair("subAccountNumber",
048:                        "Sub-Account Number"));
049:                activeLabels.add(new KeyLabelPair("financialObjectCode",
050:                        "Object Code"));
051:                activeLabels.add(new KeyLabelPair("financialSubObjectCode",
052:                        "Sub-Object Code"));
053:                activeLabels.add(new KeyLabelPair("financialBalanceTypeCode",
054:                        "Balance Type"));
055:                activeLabels.add(new KeyLabelPair("financialObjectTypeCode",
056:                        "Object Type"));
057:                activeLabels.add(new KeyLabelPair("universityFiscalPeriodCode",
058:                        "Fiscal Period"));
059:                activeLabels.add(new KeyLabelPair("financialDocumentTypeCode",
060:                        "Document Type"));
061:                activeLabels.add(new KeyLabelPair(
062:                        "financialSystemOriginationCode", "Origin code"));
063:                activeLabels
064:                        .add(new KeyLabelPair(
065:                                KFSPropertyConstants.DOCUMENT_NUMBER,
066:                                "Document Number"));
067:                activeLabels.add(new KeyLabelPair(
068:                        "transactionLedgerEntrySequenceNumber",
069:                        "Sequence Number"));
070:                activeLabels.add(new KeyLabelPair("positionNumber",
071:                        "Position Number"));
072:                activeLabels
073:                        .add(new KeyLabelPair("projectCode", "Project Code"));
074:                activeLabels.add(new KeyLabelPair(
075:                        "transactionLedgerEntryDescription", "Description"));
076:                activeLabels.add(new KeyLabelPair(
077:                        "transactionLedgerEntryAmount", "Amount"));
078:                activeLabels.add(new KeyLabelPair("transactionDebitCreditCode",
079:                        "Debit Credit Indicator"));
080:                activeLabels.add(new KeyLabelPair("transactionDate",
081:                        "Transaction Date"));
082:                activeLabels.add(new KeyLabelPair("organizationDocumentNumber",
083:                        "Org Doc Number"));
084:                activeLabels.add(new KeyLabelPair("organizationReferenceId",
085:                        "Org Ref ID"));
086:                activeLabels.add(new KeyLabelPair(
087:                        "referenceFinancialDocumentTypeCode", "Ref Doc Type"));
088:                activeLabels.add(new KeyLabelPair(
089:                        "referenceFinancialSystemOriginationCode",
090:                        "Ref Origin code"));
091:                activeLabels.add(new KeyLabelPair(
092:                        "referenceFinancialDocumentNumber", "Ref Doc Number"));
093:                activeLabels.add(new KeyLabelPair(
094:                        "financialDocumentReversalDate", "Reversal Date"));
095:                activeLabels.add(new KeyLabelPair(
096:                        "transactionEncumbranceUpdateCode", "Enc Update Code"));
097:                activeLabels.add(new KeyLabelPair("transactionPostingDate",
098:                        "Transaction Posting Date"));
099:                activeLabels.add(new KeyLabelPair("payPeriodEndDate",
100:                        "Pay Period End Date"));
101:                activeLabels.add(new KeyLabelPair("transactionTotalHours",
102:                        "Trn Total Hours"));
103:                activeLabels.add(new KeyLabelPair("payrollEndDateFiscalYear",
104:                        "Payroll EndDate Fiscal Year"));
105:                activeLabels.add(new KeyLabelPair(
106:                        "payrollEndDateFiscalPeriodCode",
107:                        "Payroll EndDate Fiscal Period Code"));
108:                activeLabels.add(new KeyLabelPair("emplid", "Empl Id"));
109:                activeLabels.add(new KeyLabelPair("employeeRecord",
110:                        "Empl Record"));
111:                activeLabels.add(new KeyLabelPair("earnCode", "Earn Code"));
112:                activeLabels.add(new KeyLabelPair("payGroup", "Pay Group"));
113:                activeLabels.add(new KeyLabelPair("salaryAdministrationPlan",
114:                        "Salary Admin Plan"));
115:                activeLabels.add(new KeyLabelPair("grade", "Grade"));
116:                activeLabels.add(new KeyLabelPair("runIdentifier", "Run Id"));
117:                activeLabels.add(new KeyLabelPair(
118:                        "laborLedgerOriginalChartOfAccountsCode",
119:                        "Original Chart Code"));
120:                activeLabels.add(new KeyLabelPair(
121:                        "laborLedgerOriginalAccountNumber",
122:                        "Original Account Number"));
123:                activeLabels.add(new KeyLabelPair(
124:                        "laborLedgerOriginalSubAccountNumber",
125:                        "Original Sub-Account Numbere"));
126:                activeLabels.add(new KeyLabelPair(
127:                        "laborLedgerOriginalFinancialObjectCode",
128:                        "Original Object Code"));
129:                activeLabels.add(new KeyLabelPair(
130:                        "laborLedgerOriginalFinancialSubObjectCode",
131:                        "Original Sub-Object Code"));
132:                activeLabels.add(new KeyLabelPair("hrmsCompany", "Company"));
133:                activeLabels.add(new KeyLabelPair("setid", "SetId"));
134:
135:                return activeLabels;
136:            }
137:
138:            /**
139:             * Get field display name.
140:             * 
141:             * @param fieldName
142:             * @return Returns the label
143:             */
144:            public String getFieldDisplayName(String fieldName) {
145:                for (Iterator iter = getKeyValues().iterator(); iter.hasNext();) {
146:                    KeyLabelPair klp = (KeyLabelPair) iter.next();
147:                    if (klp.getKey().equals(fieldName)) {
148:                        return klp.getLabel();
149:                    }
150:                }
151:
152:                return "Error";
153:            }
154:
155:            /**
156:             * Get field name
157:             * 
158:             * @param fieldDisplayName
159:             * @return Returns the key
160:             */
161:            public String getFieldName(String fieldDisplayName) {
162:                for (Iterator iter = getKeyValues().iterator(); iter.hasNext();) {
163:                    KeyLabelPair klp = (KeyLabelPair) iter.next();
164:                    if (klp.getLabel().equals(fieldDisplayName)) {
165:                        return (String) klp.getKey();
166:                    }
167:                }
168:
169:                return "Error";
170:            }
171:
172:            /**
173:             * Check each field for valid value.
174:             * 
175:             * @param fieldName
176:             * @param value
177:             * @return Returns a boolean
178:             */
179:            public boolean isValidValue(String fieldName, String value) {
180:                if (StringUtils.isBlank(fieldName)) {
181:                    return false;
182:                }
183:                String fieldType = getFieldType(fieldName);
184:                int fieldLength = getFieldLength(fieldName);
185:
186:                if (allowNull(fieldName)
187:                        && (value == null || value.length() == 0)) {
188:                    return true;
189:                }
190:                if (!allowNull(fieldName)
191:                        && (value == null || value.length() == 0)) {
192:                    return false;
193:                }
194:                if (value.length() > fieldLength) {
195:                    return false;
196:                }
197:                if ("KualiDecimal".equals(fieldType)) {
198:                    try {
199:                        KualiDecimal d = new KualiDecimal(value);
200:                        return true;
201:                    } catch (NumberFormatException nfe) {
202:                        return false;
203:                    }
204:                } else if ("Integer".equals(fieldType)) {
205:                    try {
206:                        Integer d = new Integer(value);
207:                        return true;
208:                    } catch (NumberFormatException nfe) {
209:                        return false;
210:                    }
211:                } else if ("Date".equals(fieldType)) {
212:                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
213:                    try {
214:                        Date d = df.parse(value);
215:                        return true;
216:                    } catch (ParseException e) {
217:                        return false;
218:                    }
219:                }
220:
221:                return true;
222:            }
223:
224:            /**
225:             * Get field type.
226:             * 
227:             * @param fieldName
228:             * @return Returns the fieldType
229:             */
230:            public String getFieldType(String fieldName) {
231:                if (fieldName.equals("universityFiscalYear")) {
232:                    return "Integer";
233:                }
234:                if (fieldName.equals("transactionLedgerEntrySequenceNumber")) {
235:                    return "Integer";
236:                }
237:                if (fieldName.equals("transactionLedgerEntryAmount")) {
238:                    return "KualiDecimal";
239:                }
240:                if (fieldName.equals("transactionDate")) {
241:                    return "Date";
242:                }
243:                if (fieldName.equals("financialDocumentReversalDate")) {
244:                    return "Date";
245:                }
246:
247:                if (fieldName.equals("transactionPostingDate")) {
248:                    return "Date";
249:                }
250:                if (fieldName.equals("payPeriodEndDate")) {
251:                    return "Date";
252:                }
253:                if (fieldName.equals("transactionTotalHours")) {
254:                    return "KualiDecimal";
255:                }
256:                if (fieldName.equals("payrollEndDateFiscalYear")) {
257:                    return "Integer";
258:                }
259:                if (fieldName.equals("employeeRecord")) {
260:                    return "Integer";
261:                }
262:                if (fieldName.equals("transactionDateTimeStamp")) {
263:                    return "Date";
264:                }
265:
266:                return "String";
267:            }
268:
269:            /**
270:             * Check if field allows null value
271:             * 
272:             * @param fieldName
273:             * @return Returns a boolean
274:             */
275:            public boolean allowNull(String fieldName) {
276:                if (fieldName.equals("transactionLedgerEntryAmount")) {
277:                    return false;
278:                }
279:                return true;
280:            }
281:
282:            /**
283:             * Get length of field from fieldName
284:             * 
285:             * @param fieldName
286:             * @return Returns an int
287:             */
288:            public int getFieldLength(String fieldName) {
289:                if (fieldName.equals("universityFiscalYear")) {
290:                    return 4;
291:                } else if (fieldName
292:                        .equals("transactionLedgerEntrySequenceNumber")) {
293:                    return 5;
294:                } else if (fieldName.equals("transactionLedgerEntryAmount")) {
295:                    return 19;
296:                } else if (fieldName.equals("transactionDate")) {
297:                    return 10;
298:                } else if (fieldName.equals("financialDocumentReversalDate")) {
299:                    return 10;
300:                } else if (fieldName.equals("chartOfAccountsCode")) {
301:                    return 2;
302:                } else if (fieldName.equals("accountNumber")) {
303:                    return 7;
304:                } else if (fieldName.equals("subAccountNumber")) {
305:                    return 5;
306:                } else if (fieldName.equals("financialObjectCode")) {
307:                    return 4;
308:                } else if (fieldName.equals("financialSubObjectCode")) {
309:                    return 3;
310:                } else if (fieldName.equals("financialBalanceTypeCode")) {
311:                    return 2;
312:                } else if (fieldName.equals("financialObjectTypeCode")) {
313:                    return 2;
314:                } else if (fieldName.equals("universityFiscalPeriodCode")) {
315:                    return 2;
316:                } else if (fieldName.equals("financialDocumentTypeCode")) {
317:                    return 4;
318:                } else if (fieldName.equals("financialSystemOriginationCode")) {
319:                    return 2;
320:                } else if (fieldName
321:                        .equals(KFSPropertyConstants.DOCUMENT_NUMBER)) {
322:                    return 14;
323:                } else if (fieldName
324:                        .equals("transactionLedgerEntryDescription")) {
325:                    return 40;
326:                } else if (fieldName.equals("transactionDebitCreditCode")) {
327:                    return 1;
328:                } else if (fieldName.equals("organizationDocumentNumber")) {
329:                    return 10;
330:                } else if (fieldName.equals("projectCode")) {
331:                    return 10;
332:                } else if (fieldName.equals("organizationReferenceId")) {
333:                    return 8;
334:                } else if (fieldName
335:                        .equals("referenceFinancialDocumentTypeCode")) {
336:                    return 4;
337:                } else if (fieldName
338:                        .equals("referenceFinancialSystemOriginationCode")) {
339:                    return 2;
340:                } else if (fieldName.equals("referenceFinancialDocumentNumber")) {
341:                    return 14;
342:                } else if (fieldName.equals("transactionEncumbranceUpdateCode")) {
343:                    return 1;
344:                } else if (fieldName.equals("positionNumber")) {
345:                    return 8;
346:                } else if (fieldName.equals("transactionPostingDate")) {
347:                    return 7;
348:                } else if (fieldName.equals("payPeriodEndDate")) {
349:                    return 7;
350:                } else if (fieldName.equals("transactionTotalHours")) {
351:                    return 22;
352:                } else if (fieldName.equals("payrollEndDateFiscalYear")) {
353:                    return 4;
354:                } else if (fieldName.equals("payrollEndDateFiscalPeriodCode")) {
355:                    return 2;
356:                } else if (fieldName.equals("emplid")) {
357:                    return 11;
358:                } else if (fieldName.equals("employeeRecord")) {
359:                    return 3;
360:                } else if (fieldName.equals("earnCode")) {
361:                    return 3;
362:                } else if (fieldName.equals("payGroup")) {
363:                    return 3;
364:                } else if (fieldName.equals("salaryAdministrationPlan")) {
365:                    return 4;
366:                } else if (fieldName.equals("grade")) {
367:                    return 3;
368:                } else if (fieldName.equals("runIdentifier")) {
369:                    return 10;
370:                } else if (fieldName
371:                        .equals("laborLedgerOriginalChartOfAccountsCode")) {
372:                    return 2;
373:                } else if (fieldName.equals("laborLedgerOriginalAccountNumber")) {
374:                    return 7;
375:                } else if (fieldName
376:                        .equals("laborLedgerOriginalSubAccountNumber")) {
377:                    return 5;
378:                } else if (fieldName
379:                        .equals("laborLedgerOriginalFinancialObjectCode")) {
380:                    return 4;
381:                } else if (fieldName
382:                        .equals("laborLedgerOriginalFinancialSubObjectCode")) {
383:                    return 3;
384:                } else if (fieldName.equals("hrmsCompany")) {
385:                    return 3;
386:                } else if (fieldName.equals("setid")) {
387:                    return 5;
388:                }
389:
390:                return 0;
391:            }
392:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.