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.service.impl;
017:
018: import java.util.Iterator;
019: import java.util.Map;
020:
021: import org.kuali.module.gl.bo.Encumbrance;
022: import org.kuali.module.gl.dao.EncumbranceDao;
023: import org.kuali.module.gl.service.EncumbranceService;
024: import org.springframework.transaction.annotation.Transactional;
025:
026: /**
027: * The base implementation of EncumbranaceService
028: */
029: @Transactional
030: public class EncumbranceServiceImpl implements EncumbranceService {
031: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
032: .getLogger(EncumbranceServiceImpl.class);
033:
034: private EncumbranceDao encumbranceDao;
035:
036: /**
037: * Saves an encumbrance
038: *
039: * @param enc an encumbrance to save
040: * @see org.kuali.module.gl.service.EncumbranceService#save(org.kuali.module.gl.bo.Encumbrance)
041: */
042: public void save(Encumbrance enc) {
043: LOG.debug("save() started");
044:
045: encumbranceDao.save(enc);
046: }
047:
048: /**
049: * Removes all encumbrances from the database having a certain chart and fiscal year
050: * @param chartOfAccountsCode the chart of encumbrances to purge
051: * @param year the year of encumbrances to purge
052: * @see org.kuali.module.gl.service.EncumbranceService#purgeYearByChart(java.lang.String, int)
053: */
054: public void purgeYearByChart(String chartOfAccountsCode, int year) {
055: LOG.debug("purgeYearByChart() started");
056:
057: encumbranceDao.purgeYearByChart(chartOfAccountsCode, year);
058: }
059:
060: /**
061: * Returns an iterator with all encumbrances from the database.
062: * @return an Iterator of all encumbrances
063: * @see org.kuali.module.gl.service.EncumbranceService#getAllEncumbrances()
064: */
065: public Iterator getAllEncumbrances() {
066: return encumbranceDao.getAllEncumbrances();
067: }
068:
069: /**
070: * Field accessor for EncumbranceDao
071: *
072: * @param ed
073: */
074: public void setEncumbranceDao(EncumbranceDao ed) {
075: encumbranceDao = ed;
076: }
077:
078: /**
079: * group all encumbrances with/without the given document type code by fiscal year, chart, account, sub-account, object code,
080: * sub object code, and balance type code, and summarize the encumbrance amount and the encumbrance close amount.
081: *
082: * @param documentTypeCode the given document type code
083: * @param included indicate if all encumbrances with the given document type are included in the results or not
084: * @see org.kuali.module.gl.service.EncumbranceService#getSummarizedEncumbrances(java.lang.String, boolean)
085: */
086: public Iterator getSummarizedEncumbrances(String documentTypeCode,
087: boolean included) {
088: return encumbranceDao.getSummarizedEncumbrances(
089: documentTypeCode, included);
090: }
091:
092: /**
093: * Given the fieldValues, forms a query and finds the open encumbrances that match it
094: * @param fieldValues the values to form an encumbrance query out of
095: * @return an Iterator full of qualifying encumbrances
096: * @see org.kuali.module.gl.service.EncumbranceService#findOpenEncumbrance(java.util.Map)
097: */
098: public Iterator findOpenEncumbrance(Map fieldValues) {
099: return encumbranceDao.findOpenEncumbrance(fieldValues);
100: }
101:
102: /**
103: * Returns the count of all open encumbrances in the database, matching the given field values
104: * @param fieldValues the field values to build an encumbrance query out of
105: * @return the number of qualifying open encumbrances
106: * @see org.kuali.module.gl.service.EncumbranceService#getOpenEncumbranceCount(java.util.Map)
107: */
108: public Integer getOpenEncumbranceRecordCount(Map fieldValues) {
109: return encumbranceDao
110: .getOpenEncumbranceRecordCount(fieldValues);
111: }
112: }
|