001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.kfs.module.ld.businessobject.inquiry;
017    
018    import java.util.ArrayList;
019    import java.util.HashMap;
020    import java.util.List;
021    import java.util.Map;
022    
023    import org.kuali.kfs.gl.Constant;
024    import org.kuali.kfs.module.ld.LaborConstants;
025    import org.kuali.kfs.module.ld.businessobject.LaborCalculatedSalaryFoundationTracker;
026    import org.kuali.kfs.sys.KFSConstants;
027    import org.kuali.kfs.sys.KFSPropertyConstants;
028    
029    /**
030     * This class is used to generate the URL for the user-defined attributes for the Base Funds screen. It is entended the
031     * KualiInquirableImpl class, so it covers both the default implementation and customized implemetnation.
032     */
033    public class BaseFundsInquirableImpl extends AbstractLaborInquirableImpl {
034        private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BaseFundsInquirableImpl.class);
035    
036        /**
037         * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#buildUserDefinedAttributeKeyList()
038         */
039        protected List buildUserDefinedAttributeKeyList() {
040            List<String> keys = new ArrayList<String>();
041    
042            keys.add(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR);
043            keys.add(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
044            keys.add(KFSPropertyConstants.ACCOUNT_NUMBER);
045            keys.add(KFSPropertyConstants.SUB_ACCOUNT_NUMBER);
046            keys.add(KFSPropertyConstants.FINANCIAL_OBJECT_CODE);
047            keys.add(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE);
048    
049            return keys;
050        }
051    
052        /**
053         * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getUserDefinedAttributeMap()
054         */
055        protected Map getUserDefinedAttributeMap() {
056            Map userDefinedAttributeMap = new HashMap();
057            userDefinedAttributeMap.put(KFSPropertyConstants.CSF_AMOUNT, KFSPropertyConstants.CSF_AMOUNT);
058            return userDefinedAttributeMap;
059        }
060    
061        /**
062         * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getAttributeName(java.lang.String)
063         */
064        protected String getAttributeName(String attributeName) {
065            return attributeName;
066        }
067    
068        /**
069         * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getKeyValue(java.lang.String, java.lang.Object)
070         */
071        protected Object getKeyValue(String keyName, Object keyValue) {
072            if (keyValue.toString().startsWith("-")) {
073                return keyValue;
074            }
075    
076            if (isExclusiveField(keyName, keyValue)) {
077                keyValue = Constant.EMPTY_STRING;
078            }
079            return keyValue;
080        }
081    
082        /**
083         * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getKeyName(java.lang.String)
084         */
085        protected String getKeyName(String keyName) {
086            return keyName;
087        }
088    
089        /**
090         * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getLookupableImplAttributeName()
091         */
092        protected String getLookupableImplAttributeName() {
093            return LaborConstants.LookupableBeanKeys.CSF_TRACKER;
094        }
095    
096        /**
097         * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getBaseUrl()
098         */
099        protected String getBaseUrl() {
100            return KFSConstants.GL_MODIFIED_INQUIRY_ACTION;
101        }
102    
103        /**
104         * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getInquiryBusinessObjectClass(java.lang.String)
105         */
106        protected Class getInquiryBusinessObjectClass(String attributeName) {
107            return LaborCalculatedSalaryFoundationTracker.class;
108        }
109    }