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.coa.businessobject.inquiry;
017
018 import java.util.ArrayList;
019 import java.util.List;
020 import java.util.Properties;
021
022 import org.kuali.kfs.coa.businessobject.Organization;
023 import org.kuali.kfs.coa.identity.OrgReviewRole;
024 import org.kuali.kfs.coa.identity.OrgReviewRoleLookupableHelperServiceImpl;
025 import org.kuali.kfs.sys.businessobject.inquiry.KfsInquirableImpl;
026 import org.kuali.rice.kim.util.KimConstants;
027 import org.kuali.rice.kns.bo.BusinessObject;
028 import org.kuali.rice.kns.lookup.HtmlData;
029 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
030 import org.kuali.rice.kns.util.KNSConstants;
031 import org.kuali.rice.kns.util.UrlFactory;
032 import org.kuali.rice.kns.web.ui.Field;
033 import org.kuali.rice.kns.web.ui.Row;
034 import org.kuali.rice.kns.web.ui.Section;
035
036 /**
037 * This class adds in some new sections for {@link Org} inquiries, specifically Org Hierarchy Org Review Hierarchy
038 */
039 public class OrgInquirable extends KfsInquirableImpl {
040
041 public void addAdditionalSections(List sections, BusinessObject bo) {
042 if (bo instanceof Organization) {
043 Organization org = (Organization) bo;
044
045 List rows = new ArrayList();
046
047 Field f = new Field();
048 f.setPropertyName("Organization Hierarchy");
049 f.setFieldLabel("Organization Hierarchy");
050 f.setPropertyValue(org.getOrganizationHierarchy());
051 f.setFieldType(Field.TEXT);
052 rows.add(new Row(f));
053
054 f = new Field();
055 f.setPropertyName("Organization Review Hierarchy");
056 f.setFieldLabel("Organization Review Hierarchy");
057 f.setPropertyValue("run search");
058 f.setFieldType(Field.TEXT);
059 Properties parameters = new Properties();
060 parameters.put(OrgReviewRoleLookupableHelperServiceImpl.MEMBER_ATTRIBUTE_CHART_OF_ACCOUNTS_CODE, org.getChartOfAccountsCode());
061 parameters.put(OrgReviewRoleLookupableHelperServiceImpl.MEMBER_ATTRIBUTE_ORGANIZATION_CODE, org.getOrganizationCode());
062 parameters.put(KNSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, OrgReviewRole.class.getName());
063 parameters.put(KNSConstants.RETURN_LOCATION_PARAMETER, KNSConstants.PORTAL_ACTION);
064 parameters.put(KNSConstants.DOC_FORM_KEY, KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_SHORT_KEY);
065 String hrefStr = UrlFactory.parameterizeUrl(KNSConstants.LOOKUP_ACTION, parameters);
066 HtmlData hRef = new AnchorHtmlData(hrefStr, KNSConstants.EMPTY_STRING);
067 f.setInquiryURL(hRef);
068 rows.add(new Row(f));
069
070 Section section = new Section();
071 section.setRows(rows);
072 section.setSectionTitle("Organization Hierarchy");
073 sections.add(section);
074 }
075 }
076
077
078 }