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.gl.businessobject.inquiry;
017    
018    import java.util.List;
019    import java.util.Map;
020    import java.util.Properties;
021    
022    import org.kuali.kfs.gl.businessobject.Entry;
023    import org.kuali.kfs.gl.businessobject.Transaction;
024    import org.kuali.kfs.sys.KFSPropertyConstants;
025    import org.kuali.rice.kns.bo.BusinessObject;
026    import org.kuali.rice.kns.lookup.HtmlData;
027    
028    /**
029     * This class is used to generate the URL for the user-defined attributes for the GL entry screen. It is entended the
030     * KualiInquirableImpl class, so it covers both the default implementation and customized implemetnation.
031     */
032    public class EntryInquirableImpl extends AbstractGeneralLedgerInquirableImpl {
033        private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(EntryInquirableImpl.class);  // this class, which does *nothing* has a Log?  Funny.
034    
035        /**
036         * Since there are no user defined attributes, returns null
037         * @return null - no user defined attributes
038         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#buildUserDefinedAttributeKeyList()
039         */
040        @Override
041        protected List buildUserDefinedAttributeKeyList() {
042            return null;
043        }
044    
045        /**
046         * Returns null as the map, as there are no drill downs here
047         * @return null for the map of attributes
048         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getUserDefinedAttributeMap()
049         */
050        @Override
051        protected Map getUserDefinedAttributeMap() {
052            return null;
053        }
054    
055        /**
056         * Returns null for any attribute
057         * @param attributeName the name of an attribute for the inquiry
058         * @return null, no matter what
059         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getAttributeName(java.lang.String)
060         */
061        @Override
062        protected String getAttributeName(String attributeName) {
063            return null;
064        }
065    
066        /**
067         * Returns null for any name/value pair its handed
068         * @param keyName the name of the key to lookup
069         * @param keyValue the value of the key to lookup
070         * @return null, every time
071         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getKeyValue(java.lang.String, java.lang.Object)
072         */
073        @Override
074        protected Object getKeyValue(String keyName, Object keyValue) {
075            return null;
076        }
077    
078        /**
079         * Given a key name, returns null
080         * @param keyName the key name to change on the fly
081         * @return null, every time
082         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getKeyName(java.lang.String)
083         */
084        @Override
085        protected String getKeyName(String keyName) {
086            return null;
087        }
088    
089        /**
090         * Returns null as the lookupable impl for this inquiry
091         * @return null, there isn't a lookupable impl
092         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getLookupableImplAttributeName()
093         */
094        @Override
095        protected String getLookupableImplAttributeName() {
096            return null;
097        }
098    
099        /**
100         * Returns the base inquiry url to search...in this case, nothing
101         * @return null, as there's no URL to go to
102         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getBaseUrl()
103         */
104        @Override
105        protected String getBaseUrl() {
106            return null;
107        }
108    
109        /**
110         * The class name of the business object that should be inquired on for the attribute
111         * @param the attribute name to build an inquiry for
112         * @return null, as there are no inquiries
113         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getInquiryBusinessObjectClass(java.lang.String)
114         */
115        @Override
116        protected Class getInquiryBusinessObjectClass(String attributeName) {
117            return null;
118        }
119    
120        /**
121         * Adds no parameters at all
122         * @param parameter the parameter map to add new properties
123         * @param attributeName the name of the attribute being inquired on
124         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#addMoreParameters(java.util.Properties, java.lang.String)
125         */
126        @Override
127        protected void addMoreParameters(Properties parameter, String attributeName) {
128        }
129    
130        /**
131         * @see org.kuali.kfs.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getInquiryUrl(org.kuali.rice.kns.bo.BusinessObject,
132         *      java.lang.String)
133         */
134        @Override
135        public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName) {
136            if (KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE.equals(attributeName)) {
137                if (businessObject instanceof Transaction) {
138                    Transaction transaction = (Transaction) businessObject;
139                    String docTypeCode = transaction.getFinancialDocumentTypeCode();
140    
141                    return getDocTypeInquiryUrl(docTypeCode);
142                }
143            }
144            else if (KFSPropertyConstants.REFERENCE_FIN_DOCUMENT_TYPE_CODE.equals(attributeName)) {
145                if (businessObject instanceof Transaction) {
146                    Transaction transaction = (Transaction) businessObject;
147                    String docTypeCode = transaction.getReferenceFinancialDocumentTypeCode();
148    
149                    return getDocTypeInquiryUrl(docTypeCode);
150                }
151            }
152    
153            return super.getInquiryUrl(businessObject, attributeName);
154        }
155        
156        
157    }