Search in sources :

Example 6 with CreateRepositoryParams

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);
    }
}
Also used : CreateRepositoryParams(com.enonic.xp.repository.CreateRepositoryParams)

Example 7 with 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);
        }
    }
}
Also used : CreateRepositoryParams(com.enonic.xp.repository.CreateRepositoryParams) Repository(com.enonic.xp.repository.Repository)

Example 8 with 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);
}
Also used : CreateRepositoryParams(com.enonic.xp.repository.CreateRepositoryParams) Repository(com.enonic.xp.repository.Repository) RepositoryMapper(com.enonic.xp.lib.repo.mapper.RepositoryMapper) RepositorySettings(com.enonic.xp.repository.RepositorySettings)

Example 9 with CreateRepositoryParams

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);
}
Also used : CreateRepositoryParams(com.enonic.xp.repository.CreateRepositoryParams) RepositoryService(com.enonic.xp.repository.RepositoryService)

Aggregations

CreateRepositoryParams (com.enonic.xp.repository.CreateRepositoryParams)9 Repository (com.enonic.xp.repository.Repository)3 PropertyTree (com.enonic.xp.data.PropertyTree)1 RepositoryMapper (com.enonic.xp.lib.repo.mapper.RepositoryMapper)1 RepositoryService (com.enonic.xp.repository.RepositoryService)1 RepositorySettings (com.enonic.xp.repository.RepositorySettings)1