diff --git a/dspace-api/src/main/java/org/dspace/content/authority/DSpaceControlledVocabulary.java b/dspace-api/src/main/java/org/dspace/content/authority/DSpaceControlledVocabulary.java index dfaf4a107f..d5e350faf0 100644 --- a/dspace-api/src/main/java/org/dspace/content/authority/DSpaceControlledVocabulary.java +++ b/dspace-api/src/main/java/org/dspace/content/authority/DSpaceControlledVocabulary.java @@ -132,11 +132,15 @@ public class DSpaceControlledVocabulary extends SelfNamedPlugin implements Hiera String filename = vocabulariesPath + vocabularyName + ".xml"; log.info("Loading " + filename); vocabulary = new InputSource(filename); + + hierarchyDelimiter = " " + hierarchyDelimiter + " "; } } protected String buildString(Node node) { - if (node.getNodeType() == Node.DOCUMENT_NODE) { + if (node.getNodeType() == Node.DOCUMENT_NODE || ( + node.getParentNode() != null && + node.getParentNode().getNodeType() == Node.DOCUMENT_NODE)) { return (""); } else { String parentValue = buildString(node.getParentNode()); diff --git a/dspace-api/src/test/java/org/dspace/content/authority/DSpaceControlledVocabularyTest.java b/dspace-api/src/test/java/org/dspace/content/authority/DSpaceControlledVocabularyTest.java index 7ade9c582d..255b070e5e 100644 --- a/dspace-api/src/test/java/org/dspace/content/authority/DSpaceControlledVocabularyTest.java +++ b/dspace-api/src/test/java/org/dspace/content/authority/DSpaceControlledVocabularyTest.java @@ -86,7 +86,7 @@ public class DSpaceControlledVocabularyTest extends AbstractDSpaceTest { CoreServiceFactory.getInstance().getPluginService().getNamedPlugin(Class.forName(PLUGIN_INTERFACE), "farm"); assertNotNull(instance); Choices result = instance.getMatches(text, start, limit, locale); - assertEquals("the farm::north 40", result.values[0].value); + assertEquals("north 40", result.values[0].value); } /** diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsChildrenLinkRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsChildrenLinkRepository.java index 044710d25b..1788fa893b 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsChildrenLinkRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsChildrenLinkRepository.java @@ -45,7 +45,7 @@ public class VocabularyEntryDetailsChildrenLinkRepository extends AbstractDSpace @Autowired private AuthorityUtils authorityUtils; - @PreAuthorize("hasAuthority('AUTHENTICATED')") + @PreAuthorize("permitAll()") public Page getChildren(@Nullable HttpServletRequest request, String name, @Nullable Pageable optionalPageable, Projection projection) { diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsParentLinkRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsParentLinkRepository.java index 379928d9cc..d7a1ff85c3 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsParentLinkRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsParentLinkRepository.java @@ -40,7 +40,7 @@ public class VocabularyEntryDetailsParentLinkRepository extends AbstractDSpaceRe @Autowired private AuthorityUtils authorityUtils; - @PreAuthorize("hasAuthority('AUTHENTICATED')") + @PreAuthorize("permitAll()") public VocabularyEntryDetailsRest getParent(@Nullable HttpServletRequest request, String name, @Nullable Pageable optionalPageable, Projection projection) { Context context = obtainContext(); diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsRestRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsRestRepository.java index bc7c60d62b..3e4d600b12 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsRestRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyEntryDetailsRestRepository.java @@ -66,7 +66,7 @@ public class VocabularyEntryDetailsRestRepository extends DSpaceRestRepository findAllTop(@Parameter(value = "vocabulary", required = true) String vocabularyId, Pageable pageable) { Context context = obtainContext(); diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyRestRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyRestRepository.java index dcdf71186b..fcc37d1316 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyRestRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VocabularyRestRepository.java @@ -53,7 +53,7 @@ public class VocabularyRestRepository extends DSpaceRestRepository> matchAllSrscSC110Children() { return Matchers.containsInAnyOrder( VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110102", "History of religion", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::History of religion"), + "HUMANITIES and RELIGION :: Religion/Theology :: History of religion"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110103", "Church studies", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Church studies"), + "HUMANITIES and RELIGION :: Religion/Theology :: Church studies"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110104", "Missionary studies", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Missionary studies"), + "HUMANITIES and RELIGION :: Religion/Theology :: Missionary studies"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110105", "Systematic theology", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Systematic theology"), + "HUMANITIES and RELIGION :: Religion/Theology :: Systematic theology"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110106", "Islamology", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Islamology"), + "HUMANITIES and RELIGION :: Religion/Theology :: Islamology"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110107", "Faith and reason", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Faith and reason"), + "HUMANITIES and RELIGION :: Religion/Theology :: Faith and reason"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110108", "Sociology of religion", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Sociology of religion"), + "HUMANITIES and RELIGION :: Religion/Theology :: Sociology of religion"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110109", "Psychology of religion", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Psychology of religion"), + "HUMANITIES and RELIGION :: Religion/Theology :: Psychology of religion"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110110", "Philosophy of religion", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Philosophy of religion"), + "HUMANITIES and RELIGION :: Religion/Theology :: Philosophy of religion"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110111", "New Testament exegesis", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::New Testament exegesis"), + "HUMANITIES and RELIGION :: Religion/Theology :: New Testament exegesis"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110112", "Old Testament exegesis", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Old Testament exegesis"), + "HUMANITIES and RELIGION :: Religion/Theology :: Old Testament exegesis"), VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110113", "Dogmatics with symbolics", - "Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Dogmatics with symbolics") + "HUMANITIES and RELIGION :: Religion/Theology :: Dogmatics with symbolics") ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/VocabularyRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/VocabularyRestRepositoryIT.java index 5ea8cdb231..5cfcac47d1 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/VocabularyRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/VocabularyRestRepositoryIT.java @@ -151,8 +151,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes @Test public void findOneSRSC_Test() throws Exception { - String token = getAuthToken(admin.getEmail(), password); - getClient(token).perform(get("/api/submission/vocabularies/srsc")) + getClient().perform(get("/api/submission/vocabularies/srsc")) .andExpect(status().isOk()) .andExpect(jsonPath("$", is( VocabularyMatcher.matchProperties("srsc", "srsc", false, true) @@ -161,8 +160,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes @Test public void findOneCommonTypesTest() throws Exception { - String token = getAuthToken(admin.getEmail(), password); - getClient(token).perform(get("/api/submission/vocabularies/common_types")) + getClient().perform(get("/api/submission/vocabularies/common_types")) .andExpect(status().isOk()) .andExpect(jsonPath("$", is( VocabularyMatcher.matchProperties("common_types", "common_types", true, false) @@ -179,9 +177,9 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.entries", Matchers.containsInAnyOrder( VocabularyMatcher.matchVocabularyEntry("Research Subject Categories", - "Research Subject Categories", "vocabularyEntry"), + "", "vocabularyEntry"), VocabularyMatcher.matchVocabularyEntry("Family research", - "Research Subject Categories::SOCIAL SCIENCES::Social sciences::Social work::Family research", + "SOCIAL SCIENCES :: Social sciences :: Social work :: Family research", "vocabularyEntry")))) .andExpect(jsonPath("$.page.totalElements", Matchers.is(26))) .andExpect(jsonPath("$.page.totalPages", Matchers.is(13)))