1 /* 2 * The Kuali Financial System, a comprehensive financial management system for higher education. 3 * 4 * Copyright 2005-2014 The Kuali Foundation 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 package org.kuali.kfs.module.tem.service; 20 21 import java.util.List; 22 23 import org.kuali.kfs.integration.ar.AccountsReceivableCustomer; 24 import org.kuali.kfs.integration.ar.AccountsReceivableCustomerAddress; 25 import org.kuali.kfs.module.tem.businessobject.TemProfile; 26 import org.kuali.kfs.module.tem.businessobject.TemProfileAddress; 27 import org.kuali.kfs.module.tem.businessobject.TemProfileFromCustomer; 28 import org.kuali.kfs.module.tem.businessobject.TemProfileFromKimPerson; 29 import org.kuali.kfs.module.tem.businessobject.TravelerDetail; 30 import org.kuali.kfs.module.tem.businessobject.TravelerDetailEmergencyContact; 31 import org.kuali.rice.kim.api.identity.Person; 32 import org.kuali.rice.kim.api.identity.address.EntityAddressContract; 33 import org.kuali.rice.kim.api.identity.entity.Entity; 34 35 public interface TravelerService { 36 37 /** 38 * Creates a {@link TravelerDetail} from a {@link Person} instance 39 * 40 * @param person to create {@link TravelerDetail} instance from 41 * @return a new {@link Traveler} detail instance 42 */ 43 TravelerDetail convertToTraveler(final Person person); 44 45 /** 46 * Creates a {@link TravelerDetail} from a {@link Person} instance 47 * 48 * @param person to create {@link TravelerDetail} instance from 49 * @return a new {@link Traveler} detail instance 50 */ 51 TravelerDetail convertToTraveler(final AccountsReceivableCustomer person); 52 53 /** 54 * Determines if the given {@link TravelerDetail} instance is an employee by comparing 55 * what we know about employee traveler types. This is really up to the implementation. 56 * 57 * @param traveler a {@link TravelerDetail} instance to check 58 * @return whether our institution regards the {@link TravelerDetail} instance to be an 59 * employee or not 60 */ 61 boolean isEmployee(final TravelerDetail traveler); 62 63 /** 64 * 65 * @param profile 66 * @param docType 67 * @param user 68 * @param isProfileAdmin 69 * @param isAssignedArranger 70 * @param isOrgArranger 71 * @param isArrangerDoc 72 * @param isRiskManagement 73 * @return 74 */ 75 public boolean canIncludeProfileInSearch(TemProfile profile, String docType, Person user, boolean isProfileAdmin, boolean isAssignedArranger, boolean isOrgArranger, boolean isArrangerDoc, boolean isRiskManagement); 76 77 /** 78 * 79 * @param profile 80 * @param customer 81 */ 82 public void copyTemProfileToCustomer(TemProfile profile, AccountsReceivableCustomer customer); 83 84 /** 85 * 86 * @param profile 87 * @param customer 88 */ 89 public void copyCustomerToTemProfile(TemProfile profile, AccountsReceivableCustomer customer); 90 91 /** 92 * 93 * @param profile 94 * @param principal 95 * @param kimEntityInfo 96 */ 97 public void copyKimDataToTemProfile(TemProfile profile, Person principal, Entity kimEntityInfo); 98 99 /** 100 * 101 * This method converts a KIM Person to a TemProfileFromKim object so that we can then use it to 102 * actually create a TemProfile from it 103 * @param personDetail 104 * @return the TemProfileFromKimPerson object populated from the search 105 */ 106 TemProfileFromKimPerson convertToTemProfileFromKim(Person personDetail); 107 108 /** 109 * 110 * This method converts a Customer to a TemProfileFromCustomer object so that we can then use it to 111 * actually create a TemProfile from it 112 * @param person to create {@link TemProfileFromCustomer} instance from 113 * @return a new {@link TemProfileFromCustomer} instance 114 */ 115 TemProfileFromCustomer convertToTemProfileFromCustomer(AccountsReceivableCustomer person); 116 117 118 public void convertTemProfileToTravelerDetail(TemProfile profile, TravelerDetail detail); 119 120 /** 121 * 122 * This method copies the fromTraveler to a new TravelerDetail. 123 * 124 * Document Number is set in the copied emergency contacts and the TravelerDetail 125 * 126 * @param fromTraveler 127 * @param documentNumber 128 * @return 129 */ 130 public TravelerDetail copyTravelerDetail(TravelerDetail fromTraveler, String documentNumber); 131 132 /** 133 * Copies traveler detail emergency contacts and sets new document number 134 */ 135 public List<TravelerDetailEmergencyContact> copyTravelerDetailEmergencyContact(List<TravelerDetailEmergencyContact> emergencyContacts, String documentNumber); 136 137 /** 138 * 139 * @param profile 140 */ 141 public void populateTemProfile(TemProfile profile); 142 143 /** 144 * 145 * @param person 146 * @return 147 */ 148 public boolean isCustomerEmployee(AccountsReceivableCustomer person); 149 150 /** 151 * 152 * @param principal 153 * @return 154 */ 155 public boolean isKimPersonEmployee(Person principal); 156 157 /** 158 * 159 * This method converts a CustomerAddress to a TemProfileAddress object so that we can then use it to 160 * actually create a TemProfile from it 161 * @param person to create {@link CustomerAddress} instance from 162 * @return a new {@link TemProfileAddress} instance 163 */ 164 TemProfileAddress convertToTemProfileAddressFromCustomer(AccountsReceivableCustomerAddress customerAddress); 165 166 /** 167 * 168 * This method converts a KimEntityAddressImpl to a TemProfileAddress object so that we can then use it to 169 * actually create a TemProfile from it 170 * @param person to create {@link KimEntityAddressImpl} instance from 171 * @return a new {@link TemProfileAddress} instance 172 */ 173 TemProfileAddress convertToTemProfileAddressFromKimAddress(EntityAddressContract address); 174 175 /** 176 * 177 * @param chartCode 178 * @param orgCode 179 * @param roleChartCode 180 * @param roleOrgCode 181 * @param descendHierarchy 182 * @return 183 */ 184 public boolean isParentOrg(String chartCode, String orgCode, String roleChartCode, String roleOrgCode, boolean descendHierarchy); 185 186 /** 187 * Checks both the organization approver and profile admin roles to see if the given principal can arrange for the role 188 * @param principalId the principal id to check 189 * @param profile the profile to see if the principal can be their arranger 190 * @return true if the principal can be an arranger for the profile, false otherwise 191 */ 192 public boolean isArrangeeByOrganization(String principalId, TemProfile profile); 193 }