View Javadoc
1   /*
2    * Copyright 2006 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.gl.businessobject.inquiry;
17  
18  import java.util.List;
19  import java.util.Map;
20  import java.util.Properties;
21  
22  import org.kuali.ole.gl.businessobject.Transaction;
23  import org.kuali.ole.sys.OLEPropertyConstants;
24  import org.kuali.rice.kns.lookup.HtmlData;
25  import org.kuali.rice.krad.bo.BusinessObject;
26  
27  /**
28   * This class is used to generate the URL for the user-defined attributes for the GL entry screen. It is entended the
29   * KualiInquirableImpl class, so it covers both the default implementation and customized implemetnation.
30   */
31  public class EntryInquirableImpl extends AbstractGeneralLedgerInquirableImpl {
32      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(EntryInquirableImpl.class);  // this class, which does *nothing* has a Log?  Funny.
33  
34      /**
35       * Since there are no user defined attributes, returns null
36       * @return null - no user defined attributes
37       * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#buildUserDefinedAttributeKeyList()
38       */
39      @Override
40      protected List buildUserDefinedAttributeKeyList() {
41          return null;
42      }
43  
44      /**
45       * Returns null as the map, as there are no drill downs here
46       * @return null for the map of attributes
47       * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getUserDefinedAttributeMap()
48       */
49      @Override
50      protected Map getUserDefinedAttributeMap() {
51          return null;
52      }
53  
54      /**
55       * Returns null for any attribute
56       * @param attributeName the name of an attribute for the inquiry
57       * @return null, no matter what
58       * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getAttributeName(java.lang.String)
59       */
60      @Override
61      protected String getAttributeName(String attributeName) {
62          return null;
63      }
64  
65      /**
66       * Returns null for any name/value pair its handed
67       * @param keyName the name of the key to lookup
68       * @param keyValue the value of the key to lookup
69       * @return null, every time
70       * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getKeyValue(java.lang.String, java.lang.Object)
71       */
72      @Override
73      protected Object getKeyValue(String keyName, Object keyValue) {
74          return null;
75      }
76  
77      /**
78       * Given a key name, returns null
79       * @param keyName the key name to change on the fly
80       * @return null, every time
81       * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getKeyName(java.lang.String)
82       */
83      @Override
84      protected String getKeyName(String keyName) {
85          return null;
86      }
87  
88      /**
89       * Returns null as the lookupable impl for this inquiry
90       * @return null, there isn't a lookupable impl
91       * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getLookupableImplAttributeName()
92       */
93      @Override
94      protected String getLookupableImplAttributeName() {
95          return null;
96      }
97  
98      /**
99       * Returns the base inquiry url to search...in this case, nothing
100      * @return null, as there's no URL to go to
101      * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getBaseUrl()
102      */
103     @Override
104     protected String getBaseUrl() {
105         return null;
106     }
107 
108     /**
109      * The class name of the business object that should be inquired on for the attribute
110      * @param the attribute name to build an inquiry for
111      * @return null, as there are no inquiries
112      * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getInquiryBusinessObjectClass(java.lang.String)
113      */
114     @Override
115     protected Class getInquiryBusinessObjectClass(String attributeName) {
116         return null;
117     }
118 
119     /**
120      * Adds no parameters at all
121      * @param parameter the parameter map to add new properties
122      * @param attributeName the name of the attribute being inquired on
123      * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#addMoreParameters(java.util.Properties, java.lang.String)
124      */
125     @Override
126     protected void addMoreParameters(Properties parameter, String attributeName) {
127     }
128 
129     /**
130      * @see org.kuali.ole.gl.businessobject.inquiry.AbstractGeneralLedgerInquirableImpl#getInquiryUrl(org.kuali.rice.krad.bo.BusinessObject,
131      *      java.lang.String)
132      */
133     @Override
134     public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName) {
135         if (OLEPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE.equals(attributeName)) {
136             if (businessObject instanceof Transaction) {
137                 Transaction transaction = (Transaction) businessObject;
138                 String docTypeCode = transaction.getFinancialDocumentTypeCode();
139 
140                 return getDocTypeInquiryUrl(docTypeCode);
141             }
142         }
143         else if (OLEPropertyConstants.REFERENCE_FIN_DOCUMENT_TYPE_CODE.equals(attributeName)) {
144             if (businessObject instanceof Transaction) {
145                 Transaction transaction = (Transaction) businessObject;
146                 String docTypeCode = transaction.getReferenceFinancialDocumentTypeCode();
147 
148                 return getDocTypeInquiryUrl(docTypeCode);
149             }
150         }
151 
152         return super.getInquiryUrl(businessObject, attributeName);
153     }
154     
155     
156 }