Search in sources :

Example 1 with RepositoryId

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

the class ModifyRepositoryHandler method execute.

public RepositoryMapper execute() {
    final RepositoryId repositoryId = RepositoryId.from(id);
    final UpdateRepositoryParams updateRepositoryParams = UpdateRepositoryParams.create().repositoryId(repositoryId).editor(this::editRepository).build();
    return new RepositoryMapper(repositoryServiceSupplier.get().updateRepository(updateRepositoryParams));
}
Also used : RepositoryMapper(com.enonic.xp.lib.repo.mapper.RepositoryMapper) UpdateRepositoryParams(com.enonic.xp.repository.UpdateRepositoryParams) RepositoryId(com.enonic.xp.repository.RepositoryId)

Example 2 with RepositoryId

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

the class ContextImplTest method testRepositoryId.

@Test
public void testRepositoryId() {
    final ContextImpl context = createContext();
    assertNull(context.getRepositoryId());
    final RepositoryId value = RepositoryId.from("repo-id");
    context.getLocalScope().setAttribute(value);
    assertSame(value, context.getRepositoryId());
}
Also used : RepositoryId(com.enonic.xp.repository.RepositoryId) Test(org.junit.jupiter.api.Test)

Example 3 with RepositoryId

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

the class ProjectServiceImpl method doDelete.

private boolean doDelete(final ProjectName projectName) {
    final DeleteRepositoryParams params = DeleteRepositoryParams.from(projectName.getRepoId());
    final RepositoryId deletedRepositoryId = this.repositoryService.deleteRepository(params);
    if (!ProjectConstants.DEFAULT_PROJECT_NAME.equals(projectName)) {
        DeleteProjectRolesCommand.create().securityService(securityService).projectName(projectName).build().execute();
    }
    return deletedRepositoryId != null;
}
Also used : RepositoryId(com.enonic.xp.repository.RepositoryId) DeleteRepositoryParams(com.enonic.xp.repository.DeleteRepositoryParams)

Example 4 with RepositoryId

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

the class AbstractDumpReader method loadCommits.

@Override
public CommitsLoadResult loadCommits(final RepositoryId repositoryId, final LineProcessor<EntryLoadResult> processor) {
    final PathRef tarFile = filePaths.commitMetaPath(repositoryId);
    listener.loadingCommits(repositoryId);
    final CommitsLoadResult.Builder builder = CommitsLoadResult.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();
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) DumpBlobStore(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobStore) TarArchiveInputStream(org.apache.commons.compress.archivers.tar.TarArchiveInputStream) FilePaths(com.enonic.xp.repo.impl.dump.FilePaths) RepositoryIds(com.enonic.xp.repository.RepositoryIds) BranchDumpResult(com.enonic.xp.dump.BranchDumpResult) Segment(com.enonic.xp.blob.Segment) BlobKey(com.enonic.xp.blob.BlobKey) Branch(com.enonic.xp.branch.Branch) RepoLoadException(com.enonic.xp.repo.impl.dump.RepoLoadException) RepositoryId(com.enonic.xp.repository.RepositoryId) TarArchiveEntry(org.apache.commons.compress.archivers.tar.TarArchiveEntry) RepoDumpResult(com.enonic.xp.dump.RepoDumpResult) DumpMetaJsonSerializer(com.enonic.xp.repo.impl.dump.serializer.json.DumpMetaJsonSerializer) ByteSource(com.google.common.io.ByteSource) DumpConstants(com.enonic.xp.repo.impl.dump.DumpConstants) CommitsLoadResult(com.enonic.xp.dump.CommitsLoadResult) ImmutableSet(com.google.common.collect.ImmutableSet) RepositorySegmentUtils(com.enonic.xp.repository.RepositorySegmentUtils) NodeVersionKey(com.enonic.xp.blob.NodeVersionKey) IOException(java.io.IOException) SystemLoadListener(com.enonic.xp.dump.SystemLoadListener) Branches(com.enonic.xp.branch.Branches) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) UncheckedIOException(java.io.UncheckedIOException) Objects(java.util.Objects) LineProcessor(com.google.common.io.LineProcessor) SystemDumpResult(com.enonic.xp.dump.SystemDumpResult) LoadError(com.enonic.xp.dump.LoadError) Stream(java.util.stream.Stream) DumpMeta(com.enonic.xp.repo.impl.dump.model.DumpMeta) NodeVersion(com.enonic.xp.node.NodeVersion) VersionsLoadResult(com.enonic.xp.dump.VersionsLoadResult) PathRef(com.enonic.xp.repo.impl.dump.PathRef) DumpBlobRecord(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord) NullSystemLoadListener(com.enonic.xp.repo.impl.dump.NullSystemLoadListener) BranchLoadResult(com.enonic.xp.dump.BranchLoadResult) RepoDumpException(com.enonic.xp.repo.impl.dump.RepoDumpException) InputStream(java.io.InputStream) PathRef(com.enonic.xp.repo.impl.dump.PathRef) CommitsLoadResult(com.enonic.xp.dump.CommitsLoadResult)

Example 5 with RepositoryId

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

the class AbstractDumpReader method loadBranch.

@Override
public BranchLoadResult loadBranch(final RepositoryId repositoryId, final Branch branch, final LineProcessor<EntryLoadResult> processor) {
    final PathRef tarFile = filePaths.branchMetaPath(repositoryId, branch);
    listener.loadingBranch(repositoryId, branch, getBranchSuccessfulCountFromMeta(repositoryId, branch));
    final BranchLoadResult.Builder builder = BranchLoadResult.create(branch);
    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();
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) DumpBlobStore(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobStore) TarArchiveInputStream(org.apache.commons.compress.archivers.tar.TarArchiveInputStream) FilePaths(com.enonic.xp.repo.impl.dump.FilePaths) RepositoryIds(com.enonic.xp.repository.RepositoryIds) BranchDumpResult(com.enonic.xp.dump.BranchDumpResult) Segment(com.enonic.xp.blob.Segment) BlobKey(com.enonic.xp.blob.BlobKey) Branch(com.enonic.xp.branch.Branch) RepoLoadException(com.enonic.xp.repo.impl.dump.RepoLoadException) RepositoryId(com.enonic.xp.repository.RepositoryId) TarArchiveEntry(org.apache.commons.compress.archivers.tar.TarArchiveEntry) RepoDumpResult(com.enonic.xp.dump.RepoDumpResult) DumpMetaJsonSerializer(com.enonic.xp.repo.impl.dump.serializer.json.DumpMetaJsonSerializer) ByteSource(com.google.common.io.ByteSource) DumpConstants(com.enonic.xp.repo.impl.dump.DumpConstants) CommitsLoadResult(com.enonic.xp.dump.CommitsLoadResult) ImmutableSet(com.google.common.collect.ImmutableSet) RepositorySegmentUtils(com.enonic.xp.repository.RepositorySegmentUtils) NodeVersionKey(com.enonic.xp.blob.NodeVersionKey) IOException(java.io.IOException) SystemLoadListener(com.enonic.xp.dump.SystemLoadListener) Branches(com.enonic.xp.branch.Branches) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) UncheckedIOException(java.io.UncheckedIOException) Objects(java.util.Objects) LineProcessor(com.google.common.io.LineProcessor) SystemDumpResult(com.enonic.xp.dump.SystemDumpResult) LoadError(com.enonic.xp.dump.LoadError) Stream(java.util.stream.Stream) DumpMeta(com.enonic.xp.repo.impl.dump.model.DumpMeta) NodeVersion(com.enonic.xp.node.NodeVersion) VersionsLoadResult(com.enonic.xp.dump.VersionsLoadResult) PathRef(com.enonic.xp.repo.impl.dump.PathRef) DumpBlobRecord(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord) NullSystemLoadListener(com.enonic.xp.repo.impl.dump.NullSystemLoadListener) BranchLoadResult(com.enonic.xp.dump.BranchLoadResult) RepoDumpException(com.enonic.xp.repo.impl.dump.RepoDumpException) InputStream(java.io.InputStream) PathRef(com.enonic.xp.repo.impl.dump.PathRef) BranchLoadResult(com.enonic.xp.dump.BranchLoadResult)

Aggregations

RepositoryId (com.enonic.xp.repository.RepositoryId)61 Test (org.junit.jupiter.api.Test)21 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)19 Branch (com.enonic.xp.branch.Branch)14 Repository (com.enonic.xp.repository.Repository)11 Node (com.enonic.xp.node.Node)9 ByteSource (com.google.common.io.ByteSource)8 IOException (java.io.IOException)7 PropertyTree (com.enonic.xp.data.PropertyTree)6 Segment (com.enonic.xp.blob.Segment)5 Context (com.enonic.xp.context.Context)5 ContextAccessor (com.enonic.xp.context.ContextAccessor)5 ContextBuilder (com.enonic.xp.context.ContextBuilder)5 BlobKey (com.enonic.xp.blob.BlobKey)4 EventPublisher (com.enonic.xp.event.EventPublisher)4 BinaryAttachment (com.enonic.xp.node.BinaryAttachment)4 Project (com.enonic.xp.project.Project)4 DumpConstants (com.enonic.xp.repo.impl.dump.DumpConstants)4 DumpBlobRecord (com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord)4 RepositoryIds (com.enonic.xp.repository.RepositoryIds)4