View Javadoc

1   /**
2    * Copyright 2004-2013 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.hr.time.base.web;
17  
18  import org.kuali.hr.time.service.base.TkServiceLocator;
19  import org.kuali.hr.time.util.TKContext;
20  import org.kuali.hr.time.util.TKUser;
21  import org.kuali.rice.core.api.config.property.ConfigContext;
22  import org.kuali.rice.kns.web.struts.form.KualiForm;
23  
24  public class TkForm extends KualiForm {
25  
26  	private static final long serialVersionUID = -3945893347262537122L;
27  
28  	private String methodToCall;
29  	private String principalId;
30      private String documentId;
31  
32  	public String getMethodToCall() {
33  		return methodToCall;
34  	}
35  
36  	public void setMethodToCall(String methodToCall) {
37  		this.methodToCall = methodToCall;
38  	}
39  
40  	public String getPrincipalId() {
41  		return principalId;
42  	}
43  
44  	public void setPrincipalId(String principalId) {
45  		this.principalId = principalId;
46  	}
47  	
48      public String getDocumentId() {
49          return documentId;
50      }
51  
52      public void setDocumentId(String documentId) {
53          this.documentId = documentId;
54      }
55  	
56  	public String getWorkflowUrl(){
57  		return ConfigContext.getCurrentContextConfig().getProperty("workflow.url");
58  	}
59  	
60  	public String getDocumentIdFromContext(){
61  		return TKContext.getCurrentTimesheetDocumentId();
62  	}
63  
64      public String getDocumentStatus() {
65          return TKContext.getCurrentTimesheetDocument().getDocumentHeader().getDocumentStatus();
66      }
67  
68      public String getLeaveCalendarDocumentStatus() {
69          return TKContext.getCurrentLeaveCalendarDocument().getDocumentHeader().getDocumentStatus();
70      }
71      
72      public boolean getLeaveEnabled() {
73      	boolean canViewLeaveTab= false;
74          canViewLeaveTab = this.getViewLeaveTabsWithNEStatus() || TkServiceLocator.getPermissionsService().canViewLeaveTabsWithEStatus();
75          return canViewLeaveTab; 
76      }
77      
78      public boolean getTimeEnabled() {
79      	return TkServiceLocator.getPermissionsService().canViewTimeTabs();
80      }
81      
82      public String getLeaveDocumentIdFromContext(){
83  		return TKContext.getCurrentLeaveCalendarDocumentId();
84  	}
85   
86      public boolean getViewLeaveTabsWithNEStatus() {
87      	return TkServiceLocator.getPermissionsService().canViewLeaveTabsWithNEStatus();
88      }
89  }