| 1 | |
package org.kuali.student.lum.kim.role.type; |
| 2 | |
|
| 3 | |
import java.util.List; |
| 4 | |
|
| 5 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 6 | |
import org.kuali.rice.kim.bo.Person; |
| 7 | |
import org.kuali.rice.kim.bo.types.dto.AttributeSet; |
| 8 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
| 9 | |
import org.kuali.rice.kim.service.support.impl.KimDerivedRoleTypeServiceBase; |
| 10 | |
|
| 11 | 0 | public class AffiliationDerivedRoleTypeServiceImpl extends |
| 12 | |
KimDerivedRoleTypeServiceBase { |
| 13 | |
|
| 14 | |
private static final String EMPLOYEE_STATUS_ACTIVE = "A"; |
| 15 | 0 | private List<String> includedAffiliationTypes = null; |
| 16 | 0 | private List<String> includedRouteStatuses = null; |
| 17 | |
|
| 18 | |
@Override |
| 19 | |
public boolean hasApplicationRole(String principalId, |
| 20 | |
List<String> groupIds, String namespaceCode, String roleName, |
| 21 | |
AttributeSet qualification) { |
| 22 | 0 | Person signedOnPerson = KIMServiceLocator.getPersonService().getPerson(principalId); |
| 23 | |
|
| 24 | |
|
| 25 | 0 | String routeStatus = KEWServiceLocator.getRouteHeaderService().getDocumentStatus(Long.parseLong(qualification.get("documentNumber"))); |
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | 0 | for (String affiliationType : includedAffiliationTypes) { |
| 30 | 0 | if (signedOnPerson.hasAffiliationOfType(affiliationType) && (signedOnPerson.getEmployeeStatusCode().equals(EMPLOYEE_STATUS_ACTIVE))) { |
| 31 | 0 | if(includedRouteStatuses!=null && includedRouteStatuses.contains(routeStatus)){ |
| 32 | 0 | return true; |
| 33 | |
} |
| 34 | |
} |
| 35 | |
} |
| 36 | 0 | return false; |
| 37 | |
} |
| 38 | |
|
| 39 | |
public List<String> getIncludedAffiliationTypes() { |
| 40 | 0 | return includedAffiliationTypes; |
| 41 | |
} |
| 42 | |
|
| 43 | |
public void setIncludedAffiliationTypes(List<String> includedAffiliationTypes) { |
| 44 | 0 | this.includedAffiliationTypes = includedAffiliationTypes; |
| 45 | 0 | } |
| 46 | |
|
| 47 | |
public void setIncludedRouteStatuses(List<String> includedRouteStatuses) { |
| 48 | 0 | this.includedRouteStatuses = includedRouteStatuses; |
| 49 | 0 | } |
| 50 | |
|
| 51 | |
} |