View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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.rice.kns.document.authorization;
17  
18  import java.util.HashSet;
19  import java.util.Set;
20  
21  import org.kuali.rice.krad.document.Document;
22  import org.kuali.rice.krad.util.KRADConstants;
23  
24  /**
25   * KNS version of the DocumentPresentationControllerBase - adds #getDocumentActions via {@link DocumentPresentationController}
26   */
27  public class DocumentPresentationControllerBase extends org.kuali.rice.krad.document.DocumentPresentationControllerBase implements DocumentPresentationController {
28      /**
29       * @see DocumentPresentationController#getDocumentActions(org.kuali.rice.krad.document.Document)
30       */
31      @Override
32      public Set<String> getDocumentActions(Document document){
33      	Set<String> documentActions = new HashSet<String>();
34      	if (canEdit(document)){
35      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_EDIT);
36      	}
37      	
38      	if(canAnnotate(document)){
39      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_ANNOTATE);
40      	}
41      	 
42      	if(canClose(document)){
43      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_CLOSE);
44      	}
45      	 
46      	if(canSave(document)){
47      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_SAVE);
48      	}
49      	if(canRoute(document)){
50      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_ROUTE);
51      	}
52      	 
53      	if(canCancel(document)){
54      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_CANCEL);
55      	}
56  
57          if(canRecall(document)){
58              documentActions.add(KRADConstants.KUALI_ACTION_CAN_RECALL);
59          }
60      	 
61      	if(canReload(document)){
62      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_RELOAD);
63      	}
64      	if(canCopy(document)){
65      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_COPY);
66      	}
67      	if(canPerformRouteReport(document)){
68      		documentActions.add(KRADConstants.KUALI_ACTION_PERFORM_ROUTE_REPORT);
69      	}
70      	
71      	if(canAddAdhocRequests(document)){
72      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_ADD_ADHOC_REQUESTS);
73      	}
74      	
75      	if(canBlanketApprove(document)){
76      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_BLANKET_APPROVE);
77      	}
78      	if (canApprove(document)) {
79      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_APPROVE);
80      	}
81      	if (canDisapprove(document)) {
82      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_DISAPPROVE);
83      	}
84      	if (canSendAdhocRequests(document)) {
85      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_SEND_ADHOC_REQUESTS);
86      	}
87      	if(canSendNoteFyi(document)){
88      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_SEND_NOTE_FYI);
89      	}
90      	if(this.canEditDocumentOverview(document)){
91      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_EDIT_DOCUMENT_OVERVIEW);
92      	}
93      	if (canFyi(document)) {
94      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_FYI);
95      	}
96      	if (canAcknowledge(document)) {
97      		documentActions.add(KRADConstants.KUALI_ACTION_CAN_ACKNOWLEDGE);
98      	}
99      	return documentActions;
100     }
101 }