Search in sources :

Example 1 with Commit

use of com.b2international.index.revision.Commit in project snow-owl by b2ihealthcare.

the class Rf2TransactionContext method commit.

@Override
public Optional<Commit> commit(String commitComment) {
    final Set<String> idsToRegister = ImmutableSet.copyOf(newComponents.keySet().stream().filter(SnomedIdentifiers::isValid).iterator());
    // clear local cache before executing commit
    newComponents = newHashMap();
    LOG.info("Pushing changes: {}", commitComment);
    Optional<Commit> commit = getDelegate().commit(commitComment);
    // after successful commit register all commited IDs to CIS
    final ISnomedIdentifierService cis = service(ISnomedIdentifierService.class);
    if (cis.importSupported()) {
        cis.register(idsToRegister);
    }
    return commit;
}
Also used : Commit(com.b2international.index.revision.Commit) ISnomedIdentifierService(com.b2international.snowowl.snomed.cis.ISnomedIdentifierService) SnomedIdentifiers(com.b2international.snowowl.snomed.cis.SnomedIdentifiers)

Example 2 with Commit

use of com.b2international.index.revision.Commit in project snow-owl by b2ihealthcare.

the class CommitInfoConverter method toResource.

@Override
protected CommitInfo toResource(final Commit doc) {
    final Builder builder = CommitInfo.builder(doc);
    // expand details if requested
    if (expand().containsKey(CommitInfo.Expand.DETAILS)) {
        final Options detailsExpandOptions = expand().get(CommitInfo.Expand.DETAILS, Options.class);
        final Collection<CommitDetail> commitDetails = getCommitDetails(doc, detailsExpandOptions);
        final List<CommitInfoDetail> commitInfoDetails = commitDetails.stream().flatMap(info -> toCommitInfoDetail(info)).collect(Collectors.toList());
        builder.details(new CommitInfoDetails(commitInfoDetails, null, commitInfoDetails.size(), commitInfoDetails.size()));
    }
    return builder.build();
}
Also used : RepositoryContext(com.b2international.snowowl.core.domain.RepositoryContext) Builder(com.b2international.snowowl.core.commit.CommitInfo.Builder) Collection(java.util.Collection) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) Set(java.util.Set) Commit(com.b2international.index.revision.Commit) Collectors(java.util.stream.Collectors) Strings(com.google.common.base.Strings) List(java.util.List) ExtendedLocale(com.b2international.commons.http.ExtendedLocale) Stream(java.util.stream.Stream) Options(com.b2international.commons.options.Options) Lists.newArrayListWithExpectedSize(com.google.common.collect.Lists.newArrayListWithExpectedSize) ChangeKind(com.b2international.commons.ChangeKind) CommitDetail(com.b2international.index.revision.CommitDetail) BaseResourceConverter(com.b2international.snowowl.core.request.BaseResourceConverter) Options(com.b2international.commons.options.Options) CommitDetail(com.b2international.index.revision.CommitDetail) Builder(com.b2international.snowowl.core.commit.CommitInfo.Builder)

Aggregations

Commit (com.b2international.index.revision.Commit)2 ChangeKind (com.b2international.commons.ChangeKind)1 ExtendedLocale (com.b2international.commons.http.ExtendedLocale)1 Options (com.b2international.commons.options.Options)1 CommitDetail (com.b2international.index.revision.CommitDetail)1 Builder (com.b2international.snowowl.core.commit.CommitInfo.Builder)1 RepositoryContext (com.b2international.snowowl.core.domain.RepositoryContext)1 BaseResourceConverter (com.b2international.snowowl.core.request.BaseResourceConverter)1 ISnomedIdentifierService (com.b2international.snowowl.snomed.cis.ISnomedIdentifierService)1 SnomedIdentifiers (com.b2international.snowowl.snomed.cis.SnomedIdentifiers)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Strings (com.google.common.base.Strings)1 Lists.newArrayListWithExpectedSize (com.google.common.collect.Lists.newArrayListWithExpectedSize)1 Collection (java.util.Collection)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1