01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.kra.routingform.document;
17:
18: import org.kuali.core.bo.user.UniversalUser;
19: import org.kuali.core.document.MaintenanceDocument;
20: import org.kuali.core.document.authorization.MaintenanceDocumentAuthorizations;
21: import org.kuali.core.document.authorization.MaintenanceDocumentAuthorizerBase;
22: import org.kuali.core.service.BusinessObjectService;
23: import org.kuali.core.util.ObjectUtils;
24: import org.kuali.kfs.context.SpringContext;
25: import org.kuali.module.kra.KraPropertyConstants;
26: import org.kuali.module.kra.routingform.bo.QuestionType;
27:
28: public class QuestionTypeMaintenanceDocumentAuthorizer extends
29: MaintenanceDocumentAuthorizerBase {
30:
31: @Override
32: public MaintenanceDocumentAuthorizations getFieldAuthorizations(
33: MaintenanceDocument document, UniversalUser user) {
34:
35: MaintenanceDocumentAuthorizations auths = new MaintenanceDocumentAuthorizations();
36: QuestionType question = (QuestionType) document
37: .getNewMaintainableObject().getBusinessObject();
38: BusinessObjectService service = SpringContext
39: .getBean(BusinessObjectService.class);
40: QuestionType persistedQuestion = (QuestionType) service
41: .retrieve(question);
42:
43: // If the question exists in db, set read-only fields
44: if (ObjectUtils.isNotNull(persistedQuestion)) {
45: auths
46: .addReadonlyAuthField(KraPropertyConstants.QUESTION_TYPE_DESCRIPTION);
47: }
48:
49: return auths;
50: }
51: }
|