Skip to content
Snippets Groups Projects
Commit e59bf8c3 authored by Nicholas Blair's avatar Nicholas Blair
Browse files

UdsPersonUserDetailsImpl#getPvi now returns computed PVI

parent 6d1d1964
No related branches found
No related tags found
1 merge request!8UdsPersonUserDetailsImpl#getPvi now returns computed PVI
...@@ -30,6 +30,7 @@ public class UdsPersonUserDetailsImpl implements UWUserDetails { ...@@ -30,6 +30,7 @@ public class UdsPersonUserDetailsImpl implements UWUserDetails {
private static final long serialVersionUID = 2930942419916444606L; private static final long serialVersionUID = 2930942419916444606L;
public static final String NETID_IDNAME = "NETID"; public static final String NETID_IDNAME = "NETID";
public static final String PVI_IDNAME = "PVI";
public static final String PHOTOID_IDNAME = "PHOTOID"; public static final String PHOTOID_IDNAME = "PHOTOID";
public static final String UWMSNSUDS_SOURCE = "UWMSNSUDS"; public static final String UWMSNSUDS_SOURCE = "UWMSNSUDS";
public static final String USER_DETAILS_SOURCE = "uds"; public static final String USER_DETAILS_SOURCE = "uds";
...@@ -180,22 +181,24 @@ public class UdsPersonUserDetailsImpl implements UWUserDetails { ...@@ -180,22 +181,24 @@ public class UdsPersonUserDetailsImpl implements UWUserDetails {
/** /**
* {@inheritDoc} * {@inheritDoc}
*
* This implementation always returns null.
*
* TODO it may be possible to extract a PVI value from person.getIdentifiers
*/ */
@Override @Override
public String getPvi() { public String getPvi() {
if(person.getIdentifiers() == null) {
return null;
}
for(Identifier identifier: person.getIdentifiers().getIdentifiers()) {
if(UWMSNSUDS_SOURCE.equals(identifier.getSource()) && PVI_IDNAME.equals(identifier.getIdName())) {
return identifier.getValue();
}
}
return null; return null;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* This implementation always returns null. * This implementation always returns null; UDS Person does not return EPPN.
*
* TODO it may be possible to extract a EPPN value from person.getIdentifiers
*/ */
@Override @Override
public String getEppn() { public String getEppn() {
...@@ -207,6 +210,7 @@ public class UdsPersonUserDetailsImpl implements UWUserDetails { ...@@ -207,6 +210,7 @@ public class UdsPersonUserDetailsImpl implements UWUserDetails {
* This implementation always returns null. * This implementation always returns null.
* *
* TODO it may be possible to extract an emplid value from person.getIdentifiers * TODO it may be possible to extract an emplid value from person.getIdentifiers
* Example observed: edu.wisc.services.uds.person.v1_1.Identifier@715ef617[source=UWMSNSS, idName=EMPLID, value=000123456]
*/ */
@Override @Override
public String getIsisEmplid() { public String getIsisEmplid() {
......
...@@ -120,4 +120,23 @@ public class UdsPersonUserDetailsImplTest { ...@@ -120,4 +120,23 @@ public class UdsPersonUserDetailsImplTest {
assertEquals("Badger", new UdsPersonUserDetailsImpl(person).getLastName()); assertEquals("Badger", new UdsPersonUserDetailsImpl(person).getLastName());
} }
/**
* Confirm successful result for {@link UdsPersonUserDetailsImpl#getPvi()}.
*/
@Test
public void getPvi_success() {
String pvi = "UW111E111";
Identifier identifier = new Identifier();
identifier.setSource("UWMSNSUDS");
identifier.setIdName("PVI");
identifier.setValue(pvi);
Identifiers identifiers = new Identifiers();
identifiers.getIdentifiers().add(identifier);
Person person = new Person();
person.setIdentifiers(identifiers);
assertEquals(pvi, new UdsPersonUserDetailsImpl(person).getPvi());
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment