use of com.enonic.xp.repository.Repository in project xp by enonic.
the class ProjectServiceImpl method doModify.
private Project doModify(final ModifyProjectParams params) {
final UpdateRepositoryParams updateParams = UpdateRepositoryParams.create().repositoryId(params.getName().getRepoId()).editor(editableRepository -> modifyProjectData(params, editableRepository.data)).build();
final Repository updatedRepository = repositoryService.updateRepository(updateParams);
if (!ProjectConstants.DEFAULT_PROJECT_NAME.equals(params.getName())) {
UpdateProjectRoleNamesCommand.create().securityService(securityService).projectName(params.getName()).projectDisplayName(params.getDisplayName()).build().execute();
}
return Project.from(updatedRepository);
}
use of com.enonic.xp.repository.Repository in project xp by enonic.
the class IndexServiceImpl method getSearchIndexMapping.
private IndexMapping getSearchIndexMapping(final RepositoryId repositoryId) {
final IndexMapping defaultIndexMapping = DEFAULT_INDEX_RESOURCE_PROVIDER.getMapping(repositoryId, IndexType.SEARCH);
final Repository repositoryEntry = repositoryEntryService.getRepositoryEntry(repositoryId);
if (repositoryEntry != null) {
final IndexMapping indexMapping = repositoryEntry.getSettings().getIndexMappings(IndexType.SEARCH);
if (indexMapping != null) {
return new IndexMapping(JsonHelper.merge(defaultIndexMapping.getNode(), indexMapping.getNode()));
}
}
return defaultIndexMapping;
}
use of com.enonic.xp.repository.Repository in project xp by enonic.
the class IndexServiceImpl method getSearchIndexSettings.
private IndexSettings getSearchIndexSettings(final RepositoryId repositoryId) {
final IndexSettings defaultIndexSettings = DEFAULT_INDEX_RESOURCE_PROVIDER.getSettings(repositoryId, IndexType.SEARCH);
final Repository repositoryEntry = repositoryEntryService.getRepositoryEntry(repositoryId);
if (repositoryEntry != null) {
final IndexSettings indexSettings = repositoryEntry.getSettings().getIndexSettings(IndexType.SEARCH);
if (indexSettings != null) {
return new IndexSettings(JsonHelper.merge(defaultIndexSettings.getNode(), indexSettings.getNode()));
}
}
return defaultIndexSettings;
}
use of com.enonic.xp.repository.Repository in project xp by enonic.
the class FindNodesByMultiRepoQueryCommandTest method no_access_in_one_repo.
@Test
public void no_access_in_one_repo() throws Exception {
final Repository repo1 = createRepo(REPO_USER_1, "repo1");
final Repository repo2 = createRepo(REPO_USER_2, "repo2");
runInContext(REPO_USER_1, repo1.getId(), () -> createNode(NodePath.ROOT, "repo1Node"));
runInContext(REPO_USER_2, repo2.getId(), () -> createNode(NodePath.ROOT, "repo2Node"));
final SearchTargets targets = SearchTargets.create().add(createTarget(MASTER_BRANCH, REPO_USER_1, repo1.getId())).add(// repoUser2 has no access
createTarget(MASTER_BRANCH, REPO_USER_1, repo2.getId())).build();
final NodeQuery query = NodeQuery.create().parent(NodePath.ROOT).build();
final FindNodesByMultiRepoQueryResult result = doQuery(query, targets);
assertEquals(1L, result.getTotalHits());
assertRepos(result, repo1.getId());
assertBranches(result, MASTER_BRANCH);
}
use of com.enonic.xp.repository.Repository in project xp by enonic.
the class FindNodesByMultiRepoQueryCommandTest method no_access_in_one_repo_of_three.
@Test
public void no_access_in_one_repo_of_three() throws Exception {
final Repository repo1 = createRepo(REPO_USER_1, "repo1");
final Repository repo2 = createRepo(REPO_USER_2, "repo2");
final Repository repo3 = createRepo(REPO_USER_3, "repo3");
runInContext(REPO_USER_1, repo1.getId(), () -> createNode(NodePath.ROOT, "repo1Node"));
runInContext(REPO_USER_2, repo2.getId(), () -> createNode(NodePath.ROOT, "repo2Node"));
runInContext(REPO_USER_3, repo3.getId(), () -> createNode(NodePath.ROOT, "repo2Node"));
final SearchTargets targets = SearchTargets.create().add(createTarget(MASTER_BRANCH, REPO_USER_1, repo1.getId())).add(createTarget(MASTER_BRANCH, REPO_USER_2, repo2.getId())).add(// repoUser1 has no access
createTarget(MASTER_BRANCH, REPO_USER_1, repo3.getId())).build();
final NodeQuery query = NodeQuery.create().parent(NodePath.ROOT).build();
final FindNodesByMultiRepoQueryResult result = doQuery(query, targets);
assertEquals(2L, result.getTotalHits());
assertRepos(result, repo1.getId(), repo2.getId());
assertBranches(result, MASTER_BRANCH);
}
Aggregations