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.purap.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.module.purap.PurapAuthorizationConstants;
27: import org.kuali.module.purap.PurapConstants;
28: import org.kuali.module.purap.document.PurchasingAccountsPayableDocument;
29:
30: /**
31: * Document Authorizer for the PO Amendment document.
32: */
33: public class PurchaseOrderAmendmentDocumentAuthorizer extends
34: PurchaseOrderDocumentAuthorizer {
35:
36: /**
37: * @see org.kuali.kfs.document.authorization.AccountingDocumentAuthorizer#getEditMode(org.kuali.core.document.Document,
38: * org.kuali.core.bo.user.UniversalUser, java.util.List, java.util.List)
39: */
40: @Override
41: public Map getEditMode(Document d, UniversalUser u,
42: List sourceAccountingLines, List targetAccountingLines) {
43: Map editModeMap = new HashMap();
44: String editMode = AuthorizationConstants.EditMode.VIEW_ONLY;
45:
46: KualiWorkflowDocument workflowDocument = d.getDocumentHeader()
47: .getWorkflowDocument();
48: if (((PurchasingAccountsPayableDocument) d)
49: .getStatusCode()
50: .equals(
51: PurapConstants.PurchaseOrderStatuses.CHANGE_IN_PROCESS)
52: && (workflowDocument.stateIsInitiated() || workflowDocument
53: .stateIsSaved())) {
54: editMode = PurapAuthorizationConstants.PurchaseOrderEditMode.AMENDMENT_ENTRY;
55: }
56: editModeMap.put(editMode, "TRUE");
57:
58: return editModeMap;
59: }
60: }
|