Skip to content

Instantly share code, notes, and snippets.

@antonkatz
Created March 7, 2014 19:07
Show Gist options
  • Save antonkatz/9417748 to your computer and use it in GitHub Desktop.
Save antonkatz/9417748 to your computer and use it in GitHub Desktop.
@Override
public String getExternalId()
{
try {
for (Object identifierUncast : this.getData("identifiers")) {
Map.Entry<String, String> identifier = (Map.Entry<String, String>) identifierUncast;
if (identifier.getKey().equalsIgnoreCase("external_id")){
return identifier.getValue();
}
}
} catch (Exception ex) {
return null;
}
return null;
}
@antonkatz
Copy link
Author

this.getData returns PatientData<T> which extends List. List has a get( int ), so I can't get("external_id"), like you suggested. Should I do it like this, or get the XWikiDocument and get the external_id from it?

@sdumitriu
Copy link

Do it (almost) like this.

@sdumitriu
Copy link

for (ImmutablePair<String, String> identifier : this.<ImmutablePair<String, String>>getData("identifiers")) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment