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

Merge branch 'uds-pvi' into 'master'

UdsPersonUserDetailsImpl#getPvi now returns computed PVI

PVI was returning null in previous version.

See merge request !8
parents 6d1d1964 e59bf8c3
No related branches found
No related tags found
No related merge requests found
...@@ -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