use of com.enonic.xp.repository.CreateRepositoryParams in project xp by enonic.
the class LoadRunnableTask method initializeRepo.
private void initializeRepo(final Repository repository) {
if (!this.nodeRepositoryService.isInitialized(repository.getId())) {
final CreateRepositoryParams createRepositoryParams = CreateRepositoryParams.create().repositoryId(repository.getId()).repositorySettings(repository.getSettings()).data(repository.getData()).build();
this.nodeRepositoryService.create(createRepositoryParams);
}
}
use of com.enonic.xp.repository.CreateRepositoryParams in project xp by enonic.
the class ImportRunnableTask method initializeStoredRepositories.
private void initializeStoredRepositories() {
this.repositoryService.invalidateAll();
for (Repository repository : repositoryService.list()) {
if (!this.nodeRepositoryService.isInitialized(repository.getId())) {
final CreateRepositoryParams createRepositoryParams = CreateRepositoryParams.create().repositoryId(repository.getId()).repositorySettings(repository.getSettings()).data(repository.getData()).build();
this.nodeRepositoryService.create(createRepositoryParams);
}
}
}
use of com.enonic.xp.repository.CreateRepositoryParams in project xp by enonic.
the class CreateRepositoryHandler method execute.
public RepositoryMapper execute() {
final RepositorySettings repositorySettings = RepositorySettings.create().indexDefinitions(indexDefinitions).build();
final CreateRepositoryParams createRepositoryParams = CreateRepositoryParams.create().repositoryId(repositoryId).repositorySettings(repositorySettings).rootPermissions(rootPermissions).rootChildOrder(rootChildOrder).build();
final Repository repository = repositoryServiceSupplier.get().createRepository(createRepositoryParams);
return repository == null ? null : new RepositoryMapper(repository);
}
use of com.enonic.xp.repository.CreateRepositoryParams in project xp by enonic.
the class CreateRepositoryScriptTest method initialize.
@Override
public void initialize() throws Exception {
super.initialize();
repositoryService = Mockito.mock(RepositoryService.class);
Mockito.when(repositoryService.createRepository(Mockito.isA(CreateRepositoryParams.class))).thenAnswer(invocation -> {
final CreateRepositoryParams params = (CreateRepositoryParams) invocation.getArguments()[0];
return Repository.create().id(params.getRepositoryId()).branches(Branches.from(RepositoryConstants.MASTER_BRANCH)).settings(params.getRepositorySettings()).build();
});
addService(RepositoryService.class, repositoryService);
}
Aggregations