use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class AbstractDumpReader method loadVersions.
@Override
public VersionsLoadResult loadVersions(final RepositoryId repositoryId, final LineProcessor<EntryLoadResult> processor) {
final PathRef tarFile = filePaths.versionMetaPath(repositoryId);
listener.loadingVersions(repositoryId);
final VersionsLoadResult.Builder builder = VersionsLoadResult.create();
if (!exists(tarFile)) {
return builder.build();
}
final EntriesLoadResult result = doLoadEntries(processor, tarFile);
return builder.successful(result.getSuccessful()).errors(result.getErrors().stream().map(error -> LoadError.error(error.getMessage())).collect(Collectors.toList())).build();
}
use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class AbstractMetaDumpUpgrader method deleteBufferFiles.
private void deleteBufferFiles() throws IOException {
Path bufferFile;
for (RepositoryId repositoryId : dumpReader.getRepositories()) {
bufferFile = tmpDumpReader.getVersionsFile(repositoryId);
Files.deleteIfExists(bufferFile);
for (Branch branch : dumpReader.getBranches(repositoryId)) {
bufferFile = tmpDumpReader.getBranchEntriesFile(repositoryId, branch);
Files.deleteIfExists(bufferFile);
}
}
}
use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class CommitDumpUpgrader method upgradeRepository.
@Override
protected void upgradeRepository(final RepositoryId repositoryId) {
commitedNodeIds.clear();
commitedVersionIds.clear();
processingMaster = true;
createCommit(repositoryId);
upgradeBranch(repositoryId, RepositoryConstants.MASTER_BRANCH);
processingMaster = false;
if (!commitedNodeIds.isEmpty()) {
dumpReader.getBranches(repositoryId).stream().filter(branch -> !RepositoryConstants.MASTER_BRANCH.equals(branch)).forEach(branch -> upgradeBranch(repositoryId, branch));
final Path versionsFile = dumpReader.getVersionsFile(repositoryId);
if (Files.exists(versionsFile)) {
upgradeVersionEntries(repositoryId, versionsFile);
}
}
}
use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class IndexAccessSegmentsDumpUpgrader method upgradeVersionEntry.
@Override
protected byte[] upgradeVersionEntry(final RepositoryId repositoryId, final String entryContent) {
final Pre4VersionsDumpEntryJson versionsDumpEntry = deserializeValue(entryContent, Pre4VersionsDumpEntryJson.class);
Collection<Pre6VersionDumpEntryJson> versions = versionsDumpEntry.getVersions().stream().map(versionDumpEntry -> upgradeVersionDumpEntry(repositoryId, versionDumpEntry)).collect(Collectors.toList());
final Pre6VersionsDumpEntryJson upgradedVersionsDumpEntry = Pre6VersionsDumpEntryJson.create().nodeId(versionsDumpEntry.getNodeId()).versions(versions).build();
return serialize(upgradedVersionsDumpEntry);
}
use of com.enonic.xp.repository.RepositoryId in project xp by enonic.
the class MultiRepoSearchSourceAdaptor method createSourceFilters.
private static Filter createSourceFilters(final MultiRepoSearchSource sources) {
final RepoBranchAclMap repoBranchAclMap = RepoBranchAclMap.from(sources);
final BooleanFilter.Builder sourceFilters = BooleanFilter.create();
for (final RepositoryId repoId : repoBranchAclMap) {
sourceFilters.must(createRepoFilter(repoId, repoBranchAclMap.getBranchAclEntries(repoId)));
}
return sourceFilters.build();
}
Aggregations