Search in sources :

Example 1 with RepositorySettings

use of com.enonic.xp.repository.RepositorySettings in project xp by enonic.

the class RepositoryNodeTranslator method toNode.

public static Node toNode(final Repository repository) {
    final PropertyTree repositoryNodeData = new PropertyTree();
    toNodeData(repository.getBranches(), repositoryNodeData);
    final RepositorySettings repositorySettings = repository.getSettings();
    toNodeData(repositorySettings.getIndexDefinitions(), repositoryNodeData);
    toNodeData(repository.getData(), repositoryNodeData);
    return Node.create().id(NodeId.from(repository.getId())).childOrder(ChildOrder.defaultOrder()).data(repositoryNodeData).name(repository.getId().toString()).parentPath(RepositoryConstants.REPOSITORY_STORAGE_PARENT_PATH).permissions(SystemConstants.SYSTEM_REPO_DEFAULT_ACL).attachedBinaries(repository.getAttachments()).build();
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) RepositorySettings(com.enonic.xp.repository.RepositorySettings)

Example 2 with RepositorySettings

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

Example 3 with RepositorySettings

use of com.enonic.xp.repository.RepositorySettings in project xp by enonic.

the class RepositoryNodeTranslator method toRepository.

public static Repository toRepository(final Node node) {
    final PropertyTree nodeData = node.data();
    final RepositorySettings repositorySettings = RepositorySettings.create().indexDefinitions(toIndexConfigs(nodeData)).build();
    final PropertyTree repositoryData = toRepositoryData(nodeData);
    return Repository.create().id(RepositoryId.from(node.id().toString())).branches(toBranches(nodeData)).settings(repositorySettings).data(repositoryData).attachments(node.getAttachedBinaries()).build();
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) RepositorySettings(com.enonic.xp.repository.RepositorySettings)

Example 4 with RepositorySettings

use of com.enonic.xp.repository.RepositorySettings 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)

Aggregations

RepositorySettings (com.enonic.xp.repository.RepositorySettings)4 PropertyTree (com.enonic.xp.data.PropertyTree)2 RepositoryMapper (com.enonic.xp.lib.repo.mapper.RepositoryMapper)1 CreateRepositoryParams (com.enonic.xp.repository.CreateRepositoryParams)1 Repository (com.enonic.xp.repository.Repository)1 RepositoryId (com.enonic.xp.repository.RepositoryId)1