Skip to content

Commit

Permalink
nullchecks
Browse files Browse the repository at this point in the history
  • Loading branch information
stain committed May 23, 2013
1 parent 3691fa3 commit 3fa8e0e
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import org.orcid.jaxb.model.message.OrcidMessage;
import org.orcid.jaxb.model.message.OrcidProfile;
import org.orcid.jaxb.model.message.PersonalDetails;

import com.hp.hpl.jena.ontology.DatatypeProperty;
import com.hp.hpl.jena.ontology.Individual;
Expand Down Expand Up @@ -153,13 +154,21 @@ public void writeTo(OrcidMessage xml, Class<?> type, Type genericType, Annotatio

// AnnotationProperty foafName = m.getAnnotationProperty(FOAF_0_1 + "name");
DatatypeProperty foafName = m.getDatatypeProperty(FOAF_0_1 + "name");
person.addProperty(foafName, orcidProfile.getOrcidBio().getPersonalDetails().getCreditName().getContent());

DatatypeProperty foafGivenName = m.getDatatypeProperty(FOAF_0_1 + "givenName");
person.addProperty(foafGivenName, orcidProfile.getOrcidBio().getPersonalDetails().getGivenNames().getContent());

DatatypeProperty familyName = m.getDatatypeProperty(FOAF_0_1 + "familyName");
person.addProperty(familyName, orcidProfile.getOrcidBio().getPersonalDetails().getFamilyName().getContent());

PersonalDetails personalDetails = orcidProfile.getOrcidBio().getPersonalDetails();

if (personalDetails.getCreditName() != null) {
person.addProperty(foafName, personalDetails.getCreditName().getContent());
}

if (personalDetails.getGivenNames() != null) {
person.addProperty(foafGivenName, personalDetails.getGivenNames().getContent());
}
if (personalDetails.getFamilyName() != null) {
person.addProperty(familyName, personalDetails.getFamilyName().getContent());
}

m.write(entityStream);
}
Expand Down

0 comments on commit 3fa8e0e

Please sign in to comment.