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.ar.businessobject.inquiry;
017    
018    import java.util.ArrayList;
019    import java.util.List;
020    
021    import org.kuali.kfs.module.ar.businessobject.Customer;
022    import org.kuali.kfs.sys.KFSConstants;
023    import org.kuali.kfs.sys.businessobject.inquiry.KfsInquirableImpl;
024    import org.kuali.rice.kns.bo.BusinessObject;
025    import org.kuali.rice.kns.lookup.HtmlData;
026    import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
027    import org.kuali.rice.kns.util.KNSConstants;
028    import org.kuali.rice.kns.web.ui.Field;
029    import org.kuali.rice.kns.web.ui.Row;
030    import org.kuali.rice.kns.web.ui.Section;
031    
032    public class CustomerOpenItemReportInquirableImpl extends KfsInquirableImpl {
033    
034        /**
035         * Show the Customer Open Item Report tab. This is Customer History Report.
036         * 
037         * @see org.kuali.rice.kns.inquiry.KualiInquirableImpl#addAdditionalSections(java.util.List, org.kuali.rice.kns.bo.BusinessObject)
038         */
039        @Override
040        public void addAdditionalSections(List sections, BusinessObject bo) {
041            if (bo instanceof Customer) {
042                Customer customer = (Customer) bo;
043    
044                List rows = new ArrayList();
045    
046                Field f = new Field();
047                f.setBusinessObjectClassName(bo.getClass().getName());
048                f.setPropertyName(KFSConstants.CustomerOpenItemReport.HISTORY_REPORT_NAME);
049                f.setFieldLabel("History Report");
050                f.setPropertyValue("Click here to view the history report for this customer.");
051                f.setFieldType(Field.TEXT);
052                HtmlData hRef = new AnchorHtmlData("../arCustomerOpenItemReportLookup.do?methodToCall=search&businessObjectClassName=org.kuali.kfs.module.ar.businessobject.CustomerOpenItemReportDetail&lookupableImplementaionServiceName=arCustomerOpenItemReportLookupable&docFormKey=88888888&returnLocation=&hideReturnLink=true&reportName=" + KFSConstants.CustomerOpenItemReport.HISTORY_REPORT_NAME + "&customerNumber=" + customer.getCustomerNumber() + "&customerName="+customer.getCustomerName(),KNSConstants.EMPTY_STRING, "view open item report");
053                f.setInquiryURL(hRef);
054                rows.add(new Row(f));
055    
056                Section section = new Section();
057                section.setRows(rows);
058                section.setSectionTitle(KFSConstants.CustomerOpenItemReport.HISTORY_REPORT_NAME);
059                sections.add(section);
060            }
061        }
062    }