use of org.orcid.jaxb.model.record_rc4.Keyword in project ORCID-Source by ORCID.
the class Utils method getKeyword.
public static Keyword getKeyword() {
Keyword keyword = new Keyword();
keyword.setContent("New keyword");
keyword.setVisibility(Visibility.LIMITED);
return keyword;
}
use of org.orcid.jaxb.model.record_rc4.Keyword in project ORCID-Source by ORCID.
the class Api2_0_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Keywords keywords) {
if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
LastModifiedDate latest = null;
for (Keyword keyword : keywords.getKeywords()) {
if (keyword.getLastModifiedDate() != null && keyword.getLastModifiedDate().after(latest)) {
latest = keyword.getLastModifiedDate();
}
}
keywords.setLastModifiedDate(latest);
}
}
use of org.orcid.jaxb.model.record_rc4.Keyword in project ORCID-Source by ORCID.
the class JpaJaxbKeywordAdapterTest method getKeyword.
private Keyword getKeyword() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(new Class[] { Keyword.class });
Unmarshaller unmarshaller = context.createUnmarshaller();
String name = "/record_2.0/samples/read_samples/keyword-2.0.xml";
InputStream inputStream = getClass().getResourceAsStream(name);
return (Keyword) unmarshaller.unmarshal(inputStream);
}
use of org.orcid.jaxb.model.record_rc4.Keyword in project ORCID-Source by ORCID.
the class JpaJaxbKeywordAdapterTest method fromProfileKeywordEntityToKeywordTest.
@Test
public void fromProfileKeywordEntityToKeywordTest() {
ProfileKeywordEntity entity = getProfileKeywordEntity();
Keyword keyword = adapter.toKeyword(entity);
assertNotNull(keyword);
assertEquals("keyword-1", keyword.getContent());
assertNotNull(keyword.getCreatedDate());
assertNotNull(keyword.getCreatedDate().getValue());
assertNotNull(keyword.getLastModifiedDate());
assertNotNull(keyword.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(1), keyword.getPutCode());
assertNotNull(keyword.getSource());
assertEquals("APP-000000000000", keyword.getSource().retrieveSourcePath());
assertEquals(Visibility.LIMITED, keyword.getVisibility());
}
use of org.orcid.jaxb.model.record_rc4.Keyword in project ORCID-Source by ORCID.
the class ProfileKeywordManagerTest method displayIndexIsSetTo_0_FromAPI.
@Test
public void displayIndexIsSetTo_0_FromAPI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Keyword keyword = getKeyword();
keyword.setContent(keyword.getContent() + " fromAPI1");
keyword = profileKeywordManager.createKeyword(claimedOrcid, keyword, true);
keyword = profileKeywordManager.getKeyword(claimedOrcid, keyword.getPutCode());
assertNotNull(keyword);
assertEquals(Long.valueOf(0), keyword.getDisplayIndex());
}
Aggregations