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.document.authorization;
017    
018    import java.util.Set;
019    
020    import org.kuali.kfs.coa.businessobject.ObjectCode;
021    import org.kuali.kfs.sys.KFSConstants;
022    import org.kuali.kfs.sys.context.SpringContext;
023    import org.kuali.kfs.sys.document.authorization.FinancialSystemMaintenanceDocumentPresentationControllerBase;
024    import org.kuali.rice.kns.bo.BusinessObject;
025    import org.kuali.rice.kns.service.ParameterService;
026    
027    public class ObjectCodeDocumentPresentationController extends FinancialSystemMaintenanceDocumentPresentationControllerBase {
028        
029        /**
030         * Determins whether to display the research admin attributes or not
031         * @see org.kuali.rice.kns.document.authorization.MaintenanceDocumentPresentationControllerBase#getConditionallyHiddenSectionIds(org.kuali.rice.kns.document.MaintenanceDocument)
032         */
033        @Override
034        public Set<String> getConditionallyHiddenSectionIds(BusinessObject businessObject) {
035            Set<String> hiddenSectionIds = super.getConditionallyHiddenSectionIds(businessObject);
036            
037            //  consult the system param on whether to hide the research admin attributes tab
038            if (!"Y".equalsIgnoreCase(SpringContext.getBean(ParameterService.class).getParameterValue(ObjectCode.class, KFSConstants.ObjectCodeConstants.PARAMETER_KC_ENABLE_RESEARCH_ADMIN_OBJECT_CODE_ATTRIBUTE_IND))) {
039                hiddenSectionIds.add(KFSConstants.ObjectCodeConstants.SECTION_ID_RESEARCH_ADMIN_ATTRIBUTES);
040            }
041    
042            return hiddenSectionIds;
043        }
044    
045    }