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.lookupable;
017:
018: import java.util.Collection;
019: import java.util.Collections;
020: import java.util.List;
021: import java.util.Map;
022:
023: import org.kuali.core.bo.BusinessObject;
024: import org.kuali.core.lookup.AbstractLookupableHelperServiceImpl;
025: import org.kuali.core.lookup.CollectionIncomplete;
026: import org.kuali.core.util.BeanPropertyComparator;
027: import org.kuali.kfs.KFSConstants;
028: import org.kuali.module.labor.service.LaborCalculatedSalaryFoundationTrackerService;
029: import org.kuali.module.labor.web.inquirable.LaborCalculatedSalaryFoundationTrackerInquirableImpl;
030: import org.springframework.transaction.annotation.Transactional;
031:
032: /**
033: * The CSFTrackerBalanceLookupableHelperServiceImpl class is the front-end for all Calculated Salary Foundation balance inquiry
034: * processing.
035: */
036:
037: @Transactional
038: public class LaborCalculatedSalaryFoundationTrackerLookupableHelperServiceImpl
039: extends AbstractLookupableHelperServiceImpl {
040: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
041: .getLogger(LaborCalculatedSalaryFoundationTrackerLookupableHelperServiceImpl.class);
042:
043: private LaborCalculatedSalaryFoundationTrackerService laborCalculatedSalaryFoundationTrackerService;
044:
045: /**
046: * @see org.kuali.core.lookup.AbstractLookupableHelperServiceImpl#getInquiryUrl(org.kuali.core.bo.BusinessObject,
047: * java.lang.String)
048: */
049: @Override
050: public String getInquiryUrl(BusinessObject bo, String propertyName) {
051: return (new LaborCalculatedSalaryFoundationTrackerInquirableImpl())
052: .getInquiryUrl(bo, propertyName);
053: }
054:
055: /**
056: * @see org.kuali.core.lookup.AbstractLookupableHelperServiceImpl#getSearchResults(java.util.Map)
057: */
058: @Override
059: public List getSearchResults(Map fieldValues) {
060: setBackLocation((String) fieldValues
061: .get(KFSConstants.BACK_LOCATION));
062: setDocFormKey((String) fieldValues
063: .get(KFSConstants.DOC_FORM_KEY));
064:
065: Collection searchResultsCollection = laborCalculatedSalaryFoundationTrackerService
066: .findCSFTrackerWithJuly1(fieldValues, false);
067:
068: return new CollectionIncomplete(searchResultsCollection,
069: new Long(searchResultsCollection.size()));
070: }
071:
072: /**
073: * build the serach result list from the given collection and the number of all qualified search results
074: *
075: * @param searchResultsCollection the given search results, which may be a subset of the qualified search results
076: * @param actualSize the number of all qualified search results
077: * @return the serach result list with the given results and actual size
078: */
079: protected List buildSearchResultList(
080: Collection searchResultsCollection, Long actualSize) {
081: CollectionIncomplete results = new CollectionIncomplete(
082: searchResultsCollection, actualSize);
083:
084: // sort list if default sort column given
085: List searchResults = (List) results;
086: List defaultSortColumns = getDefaultSortColumns();
087: if (defaultSortColumns.size() > 0) {
088: Collections.sort(results, new BeanPropertyComparator(
089: defaultSortColumns, true));
090: }
091: return searchResults;
092: }
093:
094: /**
095: * Sets the laborCalculatedSalaryFoundationTrackerService attribute value.
096: *
097: * @param laborCalculatedSalaryFoundationTrackerService The laborCalculatedSalaryFoundationTrackerService to set.
098: */
099: public void setLaborCalculatedSalaryFoundationTrackerService(
100: LaborCalculatedSalaryFoundationTrackerService laborCalculatedSalaryFoundationTrackerService) {
101: this.laborCalculatedSalaryFoundationTrackerService = laborCalculatedSalaryFoundationTrackerService;
102: }
103: }
|