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.financial.document.authorization;
17:
18: import java.util.HashMap;
19: import java.util.List;
20: import java.util.Map;
21:
22: import org.kuali.core.authorization.AuthorizationConstants;
23: import org.kuali.core.bo.user.UniversalUser;
24: import org.kuali.core.document.Document;
25: import org.kuali.core.workflow.service.KualiWorkflowDocument;
26: import org.kuali.kfs.document.authorization.AccountingDocumentAuthorizerBase;
27:
28: public class InternalBillingDocumentAuthorizer extends
29: AccountingDocumentAuthorizerBase {
30:
31: @Override
32: public Map getEditMode(Document document, UniversalUser user,
33: List sourceAccountingLines, List targetAccountingLines) {
34: String editMode = AuthorizationConstants.TransactionalEditMode.VIEW_ONLY;
35:
36: KualiWorkflowDocument workflowDocument = document
37: .getDocumentHeader().getWorkflowDocument();
38:
39: if (workflowDocument.stateIsInitiated()
40: || workflowDocument.stateIsSaved()) {
41: if (workflowDocument.userIsInitiator(user)) {
42: editMode = AuthorizationConstants.TransactionalEditMode.FULL_ENTRY;
43: }
44: }
45:
46: Map editModeMap = new HashMap();
47: editModeMap.put(editMode, "TRUE");
48:
49: return editModeMap;
50: }
51:
52: }
|