Search in sources :

Example 6 with SnomedRefSetType

use of com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType in project snow-owl by b2ihealthcare.

the class SnomedRf2ExportRequest method exportCombinedRefSets.

private void exportCombinedRefSets(final Path releaseDirectory, final RepositoryContext context, final String branch, final String archiveEffectiveTime, final long effectiveTimeFilterStart, final long effectiveTimeFilterEnd, final Collection<String> languageCodes, final Set<String> visitedComponentEffectiveTimes) throws IOException {
    final Multimap<SnomedRefSetType, SnomedConcept> referenceSetsByType = FluentIterable.from(getIdentifierConcepts(context, getBranchOrRangeTarget(branch))).index(c -> c.getReferenceSet().getType());
    // Create single exporter instance for each reference set type
    for (final SnomedRefSetType refSetType : referenceSetsByType.keySet()) {
        // We will handle language reference sets separately
        if (SnomedRefSetType.LANGUAGE.equals(refSetType)) {
            continue;
        }
        final Rf2RefSetExporter refSetExporter = new Rf2RefSetExporter(releaseType, countryNamespaceElement, namespaceFilter, transientEffectiveTime, archiveEffectiveTime, modules, refSetExportLayout, refSetType, referenceSetsByType.get(refSetType));
        refSetExporter.exportBranch(releaseDirectory, context, branch, effectiveTimeFilterStart, effectiveTimeFilterEnd, visitedComponentEffectiveTimes);
    }
    exportLanguageRefSets(releaseDirectory, context, branch, archiveEffectiveTime, effectiveTimeFilterStart, effectiveTimeFilterEnd, languageCodes, referenceSetsByType.get(SnomedRefSetType.LANGUAGE), visitedComponentEffectiveTimes);
}
Also used : SnomedRefSetType(com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType)

Example 7 with SnomedRefSetType

use of com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType in project snow-owl by b2ihealthcare.

the class SnomedRefSetMemberUpdateRequest method execute.

@Override
public Boolean execute(TransactionContext context) {
    SnomedRefSetMemberIndexEntry member = context.lookup(componentId(), SnomedRefSetMemberIndexEntry.class);
    SnomedRefSetMemberIndexEntry.Builder updatedMember = SnomedRefSetMemberIndexEntry.builder(member);
    /* 
		 * TODO: Generalize the logic below: any attempts of retrieving a missing component during component update
		 * (with the exception of the component that is being updated) should return a 400 response instead of a 404. 
		 */
    try {
        SnomedRefSetType type = member.getReferenceSetType();
        boolean changed = false;
        changed |= updateStatus(member, updatedMember);
        changed |= updateModule(member, updatedMember);
        changed |= updateEffectiveTime(member, updatedMember);
        SnomedRefSetMemberUpdateDelegate delegate = getDelegate(type);
        changed |= delegate.execute(member, updatedMember, context);
        if (changed) {
            if (!isEffectiveTimeUpdate()) {
                updatedMember.effectiveTime(EffectiveTimes.UNSET_EFFECTIVE_TIME);
            }
            context.update(member, updatedMember.build());
        }
        return changed;
    } catch (ComponentNotFoundException e) {
        throw e.toBadRequestException();
    }
}
Also used : SnomedRefSetMemberIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry) ComponentNotFoundException(com.b2international.snowowl.core.exceptions.ComponentNotFoundException) SnomedRefSetType(com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType)

Aggregations

SnomedRefSetType (com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType)7 BadRequestException (com.b2international.commons.exceptions.BadRequestException)4 IllegalQueryParameterException (com.b2international.commons.exceptions.IllegalQueryParameterException)1 NotImplementedException (com.b2international.commons.exceptions.NotImplementedException)1 Options (com.b2international.commons.options.Options)1 Expressions (com.b2international.index.query.Expressions)1 ExpressionBuilder (com.b2international.index.query.Expressions.ExpressionBuilder)1 ComponentNotFoundException (com.b2international.snowowl.core.exceptions.ComponentNotFoundException)1 SearchResourceRequest (com.b2international.snowowl.core.request.SearchResourceRequest)1 DataType (com.b2international.snowowl.snomed.core.domain.refset.DataType)1 SnomedConceptDocument (com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument)1 Builder (com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument.Builder)1 SnomedRefSetMemberIndexEntry (com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry)1 Expressions (com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry.Expressions)1