View Javadoc
1   /**
2    * Copyright 2004-2014 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.kpme.tklm.leave.request.approval.web;
17  
18  import java.io.Serializable;
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import org.kuali.kpme.tklm.api.leave.request.approval.web.LeaveRequestApprovalEmployeeRowContract;
23  import org.kuali.rice.kim.api.identity.principal.Principal;
24  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
25  
26  public class LeaveRequestApprovalEmployeeRow implements Comparable<LeaveRequestApprovalEmployeeRow>, Serializable, LeaveRequestApprovalEmployeeRowContract {
27  
28  	private static final long serialVersionUID = -2511572060850316312L;
29  	private String employeeName;
30  	private String principalId;	
31  	private List<LeaveRequestApprovalRow> leaveRequestList = new ArrayList<LeaveRequestApprovalRow>();
32  	
33  	public int compareTo(LeaveRequestApprovalEmployeeRow row) {
34          return employeeName.compareToIgnoreCase(row.getEmployeeName());
35      }
36  
37  	 public String getUserTargetURLParams() {
38          StringBuffer link = new StringBuffer();
39          link.append("methodToCall=changeTargetPerson");
40          Principal principal = KimApiServiceLocator.getIdentityService().getPrincipal(this.getPrincipalId());
41          link.append("&principalName=").append(principal.getPrincipalName());
42          
43          return link.toString();
44      }
45  	
46  	public String getEmployeeName() {
47  		return employeeName;
48  	}
49  
50  	public void setEmployeeName(String employeeName) {
51  		this.employeeName = employeeName;
52  	}
53  
54  	public String getPrincipalId() {
55  		return principalId;
56  	}
57  
58  	public void setPrincipalId(String principalId) {
59  		this.principalId = principalId;
60  	}
61  
62  	public List<LeaveRequestApprovalRow> getLeaveRequestList() {
63  		return leaveRequestList;
64  	}
65  
66  	public void setLeaveRequestList(List<LeaveRequestApprovalRow> leaveRequestList) {
67  		this.leaveRequestList = leaveRequestList;
68  	}
69  
70  }