}
public static Citation convert(org.openbel.framework.common.model.Citation citation) {
if (citation == null) return null;
Citation wsCitation = OBJECT_FACTORY.createCitation();
wsCitation.setId(citation.getReference());
if (citation.getType() != null) {
String value = citation.getType().getDisplayValue().toUpperCase().replace(' ', '_');
wsCitation.setCitationType(fromValue(value));
}
if (citation.getName() != null) {
wsCitation.setName(citation.getName());
}
if (citation.getDate() != null) {
try {
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(citation.getDate().getTime());
wsCitation.setPublicationDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
} catch (DatatypeConfigurationException e) {
// Swallowed
}
}
if (citation.getAuthors() != null) {
wsCitation.getAuthors().addAll(citation.getAuthors());
}
wsCitation.setComment(citation.getComment());
return wsCitation;
}