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


001:        /*
002:         * Copyright 2005-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.dao.ojb;
017:
018:        import java.sql.Date;
019:        import java.util.Collection;
020:
021:        import org.apache.ojb.broker.query.Criteria;
022:        import org.apache.ojb.broker.query.QueryByCriteria;
023:        import org.apache.ojb.broker.query.QueryFactory;
024:        import org.apache.ojb.broker.query.ReportQueryByCriteria;
025:        import org.kuali.core.dao.ojb.PlatformAwareDaoBaseOjb;
026:        import org.kuali.core.util.spring.Cached;
027:        import org.kuali.kfs.KFSPropertyConstants;
028:        import org.kuali.module.gl.bo.UniversityDate;
029:        import org.kuali.module.gl.dao.UniversityDateDao;
030:
031:        /**
032:         * The OJB implementation of the UniversityDateDao
033:         */
034:        public class UniversityDateDaoOjb extends PlatformAwareDaoBaseOjb
035:                implements  UniversityDateDao {
036:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
037:                    .getLogger(UniversityDateDaoOjb.class);
038:
039:            /**
040:             * Returns a university date record based on a given java.sql.Date.
041:             * 
042:             * @param date a Date to find the corresponding University Date record
043:             * @return a University Date record if found, null if not
044:             * @see org.kuali.module.gl.dao.UniversityDateDao#getByPrimaryKey(java.sql.Date)
045:             */
046:            @Cached
047:            public UniversityDate getByPrimaryKey(Date date) {
048:                LOG.debug("getByPrimaryKey() started");
049:
050:                Criteria crit = new Criteria();
051:                crit.addEqualTo(KFSPropertyConstants.UNIVERSITY_DATE, date);
052:
053:                QueryByCriteria qbc = QueryFactory.newQuery(
054:                        UniversityDate.class, crit);
055:
056:                return (UniversityDate) getPersistenceBrokerTemplate()
057:                        .getObjectByQuery(qbc);
058:            }
059:
060:            /**
061:             * Returns a university date record based on java.util.Date
062:             * 
063:             * @param date a java.util.Date to find the corresponding University Date record
064:             * @return a University Date record if found, null if not
065:             * @see org.kuali.module.gl.dao.UniversityDateDao#getByPrimaryKey(java.sql.Date)
066:             */
067:            @Cached
068:            public UniversityDate getByPrimaryKey(java.util.Date date) {
069:                return getByPrimaryKey(convertDate(date));
070:            }
071:
072:            /**
073:             * Converts a java.util.Date to a java.sql.Date
074:             * 
075:             * @param date a java.util.Date to convert
076:             * @return a java.sql.Date
077:             */
078:            private java.sql.Date convertDate(java.util.Date date) {
079:                return new Date(date.getTime());
080:            }
081:
082:            /**
083:             * Returns the last university date for a given fiscal year
084:             * 
085:             * @param fiscalYear the fiscal year to find the last date for
086:             * @return a UniversityDate record for the last day in the given fiscal year, or null if nothing can be found
087:             * @see org.kuali.module.gl.dao.UniversityDateDao#getLastFiscalYearDate(java.lang.Integer)
088:             */
089:            public UniversityDate getLastFiscalYearDate(Integer fiscalYear) {
090:                ReportQueryByCriteria subQuery;
091:                Criteria subCrit = new Criteria();
092:                Criteria crit = new Criteria();
093:
094:                subCrit.addEqualTo(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR,
095:                        fiscalYear);
096:                subQuery = QueryFactory.newReportQuery(UniversityDate.class,
097:                        subCrit);
098:                subQuery.setAttributes(new String[] { "max(univ_dt)" });
099:
100:                crit.addGreaterOrEqualThan(
101:                        KFSPropertyConstants.UNIVERSITY_DATE, subQuery);
102:
103:                QueryByCriteria qbc = QueryFactory.newQuery(
104:                        UniversityDate.class, crit);
105:
106:                return (UniversityDate) getPersistenceBrokerTemplate()
107:                        .getObjectByQuery(qbc);
108:            }
109:
110:            /**
111:             * Returns the first university date for a given fiscal year
112:             * 
113:             * @param fiscalYear the fiscal year to find the first date for
114:             * @return a UniversityDate record for the first day of the given fiscal year, or null if nothing can be found
115:             * @see org.kuali.module.gl.dao.UniversityDateDao#getFirstFiscalYearDate(java.lang.Integer)
116:             */
117:            public UniversityDate getFirstFiscalYearDate(Integer fiscalYear) {
118:                ReportQueryByCriteria subQuery;
119:                Criteria subCrit = new Criteria();
120:                Criteria crit = new Criteria();
121:
122:                subCrit.addEqualTo(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR,
123:                        fiscalYear);
124:                subQuery = QueryFactory.newReportQuery(UniversityDate.class,
125:                        subCrit);
126:                subQuery.setAttributes(new String[] { "min(univ_dt)" });
127:
128:                crit.addGreaterOrEqualThan(
129:                        KFSPropertyConstants.UNIVERSITY_DATE, subQuery);
130:
131:                QueryByCriteria qbc = QueryFactory.newQuery(
132:                        UniversityDate.class, crit);
133:
134:                return (UniversityDate) getPersistenceBrokerTemplate()
135:                        .getObjectByQuery(qbc);
136:            }
137:
138:            /**
139:             * Returns all distinct accounting period codes from the table
140:             * 
141:             * @return a Collection of all distinct accounting period codes represented by UniversityDate records in the database
142:             * @see org.kuali.module.gl.dao.UniversityDateDao#getAccountingPeriodCode()
143:             */
144:            public Collection getAccountingPeriodCode() {
145:                Criteria criteria = new Criteria();
146:
147:                ReportQueryByCriteria query = QueryFactory.newReportQuery(
148:                        UniversityDate.class, criteria);
149:                query
150:                        .setAttributes(new String[] { "distinct "
151:                                + KFSPropertyConstants.UNIVERSITY_FISCAL_ACCOUNTING_PERIOD });
152:                query
153:                        .addOrderByAscending(KFSPropertyConstants.UNIVERSITY_FISCAL_ACCOUNTING_PERIOD);
154:
155:                return getPersistenceBrokerTemplate().getCollectionByQuery(
156:                        query);
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.