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 import java.util.Properties;
023
024 import org.kuali.kfs.gl.Constant;
025 import org.kuali.kfs.module.ld.LaborPropertyConstants;
026 import org.kuali.kfs.module.ld.businessobject.LedgerBalance;
027 import org.kuali.kfs.sys.KFSConstants;
028 import org.kuali.kfs.sys.KFSPropertyConstants;
029
030 /**
031 * This class is used to generate the URL for the user-defined attributes for the Current Funds screen. It is entended the
032 * KualiInquirableImpl class, so it covers both the default implementation and customized implemetnation.
033 */
034 public class CurrentFundsInquirableImpl extends AbstractLaborInquirableImpl {
035 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CurrentFundsInquirableImpl.class);
036
037 /**
038 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#buildUserDefinedAttributeKeyList()
039 */
040 protected List buildUserDefinedAttributeKeyList() {
041 List<String> keys = new ArrayList<String>();
042
043 keys.add(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR);
044 keys.add(KFSPropertyConstants.ACCOUNT_NUMBER);
045 keys.add(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
046 keys.add(KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE);
047 keys.add(KFSPropertyConstants.SUB_ACCOUNT_NUMBER);
048 keys.add(KFSPropertyConstants.FINANCIAL_OBJECT_CODE);
049 keys.add(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE);
050 keys.add(KFSPropertyConstants.EMPLID);
051 keys.add(KFSPropertyConstants.POSITION_NUMBER);
052
053 keys.add(Constant.CONSOLIDATION_OPTION);
054 keys.add(Constant.PENDING_ENTRY_OPTION);
055 return keys;
056 }
057
058 /**
059 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getUserDefinedAttributeMap()
060 */
061 protected Map getUserDefinedAttributeMap() {
062
063 Map userDefinedAttributeMap = new HashMap();
064 userDefinedAttributeMap.put(LaborPropertyConstants.ANNUAL_ACTUAL_AMOUNT, KFSConstants.BALANCE_TYPE_ACTUAL);
065 userDefinedAttributeMap.put(LaborPropertyConstants.OUTSTANDING_ENCUMBRANCE, KFSConstants.BALANCE_TYPE_INTERNAL_ENCUMBRANCE);
066 return userDefinedAttributeMap;
067 }
068
069 /**
070 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getAttributeName(java.lang.String)
071 */
072 protected String getAttributeName(String attributeName) {
073 return attributeName;
074 }
075
076 /**
077 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getKeyValue(java.lang.String, java.lang.Object)
078 */
079 protected Object getKeyValue(String keyName, Object keyValue) {
080 if (isExclusiveField(keyName, keyValue)) {
081 keyValue = Constant.EMPTY_STRING;
082 }
083 return keyValue;
084 }
085
086 /**
087 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getKeyName(java.lang.String)
088 */
089 protected String getKeyName(String keyName) {
090 return keyName;
091 }
092
093 /**
094 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getLookupableImplAttributeName()
095 */
096 protected String getLookupableImplAttributeName() {
097 return Constant.EMPTY_STRING;
098 }
099
100 /**
101 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getBaseUrl()
102 */
103 protected String getBaseUrl() {
104 return KFSConstants.GL_BALANCE_INQUIRY_ACTION;
105 }
106
107 /**
108 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#getInquiryBusinessObjectClass(java.lang.String)
109 */
110 protected Class getInquiryBusinessObjectClass(String attributeName) {
111 return LedgerBalance.class;
112 }
113
114 /**
115 * @see org.kuali.kfs.module.ld.businessobject.inquiry.AbstractLaborInquirableImpl#addMoreParameters(java.util.Properties, java.lang.String)
116 */
117 protected void addMoreParameters(Properties parameter, String attributeName) {
118 String balanceTypeCode = (String) getUserDefinedAttributeMap().get(attributeName);
119 parameter.put(KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE, balanceTypeCode);
120 }
121 }