use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class RepositoryServiceImpl method createBranch.
@Override
public Branch createBranch(final CreateBranchParams createBranchParams) {
requireAdminRole();
final RepositoryId repositoryId = ContextAccessor.current().getRepositoryId();
repositoryMap.compute(repositoryId, (key, previousRepository) -> doCreateBranch(createBranchParams, repositoryId, previousRepository));
return createBranchParams.getBranch();
}
use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class RepositoryServiceImpl method doCreateRepo.
private Repository doCreateRepo(final CreateRepositoryParams params) {
final RepositoryId repositoryId = params.getRepositoryId();
final boolean repoAlreadyInitialized = this.nodeRepositoryService.isInitialized(repositoryId);
if (repoAlreadyInitialized) {
throw new RepositoryAlreadyExistException(repositoryId);
}
this.nodeRepositoryService.create(params);
createRootNode(params);
final Repository repository = createRepositoryObject(params);
repositoryEntryService.createRepositoryEntry(repository);
return repository;
}
use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class RepositoryServiceImpl method doUpdateRepository.
private Repository doUpdateRepository(final UpdateRepositoryParams updateRepositoryParams, Repository previousRepository) {
RepositoryId repositoryId = updateRepositoryParams.getRepositoryId();
previousRepository = previousRepository == null ? repositoryEntryService.getRepositoryEntry(repositoryId) : previousRepository;
if (previousRepository == null) {
throw new RepositoryNotFoundException(repositoryId);
}
final EditableRepository editableRepository = new EditableRepository(previousRepository);
updateRepositoryParams.getEditor().accept(editableRepository);
UpdateRepositoryEntryParams params = UpdateRepositoryEntryParams.create().repositoryId(repositoryId).repositoryData(editableRepository.data).attachments(ImmutableList.copyOf(editableRepository.binaryAttachments)).build();
return repositoryEntryService.updateRepositoryEntry(params);
}
use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class NodeRepositoryServiceImpl method create.
@Override
public void create(final CreateRepositoryParams params) {
final RepositoryId repositoryId = params.getRepositoryId();
final RepositorySettings repositorySettings = params.getRepositorySettings();
createIndex(params, IndexType.VERSION, Map.ofEntries(mergeWithDefaultMapping(repositorySettings, repositoryId, IndexType.VERSION), mergeWithDefaultMapping(repositorySettings, repositoryId, IndexType.BRANCH), mergeWithDefaultMapping(repositorySettings, repositoryId, IndexType.COMMIT)));
createIndex(params, IndexType.SEARCH, Map.ofEntries(mergeWithDefaultMapping(repositorySettings, repositoryId, IndexType.SEARCH)));
indexServiceInternal.waitForYellowStatus(resolveIndexNames(repositoryId));
}
use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class NodeRepositoryServiceImpl method createIndex.
private void createIndex(final CreateRepositoryParams params, final IndexType indexType, final Map<IndexType, IndexMapping> mappings) {
final RepositoryId repositoryId = params.getRepositoryId();
final IndexSettings mergedSettings = mergeWithDefaultSettings(params, indexType);
indexServiceInternal.createIndex(CreateIndexRequest.create().indexName(resolveIndexName(repositoryId, indexType)).mappings(mappings).indexSettings(mergedSettings).build());
}
Aggregations