use of org.orcid.jaxb.model.record_rc2.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());
}
use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class ProfileKeywordManagerTest method testAddKeywordToUnclaimedRecordPreserveKeywordVisibility.
@Test
public void testAddKeywordToUnclaimedRecordPreserveKeywordVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Keyword keyword = getKeyword();
keyword = profileKeywordManager.createKeyword(unclaimedOrcid, keyword, true);
keyword = profileKeywordManager.getKeyword(unclaimedOrcid, keyword.getPutCode());
assertNotNull(keyword);
assertEquals(Visibility.PUBLIC, keyword.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class ProfileKeywordManagerTest method displayIndexIsSetTo_1_FromUI.
@Test
public void displayIndexIsSetTo_1_FromUI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Keyword keyword = getKeyword();
keyword.setContent(keyword.getContent() + " fromUI1");
keyword = profileKeywordManager.createKeyword(claimedOrcid, keyword, false);
keyword = profileKeywordManager.getKeyword(claimedOrcid, keyword.getPutCode());
assertNotNull(keyword);
assertEquals(Long.valueOf(1), keyword.getDisplayIndex());
}
use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class ProfileKeywordManagerTest method getKeyword.
private Keyword getKeyword() {
Keyword keyword = new Keyword();
keyword.setContent("keyword-1");
keyword.setVisibility(Visibility.PUBLIC);
return keyword;
}
use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewKeywords.
@Override
public Response viewKeywords(String orcid) {
Keywords keywords = profileKeywordManagerReadOnly.getKeywords(orcid, getLastModifiedTime(orcid));
// Lets copy the list so we don't modify the cached collection
if (keywords.getKeywords() != null) {
List<Keyword> filteredList = new ArrayList<Keyword>(keywords.getKeywords());
keywords = new Keywords();
keywords.setKeywords(filteredList);
}
orcidSecurityManager.checkAndFilter(orcid, keywords.getKeywords(), ScopePathType.ORCID_BIO_READ_LIMITED);
ElementUtils.setPathToKeywords(keywords, orcid);
Api2_0_LastModifiedDatesHelper.calculateLastModified(keywords);
sourceUtils.setSourceName(keywords);
return Response.ok(keywords).build();
}
Aggregations