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.endow.document.authorization;
017
018 import java.util.Set;
019
020 import org.kuali.kfs.module.endow.EndowConstants;
021 import org.kuali.kfs.module.endow.EndowParameterKeyConstants;
022 import org.kuali.kfs.module.endow.EndowPropertyConstants;
023 import org.kuali.kfs.module.endow.businessobject.KEMID;
024 import org.kuali.kfs.sys.context.SpringContext;
025 import org.kuali.kfs.sys.document.authorization.FinancialSystemMaintenanceDocumentPresentationControllerBase;
026 import org.kuali.rice.kns.document.MaintenanceDocument;
027 import org.kuali.rice.kns.service.ParameterService;
028 import org.kuali.rice.kns.util.KNSConstants;
029
030 public class KEMIDDocumentPresentationController extends FinancialSystemMaintenanceDocumentPresentationControllerBase {
031
032
033 /**
034 * @see org.kuali.rice.kns.document.authorization.MaintenanceDocumentPresentationControllerBase#getConditionallyReadOnlyPropertyNames(org.kuali.rice.kns.document.MaintenanceDocument)
035 */
036 public Set<String> getConditionallyReadOnlyPropertyNames(MaintenanceDocument document) {
037
038 Set<String> fields = super.getConditionallyReadOnlyPropertyNames(document);
039 ParameterService parameterService = SpringContext.getBean(ParameterService.class);
040
041 String kemidValueSystemParam = parameterService.getParameterValue(KEMID.class, EndowParameterKeyConstants.KEMID_VALUE);
042
043 if (EndowConstants.KemidValueOptions.AUTOMATIC.equalsIgnoreCase(kemidValueSystemParam)) {
044 fields.add(EndowPropertyConstants.KEMID);
045 }
046
047 if (KNSConstants.MAINTENANCE_NEW_ACTION.equals(document.getNewMaintainableObject().getMaintenanceAction()) || KNSConstants.MAINTENANCE_COPY_ACTION.equals(document.getNewMaintainableObject().getMaintenanceAction())) {
048 fields.add(EndowPropertyConstants.KEMID_DORMANT_IND);
049 fields.add(EndowPropertyConstants.KEMID_CLOSED_IND);
050
051 }
052 if (KNSConstants.MAINTENANCE_NEW_ACTION.equals(document.getNewMaintainableObject().getMaintenanceAction())) {
053
054 fields.add(EndowPropertyConstants.KEMID_CLOSED_TO_KEMID);
055 fields.add(EndowPropertyConstants.KEMID_CLOSE_CODE);
056 fields.add(EndowPropertyConstants.KEMID_DISPOSITION_OF_FUNDS);
057 fields.add(EndowPropertyConstants.KEMID_DATE_CLOSED);
058
059 }
060
061
062 return fields;
063 }
064 }